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 * %sccs.include.redist.c% 11 * 12 * @(#)x25.h 7.5 (Berkeley) 11/13/90 13 */ 14 15 #ifdef KERNEL 16 #define PRC_IFUP 3 17 #define PRC_LINKUP 4 18 #define PRC_LINKDOWN 5 19 #define PRC_LINKRESET 6 20 #define PRC_LINKDONTCOPY 7 21 #endif 22 23 #define CCITTPROTO_HDLC 1 24 #define CCITTPROTO_X25 2 /* packet level protocol */ 25 #define IEEEPROTO_802LLC 3 /* doesn't belong here */ 26 27 #define HDLCPROTO_LAP 1 28 #define HDLCPROTO_LAPB 2 29 #define HDLCPROTO_UNSET 3 30 #define HDLCPROTO_LAPD 4 31 32 /* socket options */ 33 #define PK_ACCTFILE 1 /* use level = CCITTPROTO_X25 */ 34 #define PK_FACILITIES 2 /* use level = CCITTPROTO_X25 */ 35 36 /* 37 * X.25 Socket address structure. It contains the X.121 or variation of 38 * X.121, facilities information, higher level protocol value (first four 39 * bytes of the User Data field), and the last 12 characters of the User 40 * Data field. 41 */ 42 43 struct x25_sockaddr { /* obsolete - use sockaddr_x25 */ 44 short xaddr_len; /* Length of xaddr_addr. */ 45 u_char xaddr_addr[15]; /* Network dependent or X.121 address. */ 46 u_char xaddr_facilities; /* Facilities information. */ 47 #define XS_REVERSE_CHARGE 0x01 48 #define XS_HIPRIO 0x02 49 u_char xaddr_proto[4]; /* Protocol ID (4 bytes of user data). */ 50 u_char xaddr_userdata[12]; /* Remaining User data field. */ 51 }; 52 53 /* 54 * X.25 Socket address structure. It contains the network id, X.121 55 * address, facilities information, higher level protocol value (first four 56 * bytes of the User Data field), and up to 12 characters of User Data. 57 */ 58 59 struct sockaddr_x25 { 60 u_char x25_len; 61 u_char x25_family; /* must be AF_CCITT */ 62 short x25_net; /* network id code (usually a dnic) */ 63 char x25_addr[16]; /* X.121 address (null terminated) */ 64 struct x25opts { 65 char op_flags; /* miscellaneous options */ 66 /* pk_var.h defines other lcd_flags */ 67 #define X25_REVERSE_CHARGE 0x01 /* remote DTE pays for call */ 68 #define X25_DBIT 0x02 /* not yet supported */ 69 #define X25_MQBIT 0x04 /* prepend M&Q bit status byte to packet data */ 70 #define X25_OLDSOCKADDR 0x08 /* uses old sockaddr structure */ 71 char op_psize; /* requested packet size */ 72 #define X25_PS128 7 73 #define X25_PS256 8 74 #define X25_PS512 9 75 char op_wsize; /* window size (1 .. 7) */ 76 char op_speed; /* throughput class */ 77 } x25_opts; 78 short x25_udlen; /* user data field length */ 79 char x25_udata[16]; /* user data field */ 80 }; 81 82 /* 83 * network configuration info 84 * this structure must be 16 bytes long 85 */ 86 87 struct x25config { 88 struct sockaddr_x25 xc_addr; 89 /* link level parameters */ 90 u_short xc_lproto:4, /* link level protocol eg. CCITTPROTO_HDLC */ 91 xc_lptype:4, /* protocol type eg. HDLCPROTO_LAPB */ 92 xc_lwsize:5, /* link level window size */ 93 xc_ltrace:1, /* link level tracing flag */ 94 xc_rsvd1:2; /* for use by other link-level protocols */ 95 /* packet level parameters */ 96 u_short xc_pwsize:3, /* default window size */ 97 xc_psize:4, /* default packet size 7=128, 8=256, ... */ 98 xc_type:3, /* network type */ 99 #define X25_1976 0 100 #define X25_1980 1 101 #define X25_1984 2 102 #define X25_DDN 3 103 #define X25_BASIC 4 104 xc_ptrace:1, /* packet level tracing flag */ 105 xc_rsvd2:5; 106 u_short xc_maxlcn; /* max logical channels */ 107 u_short xc_dg_idletimo; /* timeout for idle datagram circuits. */ 108 }; 109 110 #ifdef IFNAMSIZ 111 struct ifreq_x25 { 112 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 113 struct x25config ifr_xc; 114 }; 115 #define SIOCSIFCONF_X25 _IOW('i', 12, struct ifreq_x25) /* set ifnet config */ 116 #define SIOCGIFCONF_X25 _IOWR('i',13, struct ifreq_x25) /* get ifnet config */ 117 #endif 118