Lines Matching refs:buffer

47 std::string str2hex(const char* buffer, size_t len) {  in str2hex()  argument
51 uint8_t c = buffer[i]; in str2hex()
144 const char* read(const char* buffer, const char* buffer_end);
145 char* write(char* buffer, const char* buffer_end) const;
148 const char* parseField(const char* buffer, const char* buffer_end,
156 const char* DNSName::read(const char* buffer, const char* buffer_end) { in read() argument
157 const char* cur = buffer; in read()
169 char* DNSName::write(char* buffer, const char* buffer_end) const { in write() argument
170 char* buffer_cur = buffer; in write()
199 const char* DNSName::parseField(const char* buffer, const char* buffer_end, in parseField() argument
201 if (buffer + sizeof(uint8_t) > buffer_end) { in parseField()
205 unsigned field_type = *buffer >> 6; in parseField()
206 unsigned ofs = *buffer & 0x3F; in parseField()
207 const char* cur = buffer + sizeof(uint8_t); in parseField()
233 const char* read(const char* buffer, const char* buffer_end);
234 char* write(char* buffer, const char* buffer_end) const;
238 const char* DNSQuestion::read(const char* buffer, const char* buffer_end) { in read() argument
239 const char* cur = qname.read(buffer, buffer_end); in read()
253 char* DNSQuestion::write(char* buffer, const char* buffer_end) const { in write() argument
254 char* buffer_cur = qname.write(buffer, buffer_end); in write()
267 char buffer[4096]; in toString() local
268 int len = snprintf(buffer, sizeof(buffer), "Q<%s,%s,%s>", qname.toString(), in toString()
270 return std::string(buffer, len); in toString()
279 const char* read(const char* buffer, const char* buffer_end);
280 char* write(char* buffer, const char* buffer_end) const;
290 const char* readIntFields(const char* buffer, const char* buffer_end,
292 char* writeIntFields(unsigned rdlen, char* buffer,
296 const char* DNSRecord::read(const char* buffer, const char* buffer_end) { in read() argument
297 const char* cur = name.read(buffer, buffer_end); in read()
316 char* DNSRecord::write(char* buffer, const char* buffer_end) const { in write() argument
317 char* buffer_cur = name.write(buffer, buffer_end); in write()
329 char buffer[4096]; in toString() local
330 int len = snprintf(buffer, sizeof(buffer), "R<%s,%s,%s>", name.toString(), in toString()
332 return std::string(buffer, len); in toString()
335 const char* DNSRecord::readIntFields(const char* buffer, const char* buffer_end, in readIntFields() argument
337 if (buffer + sizeof(IntFields) > buffer_end ) { in readIntFields()
341 const auto& intfields = *reinterpret_cast<const IntFields*>(buffer); in readIntFields()
346 return buffer + sizeof(IntFields); in readIntFields()
349 char* DNSRecord::writeIntFields(unsigned rdlen, char* buffer, in writeIntFields() argument
351 if (buffer + sizeof(IntFields) > buffer_end ) { in writeIntFields()
355 auto& intfields = *reinterpret_cast<IntFields*>(buffer); in writeIntFields()
360 return buffer + sizeof(IntFields); in writeIntFields()
376 const char* read(const char* buffer, const char* buffer_end);
377 char* write(char* buffer, const char* buffer_end) const;
391 const char* readHeader(const char* buffer, const char* buffer_end,
396 const char* DNSHeader::read(const char* buffer, const char* buffer_end) { in read() argument
401 const char* cur = readHeader(buffer, buffer_end, &qdcount, &ancount, in read()
450 char* DNSHeader::write(char* buffer, const char* buffer_end) const { in write() argument
451 if (buffer + sizeof(Header) > buffer_end) { in write()
455 Header& header = *reinterpret_cast<Header*>(buffer); in write()
467 char* buffer_cur = buffer + sizeof(Header); in write()
492 const char* DNSHeader::readHeader(const char* buffer, const char* buffer_end, in readHeader() argument
495 if (buffer + sizeof(Header) > buffer_end) in readHeader()
497 const auto& header = *reinterpret_cast<const Header*>(buffer); in readHeader()
514 return buffer + sizeof(Header); in readHeader()
684 char buffer[4096]; in requestHandler() local
689 len = recvfrom(socket_, buffer, sizeof(buffer), 0, in requestHandler()
699 if (handleDNSRequest(buffer, len, response, &response_len) && in requestHandler()
722 bool DNSResponder::handleDNSRequest(const char* buffer, ssize_t len, in handleDNSRequest() argument
725 ALOGI("request: '%s'", str2hex(buffer, len).c_str()); in handleDNSRequest()
726 const char* buffer_end = buffer + len; in handleDNSRequest()
728 const char* cur = header.read(buffer, buffer_end); in handleDNSRequest()