]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/aurp_misc.c
c244f4da8bf95ebef0edd1cfab99678f3132327e
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1996 Apple Computer, Inc.
25 * Created April 8, 1996 by Tuyen Nguyen
26 * Modified, March 17, 1997 by Tuyen Nguyen for MacOSX.
33 #include <sys/errno.h>
34 #include <sys/types.h>
35 #include <sys/param.h>
36 #include <machine/spl.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
40 #include <sys/filedesc.h>
41 #include <sys/fcntl.h>
43 #include <sys/socket.h>
44 #include <sys/socketvar.h>
47 #include <netat/sysglue.h>
48 #include <netat/appletalk.h>
49 #include <netat/at_var.h>
50 #include <netat/rtmp.h>
51 #include <netat/routing_tables.h>
52 #include <netat/at_pcb.h>
53 #include <netat/aurp.h>
54 #include <netat/debug.h>
57 void AURPiocack(gref
, m
)
61 /* send ok reply to ioctl command */
62 gbuf_set_type(m
, MSG_IOCACK
);
63 atalk_putnext(gref
, m
);
66 void AURPiocnak(gref
, m
, error
)
71 ioc_t
*iocbp
= (ioc_t
*)gbuf_rptr(m
);
73 /* send error reply to ioctl command */
75 gbuf_freem(gbuf_cont(m
));
78 iocbp
->ioc_error
= error
;
81 gbuf_set_type(m
, MSG_IOCNAK
);
82 atalk_putnext(gref
, m
);
94 state
= (aurp_state_t
*)&aurp_state
[1];
101 * for every tunnel peer, do the following periodically:
102 * 1. send zone requests to determine zone names of networks
103 * that still do not have asssociated zone names.
104 * 2. send any RI update that are pending
106 for (node
=1; node
<= dst_addr_cnt
; node
++, state
++) {
111 /* restart the periodic update timer */
112 timeout(AURPupdate
, arg
, AURP_UpdateRate
*10*HZ
);
124 while ((tmp_m
= m
) != 0) {
126 gbuf_next(tmp_m
) = 0;
135 aurp_state_t
*state
= (aurp_state_t
*)&aurp_state
[1];
137 RT_entry
*entry
= (RT_entry
*)RT_table
;
139 /* start the periodic update timer */
140 timeout(AURPupdate
, 0, AURP_UpdateRate
*10*HZ
);
143 /* initialize AURP flags for entries in the RT table */
144 for (entry_num
=0; entry_num
< RT_maxentry
; entry_num
++,entry
++)
147 /* initiate connections to peers */
148 for (node
=1; node
<= dst_addr_cnt
; node
++, state
++) {
149 bzero((char *)state
, sizeof(*state
));
150 state
->rem_node
= node
;
151 state
->snd_state
= AURPSTATE_Unconnected
;
152 state
->rcv_state
= AURPSTATE_Unconnected
;
153 dPrintf(D_M_AURP
, D_L_STARTUP_INFO
,
154 ("AURPinit: sending OpenReq to node %u\n", node
));
155 AURPsndOpenReq(state
);
162 void AURPcleanup(state
)
166 gbuf_freem(state
->rsp_m
);
171 gbuf_freem(state
->upd_m
);
182 aurp_state_t
*state
= (aurp_state_t
*)&aurp_state
[1];
184 /* cancel the periodic update timer */
185 untimeout(AURPupdate
, 0);
188 /* notify tunnel peers of router going-down */
189 for (node
=1; node
<= dst_addr_cnt
; node
++, state
++) {
194 /* bring down the router */
195 aurp_wakeup(NULL
, (caddr_t
) AE_SHUTDOWN
, 0);
204 entry
= (RT_entry
*)RT_table
;
205 for (entry_num
=0; entry_num
< RT_maxentry
; entry_num
++,entry
++)
206 entry
->AURPFlag
= net_export
? AURP_NetHiden
: 0;
208 for (i
=0; i
< net_access_cnt
; i
++) {
209 /* export or hide networks as configured */
210 if ((entry
= rt_blookup(net_access
[i
])) != 0)
211 entry
->AURPFlag
= net_export
? 0 : AURP_NetHiden
;
215 #endif /* AURP_SUPPORT */