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