1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)nameser.h 5.11 (Berkeley) 2/14/86
7: */
8:
9: /*
10: * Define constants based on rfc883
11: */
12: #define PACKETSZ 512 /* maximum packet size */
13: #define MAXDNAME 256 /* maximum domain name */
14: #define MAXCDNAME 255 /* maximum compressed domain name */
15: #define MAXLABEL 63 /* maximum length of domain label */
16: /* Number of bytes of fixed size data in query structure */
17: #define QFIXEDSZ 4
18: /* number of bytes of fixed size data in resource record */
19: #define RRFIXEDSZ 10
20:
21: /*
22: * Internet nameserver port number
23: */
24: #define NAMESERVER_PORT 53
25:
26: /*
27: * Currently defined opcodes
28: */
29: #define QUERY 0 /* standard query */
30: #define IQUERY 1 /* inverse query */
31: #define CQUERYM 2 /* completion query (multiple) */
32: #define CQUERYU 3 /* completion query (unique) */
33: /* non standard */
34: #define UPDATEA 100 /* add resource record */
35: #define UPDATED 101 /* delete resource record */
36: #define UPDATEM 102 /* modify resource record */
37: #define ZONEINIT 103 /* initial zone transfer */
38: #define ZONEREF 104 /* incremental zone referesh */
39:
40: /*
41: * Currently defined response codes
42: */
43: #define NOERROR 0 /* no error */
44: #define FORMERR 1 /* format error */
45: #define SERVFAIL 2 /* server failure */
46: #define NXDOMAIN 3 /* non existent domain */
47: #define NOTIMP 4 /* not implemented */
48: #define REFUSED 5 /* query refused */
49: /* non standard */
50: #define NOCHANGE 100 /* update failed to change db */
51:
52: /*
53: * Type values for resources and queries
54: */
55: #define T_A 1 /* host address */
56: #define T_NS 2 /* authoritative server */
57: #define T_MD 3 /* mail destination */
58: #define T_MF 4 /* mail forwarder */
59: #define T_CNAME 5 /* connonical name */
60: #define T_SOA 6 /* start of authority zone */
61: #define T_MB 7 /* mailbox domain name */
62: #define T_MG 8 /* mail group member */
63: #define T_MR 9 /* mail rename name */
64: #define T_NULL 10 /* null resource record */
65: #define T_WKS 11 /* well known service */
66: #define T_PTR 12 /* domain name pointer */
67: #define T_HINFO 13 /* host information */
68: #define T_MINFO 14 /* mailbox information */
69: #define T_MX 15 /* mail routing information */
70: /* non standard */
71: #define T_UINFO 100 /* user (finger) information */
72: #define T_UID 101 /* user ID */
73: #define T_GID 102 /* group ID */
74: /* Query type values which do not appear in resource records */
75: #define T_AXFR 252 /* transfer zone of authority */
76: #define T_MAILB 253 /* transfer mailbox records */
77: #define T_MAILA 254 /* transfer mail agent records */
78: #define T_ANY 255 /* wildcard match */
79:
80: /*
81: * Values for class field
82: */
83:
84: #define C_IN 1 /* the arpa internet */
85: #define C_CHAOS 3 /* for chaos net at MIT */
86: /* Query class values which do not appear in resource records */
87: #define C_ANY 255 /* wildcard match */
88:
89: /*
90: * Structure for query header, the order of the fields is machine and
91: * compiler dependent, in our case, the bits within a byte are assignd
92: * least significant first, while the order of transmition is most
93: * significant first. This requires a somewhat confusing rearrangement.
94: */
95:
96: typedef struct {
97: u_short id; /* query identification number */
98: #if defined (sun) || defined (sel) || defined (pyr) || defined (is68k) \
99: || defined (tahoe) || defined (BIT_ZERO_ON_LEFT)
100: /* Bit zero on left: Gould and similar architectures */
101: /* fields in third byte */
102: u_char qr:1; /* response flag */
103: u_char opcode:4; /* purpose of message */
104: u_char aa:1; /* authoritive answer */
105: u_char tc:1; /* truncated message */
106: u_char rd:1; /* recursion desired */
107: /* fields in fourth byte */
108: u_char ra:1; /* recursion available */
109: u_char pr:1; /* primary server required (non standard) */
110: u_char unused:2; /* unused bits */
111: u_char rcode:4; /* response code */
112: #else
113: #if defined (vax) || defined (BIT_ZERO_ON_RIGHT)
114: /* Bit zero on right: VAX */
115: /* fields in third byte */
116: u_char rd:1; /* recursion desired */
117: u_char tc:1; /* truncated message */
118: u_char aa:1; /* authoritive answer */
119: u_char opcode:4; /* purpose of message */
120: u_char qr:1; /* response flag */
121: /* fields in fourth byte */
122: u_char rcode:4; /* response code */
123: u_char unused:2; /* unused bits */
124: u_char pr:1; /* primary server required (non standard) */
125: u_char ra:1; /* recursion available */
126: #else
127: /* you must determine what the correct bit order is for your compiler */
128: UNDEFINED_BIT_ORDER;
129: #endif
130: #endif
131: /* remaining bytes */
132: u_short qdcount; /* number of question entries */
133: u_short ancount; /* number of answer entries */
134: u_short nscount; /* number of authority entries */
135: u_short arcount; /* number of resource entries */
136: } HEADER;
137:
138: /*
139: * Defines for handling compressed domain names
140: */
141: #define INDIR_MASK 0xc0
142:
143: /*
144: * Structure for passing resource records around.
145: */
146: struct rrec {
147: short r_zone; /* zone number */
148: short r_class; /* class number */
149: short r_type; /* type number */
150: u_long r_ttl; /* time to live */
151: int r_size; /* size of data area */
152: char *r_data; /* pointer to data */
153: };
154:
155: extern u_short getshort();
156: extern u_long getlong();
Defined struct's
rrec
defined in line
146; used 2 times
Defined macros
C_ANY
defined in line
87; used 14 times
C_IN
defined in line
84; used 23 times
FORMERR
defined in line
44; used 20 times
- in /usr/src/etc/named/ns_req.c line
98,
113,
126,
138,
144,
514,
525,
540,
613,
630,
653,
668,
687,
705,
713,
730
- in /usr/src/etc/named/ns_resp.c line
70,
120,
129,
140
QUERY
defined in line
29; used 25 times
T_A
defined in line
55; used 33 times
- in /usr/src/etc/named/db_load.c line
42
- in /usr/src/etc/named/ns_forw.c line
143
- in /usr/src/etc/named/ns_req.c line
1005
- in /usr/src/etc/named/ns_resp.c line
357
- in /usr/src/etc/named/tools/ns.lookup/src/getinfo.c line
192,
236,
274,
377,
390,
407,
459,
566,
574,
677
- in /usr/src/etc/named/tools/ns.lookup/src/list.c line
133-138(2),
416,
492
- in /usr/src/etc/named/tools/ns.lookup/src/main.c line
91,
219,
338,
350-353(2),
455,
544-547(2),
569
- in /usr/src/etc/named/tools/ns.lookup/src/subr.c line
320,
356
- in /usr/src/etc/named/tools/nstest.c line
77,
84
- in /usr/src/lib/libc/net/named/gethostnamadr.c line
173,
234
T_ANY
defined in line
78; used 6 times
T_GID
defined in line
73; used 4 times
T_MB
defined in line
61; used 2 times
T_MD
defined in line
57;
never used
T_MF
defined in line
58;
never used
T_MG
defined in line
62; used 2 times
T_MR
defined in line
63; used 2 times
T_MX
defined in line
69; used 5 times
T_NS
defined in line
56; used 8 times
T_PTR
defined in line
66; used 6 times
T_SOA
defined in line
60; used 15 times
T_UID
defined in line
72; used 4 times
T_WKS
defined in line
65; used 3 times
Usage of this include