Annotation of 43BSDTahoe/etc/named/ns.h, revision 1.1

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:  *     @(#)ns.h        4.22 (Berkeley) 6/18/88
        !            18:  */
        !            19: 
        !            20: /*
        !            21:  * Global definitions and variables for the name server.
        !            22:  */
        !            23: 
        !            24: #include <strings.h>
        !            25: #include <arpa/inet.h>
        !            26: 
        !            27: /*
        !            28:  * Timeout time should be around 1 minute or so.  Using the
        !            29:  * the current simplistic backoff strategy, the sequence
        !            30:  * retrys after 4, 8, and 16 seconds.  With 3 servers, this
        !            31:  * dies out in a little more than a minute.
        !            32:  * (sequence RETRYBASE, 2*RETRYBASE, 4*RETRYBASE... for MAXRETRY)
        !            33:  */
        !            34: #define MAXZONES       128             /* max number of zones supported */
        !            35: #define MINROOTS       2               /* min number of root hints */
        !            36: #define NSMAX          10              /* max number of NS's to try */
        !            37: #define RETRYBASE      4               /* base time between retries */
        !            38: #define MAXRETRY       3               /* max number of retries per addr */
        !            39: #define MAXCNAMES      8               /* max # of CNAMES tried per addr */
        !            40: #define MAXQUERIES     20              /* max # of queries to be made */
        !            41:                                        /* (prevent "recursive" loops) */
        !            42: #define        INIT_REFRESH    600             /* retry time for initial secondary */
        !            43:                                        /* contact (10 minutes) */
        !            44: 
        !            45: #define ALPHA    0.7   /* How much to preserver of old response time */
        !            46: #define        BETA     1.2    /* How much to penalize response time on failure */
        !            47: #define        GAMMA    0.98   /* How much to decay unused response times */
        !            48: 
        !            49: struct zoneinfo {
        !            50:        int     z_type;                 /* type of zone */
        !            51:        int     z_auth;                 /* zone is authoritative */
        !            52:        char    *z_origin;              /* root domain name of zone */
        !            53:        time_t  z_time;                 /* time for next refresh */
        !            54:        time_t  z_lastupdate;           /* time of last refresh */
        !            55:        u_long  z_refresh;              /* refresh interval */
        !            56:        u_long  z_retry;                /* refresh retry interval */
        !            57:        u_long  z_expire;               /* expiration time for cached info */
        !            58:        u_long  z_minimum;              /* minimum TTL value */
        !            59:        u_long  z_serial;               /* changes if zone modified */
        !            60:        char    *z_source;              /* source location of data */
        !            61:        time_t  z_ftime;                /* modification time of source file */
        !            62:        int     z_addrcnt;              /* address count */
        !            63:        struct  in_addr z_addr[NSMAX];  /* list of master servers for zone */
        !            64:        int     z_sysloged;             /* has fail to transfer been sysloged */
        !            65: #ifdef ALLOW_UPDATES
        !            66:        int     hasChanged;             /* non-zero if zone has been updated
        !            67:                                         * since last checkpoint
        !            68:                                         */
        !            69: #endif ALLOW_UPDATES
        !            70: };
        !            71: 
        !            72:        /* zone types (z_type) */
        !            73: #define Z_PRIMARY      1
        !            74: #define Z_SECONDARY    2
        !            75: #define Z_CACHE                3
        !            76: 
        !            77: /*
        !            78:  * Structure for recording info on forwarded queries.
        !            79:  */
        !            80: struct qinfo {
        !            81:        u_short q_id;                   /* id of query */
        !            82:        u_short q_nsid;                 /* id of forwarded query */
        !            83:        int     q_dfd;                  /* UDP file descriptor */
        !            84:        struct  sockaddr_in q_from;     /* requestor's address */
        !            85:        char    *q_msg;                 /* the message */
        !            86:        int     q_msglen;               /* len of message */
        !            87:        int     q_naddr;                /* number of addr's in q_addr */
        !            88:        int     q_curaddr;              /* last addr sent to */
        !            89:        struct  fwdinfo *q_fwd;         /* last forwarder used */
        !            90:        time_t  q_time;                 /* time to retry */
        !            91:        struct  qinfo *q_next;          /* rexmit list (sorted by time) */
        !            92:        struct  qinfo *q_link;          /* storage list (random order) */
        !            93:        struct  qserv {
        !            94:                struct  sockaddr_in ns_addr;    /* addresses of NS's */
        !            95:                struct  databuf *ns;    /* databuf for NS record */
        !            96:                struct  databuf *nsdata; /* databuf for server address */
        !            97:                struct  timeval stime;  /* time first query started */
        !            98:                int     nretry;         /* # of times addr retried */
        !            99:        } q_addr[NSMAX];                /* addresses of NS's */
        !           100:        struct  databuf *q_usedns[NSMAX]; /* databuf for NS that we've tried */
        !           101:        int     q_nusedns;
        !           102:        int     q_cname;                /* # of cnames found */
        !           103:        int     q_nqueries;             /* # of queries required */
        !           104:        char    *q_cmsg;                /* the cname message */
        !           105:        int     q_cmsglen;              /* len of cname message */
        !           106:        struct  qstream *q_stream;      /* TCP stream, null if UDP */
        !           107:        int     q_system;               /* boolean, system query */
        !           108: };
        !           109: 
        !           110: #define        Q_NEXTADDR(qp,n)        \
        !           111:        (((qp)->q_fwd == (struct fwdinfo *)0) ? \
        !           112:         &(qp)->q_addr[n].ns_addr : &(qp)->q_fwd->fwdaddr)
        !           113: 
        !           114: #define PRIMING_CACHE  42
        !           115: #define QINFO_NULL     ((struct qinfo *)0)
        !           116: extern struct qinfo *qfindid();
        !           117: extern struct qinfo *qnew();
        !           118: extern struct qinfo *retryqp;          /* next query to retry */
        !           119: /*
        !           120:  * Return codes from ns_forw:
        !           121:  */
        !           122: #define        FW_OK           0
        !           123: #define        FW_DUP          1
        !           124: #define        FW_NOSERVER     2
        !           125: #define        FW_SERVFAIL     3
        !           126: 
        !           127: struct qstream {
        !           128:        int     s_rfd;                  /* stream file descriptor */
        !           129:        int     s_size;                 /* expected amount of data to recive */
        !           130:        int     s_bufsize;              /* amount of data recived in s_buf */
        !           131:        char    *s_buf;                 /* buffer of recived data */
        !           132:        char    *s_bufp;                /* pointer into s_buf of recived data */
        !           133:        struct  qstream *s_next;        /* next stream */
        !           134:        struct  sockaddr_in s_from;     /* address query came from */
        !           135:        u_long  s_time;                 /* time stamp of last transaction */
        !           136:        int     s_refcnt;               /* number of outstanding queries */
        !           137:        u_short s_tempsize;             /* temporary for size from net */
        !           138: };
        !           139: 
        !           140: #define QSTREAM_NULL   ((struct qstream *)0)
        !           141: extern struct qstream *streamq;                /* stream queue */
        !           142: 
        !           143: struct qdatagram {
        !           144:        int     dq_dfd;                 /* datagram file descriptor */
        !           145:        struct  qdatagram *dq_next;     /* next datagram */
        !           146:        struct  in_addr  dq_addr;       /* address of interface */
        !           147: };
        !           148: 
        !           149: #define QDATAGRAM_NULL ((struct qdatagram *)0)
        !           150: extern struct qdatagram *datagramq;    /* datagram queue */
        !           151: 
        !           152: struct netinfo {
        !           153:        struct netinfo *next;
        !           154:        u_long net;
        !           155:        u_long mask;
        !           156:        struct in_addr my_addr;
        !           157: };
        !           158: 
        !           159: struct fwdinfo {
        !           160:        struct fwdinfo *next;
        !           161:        struct sockaddr_in fwdaddr;
        !           162: };
        !           163: 
        !           164: struct nets {
        !           165:        char *name;
        !           166:        long net;
        !           167:        struct nets *next;
        !           168: }; 
        !           169: 
        !           170: /*
        !           171:  *  Statistics Defines
        !           172:  */
        !           173: struct stats {
        !           174:        unsigned long   cnt;
        !           175:        char    *description;
        !           176: };
        !           177: 
        !           178: /* gross count of UDP packets in and out */
        !           179: #define        S_INPKTS        0
        !           180: #define        S_OUTPKTS       1
        !           181: /* gross count of queries and inverse queries received */
        !           182: #define        S_QUERIES       2
        !           183: #define        S_IQUERIES      3
        !           184: #define S_DUPQUERIES   4
        !           185: #define        S_RESPONSES     5
        !           186: #define        S_DUPRESP       6
        !           187: #define        S_RESPOK        7
        !           188: #define        S_RESPFAIL      8
        !           189: #define        S_RESPFORMERR   9
        !           190: #define        S_SYSQUERIES    10
        !           191: #define        S_PRIMECACHE    11
        !           192: #define        S_CHECKNS       12
        !           193: #define        S_BADRESPONSES  13
        !           194: #define        S_MARTIANS      14
        !           195: #define S_NSTATS       15      /* Careful! */
        !           196: #ifdef STATS
        !           197: extern struct stats stats[S_NSTATS];
        !           198: extern unsigned long typestats[T_ANY+1];
        !           199: #endif
        !           200: 
        !           201: #ifdef DEBUG
        !           202: extern int debug;                      /* debug flag */
        !           203: extern FILE *ddt;                      /* debug file discriptor */
        !           204: #endif
        !           205: extern int ds;                         /* datagram socket */
        !           206: extern struct qdatagram *dqp;
        !           207: extern struct timeval tt;              /* place to store time */
        !           208: 
        !           209: extern struct itimerval ival;          /* maintenance interval */
        !           210: extern struct zoneinfo zones[MAXZONES];        /* zone information */
        !           211: extern int nzones;                     /* number of zones in use */
        !           212: 
        !           213: #ifdef vax
        !           214: extern u_short htons(), ntohs();
        !           215: extern u_long htonl(), ntohl();
        !           216: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.