|
|
1.1 root 1: /* db.h 4.3 86/06/04 */
2:
3: /*
4: * Copyright (c) 1985 Regents of the University of California
5: * All Rights Reserved
6: */
7:
8: /*
9: * Global structures and variables for data base routines.
10: */
11:
12: #define INVBLKSZ 7 /* # of namebuf pointers per block */
13: #define INVHASHSZ 919 /* size of inverse hash table */
14:
15: /* max length of data in RR data field */
16: #define MAXDATA 256
17:
18: /*
19: * Hash table structures.
20: */
21: struct databuf {
22: struct databuf *d_next; /* linked list */
23: short d_refcount; /* reference count */
24: short d_zone; /* zone number */
25: short d_class; /* class number */
26: short d_type; /* type number */
27: u_long d_ttl; /* time to live */
28: int d_size; /* size of data area */
29: char d_data[MAXDATA]; /* malloc'ed as needed */
30: };
31: #define DATASIZE(n) (sizeof(struct databuf) - MAXDATA + n)
32:
33: struct namebuf {
34: char *n_dname; /* domain name */
35: struct namebuf *n_next; /* linked list */
36: struct databuf *n_data; /* data records */
37: struct namebuf *n_parent; /* parent domain */
38: struct hashbuf *n_hash; /* hash table for children */
39: };
40:
41: struct invbuf {
42: struct invbuf *i_next; /* linked list */
43: struct namebuf *i_dname[INVBLKSZ]; /* domain name */
44: };
45:
46: struct hashbuf {
47: int h_size; /* size of hash table */
48: int h_cnt; /* number of entries */
49: struct namebuf *h_tab[1]; /* malloc'ed as needed */
50: };
51: #define HASHSIZE(s) (s*sizeof(struct namebuf *) + 2*sizeof(int))
52:
53: #define HASHSHIFT 3
54: #define HASHMASK 0x1f
55:
56: /*
57: * Flags to updatedb
58: */
59: #define DB_NODATA 0x1 /* data should not exist */
60: #define DB_MEXIST 0x2 /* data must exist */
61: #define DB_DELETE 0x4 /* delete data if it exists */
62:
63: /*
64: * Error return codes
65: */
66: #define OK 0
67: #define NONAME -1
68: #define NOCLASS -2
69: #define NOTYPE -3
70: #define NODATA -4
71: #define DATAEXISTS -5
72: #define NODBFILE -6
73: #define TOOMANYZONES -7
74: #define GOODDB -8
75: #define NEWDB -9
76:
77: extern struct hashbuf *hashtab; /* root hash table */
78: extern struct invbuf *invtab[]; /* inverse hash table */
79:
80: extern struct namebuf *nlookup();
81: extern struct namebuf *savename();
82: extern struct databuf *savedata();
83: extern struct hashbuf *savehash();
84: extern struct invbuf *saveinv();
85: extern char *savestr();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.