Commit | Line | Data |
---|---|---|
15637ed4 RG |
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 | * @(#)pk_var.h 7.11 (Berkeley) 5/29/91 | |
39 | */ | |
40 | ||
41 | ||
42 | /* | |
43 | * | |
44 | * X.25 Logical Channel Descriptor | |
45 | * | |
46 | */ | |
47 | ||
48 | struct pklcd { | |
49 | struct pklcd_q { | |
50 | struct pklcd_q *q_forw; /* debugging chain */ | |
51 | struct pklcd_q *q_back; /* debugging chain */ | |
52 | } lcd_q; | |
53 | int (*lcd_upper)(); /* switch to socket vs datagram vs ...*/ | |
54 | caddr_t lcd_upnext; /* reference for lcd_upper() */ | |
55 | int (*lcd_send)(); /* if X.25 front end, direct connect */ | |
56 | caddr_t lcd_downnext; /* reference for lcd_send() */ | |
57 | short lcd_lcn; /* Logical channel number */ | |
58 | short lcd_state; /* Logical Channel state */ | |
59 | short lcd_timer; /* Various timer values */ | |
60 | short lcd_dg_timer; /* to reclaim idle datagram circuits */ | |
61 | bool lcd_intrconf_pending; /* Interrupt confirmation pending */ | |
62 | octet lcd_intrdata; /* Octet of incoming intr data */ | |
63 | char lcd_retry; /* Timer retry count */ | |
64 | char lcd_rsn; /* Seq no of last received packet */ | |
65 | char lcd_ssn; /* Seq no of next packet to send */ | |
66 | char lcd_output_window; /* Output flow control window */ | |
67 | char lcd_input_window; /* Input flow control window */ | |
68 | char lcd_last_transmitted_pr;/* Last Pr value transmitted */ | |
69 | bool lcd_rnr_condition; /* Remote in busy condition */ | |
70 | bool lcd_window_condition; /* Output window size exceeded */ | |
71 | bool lcd_reset_condition; /* True, if waiting reset confirm */ | |
72 | bool lcd_rxrnr_condition; /* True, if we have sent rnr */ | |
73 | char lcd_packetsize; /* Maximum packet size */ | |
74 | char lcd_windowsize; /* Window size - both directions */ | |
75 | octet lcd_closed_user_group; /* Closed user group specification */ | |
76 | char lcd_flags; /* copy of sockaddr_x25 op_flags */ | |
77 | struct mbuf *lcd_facilities; /* user supplied facilities for cr */ | |
78 | struct mbuf *lcd_template; /* Address of response packet */ | |
79 | struct socket *lcd_so; /* Socket addr for connection */ | |
80 | struct sockaddr_x25 *lcd_craddr;/* Calling address pointer */ | |
81 | struct sockaddr_x25 *lcd_ceaddr;/* Called address pointer */ | |
82 | time_t lcd_stime; /* time circuit established */ | |
83 | long lcd_txcnt; /* Data packet transmit count */ | |
84 | long lcd_rxcnt; /* Data packet receive count */ | |
85 | short lcd_intrcnt; /* Interrupt packet transmit count */ | |
86 | struct pklcd *lcd_listen; /* Next lcd on listen queue */ | |
87 | struct pkcb *lcd_pkp; /* Network this lcd is attached to */ | |
88 | struct mbuf *lcd_cps; /* Complete Packet Sequence reassembly*/ | |
89 | long lcd_cpsmax; /* Max length for CPS */ | |
90 | struct sockaddr_x25 lcd_faddr; /* Remote Address (Calling) */ | |
91 | struct sockaddr_x25 lcd_laddr; /* Local Address (Called) */ | |
92 | struct sockbuf lcd_sb; /* alternate for datagram service */ | |
93 | }; | |
94 | ||
95 | /* | |
96 | * Per network information, allocated dynamically | |
97 | * when a new network is configured. | |
98 | */ | |
99 | ||
100 | struct pkcb { | |
101 | struct pkcb *pk_next; | |
102 | short pk_state; /* packet level status */ | |
103 | short pk_maxlcn; /* local copy of xc_maxlcn */ | |
104 | int (*pk_lloutput) (); /* link level output procedure */ | |
105 | caddr_t pk_llnext; /* handle for next level down */ | |
106 | struct x25config *pk_xcp; /* network specific configuration */ | |
107 | struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */ | |
108 | struct pklcd **pk_chan; /* actual size == xc_maxlcn+1 */ | |
109 | }; | |
110 | /* | |
111 | * Interface address, x25 version. Exactly one of these structures is | |
112 | * allocated for each interface with an x25 address. | |
113 | * | |
114 | * The ifaddr structure conatins the protocol-independent part | |
115 | * of the structure, and is assumed to be first. | |
116 | */ | |
117 | struct x25_ifaddr { | |
118 | struct ifaddr ia_ifa; /* protocol-independent info */ | |
119 | #define ia_ifp ia_ifa.ifa_ifp | |
120 | #define ia_flags ia_ifa.ifa_flags | |
121 | struct x25config ia_xc; /* network specific configuration */ | |
122 | #define ia_maxlcn ia_xc.xc_maxlcn | |
123 | int (*ia_start) (); /* connect, confirm method */ | |
124 | struct sockaddr_x25 ia_dstaddr; /* reserve space for route dst */ | |
125 | }; | |
126 | ||
127 | /* | |
128 | * ``Link-Level'' extension to Routing Entry for upper level | |
129 | * packet switching via X.25 virtual circuits. | |
130 | */ | |
131 | struct llinfo_x25 { | |
132 | struct llinfo_x25 *lx_next; /* chain together in linked list */ | |
133 | struct llinfo_x25 *lx_prev; /* chain together in linked list */ | |
134 | struct rtentry *lx_rt; /* back pointer to route */ | |
135 | struct pklcd *lx_lcd; /* local connection block */ | |
136 | struct x25_ifaddr *lx_ia; /* may not be same as rt_ifa */ | |
137 | int lx_state; /* can't trust lcd->lcd_state */ | |
138 | int lx_flags; | |
139 | int lx_timer; /* for idle timeout */ | |
140 | int lx_family; /* for dispatch */ | |
141 | }; | |
142 | ||
143 | /* States for lx_state */ | |
144 | #define LXS_NEWBORN 0 | |
145 | #define LXS_RESOLVING 1 | |
146 | #define LXS_FREE 2 | |
147 | #define LXS_CONNECTING 3 | |
148 | #define LXS_CONNECTED 4 | |
149 | #define LXS_DISCONNECTING 5 | |
150 | #define LXS_LISTENING 6 | |
151 | ||
152 | /* flags */ | |
153 | #define LXF_VALID 0x1 /* Circuit is live, etc. */ | |
154 | #define LXF_RTHELD 0x2 /* this lcb references rtentry */ | |
155 | #define LXF_LISTEN 0x4 /* accepting incoming calls */ | |
156 | ||
157 | /* | |
158 | * miscellenous debugging info | |
159 | */ | |
160 | struct mbuf_cache { | |
161 | int mbc_size; | |
162 | int mbc_num; | |
163 | int mbc_oldsize; | |
164 | struct mbuf **mbc_cache; | |
165 | }; | |
166 | ||
167 | #if defined(KERNEL) && defined(CCITT) | |
168 | struct pkcb *pkcbhead; /* head of linked list of networks */ | |
169 | struct pklcd *pk_listenhead; | |
170 | struct pklcd *pk_attach(); | |
171 | ||
172 | extern char *pk_name[], *pk_state[]; | |
173 | int pk_t20, pk_t21, pk_t22, pk_t23; | |
174 | #endif |