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