FreeBSD/Linux Kernel Cross Reference
sys/netccitt/x25.h
1 /* $NetBSD: x25.h,v 1.12 2003/08/07 16:33:06 agc Exp $ */
2
3 /*
4 * Copyright (c) 1990, 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by the
8 * Laboratory for Computation Vision and the Computer Science Department
9 * of the University of British Columbia and the Computer Science
10 * Department (IV) of the University of Erlangen-Nuremberg, Germany.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)x25.h 8.1 (Berkeley) 6/10/93
37 */
38
39 /*
40 * Copyright (c) 1984 University of British Columbia.
41 * Copyright (c) 1992 Computer Science Department IV,
42 * University of Erlangen-Nuremberg, Germany.
43 *
44 * This code is derived from software contributed to Berkeley by the
45 * Laboratory for Computation Vision and the Computer Science Department
46 * of the University of British Columbia and the Computer Science
47 * Department (IV) of the University of Erlangen-Nuremberg, Germany.
48 *
49 * Redistribution and use in source and binary forms, with or without
50 * modification, are permitted provided that the following conditions
51 * are met:
52 * 1. Redistributions of source code must retain the above copyright
53 * notice, this list of conditions and the following disclaimer.
54 * 2. Redistributions in binary form must reproduce the above copyright
55 * notice, this list of conditions and the following disclaimer in the
56 * documentation and/or other materials provided with the distribution.
57 * 3. All advertising materials mentioning features or use of this software
58 * must display the following acknowledgement:
59 * This product includes software developed by the University of
60 * California, Berkeley and its contributors.
61 * 4. Neither the name of the University nor the names of its contributors
62 * may be used to endorse or promote products derived from this software
63 * without specific prior written permission.
64 *
65 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
66 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
67 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
68 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
69 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
70 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
71 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
72 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
73 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
74 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
75 * SUCH DAMAGE.
76 *
77 * @(#)x25.h 8.1 (Berkeley) 6/10/93
78 */
79
80 #ifndef _NETCCITT_X25_H_
81 #define _NETCCITT_X25_H_
82
83 #ifdef _KERNEL
84 #define PRC_IFUP 3
85 #define PRC_LINKUP 4
86 #define PRC_LINKDOWN 5
87 #define PRC_LINKRESET 6
88 #define PRC_LINKDONTCOPY 7
89 #ifndef PRC_DISCONNECT_REQUEST
90 #define PRC_DISCONNECT_REQUEST 10
91 #endif
92 #endif
93
94 #define CCITTPROTO_HDLC 1
95 #define CCITTPROTO_X25 2 /* packet level protocol */
96 #define IEEEPROTO_802LLC 3 /* doesn't belong here */
97
98 #define HDLCPROTO_LAP 1
99 #define HDLCPROTO_LAPB 2
100 #define HDLCPROTO_UNSET 3
101 #define HDLCPROTO_LAPD 4
102
103 /* socket options */
104 #define PK_ACCTFILE 1 /* use level = CCITTPROTO_X25 */
105 #define PK_FACILITIES 2 /* use level = CCITTPROTO_X25 */
106 #define PK_RTATTACH 3 /* use level = CCITTPROTO_X25 */
107 #define PK_PRLISTEN 4 /* use level = CCITTPROTO_X25 */
108
109 #define MAX_FACILITIES 109 /* maximum size for facilities */
110
111 /*
112 * X.25 Socket address structure. It contains the X.121 or variation of
113 * X.121, facilities information, higher level protocol value (first four
114 * bytes of the User Data field), and the last 12 characters of the User
115 * Data field.
116 */
117
118 struct x25_sockaddr { /* obsolete - use sockaddr_x25 */
119 short xaddr_len; /* Length of xaddr_addr. */
120 u_char xaddr_addr[15]; /* Network dependent or X.121 address. */
121 u_char xaddr_facilities; /* Facilities information. */
122 #define XS_REVERSE_CHARGE 0x01
123 #define XS_HIPRIO 0x02
124 u_char xaddr_proto[4]; /* Protocol ID (4 bytes of user data). */
125 u_char xaddr_userdata[12]; /* Remaining User data field. */
126 };
127
128 /*
129 * X.25 Socket address structure. It contains the network id, X.121
130 * address, facilities information, higher level protocol value (first four
131 * bytes of the User Data field), and up to 12 characters of User Data.
132 */
133
134 struct sockaddr_x25 {
135 u_char x25_len;
136 u_char x25_family; /* must be AF_CCITT */
137 short x25_net; /* network id code (usually a dnic) */
138 char x25_addr[16]; /* X.121 address (null terminated) */
139 struct x25opts {
140 char op_flags; /* miscellaneous options */
141 /* pk_var.h defines other lcd_flags */
142 #define X25_REVERSE_CHARGE 0x01 /* remote DTE pays for call */
143 #define X25_DBIT 0x02 /* not yet supported */
144 #define X25_MQBIT 0x04 /* prepend M&Q bit status byte to packet data */
145 #define X25_OLDSOCKADDR 0x08 /* uses old sockaddr structure */
146 #define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */
147 #define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */
148 #define X25_MBS_HOLD 0x40 /* lcd_flag: collect m-bit sequences */
149 char op_psize; /* requested packet size */
150 #define X25_PS128 7
151 #define X25_PS256 8
152 #define X25_PS512 9
153 char op_wsize; /* window size (1 .. 7) */
154 char op_speed; /* throughput class */
155 } x25_opts;
156 short x25_udlen; /* user data field length */
157 char x25_udata[16]; /* user data field */
158 };
159
160 /*
161 * network configuration info
162 * this structure must be 16 bytes long
163 */
164
165 struct x25config {
166 struct sockaddr_x25 xc_addr;
167 /* link level parameters */
168 u_short xc_lproto:4, /* link level protocol eg. CCITTPROTO_HDLC */
169 xc_lptype:4, /* protocol type eg. HDLCPROTO_LAPB */
170 xc_ltrace:1, /* link level tracing flag */
171 xc_lwsize:7; /* link level window size */
172 u_short xc_lxidxchg:1, /* link level XID exchange flag - NOT YET */
173 /* packet level parameters */
174 xc_rsvd1:2,
175 xc_pwsize:3, /* default window size */
176 xc_psize:4, /* default packet size 7=128, 8=256, ... */
177 xc_type:3, /* network type */
178 #define X25_1976 0
179 #define X25_1980 1
180 #define X25_1984 2
181 #define X25_DDN 3
182 #define X25_BASIC 4
183 xc_ptrace:1, /* packet level tracing flag */
184 xc_nodnic:1, /* remove our dnic when calling on net */
185 xc_prepnd0:1; /* prepend 0 when making offnet calls */
186 u_short xc_maxlcn; /* max logical channels */
187 u_short xc_dg_idletimo; /* timeout for idle datagram circuits. */
188 };
189
190 #ifdef IFNAMSIZ
191 struct ifreq_x25 {
192 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
193 struct x25config ifr_xc;
194 };
195 #define SIOCSIFCONF_X25 _IOW('i', 12, struct ifreq_x25) /* set ifnet config */
196 #define SIOCGIFCONF_X25 _IOWR('i',13, struct ifreq_x25) /* get ifnet config */
197 #endif
198
199 #ifdef _KERNEL
200 struct llinfo_x25;
201 struct pklcd;
202 struct sockaddr_in;
203 struct x25_ifaddr;
204 struct ifnet;
205 struct rtentry;
206 struct rt_addrinfo;
207
208 void x25_lxfree __P((struct llinfo_x25 *));
209 int x25_ifinput __P((struct mbuf *, void *));
210 int x25_connect_callback __P((struct mbuf *, void *));
211 int x25_dgram_incoming __P((struct mbuf *, void *));
212 int x25_ifoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *));
213 void x25_iftimeout __P((struct ifnet *));
214 void x25_rtrequest __P((int , struct rtentry *, struct rt_addrinfo *));
215 void x25_rtinvert __P((int , struct sockaddr *, struct rtentry *));
216 void x25_ddnip_to_ccitt __P((struct sockaddr *, struct rtentry *));
217 void x25_dg_rtinit __P((struct sockaddr_x25 *, struct x25_ifaddr *, int ));
218 void pk_init __P((void));
219 int pk_user_protolisten __P((u_char *));
220 int pk_rtattach __P((struct socket *, struct mbuf *));
221 int x25_rtattach __P((struct pklcd *, struct rtentry *));
222 #endif
223
224 #endif /* _NETCCITT_X25_H_ */
Cache object: 7774b2687b13c1e3c43ba8293c5c915d
|