📄 nameser.h
字号:
* Values for class field */#define C_IN 1 /* the arpa internet */#define C_CHAOS 3 /* for chaos net (MIT) */#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ /* Query class values which do not appear in resource records */#define C_ANY 255 /* wildcard match *//* * Flags field of the KEY RR rdata */#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key *//* The type bits can also be interpreted independently, as single bits: */#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \ KEYFLAG_RESERVED4 | \ KEYFLAG_RESERVED10| KEYFLAG_RESERVED11) /* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg *//* Signatures */ /* Size of a mod or exp in bits */#define MIN_MD5RSA_KEY_PART_BITS 512#define MAX_MD5RSA_KEY_PART_BITS 2552 /* Total of binary mod and exp, bytes */#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3) /* Max length of text sig block */#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)/* * Status return codes for T_UNSPEC conversion routines */#define CONV_SUCCESS 0#define CONV_OVERFLOW (-1)#define CONV_BADFMT (-2)#define CONV_BADCKSUM (-3)#define CONV_BADBUFLEN (-4)#ifndef BYTE_ORDER#if (BSD >= 199103)# include <machine/endian.h>#else#ifdef linux# include <endian.h>#else#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ defined(__alpha__) || defined(__alpha)#define BYTE_ORDER LITTLE_ENDIAN#endif#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ defined(apollo) || defined(__convex__) || defined(_CRAY) || \ defined(__hppa) || defined(__hp9000) || \ defined(__hp9000s300) || defined(__hp9000s700) || \ defined (BIT_ZERO_ON_LEFT) || defined(m68k)#define BYTE_ORDER BIG_ENDIAN#endif#endif /* linux */#endif /* BSD */#endif /* BYTE_ORDER */#if !defined(BYTE_ORDER) || \ (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ BYTE_ORDER != PDP_ENDIAN) /* you must determine what the correct bit order is for * your compiler - the next line is an intentional error * which will force your compiles to bomb until you fix * the above macros. */ error "Undefined or invalid BYTE_ORDER";#endif/* * Structure for query header. The order of the fields is machine- and * compiler-dependent, depending on the byte/bit order and the layout * of bit fields. We use bit fields only in int variables, as this * is all ANSI requires. This requires a somewhat confusing rearrangement. */typedef struct { unsigned id :16; /* query identification number */#if BYTE_ORDER == BIG_ENDIAN /* fields in third byte */ unsigned qr: 1; /* response flag */ unsigned opcode: 4; /* purpose of message */ unsigned aa: 1; /* authoritive answer */ unsigned tc: 1; /* truncated message */ unsigned rd: 1; /* recursion desired */ /* fields in fourth byte */ unsigned ra: 1; /* recursion available */ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ unsigned ad: 1; /* authentic data from named */ unsigned cd: 1; /* checking disabled by resolver */ unsigned rcode :4; /* response code */#endif#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN /* fields in third byte */ unsigned rd :1; /* recursion desired */ unsigned tc :1; /* truncated message */ unsigned aa :1; /* authoritive answer */ unsigned opcode :4; /* purpose of message */ unsigned qr :1; /* response flag */ /* fields in fourth byte */ unsigned rcode :4; /* response code */ unsigned cd: 1; /* checking disabled by resolver */ unsigned ad: 1; /* authentic data from named */ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /* recursion available */#endif /* remaining bytes */ unsigned qdcount :16; /* number of question entries */ unsigned ancount :16; /* number of answer entries */ unsigned nscount :16; /* number of authority entries */ unsigned arcount :16; /* number of resource entries */} HEADER;/* * Defines for handling compressed domain names */#define INDIR_MASK 0xc0extern u_int16_t _getshort __P((const u_char *));extern u_int32_t _getlong __P((const u_char *));/* * Inline versions of get/put short/long. Pointer is advanced. * * These macros demonstrate the property of C whereby it can be * portable or it can be elegant but rarely both. */#define GETSHORT(s, cp) { \ register u_char *t_cp = (u_char *)(cp); \ (s) = ((u_int16_t)t_cp[0] << 8) \ | ((u_int16_t)t_cp[1]) \ ; \ (cp) += INT16SZ; \}#define GETLONG(l, cp) { \ register u_char *t_cp = (u_char *)(cp); \ (l) = ((u_int32_t)t_cp[0] << 24) \ | ((u_int32_t)t_cp[1] << 16) \ | ((u_int32_t)t_cp[2] << 8) \ | ((u_int32_t)t_cp[3]) \ ; \ (cp) += INT32SZ; \}#define PUTSHORT(s, cp) { \ register u_int16_t t_s = (u_int16_t)(s); \ register u_char *t_cp = (u_char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ (cp) += INT16SZ; \}#define PUTLONG(l, cp) { \ register u_int32_t t_l = (u_int32_t)(l); \ register u_char *t_cp = (u_char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ *t_cp++ = t_l >> 8; \ *t_cp = t_l; \ (cp) += INT32SZ; \}#endif /* !_NAMESER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -