1#include <vector> 2#include <cstdlib> 3typedef unsigned short uint16; 4 5namespace base { 6 class StringPiece 7 { 8 public: 9 typedef std::size_t size_type; 10 size_type size() const { return length_; } 11 size_type length_; 12 }; 13} 14 15namespace net { 16 class DNSSECKeySet 17 { 18 bool CheckSignature (const base::StringPiece& name, const 19 base::StringPiece& zone, const 20 base::StringPiece& signature, uint16 rrtype, 21 const std::vector<base::StringPiece>& rrdatas); 22 }; 23} 24 25template <class C> class scoped_array 26{ 27public: typedef C element_type; 28 explicit scoped_array(C* p = __null):array_(p) {} 29private: C* array_; 30}; 31 32namespace net { 33 bool DNSSECKeySet::CheckSignature (const base::StringPiece& name, 34 const base::StringPiece& zone, const base::StringPiece& signature, 35 uint16 rrtype, const std::vector<base::StringPiece>& rrdatas) 36 { 37 unsigned signed_data_len = 0; 38 for (std::vector<base::StringPiece>::const_iterator i = 39 rrdatas.begin(); 40 i != rrdatas.end(); i++) { 41 signed_data_len += 2; 42 signed_data_len += i->size(); 43 } 44 scoped_array<unsigned char> signed_data(new unsigned 45 char[signed_data_len]); 46 } 47} 48 49