|
|
1.1 root 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 the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * @(#)db.h 4.14 (Berkeley) 6/18/88
18: */
19:
20: /*
21: * Global structures and variables for data base routines.
22: */
23:
24: #define INVBLKSZ 7 /* # of namebuf pointers per block */
25: #define INVHASHSZ 919 /* size of inverse hash table */
26:
27: /* max length of data in RR data field */
28: #define MAXDATA 256
29:
30: /*
31: * Hash table structures.
32: */
33: struct databuf {
34: struct databuf *d_next; /* linked list */
35: u_long d_ttl; /* time to live */
36: short d_flags;
37: short d_zone; /* zone number */
38: short d_class; /* class number */
39: short d_type; /* type number */
40: short d_mark; /* place to mark data */
41: short d_size; /* size of data area */
42: u_long d_nstime; /* NS response time, milliseconds */
43: char d_data[MAXDATA]; /* the data is malloc'ed to size */
44: };
45: #define DATASIZE(n) (sizeof(struct databuf) - MAXDATA + n)
46:
47: /*
48: * d_flags definitions
49: */
50: #define DB_F_HINT 0x01 /* databuf belongs to fcachetab */
51:
52: struct namebuf {
53: char *n_dname; /* domain name */
54: u_int n_hashval; /* hash value of n_dname */
55: struct namebuf *n_next; /* linked list */
56: struct databuf *n_data; /* data records */
57: struct namebuf *n_parent; /* parent domain */
58: struct hashbuf *n_hash; /* hash table for children */
59: };
60:
61: struct invbuf {
62: struct invbuf *i_next; /* linked list */
63: struct namebuf *i_dname[INVBLKSZ]; /* domain name */
64: };
65:
66: struct hashbuf {
67: int h_size; /* size of hash table */
68: int h_cnt; /* number of entries */
69: struct namebuf *h_tab[1]; /* malloc'ed as needed */
70: };
71: #define HASHSIZE(s) (s*sizeof(struct namebuf *) + 2*sizeof(int))
72:
73: #define HASHSHIFT 3
74: #define HASHMASK 0x1f
75:
76: /*
77: * Flags to updatedb
78: */
79: #define DB_NODATA 0x01 /* data should not exist */
80: #define DB_MEXIST 0x02 /* data must exist */
81: #define DB_DELETE 0x04 /* delete data if it exists */
82: #define DB_NOTAUTH 0x08 /* must not update authoritative data */
83: #define DB_NOHINTS 0x10 /* don't reflect update in fcachetab */
84:
85: #define DB_Z_CACHE (0) /* cache-zone-only db_dump() */
86: #define DB_Z_ALL (-1) /* normal db_dump() */
87:
88: /*
89: * Error return codes
90: */
91: #define OK 0
92: #define NONAME -1
93: #define NOCLASS -2
94: #define NOTYPE -3
95: #define NODATA -4
96: #define DATAEXISTS -5
97: #define NODBFILE -6
98: #define TOOMANYZONES -7
99: #define GOODDB -8
100: #define NEWDB -9
101: #define AUTH -10
102:
103: extern struct hashbuf *hashtab; /* root hash table */
104: extern struct invbuf *invtab[]; /* inverse hash table */
105: extern struct hashbuf *fcachetab; /* hash table for cache read from file*/
106:
107: extern struct namebuf *nlookup();
108: extern struct namebuf *savename();
109: extern struct databuf *savedata();
110: extern struct databuf *rm_datum();
111: extern struct hashbuf *savehash();
112: extern struct invbuf *saveinv();
113: extern char *savestr();
114: extern char *malloc(), *realloc(), *calloc();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.