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