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 * @(#)pk_var.h 7.7 (Berkeley) 10/04/90 13 */ 14 15 16 /* 17 * 18 * X.25 Logical Channel Descriptor 19 * 20 */ 21 22 struct pklcd { 23 int (*lcd_send)(); /* if X.25 front end, direct connect */ 24 int (*lcd_upper)(); /* switch to socket vs datagram vs ...*/ 25 caddr_t lcd_upnext; /* reference for lcd_upper() */ 26 short lcd_lcn; /* Logical channel number */ 27 short lcd_state; /* Logical Channel state */ 28 bool lcd_intrconf_pending; /* Interrupt confirmation pending */ 29 octet lcd_intrdata; /* Octet of incoming intr data */ 30 short lcd_timer; /* Various timer values */ 31 short lcd_dg_timer; /* to reclaim idle datagram circuits */ 32 char lcd_retry; /* Timer retry count */ 33 char lcd_rsn; /* Seq no of last received packet */ 34 char lcd_ssn; /* Seq no of next packet to send */ 35 char lcd_output_window; /* Output flow control window */ 36 char lcd_input_window; /* Input flow control window */ 37 char lcd_last_transmitted_pr;/* Last Pr value transmitted */ 38 bool lcd_rnr_condition; /* Remote in busy condition */ 39 bool lcd_window_condition; /* Output window size exceeded */ 40 bool lcd_reset_condition; /* True, if waiting reset confirm */ 41 char lcd_packetsize; /* Maximum packet size */ 42 char lcd_windowsize; /* Window size - both directions */ 43 octet lcd_closed_user_group; /* Closed user group specification */ 44 char lcd_flags; /* copy of sockaddr_x25 op_flags */ 45 struct x25_packet *lcd_template;/* Address of current packet */ 46 struct socket *lcd_so; /* Socket addr for connection */ 47 struct sockaddr_x25 *lcd_craddr;/* Calling address pointer */ 48 struct sockaddr_x25 *lcd_ceaddr;/* Called address pointer */ 49 time_t lcd_stime; /* time circuit established */ 50 long lcd_txcnt; /* Data packet transmit count */ 51 long lcd_rxcnt; /* Data packet receive count */ 52 short lcd_intrcnt; /* Interrupt packet transmit count */ 53 struct pklcd *lcd_listen; /* Next lcd on listen queue */ 54 struct pkcb *lcd_pkp; /* Network this lcd is attached to */ 55 struct mbuf *lcd_ifrag; /* IP, CLNP reassembly */ 56 struct sockaddr_x25 lcd_faddr; /* Remote Address (Calling) */ 57 struct sockaddr_x25 lcd_laddr; /* Local Address (Called) */ 58 struct sockbuf lcd_sb; /* alternate for datagram service */ 59 }; 60 61 #define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */ 62 #define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */ 63 64 /* 65 * Per network information, allocated dynamically 66 * when a new network is configured. 67 */ 68 69 struct pkcb { 70 struct pkcb *pk_next; 71 struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */ 72 int (*pk_lloutput) (); /* link level output procedure */ 73 caddr_t pk_llnext; /* handle for next level down */ 74 int (*pk_start) (); /* connect, confirm method */ 75 struct x25config *pk_xcp; /* network specific configuration */ 76 short pk_state; /* packet level status */ 77 struct x25config pk_xc; /* network specific configuration */ 78 struct pklcd **pk_chan; /* actual size == xc_maxlcn+1 */ 79 #define pk_maxlcn pk_xc.xc_maxlcn /* local copy of xc_maxlcn */ 80 }; 81 /* 82 * Interface address, x25 version. Exactly one of these structures is 83 * allocated for each interface with an x25 address. 84 * 85 * The ifaddr structure conatins the protocol-independent part 86 * of the structure, and is assumed to be first. 87 */ 88 struct x25_ifaddr { 89 struct ifaddr ia_ifa; /* protocol-independent info */ 90 #define ia_ifp ia_ifa.ifa_ifp 91 #define ia_flags ia_ifa.ifa_flags 92 struct pkcb ia_pkcb; /* per network information */ 93 #define ia_maxlcn ia_pkcb.pk_maxlcn 94 #define ia_chan ia_pkcb.pk_chan 95 #define ia_xc ia_pkcb.pk_xc 96 #define ia_xcp ia_pkcb.pk_xcp 97 struct sockaddr_x25 ia_sockmask; /* reserve space for netmask */ 98 }; 99 100 /* 101 * ``Link-Level'' extension to Routing Entry for upper level 102 * packet switching via X.25 virtual circuits. 103 */ 104 struct llinfo_x25 { 105 struct llinfo_x25 *lx_next; /* chain together in linked list */ 106 struct llinfo_x25 *lx_prev; /* chain together in linked list */ 107 struct rtentry *lx_rt; /* back pointer to route */ 108 struct pklcd *lx_lcd; /* local connection block */ 109 struct x25_ifaddr *lx_ia; /* may not be same as rt_ifa */ 110 int lx_state; /* can't trust lcd->lcd_state */ 111 int lx_flags; 112 int lx_timer; /* for idle timeout */ 113 int lx_family; /* for dispatch */ 114 }; 115 116 /* States for lx_state */ 117 #define LXS_NEWBORN 0 118 #define LXS_RESOLVING 1 119 #define LXS_FREE 2 120 #define LXS_CONNECTED 3 121 #define LXS_CONNECTING 4 122 #define LXS_DISCONNECTING 5 123 #define LXS_LISTENING 6 124 125 /* flags */ 126 #define LXF_VALID 0x1 /* Circuit is live, etc. */ 127 #define LXF_RTHELD 0x2 /* this lcb references rtentry */ 128 #define LXF_LISTEN 0x4 /* accepting incoming calls */ 129 130 #ifdef KERNEL 131 struct pkcb *pkcbhead; /* head of linked list of networks */ 132 struct pklcd *pk_listenhead; 133 struct pklcd *pk_attach(); 134 135 char *pk_name[], *pk_state[]; 136 int pk_t20, pk_t21, pk_t22, pk_t23; 137 #endif 138