1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
/*
*
* ===================================
* HARP | Host ATM Research Platform
* ===================================
*
*
* This Host ATM Research Platform ("HARP") file (the "Software") is
* made available by Network Computing Services, Inc. ("NetworkCS")
* "AS IS". NetworkCS does not provide maintenance, improvements or
* support of any kind.
*
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
* In no event shall NetworkCS be responsible for any damages, including
* but not limited to consequential damages, arising from or relating to
* any use of the Software or related support.
*
* Copyright 1994-1998 Network Computing Services, Inc.
*
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: uniip.c,v 1.1 1998/09/15 08:23:10 phk Exp $
*
*/
/*
* ATM Forum UNI Support
* ---------------------
*
* UNI IP interface module
*
*/
#include <netatm/kern_include.h>
#include <netatm/ipatm/ipatm_var.h>
#include <netatm/ipatm/ipatm_serv.h>
#include <netatm/uni/uniip_var.h>
#ifndef lint
__RCSID("@(#) $Id: uniip.c,v 1.1 1998/09/15 08:23:10 phk Exp $");
#endif
/*
* Local functions
*/
static int uniip_ipact __P((struct ip_nif *));
static int uniip_ipdact __P((struct ip_nif *));
/*
* Global variables
*/
struct uniip *uniip_head = NULL;
struct ip_serv uniip_ipserv = {
uniip_ipact,
uniip_ipdact,
uniarp_ioctl,
uniarp_pvcopen,
uniarp_svcout,
uniarp_svcin,
uniarp_svcactive,
uniarp_vcclose,
NULL,
{ATM_AAL5, ATM_ENC_LLC},
};
/*
* Local variables
*/
static struct sp_info uniip_pool = {
"uni ip pool", /* si_name */
sizeof(struct uniip), /* si_blksiz */
2, /* si_blkcnt */
100 /* si_maxallow */
};
/*
* Process module loading notification
*
* Called whenever the uni module is initializing.
*
* Arguments:
* none
*
* Returns:
* 0 initialization successful
* errno initialization failed - reason indicated
*
*/
int
uniip_start()
{
int err;
/*
* Tell arp to initialize stuff
*/
err = uniarp_start();
return (err);
}
/*
* Process module unloading notification
*
* Called whenever the uni module is about to be unloaded. All signalling
* instances will have been previously detached. All uniip resources
* must be freed now.
*
* Arguments:
* none
*
* Returns:
* 0 shutdown was successful
* errno shutdown failed - reason indicated
*
*/
int
uniip_stop()
{
/*
* All IP interfaces should be gone
*/
if (uniip_head)
return (EBUSY);
/*
* Tell arp to stop
*/
uniarp_stop();
/*
* Free our storage pools
*/
atm_release_pool(&uniip_pool);
return (0);
}
/*
* Process IP Network Interface Activation
*
* Called whenever an IP network interface becomes active.
*
* Called at splnet.
*
* Arguments:
* inp pointer to IP network interface
*
* Returns:
* 0 command successful
* errno command failed - reason indicated
*
*/
static int
uniip_ipact(inp)
struct ip_nif *inp;
{
struct uniip *uip;
/*
* Make sure we don't already have this interface
*/
for (uip = uniip_head; uip; uip = uip->uip_next) {
if (uip->uip_ipnif == inp)
return (EEXIST);
}
/*
* Get a new interface control block
*/
uip = (struct uniip *)atm_allocate(&uniip_pool);
if (uip == NULL)
return (ENOMEM);
/*
* Initialize and link up
*/
uip->uip_ipnif = inp;
LINK2TAIL(uip, struct uniip, uniip_head, uip_next);
/*
* Link from IP world
*/
inp->inf_isintf = (caddr_t)uip;
/*
* Tell arp about new interface
*/
uniarp_ipact(uip);
return (0);
}
/*
* Process IP Network Interface Deactivation
*
* Called whenever an IP network interface becomes inactive.
*
* Called at splnet.
*
* Arguments:
* inp pointer to IP network interface
*
* Returns:
* 0 command successful
* errno command failed - reason indicated
*
*/
static int
uniip_ipdact(inp)
struct ip_nif *inp;
{
struct uniip *uip;
/*
* Get the appropriate IP interface block
*/
uip = (struct uniip *)inp->inf_isintf;
if (uip == NULL)
return (ENXIO);
/*
* Let arp know about this
*/
uniarp_ipdact(uip);
/*
* Free interface info
*/
UNLINK(uip, struct uniip, uniip_head, uip_next);
if (uip->uip_prefix != NULL)
KM_FREE(uip->uip_prefix,
uip->uip_nprefix * sizeof(struct uniarp_prf), M_DEVBUF);
atm_free((caddr_t)uip);
return (0);
}
|