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.4 (Berkeley) 05/22/90 13 */ 14 15 /* 16 * Protocol-Protocol Packet Buffer. 17 * (Eventually will be replace by system-wide structure). 18 */ 19 20 struct pq { 21 int (*pq_put)(); /* How to process data */ 22 struct mbuf *pq_data; /* Queued data */ 23 int pq_space; /* For accounting */ 24 int pq_flags; 25 int (*pq_unblock)();/* called & cleared when unblocking */ 26 caddr_t pq_proto; /* for other service entries */ 27 caddr_t pq_next; /* next q, or route, or pcb */ 28 }; 29 30 /* 31 * 32 * X.25 Logical Channel Descriptor 33 * 34 */ 35 36 struct pklcd { 37 struct pq lcd_downq, lcd_upq; /* protocol glue for datagram service */ 38 short lcd_lcn; /* Logical channel number */ 39 short lcd_state; /* Logical Channel state */ 40 bool lcd_intrconf_pending; /* Interrupt confirmation pending */ 41 octet lcd_intrdata; /* Octet of incoming intr data */ 42 short lcd_timer; /* Various timer values */ 43 short lcd_dg_timer; /* to reclaim idle datagram circuits */ 44 char lcd_retry; /* Timer retry count */ 45 char lcd_rsn; /* Seq no of last received packet */ 46 char lcd_ssn; /* Seq no of next packet to send */ 47 char lcd_output_window; /* Output flow control window */ 48 char lcd_input_window; /* Input flow control window */ 49 char lcd_last_transmitted_pr;/* Last Pr value transmitted */ 50 bool lcd_rnr_condition; /* Remote in busy condition */ 51 bool lcd_window_condition; /* Output window size exceeded */ 52 bool lcd_reset_condition; /* True, if waiting reset confirm */ 53 char lcd_packetsize; /* Maximum packet size */ 54 char lcd_windowsize; /* Window size - both directions */ 55 octet lcd_closed_user_group; /* Closed user group specification */ 56 char lcd_flags; /* copy of sockaddr_x25 op_flags */ 57 struct x25_packet *lcd_template;/* Address of current packet */ 58 struct socket *lcd_so; /* Socket addr for connection */ 59 struct sockaddr_x25 *lcd_craddr;/* Calling address pointer */ 60 struct sockaddr_x25 *lcd_ceaddr;/* Called address pointer */ 61 time_t lcd_stime; /* time circuit established */ 62 long lcd_txcnt; /* Data packet transmit count */ 63 long lcd_rxcnt; /* Data packet receive count */ 64 short lcd_intrcnt; /* Interrupt packet transmit count */ 65 struct pklcd *lcd_listen; /* Next lcd on listen queue */ 66 struct pkcb *lcd_pkp; /* Network this lcd is attached to */ 67 struct sockaddr_x25 lcd_faddr /* Remote Address (Calling) */ 68 struct sockaddr_x25 lcd_laddr /* Local Address (Called) */ 69 }; 70 71 #define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */ 72 #define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */ 73 74 /* 75 * Per network information, allocated dynamically 76 * when a new network is configured. 77 */ 78 79 struct pkcb { 80 struct pkcb *pk_next; 81 struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */ 82 int (*pk_lloutput) (); /* link level output procedure */ 83 int (*pk_start) (); /* connect, confirm method */ 84 struct x25config *pk_xcp; /* network specific configuration */ 85 short pk_state; /* packet level status */ 86 struct x25config pk_xc; /* network specific configuration */ 87 struct pklcd **pk_chan; /* actual size == xc_maxlcn+1 */ 88 #define pk_maxlcn pk_xc.xc_maxlcn /* local copy of xc_maxlcn */ 89 }; 90 /* 91 * Interface address, x25 version. Exactly one of these structures is 92 * allocated for each interface with an x25 address. 93 * 94 * The ifaddr structure conatins the protocol-independent part 95 * of the structure, and is assumed to be first. 96 */ 97 struct x25_ifaddr { 98 struct ifaddr ia_ifa; /* protocol-independent info */ 99 #define ia_ifp ia_ifa.ifa_ifp 100 #define ia_flags ia_ifa.ifa_flags 101 struct pkcb ia_pkcb; /* per network information */ 102 #define ia_maxlcn ia_pkcb.pk_maxlcn 103 #define ia_chan ia_pkcb.pk_chan 104 #define ia_addr ia_pkcb.pk_xc.xc_addr 105 struct sockaddr_x25 ia_sockmask; /* reserve space for netmask */ 106 }; 107 108 /* 109 * ``Link-Level'' extension to Routing Entry for upper level 110 * packet switching via X.25 virtual circuits. 111 */ 112 struct rtextension_x25 { 113 struct pklcd *rtx_lcd; /* local connection block */ 114 struct rtentry *rtx_rt; /* back pointer to route */ 115 struct x25_ifaddr *rtx_ia; /* may not be same as rt_ifa */ 116 int rtx_state; /* can't trust lcd->lcd_state */ 117 int rtx_flags; 118 int rtx_timer; /* for idle timeout */ 119 }; 120 121 /* States for rtx_state */ 122 #define XRS_NEWBORN 0 123 #define XRS_RESOLVING 1 124 #define XRS_FREE 2 125 #define XRS_CONNECTED 3 126 #define XRS_CONNECTING 4 127 #define XRS_DISCONNECTING 5 128 129 /* flags */ 130 #define XRF_VALID 0x1 /* Circuit is live, etc. */ 131 #define XRF_RTHELD 0x2 /* this lcb references rtentry */ 132 133 #ifdef KERNEL 134 struct pkcb *pkcbhead; /* head of linked list of networks */ 135 struct pklcd *pk_listenhead; 136 struct pklcd *pk_attach(); 137 138 char *pk_name[], *pk_state[]; 139 int pk_t20, pk_t21, pk_t22, pk_t23; 140 #endif 141