Annotation of embedaddon/quagga/isisd/include-netbsd/clnp.h, revision 1.1

1.1     ! misho       1: /*     $NetBSD: clnp.h,v 1.13 2001/08/20 12:00:54 wiz Exp $    */
        !             2: 
        !             3: /*-
        !             4:  * Copyright (c) 1991, 1993, 1994
        !             5:  *     The Regents of the University of California.  All rights reserved.
        !             6:  *
        !             7:  * Redistribution and use in source and binary forms, with or without
        !             8:  * modification, are permitted provided that the following conditions
        !             9:  * are met:
        !            10:  * 1. Redistributions of source code must retain the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer.
        !            12:  * 2. Redistributions in binary form must reproduce the above copyright
        !            13:  *    notice, this list of conditions and the following disclaimer in the
        !            14:  *    documentation and/or other materials provided with the distribution.
        !            15:  * 3. All advertising materials mentioning features or use of this software
        !            16:  *    must display the following acknowledgement:
        !            17:  *     This product includes software developed by the University of
        !            18:  *     California, Berkeley and its contributors.
        !            19:  * 4. Neither the name of the University nor the names of its contributors
        !            20:  *    may be used to endorse or promote products derived from this software
        !            21:  *    without specific prior written permission.
        !            22:  *
        !            23:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            24:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            25:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            26:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            27:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            28:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            29:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            30:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            31:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            32:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            33:  * SUCH DAMAGE.
        !            34:  *
        !            35:  *     @(#)clnp.h      8.2 (Berkeley) 4/16/94
        !            36:  */
        !            37: 
        !            38: /***********************************************************
        !            39:                Copyright IBM Corporation 1987
        !            40: 
        !            41:                       All Rights Reserved
        !            42: 
        !            43: Permission to use, copy, modify, and distribute this software and its
        !            44: documentation for any purpose and without fee is hereby granted,
        !            45: provided that the above copyright notice appear in all copies and that
        !            46: both that copyright notice and this permission notice appear in
        !            47: supporting documentation, and that the name of IBM not be
        !            48: used in advertising or publicity pertaining to distribution of the
        !            49: software without specific, written prior permission.
        !            50: 
        !            51: IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
        !            52: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
        !            53: IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
        !            54: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
        !            55: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
        !            56: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
        !            57: SOFTWARE.
        !            58: 
        !            59: ******************************************************************/
        !            60: 
        !            61: /*
        !            62:  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
        !            63:  */
        !            64: 
        !            65: /* should be config option but cpp breaks with too many #defines */
        !            66: #define        DECBIT
        !            67: 
        !            68: /*
        !            69:  *     Return true if the mbuf is a cluster mbuf
        !            70:  */
        !            71: #define        IS_CLUSTER(m)   ((m)->m_flags & M_EXT)
        !            72: 
        !            73: /*
        !            74:  *     Move the halfword into the two characters
        !            75:  */
        !            76: #define        HTOC(msb, lsb, hword)\
        !            77:        (msb) = (u_char)((hword) >> 8);\
        !            78:        (lsb) = (u_char)((hword) & 0xff)
        !            79: /*
        !            80:  *     Move the two charcters into the halfword
        !            81:  */
        !            82: #define        CTOH(msb, lsb, hword)\
        !            83:        (hword) = ((msb) << 8) | (lsb)
        !            84: 
        !            85: /*
        !            86:  *     Return true if the checksum has been set - ie. the checksum is
        !            87:  *     not zero
        !            88:  */
        !            89: #define        CKSUM_REQUIRED(clnp)\
        !            90:        (((clnp)->cnf_cksum_msb != 0) || ((clnp)->cnf_cksum_lsb != 0))
        !            91: 
        !            92: /*
        !            93:  *     Fixed part of clnp header
        !            94:  */
        !            95: struct clnp_fixed {
        !            96:        u_char          cnf_proto_id;   /* network layer protocol identifier */
        !            97:        u_char          cnf_hdr_len;    /* length indicator (octets) */
        !            98:        u_char          cnf_vers;       /* version/protocol identifier
        !            99:                                         * extension */
        !           100:        u_char          cnf_ttl;/* lifetime (500 milliseconds) */
        !           101:        u_char          cnf_type;       /* type code */
        !           102:        /* Includes err_ok, more_segs, and seg_ok */
        !           103:        u_char          cnf_seglen_msb; /* pdu segment length (octets) high
        !           104:                                         * byte */
        !           105:        u_char          cnf_seglen_lsb; /* pdu segment length (octets) low
        !           106:                                         * byte */
        !           107:        u_char          cnf_cksum_msb;  /* checksum high byte */
        !           108:        u_char          cnf_cksum_lsb;  /* checksum low byte */
        !           109: } __attribute__((packed));
        !           110: #define CNF_TYPE       0x1f
        !           111: #define CNF_ERR_OK     0x20
        !           112: #define CNF_MORE_SEGS  0x40
        !           113: #define CNF_SEG_OK     0x80
        !           114: 
        !           115: #define CLNP_CKSUM_OFF 0x07    /* offset of checksum */
        !           116: 
        !           117: #define        clnl_fixed      clnp_fixed
        !           118: 
        !           119: /*
        !           120:  *     Segmentation part of clnp header
        !           121:  */
        !           122: struct clnp_segment {
        !           123:        u_short         cng_id; /* data unit identifier */
        !           124:        u_short         cng_off;/* segment offset */
        !           125:        u_short         cng_tot_len;    /* total length */
        !           126: };
        !           127: 
        !           128: /*
        !           129:  *     Clnp fragment reassembly structures:
        !           130:  *
        !           131:  *     All packets undergoing reassembly are linked together in
        !           132:  *     clnp_fragl structures. Each clnp_fragl structure contains a
        !           133:  *     pointer to the original clnp packet header, as well as a
        !           134:  *     list of packet fragments. Each packet fragment
        !           135:  *     is headed by a clnp_frag structure. This structure contains the
        !           136:  *     offset of the first and last byte of the fragment, as well as
        !           137:  *     a pointer to the data (an mbuf chain) of the fragment.
        !           138:  */
        !           139: 
        !           140: /*
        !           141:  *     NOTE:
        !           142:  *             The clnp_frag structure is stored in an mbuf immedately
        !           143:  *             preceding the fragment data. Since there are words in
        !           144:  *             this struct, it must be word aligned.
        !           145:  *
        !           146:  *     NOTE:
        !           147:  *             All the fragment code assumes that the entire clnp header is
        !           148:  *             contained in the first mbuf.
        !           149:  */
        !           150: struct clnp_frag {
        !           151:        u_int           cfr_first;      /* offset of first byte of this frag */
        !           152:        u_int           cfr_last;       /* offset of last byte of this frag */
        !           153:        u_int           cfr_bytes;      /* bytes to shave to get to data */
        !           154:        struct mbuf    *cfr_data;       /* ptr to data for this frag */
        !           155:        struct clnp_frag *cfr_next;     /* next fragment in list */
        !           156: };
        !           157: 
        !           158: struct clnp_fragl {
        !           159:        struct iso_addr cfl_src;/* source of the pkt */
        !           160:        struct iso_addr cfl_dst;/* destination of the pkt */
        !           161:        u_short         cfl_id; /* id of the pkt */
        !           162:        u_char          cfl_ttl;/* current ttl of pkt */
        !           163:        u_short         cfl_last;       /* offset of last byte of packet */
        !           164:        struct mbuf    *cfl_orighdr;    /* ptr to original header */
        !           165:        struct clnp_frag *cfl_frags;    /* linked list of fragments for pkt */
        !           166:        struct clnp_fragl *cfl_next;    /* next pkt being reassembled */
        !           167: };
        !           168: 
        !           169: /*
        !           170:  *     The following structure is used to index into an options section
        !           171:  *     of a clnp datagram. These values can be used without worry that
        !           172:  *     offset or length fields are invalid or too big, etc. That is,
        !           173:  *     the consistancy of the options will be guaranteed before this
        !           174:  *     structure is filled in. Any pointer (field ending in p) is
        !           175:  *     actually the offset from the beginning of the mbuf the option
        !           176:  *     is contained in.  A value of NULL for any pointer
        !           177:  *     means that the option is not present. The length any option
        !           178:  *     does not include the option code or option length fields.
        !           179:  */
        !           180: struct clnp_optidx {
        !           181:        u_short         cni_securep;    /* ptr to start of security option */
        !           182:        char            cni_secure_len; /* length of entire security option */
        !           183: 
        !           184:        u_short         cni_srcrt_s;    /* offset of start of src rt option */
        !           185:        u_short         cni_srcrt_len;  /* length of entire src rt option */
        !           186: 
        !           187:        u_short         cni_recrtp;     /* ptr to beginning of recrt option */
        !           188:        char            cni_recrt_len;  /* length of entire recrt option */
        !           189: 
        !           190:        char            cni_priorp;     /* ptr to priority option */
        !           191: 
        !           192:        u_short         cni_qos_formatp;        /* ptr to format of qos
        !           193:                                                 * option */
        !           194:        char            cni_qos_len;    /* length of entire qos option */
        !           195: 
        !           196:        u_char          cni_er_reason;  /* reason from ER pdu option */
        !           197: 
        !           198:        /* ESIS options */
        !           199: 
        !           200:        u_short         cni_esct;       /* value from ISH ESCT option */
        !           201: 
        !           202:        u_short         cni_netmaskp;   /* ptr to beginning of netmask option */
        !           203:        char            cni_netmask_len;        /* length of entire netmask
        !           204:                                                 * option */
        !           205: 
        !           206:        u_short         cni_snpamaskp;  /* ptr to start of snpamask option */
        !           207:        char            cni_snpamask_len;       /* length of entire snpamask
        !           208:                                                 * option */
        !           209: 
        !           210: };
        !           211: 
        !           212: #define        ER_INVALREAS    0xff    /* code for invalid ER pdu discard reason */
        !           213: 
        !           214: /* given an mbuf and addr of option, return offset from data of mbuf */
        !           215: #define CLNP_OPTTOOFF(m, opt) ((u_short) (opt - mtod(m, caddr_t)))
        !           216: 
        !           217: /* given an mbuf and offset of option, return address of option */
        !           218: #define CLNP_OFFTOOPT(m, off) ((caddr_t) (mtod(m, caddr_t) + off))
        !           219: 
        !           220: /* return true iff src route is valid */
        !           221: #define        CLNPSRCRT_VALID(oidx) ((oidx) && (oidx->cni_srcrt_s))
        !           222: 
        !           223: /* return the offset field of the src rt */
        !           224: #define CLNPSRCRT_OFF(oidx, options)\
        !           225:        (*((u_char *)(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + 1)))
        !           226: 
        !           227: /* return the type field of the src rt */
        !           228: #define CLNPSRCRT_TYPE(oidx, options)\
        !           229:        ((u_char)(*(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s))))
        !           230: 
        !           231: /* return the length of the current address */
        !           232: #define CLNPSRCRT_CLEN(oidx, options)\
        !           233:        ((u_char)(*(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + CLNPSRCRT_OFF(oidx, options) - 1)))
        !           234: 
        !           235: /* return the address of the current address */
        !           236: #define CLNPSRCRT_CADDR(oidx, options)\
        !           237:        ((caddr_t)(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + CLNPSRCRT_OFF(oidx, options)))
        !           238: 
        !           239: /*
        !           240:  * return true if the src route has run out of routes this is true if the
        !           241:  * offset of next route is greater than the end of the rt
        !           242:  */
        !           243: #define        CLNPSRCRT_TERM(oidx, options)\
        !           244:        (CLNPSRCRT_OFF(oidx, options) > oidx->cni_srcrt_len)
        !           245: 
        !           246: /*
        !           247:  *     Options a user can set/get
        !           248:  */
        !           249: #define        CLNPOPT_FLAGS   0x01    /* flags: seg permitted, no er xmit, etc  */
        !           250: #define        CLNPOPT_OPTS    0x02    /* datagram options */
        !           251: 
        !           252: /*
        !           253:  *     Values for particular datagram options
        !           254:  */
        !           255: #define        CLNPOVAL_PAD            0xcc    /* padding */
        !           256: #define        CLNPOVAL_SECURE         0xc5    /* security */
        !           257: #define        CLNPOVAL_SRCRT          0xc8    /* source routing */
        !           258: #define        CLNPOVAL_RECRT          0xcb    /* record route */
        !           259: #define        CLNPOVAL_QOS            0xc3    /* quality of service */
        !           260: #define        CLNPOVAL_PRIOR          0xcd    /* priority */
        !           261: #define CLNPOVAL_ERREAS                0xc1    /* ER PDU ONLY: reason for discard */
        !           262: 
        !           263: #define        CLNPOVAL_SRCSPEC        0x40    /* source address specific */
        !           264: #define        CLNPOVAL_DSTSPEC        0x80    /* destination address specific */
        !           265: #define        CLNPOVAL_GLOBAL         0xc0    /* globally unique */
        !           266: 
        !           267: /* Globally Unique QOS */
        !           268: #define        CLNPOVAL_SEQUENCING     0x10    /* sequencing preferred */
        !           269: #define CLNPOVAL_CONGESTED     0x08    /* congestion experienced */
        !           270: #define CLNPOVAL_LOWDELAY      0x04    /* low transit delay */
        !           271: 
        !           272: #define        CLNPOVAL_PARTRT         0x00    /* partial source routing */
        !           273: #define CLNPOVAL_COMPRT                0x01    /* complete source routing */
        !           274: 
        !           275: /*
        !           276:  *     Clnp flags used in a control block flags field.
        !           277:  *     NOTE: these must be out of the range of bits defined in ../net/raw_cb.h
        !           278:  */
        !           279: #define        CLNP_NO_SEG             0x010   /* segmentation not permitted */
        !           280: #define        CLNP_NO_ER              0x020   /* do not generate ERs */
        !           281: #define CLNP_SEND_RAW          0x080   /* send pkt as RAW DT not TP DT */
        !           282: #define        CLNP_NO_CKSUM           0x100   /* don't use clnp checksum */
        !           283: #define CLNP_ECHO              0x200   /* send echo request */
        !           284: #define        CLNP_NOCACHE            0x400   /* don't store cache information */
        !           285: #define CLNP_ECHOR             0x800   /* send echo reply */
        !           286: 
        !           287: /* valid clnp flags */
        !           288: #define CLNP_VFLAGS \
        !           289:        (CLNP_SEND_RAW|CLNP_NO_SEG|CLNP_NO_ER|CLNP_NO_CKSUM|\
        !           290:         CLNP_ECHO|CLNP_NOCACHE|CLNP_ECHOR)
        !           291: 
        !           292: /*
        !           293:  * Constants used by clnp
        !           294:  */
        !           295: #define        CLNP_HDR_MIN    (sizeof (struct clnp_fixed))
        !           296: #define        CLNP_HDR_MAX    (254)
        !           297: #define        CLNP_TTL_UNITS  2       /* 500 milliseconds */
        !           298: #define CLNP_TTL       15*CLNP_TTL_UNITS       /* time to live (seconds) */
        !           299: #define        ISO8473_V1      0x01
        !           300: 
        !           301: /*
        !           302:  *     Clnp packet types
        !           303:  *     In order to test raw clnp and tp/clnp simultaneously, a third type of
        !           304:  *     packet has been defined: CLNP_RAW. This is done so that the input
        !           305:  *     routine can switch to the correct input routine (rclnp_input or
        !           306:  *     tpclnp_input) based on the type field. If clnp had a higher level
        !           307:  *     protocol field, this would not be necessary.
        !           308:  */
        !           309: #define        CLNP_DT                 0x1C    /* normal data */
        !           310: #define        CLNP_ER                 0x01    /* error report */
        !           311: #define        CLNP_RAW                0x1D    /* debug only */
        !           312: #define CLNP_EC                        0x1E    /* echo packet */
        !           313: #define CLNP_ECR               0x1F    /* echo reply */
        !           314: 
        !           315: /*
        !           316:  *     ER pdu error codes
        !           317:  */
        !           318: #define GEN_NOREAS             0x00    /* reason not specified */
        !           319: #define GEN_PROTOERR           0x01    /* protocol procedure error */
        !           320: #define GEN_BADCSUM            0x02    /* incorrect checksum */
        !           321: #define GEN_CONGEST            0x03    /* pdu discarded due to congestion */
        !           322: #define GEN_HDRSYNTAX          0x04    /* header syntax error */
        !           323: #define GEN_SEGNEEDED          0x05    /* need segmentation but not allowed */
        !           324: #define GEN_INCOMPLETE         0x06    /* incomplete pdu received */
        !           325: #define GEN_DUPOPT             0x07    /* duplicate option */
        !           326: 
        !           327: /* address errors */
        !           328: #define ADDR_DESTUNREACH       0x80    /* destination address unreachable */
        !           329: #define ADDR_DESTUNKNOWN       0x81    /* destination address unknown */
        !           330: 
        !           331: /* source routing */
        !           332: #define SRCRT_UNSPECERR                0x90    /* unspecified src rt error */
        !           333: #define SRCRT_SYNTAX           0x91    /* syntax error in src rt field */
        !           334: #define SRCRT_UNKNOWNADDR      0x92    /* unknown addr in src rt field */
        !           335: #define SRCRT_BADPATH          0x93    /* path not acceptable */
        !           336: 
        !           337: /* lifetime */
        !           338: #define TTL_EXPTRANSIT         0xa0    /* lifetime expired during transit */
        !           339: #define TTL_EXPREASS           0xa1    /* lifetime expired during reassembly */
        !           340: 
        !           341: /* pdu discarded */
        !           342: #define DISC_UNSUPPOPT         0xb0    /* unsupported option not specified? */
        !           343: #define DISC_UNSUPPVERS                0xb1    /* unsupported protocol version */
        !           344: #define DISC_UNSUPPSECURE      0xb2    /* unsupported security option */
        !           345: #define DISC_UNSUPPSRCRT       0xb3    /* unsupported src rt option */
        !           346: #define DISC_UNSUPPRECRT       0xb4    /* unsupported rec rt option */
        !           347: 
        !           348: /* reassembly */
        !           349: #define REASS_INTERFERE                0xc0    /* reassembly interference */
        !           350: #define CLNP_ERRORS            22
        !           351: 
        !           352: 
        !           353: #ifdef CLNP_ER_CODES
        !           354: u_char          clnp_er_codes[CLNP_ERRORS] = {
        !           355:        GEN_NOREAS, GEN_PROTOERR, GEN_BADCSUM, GEN_CONGEST,
        !           356:        GEN_HDRSYNTAX, GEN_SEGNEEDED, GEN_INCOMPLETE, GEN_DUPOPT,
        !           357:        ADDR_DESTUNREACH, ADDR_DESTUNKNOWN,
        !           358:        SRCRT_UNSPECERR, SRCRT_SYNTAX, SRCRT_UNKNOWNADDR, SRCRT_BADPATH,
        !           359:        TTL_EXPTRANSIT, TTL_EXPREASS,
        !           360:        DISC_UNSUPPOPT, DISC_UNSUPPVERS, DISC_UNSUPPSECURE,
        !           361:        DISC_UNSUPPSRCRT, DISC_UNSUPPRECRT, REASS_INTERFERE
        !           362: };
        !           363: #endif
        !           364: 
        !           365: #ifdef TROLL
        !           366: 
        !           367: #define        TR_DUPEND               0x01    /* duplicate end of fragment */
        !           368: #define TR_DUPPKT              0x02    /* duplicate entire packet */
        !           369: #define        TR_DROPPKT              0x04    /* drop packet on output */
        !           370: #define TR_TRIM                        0x08    /* trim bytes from packet */
        !           371: #define TR_CHANGE              0x10    /* change bytes in packet */
        !           372: #define TR_MTU                 0x20    /* delta to change device mtu */
        !           373: #define        TR_CHUCK                0x40    /* drop packet in rclnp_input */
        !           374: #define        TR_BLAST                0x80    /* force rclnp_output to blast many
        !           375:                                         * packet */
        !           376: #define        TR_RAWLOOP              0x100   /* make if_loop call clnpintr
        !           377:                                         * directly */
        !           378: struct troll {
        !           379:        int             tr_ops; /* operations to perform */
        !           380:        float           tr_dup_size;    /* % to duplicate */
        !           381:        float           tr_dup_freq;    /* frequency to duplicate packets */
        !           382:        float           tr_drop_freq;   /* frequence to drop packets */
        !           383:        int             tr_mtu_adj;     /* delta to adjust if mtu */
        !           384:        int             tr_blast_cnt;   /* # of pkts to blast out */
        !           385: };
        !           386: 
        !           387: #define        SN_OUTPUT(clcp, m)\
        !           388:        troll_output(clcp->clc_ifp, m, clcp->clc_firsthop, clcp->clc_rt)
        !           389: 
        !           390: #define        SN_MTU(ifp, rt) (((rt && rt->rt_rmx.rmx_mtu) ?\
        !           391:        rt->rt_rmx.rmx_mtu : clnp_badmtu(ifp, rt, __LINE__, __FILE__))\
        !           392:                - trollctl.tr_mtu_adj)
        !           393: 
        !           394: #ifdef _KERNEL
        !           395: extern float    troll_random;
        !           396: #endif
        !           397: 
        !           398: #else                          /* NO TROLL */
        !           399: 
        !           400: #define        SN_OUTPUT(clcp, m)\
        !           401:        (*clcp->clc_ifp->if_output)(clcp->clc_ifp, m, clcp->clc_firsthop, \
        !           402:                                    clcp->clc_rt)
        !           403: 
        !           404: #define        SN_MTU(ifp, rt) (((rt && rt->rt_rmx.rmx_mtu) ?\
        !           405:        rt->rt_rmx.rmx_mtu : clnp_badmtu(ifp, rt, __LINE__, __FILE__)))
        !           406: 
        !           407: #endif                         /* TROLL */
        !           408: 
        !           409: /*
        !           410:  *     Macro to remove an address from a clnp header
        !           411:  */
        !           412: #define CLNP_EXTRACT_ADDR(isoa, hoff, hend)\
        !           413:        {\
        !           414:                isoa.isoa_len = (u_char)*hoff;\
        !           415:                if ((((++hoff) + isoa.isoa_len) > hend) ||\
        !           416:                        (isoa.isoa_len > 20) || (isoa.isoa_len == 0)) {\
        !           417:                        hoff = (caddr_t)0;\
        !           418:                } else {\
        !           419:                        (void) bcopy(hoff, (caddr_t)isoa.isoa_genaddr, \
        !           420:                                     isoa.isoa_len);\
        !           421:                        hoff += isoa.isoa_len;\
        !           422:                }\
        !           423:        }
        !           424: 
        !           425: /*
        !           426:  *     Macro to insert an address into a clnp header
        !           427:  */
        !           428: #define CLNP_INSERT_ADDR(hoff, isoa)\
        !           429:        *hoff++ = (isoa).isoa_len;\
        !           430:        (void) bcopy((caddr_t)((isoa).isoa_genaddr), hoff, (isoa).isoa_len);\
        !           431:        hoff += (isoa).isoa_len;
        !           432: 
        !           433: /*
        !           434:  *     Clnp hdr cache. Whenever a clnp packet is sent, a copy of the
        !           435:  *     header is made and kept in this cache. In addition to a copy of
        !           436:  *     the cached clnp hdr, the cache contains
        !           437:  *     information necessary to determine whether the new packet
        !           438:  *     to send requires a new header to be built.
        !           439:  */
        !           440: struct clnp_cache {
        !           441:        /* these fields are used to check the validity of the cache */
        !           442:        struct iso_addr clc_dst;/* destination of packet */
        !           443:        struct mbuf    *clc_options;    /* ptr to options mbuf */
        !           444:        int             clc_flags;      /* flags passed to clnp_output */
        !           445: 
        !           446:        /* these fields are state that clnp_output requires to finish the pkt */
        !           447:        int             clc_segoff;     /* offset of seg part of header */
        !           448:        struct rtentry *clc_rt; /* ptr to rtentry (points into the route
        !           449:                                 * structure) */
        !           450:        struct sockaddr *clc_firsthop;  /* first hop of packet */
        !           451:        struct ifnet   *clc_ifp;/* ptr to interface structure */
        !           452:        struct iso_ifaddr
        !           453:                       *clc_ifa;/* ptr to interface address */
        !           454:        struct mbuf    *clc_hdr;/* cached pkt hdr (finally)! */
        !           455: };
        !           456: 
        !           457: #ifdef _KERNEL
        !           458: struct iso_addr;
        !           459: struct sockaddr_iso;
        !           460: struct mbuf;
        !           461: struct clnp_segment;
        !           462: struct sockaddr;
        !           463: struct rt_entry;
        !           464: struct clnp_fragl;
        !           465: struct clnp_optidx;
        !           466: struct isopcb;
        !           467: struct snpa_hdr;
        !           468: struct iso_ifaddr;
        !           469: struct route_iso;
        !           470: 
        !           471: /* clnp_debug.c */
        !           472: char *clnp_hexp __P((char *, int, char *));
        !           473: char *clnp_iso_addrp __P((struct iso_addr *));
        !           474: char *clnp_saddr_isop __P((struct sockaddr_iso *));
        !           475: 
        !           476: /* clnp_er.c */
        !           477: void clnp_er_input __P((struct mbuf *, struct iso_addr *, u_int));
        !           478: void clnp_discard __P((struct mbuf *, u_int));
        !           479: void clnp_emit_er __P((struct mbuf *, u_int));
        !           480: int clnp_er_index __P((u_int));
        !           481: 
        !           482: int clnp_fragment __P((struct ifnet *, struct mbuf *, struct sockaddr *,
        !           483:                       int, int, int, struct rtentry *));
        !           484: struct mbuf *clnp_reass __P((struct mbuf *, struct iso_addr *,
        !           485:                             struct iso_addr *, struct clnp_segment *));
        !           486: int clnp_newpkt __P((struct mbuf *, struct iso_addr *, struct iso_addr *,
        !           487:                     struct clnp_segment *));
        !           488: void clnp_insert_frag __P((struct clnp_fragl *, struct mbuf *,
        !           489:                           struct clnp_segment *));
        !           490: struct mbuf    *clnp_comp_pdu __P((struct clnp_fragl *));
        !           491: #ifdef TROLL
        !           492: float troll_random __P((void));
        !           493: int troll_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
        !           494:                      struct rtentry *));
        !           495: #endif
        !           496: 
        !           497: /* clnp_input.c */
        !           498: void clnp_init  __P((void));
        !           499: void clnlintr    __P((void));
        !           500: void clnp_input __P((struct mbuf *, ...));
        !           501: 
        !           502: /* clnp_options.c */
        !           503: void clnp_update_srcrt __P((struct mbuf *, struct clnp_optidx *));
        !           504: void clnp_dooptions __P((struct mbuf *, struct clnp_optidx *, struct ifnet *,
        !           505:                         struct iso_addr *));
        !           506: int clnp_set_opts __P((struct mbuf **, struct mbuf **));
        !           507: int clnp_opt_sanity __P((struct mbuf *, caddr_t, int, struct clnp_optidx *));
        !           508: 
        !           509: /* clnp_output.c */
        !           510: int clnp_output __P((struct mbuf *, ...));
        !           511: void clnp_ctloutput __P((void));
        !           512: 
        !           513: /* clnp_raw.c */
        !           514: void rclnp_input __P((struct mbuf *, ...));
        !           515: int rclnp_output __P((struct mbuf *, ...));
        !           516: int rclnp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
        !           517: int clnp_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
        !           518:                     struct mbuf *, struct proc *));
        !           519: 
        !           520: /* clnp_subr.c */
        !           521: struct mbuf    *clnp_data_ck __P((struct mbuf *, int));
        !           522: caddr_t clnp_extract_addr __P((caddr_t, int, struct iso_addr *,
        !           523:                               struct iso_addr *));
        !           524: int clnp_ours   __P((struct iso_addr *));
        !           525: void clnp_forward __P((struct mbuf *, int, struct iso_addr *,
        !           526:                       struct clnp_optidx *, int, struct snpa_hdr *));
        !           527: caddr_t clnp_insert_addr __P((caddr_t, struct iso_addr *, struct iso_addr *));
        !           528: int clnp_route  __P((struct iso_addr *, struct route_iso *, int,
        !           529:                     struct sockaddr **, struct iso_ifaddr **));
        !           530: int clnp_srcroute __P((struct mbuf *, struct clnp_optidx *, struct route_iso *,
        !           531:                       struct sockaddr **, struct iso_ifaddr **,
        !           532:                       struct iso_addr *));
        !           533: int clnp_echoreply __P((struct mbuf *, int, struct sockaddr_iso *,
        !           534:                        struct sockaddr_iso *, struct clnp_optidx *));
        !           535: int clnp_badmtu __P((struct ifnet *, struct rtentry *, int, char *));
        !           536: void clnp_ypocb  __P((caddr_t, caddr_t, u_int));
        !           537: 
        !           538: /* clnp_timer.c */
        !           539: struct clnp_fragl *clnp_freefrags __P((struct clnp_fragl *));
        !           540: void clnp_slowtimo __P((void));
        !           541: void clnp_drain __P((void));
        !           542: 
        !           543: #ifdef TROLL
        !           544: struct troll    trollctl;
        !           545: #endif /* TROLL */
        !           546: 
        !           547: #endif /* _KERNEL */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>