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

Defined macros

AUTH defined in line 96; used 1 times
DATASIZE defined in line 40; used 2 times
DB_Z_ALL defined in line 81; used 3 times
GOODDB defined in line 94; never used
HASHMASK defined in line 69; used 2 times
HASHSHIFT defined in line 68; used 1 times
HASHSIZE defined in line 66; used 1 times
MAXDATA defined in line 23; used 6 times
NEWDB defined in line 95; never used
NOCLASS defined in line 88; never used
NODATA defined in line 90; used 2 times
NODBFILE defined in line 92; used 4 times
NONAME defined in line 87; used 1 times
NOTYPE defined in line 89; never used
TOOMANYZONES defined in line 93; never used

Usage of this include

Last modified: 1988-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1637
Valid CSS Valid XHTML 1.0 Strict