1 | #ifndef _ARPA_NAMESER_H_ |
---|---|
2 | |
3 | #include <resolv/arpa/nameser.h> |
4 | |
5 | /* If the machine allows unaligned access we can do better than using |
6 | the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the |
7 | installed header. */ |
8 | #include <string.h> |
9 | #include <stdint.h> |
10 | #include <netinet/in.h> |
11 | |
12 | extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden; |
13 | |
14 | #if _STRING_ARCH_unaligned |
15 | |
16 | # undef NS_GET16 |
17 | # define NS_GET16(s, cp) \ |
18 | do { \ |
19 | const uint16_t *t_cp = (const uint16_t *) (cp); \ |
20 | (s) = ntohs (*t_cp); \ |
21 | (cp) += NS_INT16SZ; \ |
22 | } while (0) |
23 | |
24 | # undef NS_GET32 |
25 | # define NS_GET32(l, cp) \ |
26 | do { \ |
27 | const uint32_t *t_cp = (const uint32_t *) (cp); \ |
28 | (l) = ntohl (*t_cp); \ |
29 | (cp) += NS_INT32SZ; \ |
30 | } while (0) |
31 | |
32 | # undef NS_PUT16 |
33 | # define NS_PUT16(s, cp) \ |
34 | do { \ |
35 | uint16_t *t_cp = (uint16_t *) (cp); \ |
36 | *t_cp = htons (s); \ |
37 | (cp) += NS_INT16SZ; \ |
38 | } while (0) |
39 | |
40 | # undef NS_PUT32 |
41 | # define NS_PUT32(l, cp) \ |
42 | do { \ |
43 | uint32_t *t_cp = (uint32_t *) (cp); \ |
44 | *t_cp = htonl (l); \ |
45 | (cp) += NS_INT32SZ; \ |
46 | } while (0) |
47 | |
48 | #endif |
49 | |
50 | extern u_int __ns_get16 (const u_char *) __THROW; |
51 | extern u_long __ns_get32 (const u_char *) __THROW; |
52 | |
53 | #define ns_msg_getflag(handle, flag) \ |
54 | (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) |
55 | |
56 | libresolv_hidden_proto (ns_get16) |
57 | libresolv_hidden_proto (ns_get32) |
58 | libresolv_hidden_proto (ns_put16) |
59 | libresolv_hidden_proto (ns_put32) |
60 | libresolv_hidden_proto (ns_initparse) |
61 | libresolv_hidden_proto (ns_skiprr) |
62 | libresolv_hidden_proto (ns_parserr) |
63 | libresolv_hidden_proto (ns_name_ntop) |
64 | libresolv_hidden_proto (ns_name_pton) |
65 | libresolv_hidden_proto (ns_name_pack) |
66 | libresolv_hidden_proto (ns_name_skip) |
67 | libresolv_hidden_proto (ns_name_unpack) |
68 | libresolv_hidden_proto (ns_name_compress) |
69 | libresolv_hidden_proto (ns_name_uncompress) |
70 | libresolv_hidden_proto (ns_sprintrr) |
71 | libresolv_hidden_proto (ns_sprintrrf) |
72 | libresolv_hidden_proto (ns_samedomain) |
73 | libresolv_hidden_proto (ns_samename) |
74 | libresolv_hidden_proto (ns_makecanon) |
75 | libresolv_hidden_proto (ns_format_ttl) |
76 | |
77 | #endif |
78 |