Annotation of kernel/bsd/netiso/clnp.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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