1: /*	ns.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 definitions and variables for the name server.
  10:  */
  11: 
  12: #include <strings.h>
  13: #include <arpa/inet.h>
  14: 
  15: /* MAXRETRY * RETRYTIME * #ns should be less than 1 minute or so */
  16: /* 3 * 8 * 3 = 72 seconds for 3 root domain servers */
  17: #define MAXNS       10      /* max number of NS's to try */
  18: #define RETRYTIME   8       /* time between retries */
  19: #define MAXRETRY    3       /* max number of retries per addr */
  20: #define MAXCNAMES   8       /* max # of CNAMES tried per addr */
  21: 
  22: #define MAXZONES 32
  23: 
  24: struct zoneinfo {
  25:     int z_type;         /* type of zone */
  26:     char    *z_origin;      /* root domain name of zone */
  27:     time_t  z_time;         /* time left before refresh */
  28:     u_long  z_refresh;      /* refresh interval */
  29:     u_long  z_retry;        /* refresh retry interval */
  30:     u_long  z_expire;       /* expiriation time for cached info */
  31:     u_long  z_minimum;      /* minimum TTL value */
  32:     u_long  z_serial;       /* changes if zone modified */
  33:     char    *z_source;      /* source location of data */
  34:     int z_addrcnt;      /* address count */
  35:     struct  in_addr z_addr[MAXNS];  /* list of master servers for zone */
  36: };
  37: 
  38:     /* zone types (z_type) */
  39: #define Z_PRIMARY   1
  40: #define Z_SECONDARY 2
  41: #define Z_CACHE     3
  42: #define Z_DOMAIN    4
  43: 
  44:     /* Flags to ns_req() */
  45: #define ISTCP       01
  46: #define ISLOCAL     02
  47: 
  48: /*
  49:  * Structure for recording info on forwarded queries.
  50:  */
  51: struct qinfo {
  52:     u_short q_id;           /* id of query */
  53:     u_short q_nsid;         /* id of forwarded query */
  54:     struct  sockaddr_in q_from; /* requestor's address */
  55:     char    *q_msg;         /* the message */
  56:     int q_msglen;       /* len of message */
  57:     int q_naddr;        /* number of addr's in q_addr */
  58:     int q_curaddr;      /* last addr sent to */
  59:     time_t  q_time;         /* time to retry */
  60:     struct  qinfo *q_next;      /* rexmit list (sorted by time) */
  61:     struct  qinfo *q_link;      /* storage list (random order) */
  62:     struct  sockaddr_in q_addr[MAXNS];  /* addresses of NS's */
  63:     int q_nretry[MAXNS];    /* # of times addr retried */
  64:     int q_cname;        /* # of cnames found */
  65:     char    *q_cmsg;        /* the cname message */
  66:     int q_cmsglen;      /* len of cname message */
  67:     struct  qstream *q_stream;  /* TCP stream, null if UDP */
  68: };
  69: 
  70: #define QINFO_NULL  ((struct qinfo *)0)
  71: extern struct qinfo *qfindid();
  72: extern struct qinfo *qnew();
  73: extern struct qinfo *retryqp;       /* next query to retry */
  74: 
  75: struct qstream {
  76:     int     s_rfd;          /* stream file descriptor */
  77:     int     s_size;         /* expected amount of data to recive */
  78:     int     s_bufsize;      /* amount of data recived in s_buf */
  79:     char    *s_buf;         /* buffer of recived data */
  80:     char    *s_bufp;        /* pointer into s_buf of recived data */
  81:     struct  qstream *s_next;    /* next stream */
  82:     struct  sockaddr_in s_from; /* address query came from */
  83:     u_long  s_time;         /* time stamp of last transaction */
  84:     int s_refcnt;       /* number of outstanding queries */
  85:     u_short s_tempsize;     /* temporary for size from net */
  86: };
  87: 
  88: #define QSTREAM_NULL    ((struct qstream *)0)
  89: extern struct qstream *streamq;     /* stream queue */
  90: 
  91: #ifdef DEBUG
  92: extern int debug;           /* debug flag */
  93: extern FILE *ddt;           /* debug file discriptor */
  94: #endif
  95: extern int ds;              /* datagram socket */
  96: extern struct timeval tt;       /* place to store time */
  97: 
  98: extern struct itimerval ival;       /* maintenance interval */
  99: extern struct zoneinfo zones[MAXZONES]; /* zone information */
 100: extern int nzones;          /* number of zones in use */
 101: 
 102: #ifdef vax
 103: extern u_short htons(), ntohs();
 104: extern u_long htonl(), ntohl();
 105: #endif

Defined struct's

qinfo defined in line 51; used 52 times
qstream defined in line 75; used 29 times
zoneinfo defined in line 24; used 20 times

Defined macros

ISLOCAL defined in line 46; never used
ISTCP defined in line 45; never used
MAXCNAMES defined in line 20; used 1 times
MAXNS defined in line 17; used 14 times
MAXRETRY defined in line 19; used 1 times
MAXZONES defined in line 22; used 3 times
QINFO_NULL defined in line 70; used 8 times
Z_CACHE defined in line 41; used 1 times
Z_DOMAIN defined in line 42; used 3 times
Z_PRIMARY defined in line 39; used 1 times
Z_SECONDARY defined in line 40; used 2 times

Usage of this include

Last modified: 1986-06-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1113
Valid CSS Valid XHTML 1.0 Strict