1*39194Ssklower 236366Ssklower /*********************************************************** 336366Ssklower Copyright IBM Corporation 1987 436366Ssklower 536366Ssklower All Rights Reserved 636366Ssklower 736366Ssklower Permission to use, copy, modify, and distribute this software and its 836366Ssklower documentation for any purpose and without fee is hereby granted, 936366Ssklower provided that the above copyright notice appear in all copies and that 1036366Ssklower both that copyright notice and this permission notice appear in 1136366Ssklower supporting documentation, and that the name of IBM not be 1236366Ssklower used in advertising or publicity pertaining to distribution of the 1336366Ssklower software without specific, written prior permission. 1436366Ssklower 1536366Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 1636366Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 1736366Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 1836366Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 1936366Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 2036366Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 2136366Ssklower SOFTWARE. 2236366Ssklower 2336366Ssklower ******************************************************************/ 2436366Ssklower 2536366Ssklower /* 2636366Ssklower * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison 2736366Ssklower */ 2836762Ssklower /* $Header: /var/src/sys/netiso/RCS/clnp.h,v 5.1 89/02/09 16:17:22 hagens Exp $ */ 2936762Ssklower /* $Source: /var/src/sys/netiso/RCS/clnp.h,v $ */ 30*39194Ssklower /* @(#)clnp.h 7.5 (Berkeley) 09/22/89 */ 3136366Ssklower 3236366Ssklower #ifndef BYTE_ORDER 3336366Ssklower /* 3436366Ssklower * Definitions for byte order, 3536366Ssklower * according to byte significance from low address to high. 3636366Ssklower */ 3736366Ssklower #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ 3836366Ssklower #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ 3936366Ssklower #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ 4036366Ssklower 4136366Ssklower #ifdef vax 4236366Ssklower #define BYTE_ORDER LITTLE_ENDIAN 4336366Ssklower #else 4436366Ssklower #define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ 4536366Ssklower #endif 4636366Ssklower #endif BYTE_ORDER 4736366Ssklower 4836762Ssklower /* should be config option but cpp breaks with too many #defines */ 4936762Ssklower #define DECBIT 5036762Ssklower 5136366Ssklower /* 5236366Ssklower * Return true if the mbuf is a cluster mbuf 5336366Ssklower */ 5436761Ssklower #define IS_CLUSTER(m) ((m)->m_flags & M_EXT) 5536366Ssklower 5636366Ssklower /* 5736366Ssklower * Move the halfword into the two characters 5836366Ssklower */ 5936366Ssklower #define HTOC(msb, lsb, hword)\ 6036366Ssklower (msb) = (u_char)((hword) >> 8);\ 6136366Ssklower (lsb) = (u_char)((hword) & 0xff) 6236366Ssklower /* 6336366Ssklower * Move the two charcters into the halfword 6436366Ssklower */ 6536366Ssklower #define CTOH(msb, lsb, hword)\ 6636366Ssklower (hword) = ((msb) << 8) | (lsb) 6736366Ssklower 6836366Ssklower /* 6936366Ssklower * Return true if the checksum has been set - ie. the checksum is 7036366Ssklower * not zero 7136366Ssklower */ 7236366Ssklower #define CKSUM_REQUIRED(clnp)\ 7336366Ssklower (((clnp)->cnf_cksum_msb != 0) || ((clnp)->cnf_cksum_lsb != 0)) 7436366Ssklower 7536366Ssklower /* 7636366Ssklower * Fixed part of clnp header 7736366Ssklower */ 7836366Ssklower struct clnp_fixed { 7936366Ssklower u_char cnf_proto_id; /* network layer protocol identifier */ 8036366Ssklower u_char cnf_hdr_len; /* length indicator (octets) */ 8136366Ssklower u_char cnf_vers; /* version/protocol identifier extension */ 8236366Ssklower u_char cnf_ttl; /* lifetime (500 milliseconds) */ 8337469Ssklower u_char cnf_type; /* type code */ 8437469Ssklower /* Includes err_ok, more_segs, and seg_ok */ 8536366Ssklower u_char cnf_seglen_msb; /* pdu segment length (octets) high byte */ 8636366Ssklower u_char cnf_seglen_lsb; /* pdu segment length (octets) low byte */ 8736366Ssklower u_char cnf_cksum_msb; /* checksum high byte */ 8836366Ssklower u_char cnf_cksum_lsb; /* checksum low byte */ 8936366Ssklower }; 9037469Ssklower #define CNF_TYPE 0x1f 9137469Ssklower #define CNF_ERR_OK 0x20 9237469Ssklower #define CNF_MORE_SEGS 0x40 9337469Ssklower #define CNF_SEG_OK 0x80 9437469Ssklower 9536366Ssklower #define CLNP_CKSUM_OFF 0x07 /* offset of checksum */ 9636366Ssklower 9736366Ssklower #define clnl_fixed clnp_fixed 9836366Ssklower 9936366Ssklower /* 10036366Ssklower * Segmentation part of clnp header 10136366Ssklower */ 10236366Ssklower struct clnp_segment { 10336366Ssklower u_short cng_id; /* data unit identifier */ 10436366Ssklower u_short cng_off; /* segment offset */ 10536366Ssklower u_short cng_tot_len; /* total length */ 10636366Ssklower }; 10736366Ssklower 10836366Ssklower /* 10936366Ssklower * Clnp fragment reassembly structures: 11036366Ssklower * 11136366Ssklower * All packets undergoing reassembly are linked together in 11236366Ssklower * clnp_fragl structures. Each clnp_fragl structure contains a 11336366Ssklower * pointer to the original clnp packet header, as well as a 11436366Ssklower * list of packet fragments. Each packet fragment 11536366Ssklower * is headed by a clnp_frag structure. This structure contains the 11636366Ssklower * offset of the first and last byte of the fragment, as well as 11736366Ssklower * a pointer to the data (an mbuf chain) of the fragment. 11836366Ssklower */ 11936366Ssklower 12036366Ssklower /* 12136366Ssklower * NOTE: 12236366Ssklower * The clnp_frag structure is stored in an mbuf immedately preceeding 12336366Ssklower * the fragment data. Since there are words in this struct, 12436366Ssklower * it must be word aligned. 12536366Ssklower * 12636366Ssklower * NOTE: 12736366Ssklower * All the fragment code assumes that the entire clnp header is 12836366Ssklower * contained in the first mbuf. 12936366Ssklower */ 13036366Ssklower struct clnp_frag { 13136366Ssklower u_int cfr_first; /* offset of first byte of this frag */ 13236366Ssklower u_int cfr_last; /* offset of last byte of this frag */ 13336366Ssklower u_int cfr_bytes; /* bytes to shave to get to data */ 13436366Ssklower struct mbuf *cfr_data; /* ptr to data for this frag */ 13536366Ssklower struct clnp_frag *cfr_next; /* next fragment in list */ 13636366Ssklower }; 13736366Ssklower 13836366Ssklower struct clnp_fragl { 13936366Ssklower struct iso_addr cfl_src; /* source of the pkt */ 14036366Ssklower struct iso_addr cfl_dst; /* destination of the pkt */ 14136366Ssklower u_short cfl_id; /* id of the pkt */ 14236366Ssklower u_char cfl_ttl; /* current ttl of pkt */ 14336366Ssklower u_short cfl_last; /* offset of last byte of packet */ 14436366Ssklower struct mbuf *cfl_orighdr; /* ptr to original header */ 14536366Ssklower struct clnp_frag *cfl_frags; /* linked list of fragments for pkt */ 14636366Ssklower struct clnp_fragl *cfl_next; /* next pkt being reassembled */ 14736366Ssklower }; 14836366Ssklower 14936366Ssklower /* 15036366Ssklower * The following structure is used to index into an options section 15136366Ssklower * of a clnp datagram. These values can be used without worry that 15236366Ssklower * offset or length fields are invalid or too big, etc. That is, 15336366Ssklower * the consistancy of the options will be guaranteed before this 15436366Ssklower * structure is filled in. Any pointer (field ending in p) is 15536366Ssklower * actually the offset from the beginning of the mbuf the option 15636366Ssklower * is contained in. A value of NULL for any pointer 15736366Ssklower * means that the option is not present. The length any option 15836366Ssklower * does not include the option code or option length fields. 15936366Ssklower */ 16036366Ssklower struct clnp_optidx { 16136366Ssklower u_short cni_securep; /* ptr to beginning of security option */ 16236366Ssklower char cni_secure_len; /* length of entire security option */ 16336366Ssklower 16436366Ssklower u_short cni_srcrt_s; /* offset of start of src rt option */ 16536366Ssklower u_short cni_srcrt_len; /* length of entire src rt option */ 16636366Ssklower 16736366Ssklower u_short cni_recrtp; /* ptr to beginning of recrt option */ 16836366Ssklower char cni_recrt_len; /* length of entire recrt option */ 16936366Ssklower 17036366Ssklower char cni_priorp; /* ptr to priority option */ 17136366Ssklower 17236366Ssklower u_short cni_qos_formatp; /* ptr to format of qos option */ 17336366Ssklower char cni_qos_len; /* length of entire qos option */ 17436366Ssklower 17536366Ssklower u_char cni_er_reason; /* reason from ER pdu option */ 17637469Ssklower 17737469Ssklower /* ESIS options */ 17837469Ssklower 17937469Ssklower u_short cni_esct; /* value from ISH ESCT option */ 18037469Ssklower 18137469Ssklower u_short cni_netmaskp; /* ptr to beginning of netmask option */ 18237469Ssklower char cni_netmask_len; /* length of entire netmask option */ 18337469Ssklower 18437469Ssklower u_short cni_snpamaskp; /* ptr to beginning of snpamask option */ 18537469Ssklower char cni_snpamask_len; /* length of entire snpamask option */ 18637469Ssklower 18736366Ssklower }; 18836366Ssklower 18936366Ssklower #define ER_INVALREAS 0xff /* code for invalid ER pdu discard reason */ 19036366Ssklower 19136762Ssklower /* given an mbuf and addr of option, return offset from data of mbuf */ 19236762Ssklower #define CLNP_OPTTOOFF(m, opt)\ 19337469Ssklower ((u_short) (opt - mtod(m, caddr_t))) 19436762Ssklower 19536762Ssklower /* given an mbuf and offset of option, return address of option */ 19636762Ssklower #define CLNP_OFFTOOPT(m, off)\ 19736762Ssklower ((caddr_t) (mtod(m, caddr_t) + off)) 19836762Ssklower 19936366Ssklower /* return true iff src route is valid */ 20036366Ssklower #define CLNPSRCRT_VALID(oidx)\ 20136366Ssklower ((oidx) && (oidx->cni_srcrt_s)) 20236366Ssklower 20336366Ssklower /* return the offset field of the src rt */ 20436366Ssklower #define CLNPSRCRT_OFF(oidx, options)\ 20536762Ssklower (*((u_char *)(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + 1))) 20636366Ssklower 20736366Ssklower /* return the type field of the src rt */ 20836366Ssklower #define CLNPSRCRT_TYPE(oidx, options)\ 20936762Ssklower ((u_char)(*(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s)))) 21036366Ssklower 21136366Ssklower /* return the length of the current address */ 21236366Ssklower #define CLNPSRCRT_CLEN(oidx, options)\ 21336762Ssklower ((u_char)(*(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + CLNPSRCRT_OFF(oidx, options) - 1))) 21436366Ssklower 21536366Ssklower /* return the address of the current address */ 21636366Ssklower #define CLNPSRCRT_CADDR(oidx, options)\ 21736762Ssklower ((caddr_t)(CLNP_OFFTOOPT(options, oidx->cni_srcrt_s) + CLNPSRCRT_OFF(oidx, options))) 21836366Ssklower 21936366Ssklower /* 22036366Ssklower * return true if the src route has run out of routes 22136366Ssklower * this is true if the offset of next route is greater than the end of the rt 22236366Ssklower */ 22336366Ssklower #define CLNPSRCRT_TERM(oidx, options)\ 22436366Ssklower (CLNPSRCRT_OFF(oidx, options) > oidx->cni_srcrt_len) 22536366Ssklower 22636366Ssklower /* 22736366Ssklower * Options a user can set/get 22836366Ssklower */ 22936366Ssklower #define CLNPOPT_FLAGS 0x01 /* flags: seg permitted, no er xmit, etc */ 23036366Ssklower #define CLNPOPT_OPTS 0x02 /* datagram options */ 23136366Ssklower 23236366Ssklower /* 23336366Ssklower * Values for particular datagram options 23436366Ssklower */ 23536366Ssklower #define CLNPOVAL_PAD 0xcc /* padding */ 23636366Ssklower #define CLNPOVAL_SECURE 0xc5 /* security */ 23736366Ssklower #define CLNPOVAL_SRCRT 0xc8 /* source routing */ 23836366Ssklower #define CLNPOVAL_RECRT 0xcb /* record route */ 23936366Ssklower #define CLNPOVAL_QOS 0xc3 /* quality of service */ 24036366Ssklower #define CLNPOVAL_PRIOR 0xcd /* priority */ 24136366Ssklower #define CLNPOVAL_ERREAS 0xc1 /* ER PDU ONLY: reason for discard */ 24236366Ssklower 24336366Ssklower #define CLNPOVAL_SRCSPEC 0x40 /* source address specific */ 24436366Ssklower #define CLNPOVAL_DSTSPEC 0x80 /* destination address specific */ 24536366Ssklower #define CLNPOVAL_GLOBAL 0xc0 /* globally unique */ 24636366Ssklower 24736762Ssklower /* Globally Unique QOS */ 24836762Ssklower #define CLNPOVAL_SEQUENCING 0x10 /* sequencing preferred */ 24936762Ssklower #define CLNPOVAL_CONGESTED 0x08 /* congestion experienced */ 25036762Ssklower #define CLNPOVAL_LOWDELAY 0x04 /* low transit delay */ 25136762Ssklower 25236366Ssklower #define CLNPOVAL_PARTRT 0x00 /* partial source routing */ 25336366Ssklower #define CLNPOVAL_COMPRT 0x01 /* complete source routing */ 25436366Ssklower 25536366Ssklower /* 25636366Ssklower * Clnp flags used in a control block flags field. 25736366Ssklower * NOTE: these must be out of the range of bits defined in ../net/raw_cb.h 25836366Ssklower */ 25936366Ssklower #define CLNP_NO_SEG 0x010 /* segmentation not permitted */ 26036366Ssklower #define CLNP_NO_ER 0x020 /* do not generate ERs */ 26136366Ssklower #define CLNP_SEND_RAW 0x080 /* send pkt as RAW DT rather than TP DT */ 26236366Ssklower #define CLNP_NO_CKSUM 0x100 /* don't use clnp checksum */ 26336366Ssklower #define CLNP_ECHO 0x200 /* fake echo function */ 26436366Ssklower #define CLNP_NOCACHE 0x400 /* don't store cache information */ 26536366Ssklower 26636366Ssklower /* valid clnp flags */ 26736366Ssklower #define CLNP_VFLAGS (CLNP_SEND_RAW|CLNP_NO_SEG|CLNP_NO_ER|CLNP_NO_CKSUM\ 26836366Ssklower |CLNP_ECHO|CLNP_NOCACHE) 26936366Ssklower 27036366Ssklower /* 27136366Ssklower * Constants used by clnp 27236366Ssklower */ 27336366Ssklower #define CLNP_HDR_MIN (sizeof (struct clnp_fixed)) 27436366Ssklower #define CLNP_HDR_MAX (254) 27536366Ssklower #define CLNP_TTL_UNITS 2 /* 500 milliseconds */ 27636366Ssklower #define CLNP_TTL 15*CLNP_TTL_UNITS /* time to live (seconds) */ 27736366Ssklower #define ISO8473_V1 0x01 27836366Ssklower 27936366Ssklower /* 28036366Ssklower * Clnp packet types 28136366Ssklower * In order to test raw clnp and tp/clnp simultaneously, a third type of 28236366Ssklower * packet has been defined: CLNP_RAW. This is done so that the input 28336366Ssklower * routine can switch to the correct input routine (rclnp_input or 28436366Ssklower * tpclnp_input) based on the type field. If clnp had a higher level protocol 28536366Ssklower * field, this would not be necessary. 28636366Ssklower */ 28736366Ssklower #define CLNP_DT 0x1C /* normal data */ 28836366Ssklower #define CLNP_ER 0x01 /* error report */ 28936366Ssklower #define CLNP_RAW 0x1D /* debug only */ 29036366Ssklower #define CLNP_EC 0x1E /* echo packet */ 29136366Ssklower #define CLNP_ECR 0x1F /* echo reply */ 29236366Ssklower 29336366Ssklower /* 29436366Ssklower * ER pdu error codes 29536366Ssklower */ 29636366Ssklower #define GEN_NOREAS 0x00 /* reason not specified */ 29736366Ssklower #define GEN_PROTOERR 0x01 /* protocol procedure error */ 29836366Ssklower #define GEN_BADCSUM 0x02 /* incorrect checksum */ 29936366Ssklower #define GEN_CONGEST 0x03 /* pdu discarded due to congestion */ 30036366Ssklower #define GEN_HDRSYNTAX 0x04 /* header syntax error */ 30136366Ssklower #define GEN_SEGNEEDED 0x05 /* segmentation needed, but not permitted */ 30236366Ssklower #define GEN_INCOMPLETE 0x06 /* incomplete pdu received */ 30336366Ssklower #define GEN_DUPOPT 0x07 /* duplicate option */ 30436366Ssklower 30536366Ssklower /* address errors */ 30636366Ssklower #define ADDR_DESTUNREACH 0x80 /* destination address unreachable */ 30736366Ssklower #define ADDR_DESTUNKNOWN 0x81 /* destination address unknown */ 30836366Ssklower 30936366Ssklower /* source routing */ 31036366Ssklower #define SRCRT_UNSPECERR 0x90 /* unspecified src rt error */ 31136366Ssklower #define SRCRT_SYNTAX 0x91 /* syntax error in src rt field */ 31236366Ssklower #define SRCRT_UNKNOWNADDR 0x92 /* unknown addr in src rt field */ 31336366Ssklower #define SRCRT_BADPATH 0x93 /* path not acceptable */ 31436366Ssklower 31536366Ssklower /* lifetime */ 31636366Ssklower #define TTL_EXPTRANSIT 0xa0 /* lifetime expired during transit */ 31736366Ssklower #define TTL_EXPREASS 0xa1 /* lifetime expired during reassembly */ 31836366Ssklower 31936366Ssklower /* pdu discarded */ 32036366Ssklower #define DISC_UNSUPPOPT 0xb0 /* unsupported option not specified? */ 32136366Ssklower #define DISC_UNSUPPVERS 0xb1 /* unsupported protocol version */ 32236366Ssklower #define DISC_UNSUPPSECURE 0xb2 /* unsupported security option */ 32336366Ssklower #define DISC_UNSUPPSRCRT 0xb3 /* unsupported src rt option */ 32436366Ssklower #define DISC_UNSUPPRECRT 0xb4 /* unsupported rec rt option */ 32536366Ssklower 32636366Ssklower /* reassembly */ 32736366Ssklower #define REASS_INTERFERE 0xc0 /* reassembly interference */ 328*39194Ssklower #define CLNP_ERRORS 22 32936366Ssklower 330*39194Ssklower 331*39194Ssklower #ifdef KERNEL 332*39194Ssklower int clnp_er_index(); 333*39194Ssklower #endif 334*39194Ssklower 335*39194Ssklower #ifdef CLNP_ER_CODES 336*39194Ssklower u_char clnp_er_codes[CLNP_ERRORS] = { 337*39194Ssklower GEN_NOREAS, GEN_PROTOERR, GEN_BADCSUM, GEN_CONGEST, 338*39194Ssklower GEN_HDRSYNTAX, GEN_SEGNEEDED, GEN_INCOMPLETE, GEN_DUPOPT, 339*39194Ssklower ADDR_DESTUNREACH, ADDR_DESTUNKNOWN, 340*39194Ssklower SRCRT_UNSPECERR, SRCRT_SYNTAX, SRCRT_UNKNOWNADDR, SRCRT_BADPATH, 341*39194Ssklower TTL_EXPTRANSIT, TTL_EXPREASS, 342*39194Ssklower DISC_UNSUPPOPT, DISC_UNSUPPVERS, DISC_UNSUPPSECURE, 343*39194Ssklower DISC_UNSUPPSRCRT, DISC_UNSUPPRECRT, REASS_INTERFERE }; 344*39194Ssklower #endif 345*39194Ssklower 34636366Ssklower #ifdef TROLL 34736366Ssklower 34836366Ssklower #define TR_DUPEND 0x01 /* duplicate end of fragment */ 34936366Ssklower #define TR_DUPPKT 0x02 /* duplicate entire packet */ 35036366Ssklower #define TR_DROPPKT 0x04 /* drop packet on output */ 35136366Ssklower #define TR_TRIM 0x08 /* trim bytes from packet */ 35236366Ssklower #define TR_CHANGE 0x10 /* change bytes in packet */ 35336366Ssklower #define TR_MTU 0x20 /* delta to change device mtu */ 35436366Ssklower #define TR_CHUCK 0x40 /* drop packet in rclnp_input */ 35536366Ssklower #define TR_BLAST 0x80 /* force rclnp_output to blast many packet */ 35636366Ssklower #define TR_RAWLOOP 0x100 /* make if_loop call clnpintr directly */ 35736366Ssklower struct troll { 35836366Ssklower int tr_ops; /* operations to perform */ 35936366Ssklower float tr_dup_size; /* % to duplicate */ 36036366Ssklower float tr_dup_freq; /* frequency to duplicate packets */ 36136366Ssklower float tr_drop_freq; /* frequence to drop packets */ 36236366Ssklower int tr_mtu_adj; /* delta to adjust if mtu */ 36336366Ssklower int tr_blast_cnt; /* # of pkts to blast out */ 36436366Ssklower }; 36536366Ssklower 36636366Ssklower #define SN_OUTPUT(clcp, m)\ 36737469Ssklower troll_output(clcp->clc_ifa->ia_ifp, m, clcp->clc_firsthop) 36836366Ssklower 36936366Ssklower #define SN_MTU(ifp)\ 37036366Ssklower (ifp->if_mtu - trollctl.tr_mtu_adj) 37136366Ssklower 37237469Ssklower #ifdef KERNEL 37337469Ssklower extern float troll_random; 37437469Ssklower #endif 37537469Ssklower 37636366Ssklower #else /* NO TROLL */ 37736366Ssklower 37836366Ssklower #define SN_OUTPUT(clcp, m)\ 37937469Ssklower (*clcp->clc_ifa->ia_ifp->if_output)(clcp->clc_ifa->ia_ifp, m, clcp->clc_firsthop) 38036366Ssklower 38136366Ssklower #define SN_MTU(ifp)\ 38236366Ssklower (ifp->if_mtu) 38336366Ssklower 38436366Ssklower #endif TROLL 38536366Ssklower 38636366Ssklower /* 38736366Ssklower * Macro to remove an address from a clnp header 38836366Ssklower */ 38936366Ssklower #define CLNP_EXTRACT_ADDR(isoa, hoff, hend)\ 39036366Ssklower {\ 39136366Ssklower isoa.isoa_len = (u_char)*hoff;\ 39236366Ssklower if ((((++hoff) + isoa.isoa_len) > hend) ||\ 39336366Ssklower (isoa.isoa_len > 20) || (isoa.isoa_len == 0)) {\ 39436366Ssklower hoff = (caddr_t)0;\ 39536366Ssklower } else {\ 39637469Ssklower (void) bcopy(hoff, (caddr_t)isoa.isoa_genaddr, isoa.isoa_len);\ 39736366Ssklower hoff += isoa.isoa_len;\ 39836366Ssklower }\ 39936366Ssklower } 40036366Ssklower 40136366Ssklower /* 40236366Ssklower * Macro to insert an address into a clnp header 40336366Ssklower */ 40437469Ssklower #define CLNP_INSERT_ADDR(hoff, isoa)\ 40537469Ssklower *hoff++ = (isoa).isoa_len;\ 40637469Ssklower (void) bcopy((caddr_t)((isoa).isoa_genaddr), hoff, (isoa).isoa_len);\ 40737469Ssklower hoff += (isoa).isoa_len; 40836366Ssklower 40936366Ssklower /* 41036366Ssklower * Clnp hdr cache. Whenever a clnp packet is sent, a copy of the 41136366Ssklower * header is made and kept in this cache. In addition to a copy of 41236366Ssklower * the cached clnp hdr, the cache contains 41336366Ssklower * information necessary to determine whether the new packet 41436366Ssklower * to send requires a new header to be built. 41536366Ssklower */ 41636366Ssklower struct clnp_cache { 41736366Ssklower /* these fields are used to check the validity of the cache */ 41836366Ssklower struct iso_addr clc_dst; /* destination of packet */ 41936366Ssklower struct mbuf *clc_options; /* ptr to options mbuf */ 42036366Ssklower int clc_flags; /* flags passed to clnp_output */ 42136366Ssklower 42236366Ssklower /* these fields are state that clnp_output requires to finish the pkt */ 42336366Ssklower int clc_segoff; /* offset of seg part of header */ 42436366Ssklower struct sockaddr *clc_firsthop; /* first hop of packet (points into 42536366Ssklower the route structure) */ 42637469Ssklower struct iso_ifaddr *clc_ifa; /* ptr to interface (points into 42736366Ssklower the route structure) */ 42836366Ssklower struct mbuf *clc_hdr; /* cached pkt hdr (finally)! */ 42936366Ssklower }; 43036366Ssklower 43136366Ssklower #ifndef satosiso 43236366Ssklower #define satosiso(sa)\ 43336366Ssklower ((struct sockaddr_iso *)(sa)) 43436366Ssklower #endif 43536366Ssklower 43636366Ssklower #ifdef KERNEL 43736366Ssklower caddr_t clnp_insert_addr(); 43836366Ssklower struct iso_addr *clnp_srcaddr(); 43936366Ssklower struct mbuf *clnp_reass(); 44036366Ssklower #ifdef TROLL 44136366Ssklower struct troll trollctl; 44236366Ssklower #endif TROLL 44336366Ssklower #endif KERNEL 444