Annotation of Net2/netiso/clnp.h, revision 1.1

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

unix.superglobalmegacorp.com

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