compaq changes
[unix-history] / usr / src / sys / netccitt / pk_var.h
CommitLineData
dc8f6c26
KS
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 *
1c41f5e9 12 * @(#)pk_var.h 7.7 (Berkeley) %G%
dc8f6c26
KS
13 */
14
5abb4ba0
KS
15
16/*
17 *
18 * X.25 Logical Channel Descriptor
19 *
20 */
21
22struct pklcd {
b84e7ca8
KS
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() */
5abb4ba0
KS
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 */
039be508 31 short lcd_dg_timer; /* to reclaim idle datagram circuits */
5abb4ba0
KS
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 */
ffababe5
KS
47 struct sockaddr_x25 *lcd_craddr;/* Calling address pointer */
48 struct sockaddr_x25 *lcd_ceaddr;/* Called address pointer */
5abb4ba0
KS
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 */
ffababe5 54 struct pkcb *lcd_pkp; /* Network this lcd is attached to */
1c41f5e9 55 struct mbuf *lcd_ifrag; /* IP, CLNP reassembly */
4507dea2
KS
56 struct sockaddr_x25 lcd_faddr; /* Remote Address (Calling) */
57 struct sockaddr_x25 lcd_laddr; /* Local Address (Called) */
b84e7ca8 58 struct sockbuf lcd_sb; /* alternate for datagram service */
5abb4ba0
KS
59};
60
039be508
KS
61#define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */
62#define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */
dc8f6c26 63
039be508
KS
64/*
65 * Per network information, allocated dynamically
66 * when a new network is configured.
67 */
68
69struct pkcb {
70 struct pkcb *pk_next;
71 struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */
ffababe5 72 int (*pk_lloutput) (); /* link level output procedure */
b84e7ca8 73 caddr_t pk_llnext; /* handle for next level down */
ffababe5 74 int (*pk_start) (); /* connect, confirm method */
039be508 75 struct x25config *pk_xcp; /* network specific configuration */
ffababe5 76 short pk_state; /* packet level status */
039be508
KS
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};
5abb4ba0 81/*
dc8f6c26
KS
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.
5abb4ba0 87 */
dc8f6c26
KS
88struct 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
039be508
KS
92 struct pkcb ia_pkcb; /* per network information */
93#define ia_maxlcn ia_pkcb.pk_maxlcn
94#define ia_chan ia_pkcb.pk_chan
4507dea2
KS
95#define ia_xc ia_pkcb.pk_xc
96#define ia_xcp ia_pkcb.pk_xcp
dc8f6c26 97 struct sockaddr_x25 ia_sockmask; /* reserve space for netmask */
dc8f6c26 98};
5abb4ba0 99
dc8f6c26
KS
100/*
101 * ``Link-Level'' extension to Routing Entry for upper level
102 * packet switching via X.25 virtual circuits.
103 */
4507dea2 104struct llinfo_x25 {
1c41f5e9
KS
105 struct llinfo_x25 *lx_next; /* chain together in linked list */
106 struct llinfo_x25 *lx_prev; /* chain together in linked list */
4507dea2 107 struct rtentry *lx_rt; /* back pointer to route */
1c41f5e9 108 struct pklcd *lx_lcd; /* local connection block */
4507dea2
KS
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 */
1c41f5e9 113 int lx_family; /* for dispatch */
5abb4ba0
KS
114};
115
4507dea2
KS
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
1c41f5e9 123#define LXS_LISTENING 6
039be508
KS
124
125/* flags */
4507dea2
KS
126#define LXF_VALID 0x1 /* Circuit is live, etc. */
127#define LXF_RTHELD 0x2 /* this lcb references rtentry */
1c41f5e9 128#define LXF_LISTEN 0x4 /* accepting incoming calls */
039be508 129
5abb4ba0 130#ifdef KERNEL
039be508 131struct pkcb *pkcbhead; /* head of linked list of networks */
5abb4ba0 132struct pklcd *pk_listenhead;
ffababe5 133struct pklcd *pk_attach();
5abb4ba0
KS
134
135char *pk_name[], *pk_state[];
136int pk_t20, pk_t21, pk_t22, pk_t23;
137#endif