Commit | Line | Data |
---|---|---|
7bcd1bb8 KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
7 | * @(#)cons_pcb.h 7.4 (Berkeley) %G% | |
8 | */ | |
9 | ||
a6b4f57d KS |
10 | /*********************************************************** |
11 | Copyright IBM Corporation 1987 | |
12 | ||
13 | All Rights Reserved | |
14 | ||
15 | Permission to use, copy, modify, and distribute this software and its | |
16 | documentation for any purpose and without fee is hereby granted, | |
17 | provided that the above copyright notice appear in all copies and that | |
18 | both that copyright notice and this permission notice appear in | |
19 | supporting documentation, and that the name of IBM not be | |
20 | used in advertising or publicity pertaining to distribution of the | |
21 | software without specific, written prior permission. | |
22 | ||
23 | IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
24 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
25 | IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
26 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
27 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
28 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
29 | SOFTWARE. | |
30 | ||
31 | ******************************************************************/ | |
32 | ||
33 | /* | |
34 | * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison | |
35 | */ | |
36 | /* $Header: cons_pcb.h,v 4.2 88/06/29 14:59:08 hagens Exp $ */ | |
37 | /* $Source: /usr/argo/sys/netiso/RCS/cons_pcb.h,v $ */ | |
38 | ||
39 | /* | |
40 | * protocol control block for the connection oriented network service | |
41 | */ | |
42 | ||
43 | /* | |
44 | * legit port #s for cons "transport" are 0..23 for su users only, and | |
45 | * 1024..1099 for public users | |
46 | */ | |
47 | #define X25_SBSIZE 512 | |
48 | #define X25_PORT_RESERVED 24 | |
49 | #define X25_PORT_USERMAX 1099 | |
50 | #define X25_FACIL_LEN_MAX 109 | |
51 | #define X25_PARTIAL_PKT_LEN_MAX (MLEN - sizeof(struct cons_pcb)) | |
52 | ||
53 | #ifndef ARGO_DEBUG | |
54 | #define X25_TTL 600 /* 5 min */ | |
55 | #else ARGO_DEBUG | |
56 | #define X25_TTL 120 /* 1 min */ | |
57 | #endif ARGO_DEBUG | |
58 | ||
59 | struct cons_pcb { | |
60 | struct isopcb _co_isopcb; | |
61 | #define co_next _co_isopcb.isop_next | |
62 | /* prev used for netstat only */ | |
63 | #define co_prev _co_isopcb.isop_prev | |
64 | #define co_head _co_isopcb.isop_head | |
65 | #define co_laddr _co_isopcb.isop_laddr | |
66 | #define co_faddr _co_isopcb.isop_faddr | |
67 | #define co_lport _co_isopcb.isop_laddr.siso_tsuffix | |
68 | #define co_fport _co_isopcb.isop_faddr.siso_tsuffix | |
69 | #define co_route _co_isopcb.isop_route | |
70 | #define co_socket _co_isopcb.isop_socket | |
71 | #define co_chanmask _co_isopcb.isop_chanmask | |
72 | #define co_negchanmask _co_isopcb.isop_negchanmask | |
73 | #define co_x25crud _co_isopcb.isop_x25crud | |
74 | #define co_x25crud_len _co_isopcb.isop_x25crud_len | |
75 | u_short co_state; | |
76 | u_char co_flags; | |
77 | u_short co_ttl; /* time to live timer */ | |
78 | u_short co_init_ttl; /* initial value of ttl */ | |
79 | int co_channel; /* logical channel */ | |
80 | struct ifnet * co_ifp; /* interface */ | |
81 | struct protosw *co_proto; | |
82 | ||
83 | struct ifqueue co_pending; /* queue data to send when connection | |
84 | completes*/ | |
85 | #define MAX_DTE_LEN 0x7 /* 17 bcd digits */ | |
86 | struct dte_addr co_peer_dte; | |
87 | struct cons_pcb *co_myself; /* DEBUGGING AID */ | |
88 | }; | |
89 | ||
90 | /* | |
91 | * X.25 Packet types | |
92 | */ | |
93 | #define XPKT_DATA 1 | |
94 | #define XPKT_INTERRUPT 2 | |
95 | #define XPKT_FLOWCONTROL 3 /* not delivered? */ | |
96 | ||
97 | /* | |
98 | * pcb xtates | |
99 | */ | |
100 | ||
101 | #define CLOSED 0x0 | |
102 | #define LISTENING 0x1 | |
103 | #define CLOSING 0x2 | |
104 | /* USABLE STATES MUST BE LAST */ | |
105 | #define CONNECTING 0x3 | |
106 | #define ACKWAIT 0x4 | |
107 | #define OPEN 0x5 | |
108 | #define MIN_USABLE_STATE CONNECTING | |
109 | ||
110 | #define cons_NSTATES 0x6 | |
111 | ||
112 | ||
113 | /* type */ | |
114 | #define CONSF_OCRE 0x40 /* created on OUTPUT */ | |
115 | #define CONSF_ICRE 0x20 /* created on INPUT */ | |
116 | #define CONSF_unused 0x10 /* not used */ | |
117 | #define CONSF_unused2 0x08 /* not used */ | |
118 | #define CONSF_DGM 0x04 /* for dgm use only */ | |
119 | #define CONSF_XTS 0x02 /* for cons-as-transport-service */ | |
120 | #define CONSF_LOOPBACK 0x01 /* loopback was on when connection commenced */ | |
121 | ||
122 | #define X_NOCHANNEL 0x80 | |
123 | ||
124 | ||
125 | struct cons_stat { | |
126 | u_int co_intr; /* input from eicon board */ | |
127 | u_int co_restart; /* ecn_restart() request issued to board */ | |
128 | u_int co_slowtimo; /* times slowtimo called */ | |
129 | u_int co_timedout; /* connections closed by slowtimo */ | |
130 | u_int co_ack; /* ECN_ACK indication came from eicon board */ | |
131 | u_int co_receive; /* ECN_RECEIVE indication came from eicon board */ | |
132 | u_int co_send; /* ECN_SEND request issued to board */ | |
133 | u_int co_reset_in; /* ECN_RESET indication came from eicon board */ | |
134 | u_int co_reset_out; /* ECN_RESET issued to the eicon board */ | |
135 | u_int co_clear_in; /* ECN_CLEAR indication came from eicon board */ | |
136 | u_int co_clear_out; /* ECN_CLEAR request issued to board */ | |
137 | u_int co_refuse; /* ECN_REFUSE indication came from eicon board */ | |
138 | u_int co_accept; /* ECN_ACCEPT indication came from eicon board */ | |
139 | u_int co_connect; /* ECN_CONNECT indication came from eicon board */ | |
140 | u_int co_call; /* ECN_CALL request issued to board */ | |
141 | u_int co_Rdrops; /* bad pkt came from ll */ | |
142 | u_int co_Xdrops; /* can't keep up */ | |
143 | ||
144 | u_int co_intrpt_pkts_in; /* interrupt packets in */ | |
145 | u_int co_avg_qlen; | |
146 | u_int co_avg_qdrop; | |
147 | u_int co_active; | |
148 | ||
149 | u_int co_noresources; | |
150 | u_int co_parse_facil_err; | |
151 | u_int co_addr_proto_consist_err; | |
152 | u_int co_no_copcb; | |
153 | } cons_stat; | |
154 | ||
155 | u_char x25_error_stats[CONL_ERROR_MAX + 1]; | |
156 | ||
157 | struct ifqueue consintrq; | |
158 | ||
159 | /* reasons for clear are in a data mbuf chained to a clear ecn_request */ | |
160 | struct e_clear_data { | |
161 | u_char ecd_cause; | |
162 | u_char ecd_diagnostic; | |
163 | }; | |
164 | ||
165 | #ifdef KERNEL | |
166 | #define IncStat(XYZ) cons_stat.XYZ++ | |
167 | #endif KERNEL |