2 * ===================================
3 * HARP | Host ATM Research Platform
4 * ===================================
7 * This Host ATM Research Platform ("HARP") file (the "Software") is
8 * made available by Network Computing Services, Inc. ("NetworkCS")
9 * "AS IS". NetworkCS does not provide maintenance, improvements or
10 * support of any kind.
12 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
13 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
14 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
15 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
16 * In no event shall NetworkCS be responsible for any damages, including
17 * but not limited to consequential damages, arising from or relating to
18 * any use of the Software or related support.
20 * Copyright 1994-1998 Network Computing Services, Inc.
22 * Copies of this Software may be made, however, the above copyright
23 * notice must be reproduced on all copies.
27 * ATM Forum UNI Support
28 * ---------------------
30 * Loadable kernel module support
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
36 #ifndef ATM_UNI_MODULE
40 #include <sys/param.h>
41 #include <sys/types.h>
42 #include <sys/systm.h>
43 #include <sys/errno.h>
45 #include <sys/kernel.h>
46 #include <sys/socket.h>
47 #include <sys/socketvar.h>
48 #include <sys/syslog.h>
50 #include <netatm/port.h>
51 #include <netatm/queue.h>
52 #include <netatm/atm.h>
53 #include <netatm/atm_sys.h>
54 #include <netatm/atm_sap.h>
55 #include <netatm/atm_cm.h>
56 #include <netatm/atm_if.h>
57 #include <netatm/atm_stack.h>
58 #include <netatm/atm_pcb.h>
59 #include <netatm/atm_var.h>
64 int sscop_start(void);
66 int sscf_uni_start(void);
67 int sscf_uni_stop(void);
68 int uniip_start(void);
70 int unisig_start(void);
71 int unisig_stop(void);
76 static int uni_start(void);
77 static int uni_stop(void);
81 * Initialize uni processing
83 * This will be called during module loading. We just notify all of our
84 * sub-services to initialize.
90 * 0 startup was successful
91 * errno startup failed - reason indicated
100 * Verify software version
102 if (atm_version != ATM_VERSION) {
103 log(LOG_ERR, "version mismatch: uni=%d.%d kernel=%d.%d\n",
104 ATM_VERS_MAJ(ATM_VERSION), ATM_VERS_MIN(ATM_VERSION),
105 ATM_VERS_MAJ(atm_version), ATM_VERS_MIN(atm_version));
110 * Initialize uni sub-services
116 err = sscf_uni_start();
120 err = unisig_start();
134 * Halt uni processing
136 * This will be called just prior to unloading the module from
137 * memory. All sub-services will be notified of the termination.
143 * 0 shutdown was successful
144 * errno shutdown failed - reason indicated
150 int err, s = splnet();
153 * Terminate uni sub-services
163 err = sscf_uni_stop();
177 #ifdef ATM_UNI_MODULE
179 *******************************************************************
181 * Loadable Module Support
183 *******************************************************************
185 static int uni_doload(void);
186 static int uni_dounload(void);
189 * Generic module load processing
191 * This function is called by an OS-specific function when this
192 * module is being loaded.
198 * 0 load was successful
199 * errno load failed - reason indicated
212 /* Problems, clean up */
220 * Generic module unload processing
222 * This function is called by an OS-specific function when this
223 * module is being unloaded.
229 * 0 unload was successful
230 * errno unload failed - reason indicated
239 * OK, try to clean up our mess
249 #include <sys/exec.h>
250 #include <sys/sysent.h>
254 * Loadable miscellaneous module description
260 * Loadable module support "load" entry point
262 * This is the routine called by the lkm driver whenever the
263 * modload(1) command is issued for this module.
266 * lkmtp pointer to lkm drivers's structure
267 * cmd lkm command code
270 * 0 command was successful
271 * errno command failed - reason indicated
276 struct lkm_table *lkmtp;
279 return(uni_doload());
284 * Loadable module support "unload" entry point
286 * This is the routine called by the lkm driver whenever the
287 * modunload(1) command is issued for this module.
290 * lkmtp pointer to lkm drivers's structure
291 * cmd lkm command code
294 * 0 command was successful
295 * errno command failed - reason indicated
299 uni_unload(lkmtp, cmd)
300 struct lkm_table *lkmtp;
303 return(uni_dounload());
308 * Loadable module support entry point
310 * This is the routine called by the lkm driver for all loadable module
311 * functions for this driver. This routine name must be specified
312 * on the modload(1) command. This routine will be called whenever the
313 * modload(1), modunload(1) or modstat(1) commands are issued for this
317 * lkmtp pointer to lkm drivers's structure
318 * cmd lkm command code
322 * 0 command was successful
323 * errno command failed - reason indicated
327 uni_mod(lkmtp, cmd, ver)
328 struct lkm_table *lkmtp;
332 MOD_DISPATCH(uni, lkmtp, cmd, ver,
333 uni_load, uni_unload, lkm_nullcmd);
336 #else /* !ATM_UNI_MODULE */
339 *******************************************************************
341 * Kernel Compiled Module Support
343 *******************************************************************
345 static void uni_doload(void *);
347 SYSINIT(atmuni, SI_SUB_PROTO_END, SI_ORDER_ANY, uni_doload, NULL)
350 * Kernel initialization
360 uni_doload(void *arg)
369 /* Problems, clean up */
372 log(LOG_ERR, "ATM UNI unable to initialize (%d)!!\n", err);
376 #endif /* ATM_UNI_MODULE */