FreeBSD/Linux Kernel Cross Reference
sys/netccitt/hd_var.h
1 /* $NetBSD: hd_var.h,v 1.11 2003/08/07 16:33:01 agc Exp $ */
2
3 /*
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Laboratory for Computation Vision and the Computer Science Department
9 * of the University of British Columbia.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)hd_var.h 8.1 (Berkeley) 6/10/93
36 */
37
38 /*
39 * Copyright (c) 1984 University of British Columbia.
40 *
41 * This code is derived from software contributed to Berkeley by
42 * the Laboratory for Computation Vision and the Computer Science Department
43 * of the University of British Columbia.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions
47 * are met:
48 * 1. Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer.
50 * 2. Redistributions in binary form must reproduce the above copyright
51 * notice, this list of conditions and the following disclaimer in the
52 * documentation and/or other materials provided with the distribution.
53 * 3. All advertising materials mentioning features or use of this software
54 * must display the following acknowledgement:
55 * This product includes software developed by the University of
56 * California, Berkeley and its contributors.
57 * 4. Neither the name of the University nor the names of its contributors
58 * may be used to endorse or promote products derived from this software
59 * without specific prior written permission.
60 *
61 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
62 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
65 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71 * SUCH DAMAGE.
72 *
73 * @(#)hd_var.h 8.1 (Berkeley) 6/10/93
74 */
75
76 /*
77 *
78 * hdlc control block
79 *
80 */
81
82 struct hdtxq {
83 struct mbuf *head;
84 struct mbuf *tail;
85 };
86
87 struct hdcb {
88 struct hdcb *hd_next; /* pointer to next hdlc control block */
89 char hd_state; /* link state */
90 char hd_vs; /* send state variable */
91 char hd_vr; /* receive state variable */
92 char hd_lastrxnr; /* last received N(R) */
93 char hd_lasttxnr; /* last transmitted N(R) */
94 char hd_condition;
95 #define TIMER_RECOVERY_CONDITION 0x01
96 #define REJ_CONDITION 0x02
97 #define REMOTE_RNR_CONDITION 0X04
98 char hd_retxcnt;
99 char hd_xx;
100 struct hdtxq hd_txq;
101 struct mbuf *hd_retxq[MODULUS];
102 char hd_retxqi;
103 char hd_rrtimer;
104 char hd_timer;
105 #define SET_TIMER(hdp) hdp->hd_timer = hd_t1
106 #define KILL_TIMER(hdp) hdp->hd_timer = 0
107 char hd_dontcopy; /* if-driver doesn't free I-frames */
108 struct ifnet *hd_ifp; /* device's network visible interface */
109 struct ifaddr *hd_ifa; /* device's X.25 network address */
110 struct x25config *hd_xcp;
111 caddr_t hd_pkp; /* Level III junk */
112 int (*hd_output) /* separate entry for HDLC direct output */
113 __P((struct mbuf *, ...));
114
115 /* link statistics */
116
117 long hd_iframes_in;
118 long hd_iframes_out;
119 long hd_rrs_in;
120 long hd_rrs_out;
121 short hd_rejs_in;
122 short hd_rejs_out;
123 long hd_window_condition;
124 short hd_invalid_ns;
125 short hd_invalid_nr;
126 short hd_timeouts;
127 short hd_resets;
128 short hd_unknown;
129 short hd_frmrs_in;
130 short hd_frmrs_out;
131 short hd_rnrs_in;
132 short hd_rnrs_out;
133 };
134
135 #ifdef _KERNEL
136 extern struct hdcb *hdcbhead; /* head of linked list of hdcb's */
137 extern struct Frmr_frame hd_frmr; /* rejected frame diagnostic info */
138 extern struct ifqueue hdintrq; /* hdlc packet input queue */
139 struct Hdlc_frame;
140 struct Hdlc_iframe;
141 struct Hdlc_sframe;
142
143 extern int hd_t1; /* timer T1 value */
144 extern int hd_t3; /* RR send timer */
145 extern int hd_n2; /* frame retransmission limit */
146
147
148 /* hd_debug.c */
149 void hd_trace __P((struct hdcb *, int , struct mbuf *));
150 int hd_dumptrace __P((struct hdcb *));
151
152 /* hd_input.c */
153 void hdintr __P((void));
154 int process_rxframe __P((struct hdcb *, struct mbuf *));
155 int process_iframe __P((struct hdcb *, struct mbuf *, struct Hdlc_iframe *));
156 bool range_check __P((int, int , int ));
157 void process_sframe __P((struct hdcb *, struct Hdlc_sframe *, int));
158 bool valid_nr __P((struct hdcb *, int , int));
159
160 /* hd_output.c */
161 int hd_output __P((struct mbuf *, ...));
162 void hd_start __P((struct hdcb *));
163 void hd_send_iframe __P((struct hdcb *, struct mbuf *, int));
164 int hd_ifoutput __P((struct mbuf *, ...));
165 void hd_resend_iframe __P((struct hdcb *));
166
167 /* hd_subr.c */
168 void hd_init __P((void));
169 void *hd_ctlinput __P((int , struct sockaddr *, void *));
170 void hd_initvars __P((struct hdcb *));
171 int hd_decode __P((struct hdcb *, struct Hdlc_frame *));
172 void hd_writeinternal __P((struct hdcb *, int, int ));
173 void hd_append __P((struct hdtxq *, struct mbuf *));
174 void hd_flush __P((struct ifnet *));
175 void hd_message __P((struct hdcb *, char *));
176 int hd_status __P((struct hdcb *));
177 struct mbuf *hd_remove __P((struct hdtxq *));
178
179 /* hd_timer.c */
180 void hd_timer __P((void));
181
182 #endif
Cache object: 8ce04adeda57d939eff51fe1742e60c9
|