#include <netat/at_aarp.h>
#include <netat/debug.h>
+#include <sys/kern_event.h>
+
static int probing;
/* Following two variables are used to keep track of how many dynamic addresses
* we have tried out at startup.
int aarp_init1(), aarp_init2();
int aarp_send_data();
-int aarp_sched_probe();
StaticProc int aarp_req_cmd_in();
StaticProc int aarp_resp_cmd_in();
StaticProc int aarp_glean_info();
StaticProc int aarp_delete_amt_info();
StaticProc void aarp_build_pkt();
-StaticProc int aarp_sched_req();
+StaticProc void aarp_sched_req(void *);
StaticProc int aarp_get_rand_node();
StaticProc int aarp_get_next_node();
StaticProc int aarp_get_rand_net();
elapp->ifThisNode = elapp->initial_addr;
probing = PROBE_DONE;
-
+
+ /* AppleTalk was successfully started up. Send event with node and net. */
+ atalk_post_msg(elapp->aa_ifp, KEV_ATALK_ENABLED, &(elapp->ifThisNode), 0);
+
+ /* Set global flag */
+ at_state.flags |= AT_ST_STARTED;
+
return(0);
}
register at_ddp_t *ddp_hdrp;
int error;
int s;
+ struct timeval timenow;
+ getmicrouptime(&timenow);
if (gbuf_len(m) <= 0)
ddp_hdrp = (at_ddp_t *)gbuf_rptr(gbuf_cont(m));
amt_ptr->dest_at_addr = *dest_at_addr;
amt_ptr->dest_at_addr.atalk_unused = 0;
- amt_ptr->last_time = time.tv_sec;
+ getmicrouptime(&timenow);
+ amt_ptr->last_time = timenow.tv_sec;
amt_ptr->m = m;
amt_ptr->elapp = elapp;
amt_ptr->no_of_retries = 0;
*
****************************************************************************/
-int aarp_sched_probe()
+void aarp_sched_probe(void *arg)
{
- boolean_t funnel_state;
- funnel_state = thread_funnel_set(network_flock, TRUE);
+ atalk_lock();
- if (probe_cb.no_of_retries != AARP_MAX_PROBE_RETRIES) {
+ if (probe_cb.elapp->aa_ifp != 0 &&
+ probe_cb.no_of_retries != AARP_MAX_PROBE_RETRIES) {
if (aarp_send_probe() == -1)
AARPwakeup(&probe_cb);
} else {
AARPwakeup(&probe_cb);
}
- (void) thread_funnel_set(network_flock, FALSE);
- return(0);
+ atalk_unlock();
}
*
****************************************************************************/
-StaticProc int aarp_sched_req(amt_ptr)
- register aarp_amt_t *amt_ptr;
+StaticProc void aarp_sched_req(arg)
+ void *arg;
{
int s, i;
- boolean_t funnel_state;
+ aarp_amt_t *amt_ptr = (aarp_amt_t *)arg;
- funnel_state = thread_funnel_set(network_flock, TRUE);
+ atalk_lock();
/*
* make sure pointer still valid in case interface removed
* into one of the amt arrays.
*/
for (i = 0; i < IF_TOTAL_MAX; i++) {
- if (aarp_table[i] == NULL || amt_ptr < aarp_table[i] || amt_ptr >= (aarp_table[i] + 1))
+ if (aarp_table[i] == NULL || (void *)amt_ptr < (void *)aarp_table[i] ||
+ (void *)amt_ptr >= (void *)(aarp_table[i] + 1))
continue; /* no match - try next entry */
/*
ATDISABLE(s, arpinp_lock);
if (amt_ptr->tmo == 0) {
ATENABLE(s, arpinp_lock);
- (void) thread_funnel_set(network_flock, FALSE);
- return(0);
+ atalk_unlock();
+ return;
}
if (amt_ptr->no_of_retries < AARP_MAX_REQ_RETRIES) {
ATENABLE(s, arpinp_lock);
if (aarp_send_req(amt_ptr) == 0) {
- (void) thread_funnel_set(network_flock, FALSE);
- return(0);
+ atalk_unlock();
+ return;
}
ATDISABLE(s, arpinp_lock);
}
aarp_delete_amt_info(amt_ptr);
break;
}
- (void) thread_funnel_set(network_flock, FALSE);
+ atalk_unlock();
- return(0);
+ return;
}