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