New upstream release and new maintainer
[quagga-debian.git] / isisd / include-netbsd / esis.h
1 /*      $NetBSD: esis.h,v 1.11 1997/11/03 15:01:19 is Exp $     */\r
2 \r
3 /*-\r
4  * Copyright (c) 1991, 1993\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  *      @(#)esis.h      8.1 (Berkeley) 6/10/93\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 #include <machine/endian.h>\r
66 \r
67 #define SNPAC_AGE               60      /* seconds */\r
68 #define ESIS_CONFIG             60      /* seconds */\r
69 #define ESIS_HT                 (ESIS_CONFIG * 2)\r
70 \r
71 /*\r
72  *      Fixed part of an ESIS header\r
73  */\r
74 struct esis_fixed {\r
75         u_char          esis_proto_id;  /* network layer protocol identifier */\r
76         u_char          esis_hdr_len;   /* length indicator (octets) */\r
77         u_char          esis_vers;      /* version/protocol identifier\r
78                                          * extension */\r
79         u_char          esis_res1;      /* reserved */\r
80         u_char          esis_type;      /* type code */\r
81         /* technically, type should be &='d 0x1f */\r
82 #define ESIS_ESH        0x02    /* End System Hello */\r
83 #define ESIS_ISH        0x04    /* Intermediate System Hello */\r
84 #define ESIS_RD         0x06    /* Redirect */\r
85         u_char          esis_ht_msb;    /* holding time (seconds) high byte */\r
86         u_char          esis_ht_lsb;    /* holding time (seconds) low byte */\r
87         u_char          esis_cksum_msb; /* checksum high byte */\r
88         u_char          esis_cksum_lsb; /* checksum low byte */\r
89 } __attribute__((packed));\r
90 /*\r
91  * Values for ESIS datagram options\r
92  */\r
93 #define ESISOVAL_NETMASK        0xe1    /* address mask option, RD PDU only */\r
94 #define ESISOVAL_SNPAMASK       0xe2    /* snpa mask option, RD PDU only */\r
95 #define ESISOVAL_ESCT           0xc6    /* end system conf. timer, ISH PDU\r
96                                          * only */\r
97 \r
98 \r
99 #define ESIS_CKSUM_OFF          0x07\r
100 #define ESIS_CKSUM_REQUIRED(pdu)\\r
101         ((pdu->esis_cksum_msb != 0) || (pdu->esis_cksum_lsb != 0))\r
102 \r
103 #define ESIS_VERSION    1\r
104 \r
105 struct esis_stat {\r
106         u_short         es_nomem;       /* insufficient memory to send hello */\r
107         u_short         es_badcsum;     /* incorrect checksum */\r
108         u_short         es_badvers;     /* incorrect version number */\r
109         u_short         es_badtype;     /* unknown pdu type field */\r
110         u_short         es_toosmall;    /* packet too small */\r
111         u_short         es_eshsent;     /* ESH sent */\r
112         u_short         es_eshrcvd;     /* ESH rcvd */\r
113         u_short         es_ishsent;     /* ISH sent */\r
114         u_short         es_ishrcvd;     /* ISH rcvd */\r
115         u_short         es_rdsent;      /* RD sent */\r
116         u_short         es_rdrcvd;      /* RD rcvd */\r
117 };\r
118 \r
119 #ifdef  _KERNEL\r
120 struct esis_stat esis_stat;\r
121 struct socket;\r
122 struct mbuf;\r
123 struct snpa_hdr;\r
124 struct clnp_optidx;\r
125 struct iso_addr;\r
126 struct rtentry;\r
127 struct sockaddr_dl;\r
128 \r
129 void esis_init __P((void));\r
130 int esis_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,\r
131                      struct mbuf *, struct proc *));\r
132 void esis_input __P((struct mbuf *, ...));\r
133 void esis_rdoutput __P((struct snpa_hdr *, struct mbuf *, struct clnp_optidx *,\r
134                         struct iso_addr *, struct rtentry *));\r
135 int esis_insert_addr __P((caddr_t *, int *, struct iso_addr *, struct mbuf *,\r
136                           int));\r
137 void esis_eshinput __P((struct mbuf *, struct snpa_hdr *));\r
138 void esis_ishinput __P((struct mbuf *, struct snpa_hdr *));\r
139 void esis_rdinput __P((struct mbuf *, struct snpa_hdr *));\r
140 void esis_config __P((void *));\r
141 void esis_shoutput __P((struct ifnet *, int, int, caddr_t, int,\r
142                        struct iso_addr *));\r
143 void isis_input __P((struct mbuf *, ...));\r
144 int isis_output __P((struct mbuf *, ...));\r
145 void *esis_ctlinput __P((int, struct sockaddr *, void *));\r
146 #endif /* _KERNEL */\r