]> git.saurik.com Git - apple/xnu.git/blame - bsd/netccitt/x25.h
xnu-123.5.tar.gz
[apple/xnu.git] / bsd / netccitt / x25.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Copyright (c) University of British Columbia, 1984
24 * Copyright (c) 1990, 1992, 1993
25 * The Regents of the University of California. All rights reserved.
26 * University of Erlangen-Nuremberg, Germany, 1992
27 *
28 * This code is derived from software contributed to Berkeley by the
29 * Laboratory for Computation Vision and the Computer Science Department
30 * of the the University of British Columbia and the Computer Science
31 * Department (IV) of the University of Erlangen-Nuremberg, Germany.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)x25.h 8.1 (Berkeley) 6/10/93
62 */
63
64#ifdef KERNEL
65#define PRC_IFUP 3
66#define PRC_LINKUP 4
67#define PRC_LINKDOWN 5
68#define PRC_LINKRESET 6
69#define PRC_LINKDONTCOPY 7
70#ifndef PRC_DISCONNECT_REQUEST
71#define PRC_DISCONNECT_REQUEST 10
72#endif
73#endif
74
75#define CCITTPROTO_HDLC 1
76#define CCITTPROTO_X25 2 /* packet level protocol */
77#define IEEEPROTO_802LLC 3 /* doesn't belong here */
78
79#define HDLCPROTO_LAP 1
80#define HDLCPROTO_LAPB 2
81#define HDLCPROTO_UNSET 3
82#define HDLCPROTO_LAPD 4
83
84/* socket options */
85#define PK_ACCTFILE 1 /* use level = CCITTPROTO_X25 */
86#define PK_FACILITIES 2 /* use level = CCITTPROTO_X25 */
87#define PK_RTATTACH 3 /* use level = CCITTPROTO_X25 */
88#define PK_PRLISTEN 4 /* use level = CCITTPROTO_X25 */
89
90#define MAX_FACILITIES 109 /* maximum size for facilities */
91
92/*
93 * X.25 Socket address structure. It contains the X.121 or variation of
94 * X.121, facilities information, higher level protocol value (first four
95 * bytes of the User Data field), and the last 12 characters of the User
96 * Data field.
97 */
98
99struct x25_sockaddr { /* obsolete - use sockaddr_x25 */
100 short xaddr_len; /* Length of xaddr_addr. */
101 u_char xaddr_addr[15]; /* Network dependent or X.121 address. */
102 u_char xaddr_facilities; /* Facilities information. */
103#define XS_REVERSE_CHARGE 0x01
104#define XS_HIPRIO 0x02
105 u_char xaddr_proto[4]; /* Protocol ID (4 bytes of user data). */
106 u_char xaddr_userdata[12]; /* Remaining User data field. */
107};
108
109/*
110 * X.25 Socket address structure. It contains the network id, X.121
111 * address, facilities information, higher level protocol value (first four
112 * bytes of the User Data field), and up to 12 characters of User Data.
113 */
114
115struct sockaddr_x25 {
116 u_char x25_len;
117 u_char x25_family; /* must be AF_CCITT */
118 short x25_net; /* network id code (usually a dnic) */
119 char x25_addr[16]; /* X.121 address (null terminated) */
120 struct x25opts {
121 char op_flags; /* miscellaneous options */
122 /* pk_var.h defines other lcd_flags */
123#define X25_REVERSE_CHARGE 0x01 /* remote DTE pays for call */
124#define X25_DBIT 0x02 /* not yet supported */
125#define X25_MQBIT 0x04 /* prepend M&Q bit status byte to packet data */
126#define X25_OLDSOCKADDR 0x08 /* uses old sockaddr structure */
127#define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */
128#define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */
129#define X25_MBS_HOLD 0x40 /* lcd_flag: collect m-bit sequences */
130 char op_psize; /* requested packet size */
131#define X25_PS128 7
132#define X25_PS256 8
133#define X25_PS512 9
134 char op_wsize; /* window size (1 .. 7) */
135 char op_speed; /* throughput class */
136 } x25_opts;
137 short x25_udlen; /* user data field length */
138 char x25_udata[16]; /* user data field */
139};
140
141/*
142 * network configuration info
143 * this structure must be 16 bytes long
144 */
145
146struct x25config {
147 struct sockaddr_x25 xc_addr;
148 /* link level parameters */
149 u_short xc_lproto:4, /* link level protocol eg. CCITTPROTO_HDLC */
150 xc_lptype:4, /* protocol type eg. HDLCPROTO_LAPB */
151 xc_ltrace:1, /* link level tracing flag */
152 xc_lwsize:7; /* link level window size */
153 u_short xc_lxidxchg:1, /* link level XID exchange flag - NOT YET */
154 /* packet level parameters */
155 xc_rsvd1:2,
156 xc_pwsize:3, /* default window size */
157 xc_psize:4, /* default packet size 7=128, 8=256, ... */
158 xc_type:3, /* network type */
159#define X25_1976 0
160#define X25_1980 1
161#define X25_1984 2
162#define X25_DDN 3
163#define X25_BASIC 4
164 xc_ptrace:1, /* packet level tracing flag */
165 xc_nodnic:1, /* remove our dnic when calling on net */
166 xc_prepnd0:1; /* prepend 0 when making offnet calls */
167 u_short xc_maxlcn; /* max logical channels */
168 u_short xc_dg_idletimo; /* timeout for idle datagram circuits. */
169};
170
171#ifdef IFNAMSIZ
172struct ifreq_x25 {
173 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
174 struct x25config ifr_xc;
175};
176#define SIOCSIFCONF_X25 _IOW('i', 12, struct ifreq_x25) /* set ifnet config */
177#define SIOCGIFCONF_X25 _IOWR('i',13, struct ifreq_x25) /* get ifnet config */
178#endif