Annotation of researchv10dc/lsys/sys/inet/ip_var.h, revision 1.1

1.1     ! root        1: /*     ip_var.h        6.1     83/07/29        */
        !             2: 
        !             3: /*
        !             4:  * Overlay for ip header used by other protocols (tcp, udp).
        !             5:  */
        !             6: struct ipovly {
        !             7:        struct  tcpiphdr *ih_next;      /* for protocol sequence q's */
        !             8:        struct  block *ih_bp;           /* bookkeeping for above queue seq */
        !             9:        u_char  ih_x1;                  /* (unused) */
        !            10:        u_char  ih_pr;                  /* protocol */
        !            11:        short   ih_len;                 /* protocol length */
        !            12:        in_addr ih_src;         /* source internet address */
        !            13:        in_addr ih_dst;         /* destination internet address */
        !            14: };
        !            15: 
        !            16: /*
        !            17:  * Ipq points to the ip reassembly queue.
        !            18:  *
        !            19:  * Ip reassembly queue structure.  Each fragment being reassembled
        !            20:  * has one of these structures as the data in the header block structure.
        !            21:  *
        !            22:  * They are timed out after ipq_ttl drops to 0, and may also
        !            23:  * be reclaimed if memory becomes tight.
        !            24:  */
        !            25: struct ipq {
        !            26:        struct  block *next,*prev;      /* to other reass headers */
        !            27:        u_char  ipq_ttl;                /* time for reass q to live */
        !            28:        u_char  ipq_p;                  /* protocol of this fragment */
        !            29:        u_short ipq_id;                 /* sequence id for reassembly */
        !            30:        in_addr ipq_src,ipq_dst;
        !            31: };
        !            32: 
        !            33: /*
        !            34:  * Ip header, when holding a fragment.
        !            35:  *
        !            36:  * Note: ipf_next must be at same offset as ipq_next above
        !            37:  */
        !            38: struct ipasfrag {
        !            39: #ifdef vax
        !            40:        u_int   ip_hl:4,
        !            41:                ip_v:4;
        !            42: #endif
        !            43:        u_char  ip_tos;
        !            44:        short   ip_len;
        !            45:        u_short ip_id;
        !            46:        short   ip_off;
        !            47:        u_char  ip_ttl;
        !            48:        u_char  ip_p;
        !            49:        u_short ip_sum;
        !            50:        struct  block *ipf_next;        /* next fragment */
        !            51:        struct  block *ipf_prev;        /* previous fragment */
        !            52: };
        !            53: 
        !            54: struct ipstat {
        !            55:        int     ips_badsum;             /* checksum bad */
        !            56:        int     ips_tooshort;           /* packet too short */
        !            57:        int     ips_toosmall;           /* not enough data */
        !            58:        int     ips_badhlen;            /* ip header length < data size */
        !            59:        int     ips_badlen;             /* ip length < ip header length */
        !            60:        int     ips_qfull;
        !            61:        int     ips_route;              /* routing output errors */
        !            62:        int     ips_fragout;            /* fragmented packets */
        !            63: };
        !            64: 
        !            65: /* flags passed to ip_output as last parameter */
        !            66: #define        IP_FORWARDING           0x1     /* most of ip header exists */
        !            67: #define        IP_ROUTETOIF            0x10    /* same as SO_DONTROUTE */
        !            68: 
        !            69: #ifdef KERNEL
        !            70: struct ipstat  ipstat;
        !            71: u_short        ip_id;                          /* ip packet ctr, for ids */
        !            72: #endif
        !            73: 
        !            74: /*
        !            75:  * interface stuff
        !            76:  */
        !            77: struct ipif{
        !            78:        struct queue *queue;
        !            79:        int flags;
        !            80:        int mtu;
        !            81:        in_addr thishost;
        !            82:        in_addr that;
        !            83:        in_addr mask;
        !            84:        in_addr broadcast;
        !            85:        int ipackets, ierrors;
        !            86:        int opackets, oerrors;
        !            87:        int arp;
        !            88:        int dev;
        !            89: };
        !            90: #define IFF_UP         0x1
        !            91: #define IFF_HOST       0x2
        !            92: #define IFF_ARP                0x4
        !            93: 
        !            94: #ifdef KERNEL
        !            95: extern struct ipif ipif[];
        !            96: extern struct ipif *ip_ifwithaddr(), *ip_ifonnetof();
        !            97: #endif
        !            98: 
        !            99: #define IPIOHOST       (('i'<<8)|1)
        !           100: #define IPIONET                (('i'<<8)|2)
        !           101: #define IPIOLOCAL      (('i'<<8)|3)
        !           102: #define IPIOARP                (('i'<<8)|4)
        !           103: #define IPIORESOLVE    (('i'<<8)|5)
        !           104: #define IPIOMTU                (('i'<<8)|6)
        !           105: #define IPIOROUTE      (('i'<<8)|7)
        !           106: #define IPIOGETIFS     (('i'<<8)|8)
        !           107: #define IPIOMASK       (('i'<<8)|9)
        !           108: 
        !           109: #define IP_BODY_LIMIT 8192
        !           110: #define IP_MSG_LIMIT (sizeof(struct ipovly) + IP_BODY_LIMIT)
        !           111: 
        !           112: /* an ip routing record */
        !           113: struct ip_route{
        !           114:        long time;              /* time of last access */
        !           115:        in_addr dst;            /* destination */
        !           116:        in_addr gate;           /* gate to use for this destination */
        !           117: };
        !           118: 
        !           119: #ifdef KERNEL
        !           120: /* structure returned by "ip_route" */
        !           121: struct ip_route_info {
        !           122:        in_addr addr;
        !           123:        struct ipif *ifp;
        !           124: };
        !           125: struct ip_route_info ip_route();
        !           126: #endif KERNEL
        !           127: 
        !           128: /* an ip to ethernet address mapping */
        !           129: struct ip_arp{
        !           130:        long time;                      /* time of last access */
        !           131:        in_addr inaddr;                 /* inet address */
        !           132:        unsigned char enaddr[6];        /* ethernet address */
        !           133: };
        !           134: 
        !           135: #define BLEN(bp) ((bp)->wptr - (bp)->rptr)
        !           136: #define BSZ(bp) ((bp)->lim - (bp)->base)
        !           137: #define MAXBLEN        64
        !           138: 
        !           139: /* #define MGET(m, x, y)       ((m) = bp_get(x, y)) */
        !           140: 
        !           141: #ifdef KERNEL
        !           142: extern struct block *bp_copy();
        !           143: extern struct block *bp_get();
        !           144: #endif
        !           145: 
        !           146: #ifdef IN_PARANOID
        !           147: extern struct block cblock[];
        !           148: extern int blkcnt;
        !           149: #define BLOCKCHK(bp)\
        !           150:        if(bp < cblock || cblock >= &cblock[blkcnt])\
        !           151:                panic("bp_check bad bp");\
        !           152:        if(bp->base == 0 || bp->lim == 0)\
        !           153:                panic("bp_check 0");\
        !           154:        if(bp->rptr > bp->lim || bp->rptr < bp->base)\
        !           155:                panic("bp_check rptr");\
        !           156:        if(bp->wptr > bp->lim || bp->wptr < bp->base)\
        !           157:                panic("bp_check wptr");\
        !           158:        if(bp->rptr > bp->wptr)\
        !           159:                panic("bp_check rptr > wptr")
        !           160: #define MCHECK(bp) bp_check(bp)
        !           161: #else
        !           162: #define BLOCKCHK(bp)
        !           163: #define MCHECK(bp)
        !           164: #endif

unix.superglobalmegacorp.com

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