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