diff options
Diffstat (limited to 'ares')
-rw-r--r-- | ares/ares_dns.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ares/ares_dns.h b/ares/ares_dns.h index a7ae5be17..2187da6e3 100644 --- a/ares/ares_dns.h +++ b/ares/ares_dns.h @@ -54,19 +54,19 @@ #define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) /* Macros for constructing a DNS header */ -#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) -#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (((v) & 0x1) << 7)) -#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (((v) & 0xf) << 3)) -#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (((v) & 0x1) << 2)) -#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (((v) & 0x1) << 1)) -#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (((v) & 0x1))) -#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (((v) & 0x1) << 7)) -#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (((v) & 0x7) << 4)) -#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (((v) & 0xf))) -#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) -#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) -#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) -#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) +#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) +#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3)) +#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2)) +#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1)) +#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1)) +#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4)) +#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf)) +#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) +#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) +#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) +#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) /* Macros for parsing the fixed part of a DNS question */ #define DNS_QUESTION_TYPE(q) DNS__16BIT(q) |