Lines Matching refs:p

93 static inline uint8_t* DNS_PACKET_DATA(const DnsPacket *p) {  in DNS_PACKET_DATA()  argument
94 if (_unlikely_(!p)) in DNS_PACKET_DATA()
97 if (p->_data) in DNS_PACKET_DATA()
98 return p->_data; in DNS_PACKET_DATA()
100 return ((uint8_t*) p) + ALIGN(sizeof(DnsPacket)); in DNS_PACKET_DATA()
103 #define DNS_PACKET_HEADER(p) ((DnsPacketHeader*) DNS_PACKET_DATA(p)) argument
104 #define DNS_PACKET_ID(p) DNS_PACKET_HEADER(p)->id argument
105 #define DNS_PACKET_QR(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 15) & 1) argument
106 #define DNS_PACKET_OPCODE(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 11) & 15) argument
107 #define DNS_PACKET_AA(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 10) & 1) argument
108 #define DNS_PACKET_TC(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 9) & 1) argument
109 #define DNS_PACKET_RD(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 8) & 1) argument
110 #define DNS_PACKET_RA(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 7) & 1) argument
111 #define DNS_PACKET_AD(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 5) & 1) argument
112 #define DNS_PACKET_CD(p) ((be16toh(DNS_PACKET_HEADER(p)->flags) >> 4) & 1) argument
116 static inline uint16_t DNS_PACKET_RCODE(DnsPacket *p) { in DNS_PACKET_RCODE() argument
119 if (p->opt) in DNS_PACKET_RCODE()
120 rcode = (uint16_t) (p->opt->ttl >> 24); in DNS_PACKET_RCODE()
124 return rcode | (be16toh(DNS_PACKET_HEADER(p)->flags) & 0xF); in DNS_PACKET_RCODE()
127 static inline uint16_t DNS_PACKET_PAYLOAD_SIZE_MAX(DnsPacket *p) { in DNS_PACKET_PAYLOAD_SIZE_MAX() argument
131 if (p->ipproto == IPPROTO_TCP) /* we ignore EDNS(0) size data on TCP, like everybody else */ in DNS_PACKET_PAYLOAD_SIZE_MAX()
134 if (p->opt) in DNS_PACKET_PAYLOAD_SIZE_MAX()
135 return MAX(DNS_PACKET_UNICAST_SIZE_MAX, p->opt->key->class); in DNS_PACKET_PAYLOAD_SIZE_MAX()
140 static inline bool DNS_PACKET_DO(DnsPacket *p) { in DNS_PACKET_DO() argument
141 if (!p->opt) in DNS_PACKET_DO()
144 return !!(p->opt->ttl & (1U << 15)); in DNS_PACKET_DO()
147 static inline bool DNS_PACKET_VERSION_SUPPORTED(DnsPacket *p) { in DNS_PACKET_VERSION_SUPPORTED() argument
151 if (!p->opt) in DNS_PACKET_VERSION_SUPPORTED()
154 return DNS_RESOURCE_RECORD_OPT_VERSION_SUPPORTED(p->opt); in DNS_PACKET_VERSION_SUPPORTED()
157 static inline bool DNS_PACKET_IS_FRAGMENTED(DnsPacket *p) { in DNS_PACKET_IS_FRAGMENTED() argument
158 assert(p); in DNS_PACKET_IS_FRAGMENTED()
162 return p->fragsize != 0; in DNS_PACKET_IS_FRAGMENTED()
166 #define DNS_PACKET_LLMNR_C(p) DNS_PACKET_AA(p) argument
167 #define DNS_PACKET_LLMNR_T(p) DNS_PACKET_RD(p) argument
169 #define DNS_PACKET_QDCOUNT(p) be16toh(DNS_PACKET_HEADER(p)->qdcount) argument
170 #define DNS_PACKET_ANCOUNT(p) be16toh(DNS_PACKET_HEADER(p)->ancount) argument
171 #define DNS_PACKET_NSCOUNT(p) be16toh(DNS_PACKET_HEADER(p)->nscount) argument
172 #define DNS_PACKET_ARCOUNT(p) be16toh(DNS_PACKET_HEADER(p)->arcount) argument
185 static inline unsigned DNS_PACKET_RRCOUNT(DnsPacket *p) { in DNS_PACKET_RRCOUNT() argument
187 (unsigned) DNS_PACKET_ANCOUNT(p) + in DNS_PACKET_RRCOUNT()
188 (unsigned) DNS_PACKET_NSCOUNT(p) + in DNS_PACKET_RRCOUNT()
189 (unsigned) DNS_PACKET_ARCOUNT(p); in DNS_PACKET_RRCOUNT()
192 int dns_packet_new(DnsPacket **p, DnsProtocol protocol, size_t min_alloc_dsize, size_t max_size);
193 int dns_packet_new_query(DnsPacket **p, DnsProtocol protocol, size_t min_alloc_dsize, bool dnssec_c…
195 int dns_packet_dup(DnsPacket **ret, DnsPacket *p);
197 void dns_packet_set_flags(DnsPacket *p, bool dnssec_checking_disabled, bool truncated);
199 DnsPacket *dns_packet_ref(DnsPacket *p);
200 DnsPacket *dns_packet_unref(DnsPacket *p);
212 int dns_packet_validate(DnsPacket *p);
213 int dns_packet_validate_reply(DnsPacket *p);
214 int dns_packet_validate_query(DnsPacket *p);
216 int dns_packet_is_reply_for(DnsPacket *p, const DnsResourceKey *key);
218 int dns_packet_append_blob(DnsPacket *p, const void *d, size_t sz, size_t *start);
219 int dns_packet_append_uint8(DnsPacket *p, uint8_t v, size_t *start);
220 int dns_packet_append_uint16(DnsPacket *p, uint16_t v, size_t *start);
221 int dns_packet_append_uint32(DnsPacket *p, uint32_t v, size_t *start);
222 int dns_packet_append_string(DnsPacket *p, const char *s, size_t *start);
223 int dns_packet_append_raw_string(DnsPacket *p, const void *s, size_t size, size_t *start);
224 int dns_packet_append_label(DnsPacket *p, const char *s, size_t l, bool canonical_candidate, size_t…
225 int dns_packet_append_name(DnsPacket *p, const char *name, bool allow_compression, bool canonical_c…
226 int dns_packet_append_key(DnsPacket *p, const DnsResourceKey *key, const DnsAnswerFlags flags, size…
227 int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, const DnsAnswerFlags flags, siz…
228 int dns_packet_append_opt(DnsPacket *p, uint16_t max_udp_size, bool edns0_do, bool include_rfc6975,…
229 int dns_packet_append_question(DnsPacket *p, DnsQuestion *q);
230 int dns_packet_append_answer(DnsPacket *p, DnsAnswer *a, unsigned *completed);
232 int dns_packet_patch_max_udp_size(DnsPacket *p, uint16_t max_udp_size);
233 int dns_packet_patch_ttls(DnsPacket *p, usec_t timestamp);
235 void dns_packet_truncate(DnsPacket *p, size_t sz);
236 int dns_packet_truncate_opt(DnsPacket *p);
238 int dns_packet_read(DnsPacket *p, size_t sz, const void **ret, size_t *start);
239 int dns_packet_read_blob(DnsPacket *p, void *d, size_t sz, size_t *start);
240 int dns_packet_read_uint8(DnsPacket *p, uint8_t *ret, size_t *start);
241 int dns_packet_read_uint16(DnsPacket *p, uint16_t *ret, size_t *start);
242 int dns_packet_read_uint32(DnsPacket *p, uint32_t *ret, size_t *start);
243 int dns_packet_read_string(DnsPacket *p, char **ret, size_t *start);
244 int dns_packet_read_raw_string(DnsPacket *p, const void **ret, size_t *size, size_t *start);
245 int dns_packet_read_name(DnsPacket *p, char **ret, bool allow_compression, size_t *start);
246 int dns_packet_read_key(DnsPacket *p, DnsResourceKey **ret, bool *ret_cache_flush_or_qu, size_t *st…
247 int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, bool *ret_cache_flush, size_t *start);
249 void dns_packet_rewind(DnsPacket *p, size_t idx);
251 int dns_packet_skip_question(DnsPacket *p);
252 int dns_packet_extract(DnsPacket *p);
256 int dns_packet_has_nsid_request(DnsPacket *p);
287 const char* dns_protocol_to_string(DnsProtocol p) _const_;
325 static inline size_t dns_packet_size_max(DnsPacket *p) { in dns_packet_size_max() argument
326 assert(p); in dns_packet_size_max()
332 return p->max_size != 0 ? p->max_size : DNS_PACKET_SIZE_MAX; in dns_packet_size_max()
347 size_t dns_packet_size_unfragmented(DnsPacket *p);