cosmetic quickie
[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 *
039be508 12 * @(#)pk_var.h 7.3 (Berkeley) %G%
dc8f6c26
KS
13 */
14
15/*
16 * Protocol-Protocol Packet Buffer.
17 * (Eventually will be replace by system-wide structure).
18 */
5abb4ba0 19
dc8f6c26
KS
20struct 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};
5abb4ba0
KS
29
30/*
31 *
32 * X.25 Logical Channel Descriptor
33 *
34 */
35
36struct pklcd {
dc8f6c26 37 struct pq lcd_downq, lcd_upq; /* protocol glue for datagram service */
5abb4ba0
KS
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 */
039be508 43 short lcd_dg_timer; /* to reclaim idle datagram circuits */
5abb4ba0
KS
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 */
60 struct sockaddr_x25 *lcd_ceaddr;/* Called address */
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 */
039be508 66 struct pkcb *lcd_pkp; /* network this lcd is attached to */
5abb4ba0
KS
67};
68
039be508
KS
69#define X25_DG_CIRCUIT 0x10 /* lcd_flag: used for datagrams */
70#define X25_DG_ROUTING 0x20 /* lcd_flag: peer addr not yet known */
dc8f6c26 71
039be508
KS
72/*
73 * Per network information, allocated dynamically
74 * when a new network is configured.
75 */
76
77struct pkcb {
78 struct pkcb *pk_next;
79 struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */
80 short pk_state; /* packet level status */
81 int (*pk_output) (); /* link level output procedure */
82 struct x25config *pk_xcp; /* network specific configuration */
83 struct x25config pk_xc; /* network specific configuration */
84 struct pklcd **pk_chan; /* actual size == xc_maxlcn+1 */
85#define pk_maxlcn pk_xc.xc_maxlcn /* local copy of xc_maxlcn */
86};
5abb4ba0 87/*
dc8f6c26
KS
88 * Interface address, x25 version. Exactly one of these structures is
89 * allocated for each interface with an x25 address.
90 *
91 * The ifaddr structure conatins the protocol-independent part
92 * of the structure, and is assumed to be first.
5abb4ba0 93 */
dc8f6c26
KS
94struct x25_ifaddr {
95 struct ifaddr ia_ifa; /* protocol-independent info */
96#define ia_ifp ia_ifa.ifa_ifp
97#define ia_flags ia_ifa.ifa_flags
039be508
KS
98 struct pkcb ia_pkcb; /* per network information */
99#define ia_maxlcn ia_pkcb.pk_maxlcn
100#define ia_chan ia_pkcb.pk_chan
101#define ia_addr ia_pkcb.pk_xc.xc_addr
dc8f6c26 102 struct sockaddr_x25 ia_sockmask; /* reserve space for netmask */
dc8f6c26 103};
5abb4ba0 104
dc8f6c26
KS
105/*
106 * ``Link-Level'' extension to Routing Entry for upper level
107 * packet switching via X.25 virtual circuits.
108 */
039be508
KS
109struct rtextension_x25 {
110 struct pklcd *rtx_lcd; /* local connection block */
111 struct rtentry *rtx_rt; /* back pointer to route */
112 struct x25_ifaddr *rtx_ia; /* may not be same as rt_ifa */
113 int rtx_state; /* can't trust lcd->lcd_state */
114 int rtx_flags;
115 int rtx_timer; /* for idle timeout */
5abb4ba0
KS
116};
117
039be508
KS
118/* States for rtx_state */
119#define XRS_NEWBORN 0
120#define XRS_RESOLVING 1
121#define XRS_FREE 2
122#define XRS_CONNECTED 3
123#define XRS_CONNECTING 4
124#define XRS_DISCONNECTING 5
125
126/* flags */
127#define XRF_VALID 0x1 /* Circuit is live, etc. */
128#define XRF_RTHELD 0x2 /* this lcb references rtentry */
129
5abb4ba0 130#ifdef KERNEL
039be508 131struct pkcb *pkcbhead; /* head of linked list of networks */
5abb4ba0
KS
132struct pklcd *pk_listenhead;
133
134char *pk_name[], *pk_state[];
135int pk_t20, pk_t21, pk_t22, pk_t23;
136#endif