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
12extern 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
50extern u_int __ns_get16 (const u_char *) __THROW;
51extern 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
56libresolv_hidden_proto (ns_get16)
57libresolv_hidden_proto (ns_get32)
58libresolv_hidden_proto (ns_put16)
59libresolv_hidden_proto (ns_put32)
60libresolv_hidden_proto (ns_initparse)
61libresolv_hidden_proto (ns_skiprr)
62libresolv_hidden_proto (ns_parserr)
63libresolv_hidden_proto (ns_name_ntop)
64libresolv_hidden_proto (ns_name_pton)
65libresolv_hidden_proto (ns_name_pack)
66libresolv_hidden_proto (ns_name_skip)
67libresolv_hidden_proto (ns_name_unpack)
68libresolv_hidden_proto (ns_name_compress)
69libresolv_hidden_proto (ns_name_uncompress)
70libresolv_hidden_proto (ns_sprintrr)
71libresolv_hidden_proto (ns_sprintrrf)
72libresolv_hidden_proto (ns_samedomain)
73libresolv_hidden_proto (ns_samename)
74libresolv_hidden_proto (ns_makecanon)
75libresolv_hidden_proto (ns_format_ttl)
76
77#endif
78