1: /*
2: * Copyright (c) 1985 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that this notice is preserved and that due credit is given
7: * to the University of California at Berkeley. The name of the University
8: * may not be used to endorse or promote products derived from this
9: * software without specific prior written permission. This software
10: * is provided ``as is'' without express or implied warranty.
11: *
12: * @(#)db.h 4.13 (Berkeley) 2/17/88
13: */
14:
15: /*
16: * Global structures and variables for data base routines.
17: */
18:
19: #define INVBLKSZ 7 /* # of namebuf pointers per block */
20: #define INVHASHSZ 919 /* size of inverse hash table */
21:
22: /* max length of data in RR data field */
23: #define MAXDATA 256
24:
25: /*
26: * Hash table structures.
27: */
28: struct databuf {
29: struct databuf *d_next; /* linked list */
30: u_long d_ttl; /* time to live */
31: short d_flags;
32: short d_zone; /* zone number */
33: short d_class; /* class number */
34: short d_type; /* type number */
35: short d_mark; /* place to mark data */
36: short d_size; /* size of data area */
37: u_long d_nstime; /* NS response time, milliseconds */
38: char d_data[MAXDATA]; /* the data is malloc'ed to size */
39: };
40: #define DATASIZE(n) (sizeof(struct databuf) - MAXDATA + n)
41:
42: /*
43: * d_flags definitions
44: */
45: #define DB_F_HINT 0x01 /* databuf belongs to fcachetab */
46:
47: struct namebuf {
48: char *n_dname; /* domain name */
49: u_int n_hashval; /* hash value of n_dname */
50: struct namebuf *n_next; /* linked list */
51: struct databuf *n_data; /* data records */
52: struct namebuf *n_parent; /* parent domain */
53: struct hashbuf *n_hash; /* hash table for children */
54: };
55:
56: struct invbuf {
57: struct invbuf *i_next; /* linked list */
58: struct namebuf *i_dname[INVBLKSZ]; /* domain name */
59: };
60:
61: struct hashbuf {
62: int h_size; /* size of hash table */
63: int h_cnt; /* number of entries */
64: struct namebuf *h_tab[1]; /* malloc'ed as needed */
65: };
66: #define HASHSIZE(s) (s*sizeof(struct namebuf *) + 2*sizeof(int))
67:
68: #define HASHSHIFT 3
69: #define HASHMASK 0x1f
70:
71: /*
72: * Flags to updatedb
73: */
74: #define DB_NODATA 0x01 /* data should not exist */
75: #define DB_MEXIST 0x02 /* data must exist */
76: #define DB_DELETE 0x04 /* delete data if it exists */
77: #define DB_NOTAUTH 0x08 /* must not update authoritative data */
78: #define DB_NOHINTS 0x10 /* don't reflect update in fcachetab */
79:
80: #define DB_Z_CACHE (0) /* cache-zone-only db_dump() */
81: #define DB_Z_ALL (-1) /* normal db_dump() */
82:
83: /*
84: * Error return codes
85: */
86: #define OK 0
87: #define NONAME -1
88: #define NOCLASS -2
89: #define NOTYPE -3
90: #define NODATA -4
91: #define DATAEXISTS -5
92: #define NODBFILE -6
93: #define TOOMANYZONES -7
94: #define GOODDB -8
95: #define NEWDB -9
96: #define AUTH -10
97:
98: extern struct hashbuf *hashtab; /* root hash table */
99: extern struct invbuf *invtab[]; /* inverse hash table */
100: extern struct hashbuf *fcachetab; /* hash table for cache read from file*/
101:
102: extern struct namebuf *nlookup();
103: extern struct namebuf *savename();
104: extern struct databuf *savedata();
105: extern struct databuf *rm_datum();
106: extern struct hashbuf *savehash();
107: extern struct invbuf *saveinv();
108: extern char *savestr();
109: extern char *malloc(), *realloc(), *calloc();
Defined struct's
databuf
defined in line
28; used 130 times
- in line 29(2),
51(2),
104-105(4)
- in /usr/src/usr.sbin/named/named/db_dump.c line
138(2),
176(2),
287(2)
- in /usr/src/usr.sbin/named/named/db_load.c line
120(2)
- in /usr/src/usr.sbin/named/named/db_lookup.c line
152(2)
- in /usr/src/usr.sbin/named/named/db_reload.c line
60(2)
- in /usr/src/usr.sbin/named/named/db_save.c line
58(2),
65-71(6)
- in /usr/src/usr.sbin/named/named/db_update.c line
42-47(4),
68(2),
190(2),
210(2),
242-245(4),
300(2)
- in /usr/src/usr.sbin/named/named/ns_forw.c line
47(2),
153-157(4)
- in /usr/src/usr.sbin/named/named/ns_maint.c line
377(2),
488(2),
578(2),
606(2)
- in /usr/src/usr.sbin/named/named/ns_req.c line
63(2),
72(2),
621(2),
653(2),
814(2),
886(2),
943-946(4),
1038(2),
1050-1051(4),
1201(2),
1219(2),
1235-1240(6)
- in /usr/src/usr.sbin/named/named/ns_resp.c line
47-49(4),
126(2),
365(2),
719(2),
726(2),
908(2),
924(2),
1116(2),
1223(2),
1273(2),
1346-1351(6),
1461(2),
1539(2),
1587-1591(4),
1618(2)
- in /usr/src/usr.sbin/named/named/ns_sort.c line
140(2)
hashbuf
defined in line
61; used 65 times
- in line 53,
98-100(4),
106(2)
- in /usr/src/usr.sbin/named/named/db_dump.c line
136(2),
173(2),
247(2),
283(2)
- in /usr/src/usr.sbin/named/named/db_lookup.c line
26-27(4),
42(2),
50(2),
70(2)
- in /usr/src/usr.sbin/named/named/db_reload.c line
58(2)
- in /usr/src/usr.sbin/named/named/db_save.c line
104-108(6),
128(2),
134(2)
- in /usr/src/usr.sbin/named/named/db_update.c line
44(2)
- in /usr/src/usr.sbin/named/named/ns_forw.c line
160(2)
- in /usr/src/usr.sbin/named/named/ns_init.c line
67-70(4)
- in /usr/src/usr.sbin/named/named/ns_maint.c line
574(2),
602(2)
- in /usr/src/usr.sbin/named/named/ns_req.c line
64(2),
817(2),
945(2),
1048(2)
- in /usr/src/usr.sbin/named/named/ns_resp.c line
62(2),
1117(2),
1275(2),
1352(2)
invbuf
defined in line
56; used 24 times
namebuf
defined in line
47; used 104 times
- in line 50-52(4),
58(2),
64(2),
102-103(4)
- in /usr/src/usr.sbin/named/named/db_dump.c line
139(2),
177-178(4),
288-289(4)
- in /usr/src/usr.sbin/named/named/db_lookup.c line
39(2),
46-51(4)
- in /usr/src/usr.sbin/named/named/db_reload.c line
61-62(4)
- in /usr/src/usr.sbin/named/named/db_save.c line
37-43(8),
109(2)
- in /usr/src/usr.sbin/named/named/db_update.c line
46(2),
209(2),
246(2)
- in /usr/src/usr.sbin/named/named/ns_forw.c line
156(2)
- in /usr/src/usr.sbin/named/named/ns_maint.c line
485-490(6),
579-580(4),
607-608(4)
- in /usr/src/usr.sbin/named/named/ns_req.c line
62(2),
813(2),
885(2),
910(2),
939(2),
947-948(4),
1049(2),
1238(2),
1258(2)
- in /usr/src/usr.sbin/named/named/ns_resp.c line
63(2),
1115(2),
1224(2),
1274(2),
1345-1349(4),
1455(2),
1586(2),
1615(2)
- in /usr/src/usr.sbin/named/named/ns_sort.c line
138(2)
Defined macros
AUTH
defined in line
96; used 1 times
NEWDB
defined in line
95;
never used
OK
defined in line
86; used 9 times
Usage of this include