clnp.h 20 KB

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