2.7.90-15
[glibc.git] / include / arpa / nameser.h
blobefbe95660243cf3b537a3bc61f40427677686e84
1 #include <resolv/arpa/nameser.h>
3 /* If the machine allows unaligned access we can do better than using
4 the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
5 installed header. */
6 #include <string.h>
7 #include <stdint.h>
8 #include <netinet/in.h>
10 extern struct _ns_flagdata _ns_flagdata[] attribute_hidden;
12 #if _STRING_ARCH_unaligned
14 # undef NS_GET16
15 # define NS_GET16(s, cp) \
16 do { \
17 uint16_t *t_cp = (uint16_t *) (cp); \
18 (s) = ntohs (*t_cp); \
19 (cp) += NS_INT16SZ; \
20 } while (0)
22 # undef NS_GET32
23 # define NS_GET32(l, cp) \
24 do { \
25 uint32_t *t_cp = (uint32_t *) (cp); \
26 (l) = ntohl (*t_cp); \
27 (cp) += NS_INT32SZ; \
28 } while (0)
30 # undef NS_PUT16
31 # define NS_PUT16(s, cp) \
32 do { \
33 uint16_t *t_cp = (uint16_t *) (cp); \
34 *t_cp = htons (s); \
35 (cp) += NS_INT16SZ; \
36 } while (0)
38 # undef NS_PUT32
39 # define NS_PUT32(l, cp) \
40 do { \
41 uint32_t *t_cp = (uint32_t *) (cp); \
42 *t_cp = htonl (l); \
43 (cp) += NS_INT32SZ; \
44 } while (0)
46 #endif