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