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