Back to index

glibc  2.9
nameser.h
Go to the documentation of this file.
00001 #ifndef _ARPA_NAMESER_H_
00002 
00003 #include <resolv/arpa/nameser.h>
00004 
00005 /* If the machine allows unaligned access we can do better than using
00006    the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
00007    installed header.  */
00008 #include <string.h>
00009 #include <stdint.h>
00010 #include <netinet/in.h>
00011 
00012 extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden;
00013 
00014 #if _STRING_ARCH_unaligned
00015 
00016 # undef NS_GET16
00017 # define NS_GET16(s, cp) \
00018   do {                                                               \
00019     const uint16_t *t_cp = (const uint16_t *) (cp);                         \
00020     (s) = ntohs (*t_cp);                                             \
00021     (cp) += NS_INT16SZ;                                                     \
00022   } while (0)
00023 
00024 # undef NS_GET32
00025 # define NS_GET32(l, cp) \
00026   do {                                                               \
00027     const uint32_t *t_cp = (const uint32_t *) (cp);                         \
00028     (l) = ntohl (*t_cp);                                             \
00029     (cp) += NS_INT32SZ;                                                     \
00030   } while (0)
00031 
00032 # undef NS_PUT16
00033 # define NS_PUT16(s, cp) \
00034   do {                                                               \
00035     uint16_t *t_cp = (uint16_t *) (cp);                                     \
00036     *t_cp = htons (s);                                                      \
00037     (cp) += NS_INT16SZ;                                                     \
00038   } while (0)
00039 
00040 # undef NS_PUT32
00041 # define NS_PUT32(l, cp) \
00042   do {                                                               \
00043     uint32_t *t_cp = (uint32_t *) (cp);                                     \
00044     *t_cp = htonl (l);                                                      \
00045     (cp) += NS_INT32SZ;                                                     \
00046   } while (0)
00047 
00048 #endif
00049 
00050 extern u_int         __ns_get16 (const u_char *) __THROW;
00051 extern u_long        __ns_get32 (const u_char *) __THROW;
00052 
00053 #define ns_msg_getflag(handle, flag) \
00054   (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
00055 
00056 libresolv_hidden_proto (ns_get16)
00057 libresolv_hidden_proto (ns_get32)
00058 libresolv_hidden_proto (ns_put16)
00059 libresolv_hidden_proto (ns_put32)
00060 libresolv_hidden_proto (ns_initparse)
00061 libresolv_hidden_proto (ns_skiprr)
00062 libresolv_hidden_proto (ns_parserr)
00063 libresolv_hidden_proto (ns_name_ntop)
00064 libresolv_hidden_proto (ns_name_pton)
00065 libresolv_hidden_proto (ns_name_pack)
00066 libresolv_hidden_proto (ns_name_skip)
00067 libresolv_hidden_proto (ns_name_unpack)
00068 libresolv_hidden_proto (ns_name_compress)
00069 libresolv_hidden_proto (ns_name_uncompress)
00070 libresolv_hidden_proto (ns_sprintrr)
00071 libresolv_hidden_proto (ns_sprintrrf)
00072 libresolv_hidden_proto (ns_samedomain)
00073 libresolv_hidden_proto (ns_samename)
00074 libresolv_hidden_proto (ns_makecanon)
00075 libresolv_hidden_proto (ns_format_ttl)
00076 
00077 #endif