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.8 (Berkeley) 05/29/91 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 #define PK_RTATTACH 3 /* use level = CCITTPROTO_X25 */ 36 #define PK_PRLISTEN 4 /* use level = CCITTPROTO_X25 */ 37 38 #define MAX_FACILITIES 109 /* maximum size for facilities */ 39 40 /* 41 * X.25 Socket address structure. It contains the X.121 or variation of 42 * X.121, facilities information, higher level protocol value (first four 43 * bytes of the User Data field), and the last 12 characters of the User 44 * Data field. 45 */ 46 47 struct x25_sockaddr { /* obsolete - use sockaddr_x25 */ 48 short xaddr_len; /* Length of xaddr_addr. */ 49 u_char xaddr_addr[15]; /* Network dependent or X.121 address. */ 50 u_char xaddr_facilities; /* Facilities information. */ 51 #define XS_REVERSE_CHARGE 0x01 52 #define XS_HIPRIO 0x02 53 u_char xaddr_proto[4]; /* Protocol ID (4 bytes of user data). */ 54 u_char xaddr_userdata[12]; /* Remaining User data field. */ 55 }; 56 57 /* 58 * X.25 Socket address structure. It contains the network id, X.121 59 * address, facilities information, higher level protocol value (first four 60 * bytes of the User Data field), and up to 12 characters of User Data. 61 */ 62 63 struct sockaddr_x25 { 64 u_char x25_len; 65 u_char x25_family; /* must be AF_CCITT */ 66 short x25_net; /* network id code (usually a dnic) */ 67 char x25_addr[16]; /* X.121 address (null terminated) */ 68 struct x25opts { 69 char op_flags; /* miscellaneous options */ 70 /* pk_var.h defines other lcd_flags */ 71 #define X25_REVERSE_CHARGE 0x01 /* remote DTE pays for call */ 72 #define X25_DBIT 0x02 /* not yet supported */ 73 #define X25_MQBIT 0x04 /* prepend M&Q bit status byte to packet data */ 74 #define X25_OLDSOCKADDR 0x08 /* uses old sockaddr structure */ 75 #define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */ 76 #define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */ 77 #define X25_MBS_HOLD 0x40 /* lcd_flag: collect m-bit sequences */ 78 char op_psize; /* requested packet size */ 79 #define X25_PS128 7 80 #define X25_PS256 8 81 #define X25_PS512 9 82 char op_wsize; /* window size (1 .. 7) */ 83 char op_speed; /* throughput class */ 84 } x25_opts; 85 short x25_udlen; /* user data field length */ 86 char x25_udata[16]; /* user data field */ 87 }; 88 89 /* 90 * network configuration info 91 * this structure must be 16 bytes long 92 */ 93 94 struct x25config { 95 struct sockaddr_x25 xc_addr; 96 /* link level parameters */ 97 u_short xc_lproto:4, /* link level protocol eg. CCITTPROTO_HDLC */ 98 xc_lptype:4, /* protocol type eg. HDLCPROTO_LAPB */ 99 xc_lwsize:5, /* link level window size */ 100 xc_ltrace:1, /* link level tracing flag */ 101 xc_rsvd1:2; /* for use by other link-level protocols */ 102 /* packet level parameters */ 103 u_short xc_pwsize:3, /* default window size */ 104 xc_psize:4, /* default packet size 7=128, 8=256, ... */ 105 xc_type:3, /* network type */ 106 #define X25_1976 0 107 #define X25_1980 1 108 #define X25_1984 2 109 #define X25_DDN 3 110 #define X25_BASIC 4 111 xc_ptrace:1, /* packet level tracing flag */ 112 xc_nodnic:1, /* remove our dnic when calling on net */ 113 xc_prepnd0:1, /* prepend 0 when making offnet calls */ 114 xc_rsvd2:3; 115 u_short xc_maxlcn; /* max logical channels */ 116 u_short xc_dg_idletimo; /* timeout for idle datagram circuits. */ 117 }; 118 119 #ifdef IFNAMSIZ 120 struct ifreq_x25 { 121 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 122 struct x25config ifr_xc; 123 }; 124 #define SIOCSIFCONF_X25 _IOW('i', 12, struct ifreq_x25) /* set ifnet config */ 125 #define SIOCGIFCONF_X25 _IOWR('i',13, struct ifreq_x25) /* get ifnet config */ 126 #endif 127