/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
- * Copyright (c) 1987, 1988, 1989 Apple Computer, Inc.
- *
- *
* Modified for MP, 1996 by Tuyen Nguyen
* Added AURP support, April 8, 1996 by Tuyen Nguyen
* Modified, March 17, 1997 by Tuyen Nguyen for MacOSX.
#include <netat/sysglue.h>
#include <netat/appletalk.h>
+#include <netat/at_pcb.h>
#include <netat/at_var.h>
#include <netat/ddp.h>
#include <netat/ep.h>
#include <netat/nbp.h>
#include <netat/rtmp.h>
#include <netat/zip.h>
-#include <netat/at_pcb.h>
#include <netat/routing_tables.h>
#include <netat/at_snmp.h>
#include <netat/aurp.h>
#include <netat/at_aarp.h>
#include <netat/adsp.h>
#include <netat/adsp_internal.h>
+#include <netat/at_pat.h>
+#include <netat/atp.h>
+
+#include <net/kpi_protocol.h>
/* globals */
/* Queue of LAP interfaces which have registered themselves with DDP */
struct at_ifQueueHd at_ifQueueHd;
-extern at_state_t at_state;
extern TAILQ_HEAD(name_registry, _nve_) name_registry;
snmpStats_t snmpStats; /* snmp ddp & echo stats */
extern at_ifaddr_t at_interfaces[];
/* routing mode special */
-void (*ddp_AURPsendx)();
+void (*ddp_AURPsendx)(void) = NULL;
at_ifaddr_t *aurp_ifID = 0;
-extern pktsIn,pktsOut;
-int pktsDropped,pktsHome;
+
+int pktsIn = 0;
+int pktsOut = 0;
+int pktsDropped = 0;
+int pktsHome = 0;
extern int *atp_pidM;
extern int *adsp_pidM;
extern struct atpcb *atp_inputQ[];
extern CCB *adsp_inputQ[];
-at_ifaddr_t *forUs(at_ddp_t *);
-
-void ddp_input(), ddp_notify_nbp();
+static void fillin_pkt_chain(gbuf_t *);
+static int ot_ddp_check_socket(unsigned char ,int pid);
-extern void routing_needed();
-extern void ddp_brt_sweep();
struct {
- void (*func)();
+ ddp_handler_func func;
} ddp_handler[256];
-void init_ddp_handler()
+void init_ddp_handler(void)
{
bzero(ddp_handler, sizeof(ddp_handler));
}
void add_ddp_handler(ddp_socket, input_func)
u_char ddp_socket;
- void (*input_func)();
+ ddp_handler_func input_func;
{
ddp_handler[ddp_socket].func = input_func;
}
ifa->ifa_addr = NULL;
ifnet_lock_done(ifID->aa_ifp);
}
- if (ifID->at_dl_tag) {
-/* dlil_detach_protocol(ifID->at_dl_tag); */
- ether_detach_at(ifID->aa_ifp);
- ifID->at_dl_tag = 0;
+ if (ifID->at_was_attached == 0 && ifID->aa_ifp != NULL) {
+ (void)proto_unplumb(PF_APPLETALK, ifID->aa_ifp);
}
/* un-do processing done in ddp_add_if() */
*/
/* *** Do we still need to do this? *** */
-int ot_ddp_check_socket(socket, pid)
+static int ot_ddp_check_socket(socket, pid)
unsigned char socket;
int pid;
{
return(cnt);
}
-void ddp_notify_nbp(socket, pid, ddptype)
- unsigned char socket;
- int pid;
- unsigned char ddptype; /* not used */
+void ddp_notify_nbp(
+ unsigned char socket,
+ int pid,
+ __unused unsigned char ddptype)
{
- extern int nve_lock;
nve_entry_t *nve_entry, *nve_next;
if (at_state.flags & AT_ST_STARTED) {
{
register at_ifaddr_t *ifID = ifID_home, *ifIDTmp = NULL;
register at_ddp_t *ddp;
- register ddp_brt_t *brt;
+ register ddp_brt_t *brt = NULL;
register at_net_al dst_net;
register int len;
struct atalk_addr at_dest;
int loop = 0;
int error = 0;
int addr_type;
- u_char addr_flag;
+ u_char addr_flag = 0;
char *addr = NULL;
register gbuf_t *m;
{ /* begin block */
struct etalk_addr dest_addr;
struct atalk_addr dest_at_addr;
- int loop = TRUE; /* flag to aarp to loopback (default) */
+
+ loop = TRUE; /* flag to aarp to loopback (default) */
m = *mp;
aarp_send_data(m,ifID, &dest_at_addr, loop);
break;
case ET_ADDR :
- pat_output(ifID, m, &dest_addr, 0);
+ pat_output(ifID, m, (unsigned char *)&dest_addr, 0);
break;
}
} /* end block */
len = DDPLEN_VALUE(ddp);
if (msgsize != len) {
- if ((unsigned) msgsize > len) {
+ if (msgsize > len) {
if (len < DDP_X_HDR_SIZE) {
dPrintf(D_M_DDP, D_L_ERROR,
("Length problems, ddp length %d, buffer length %d",
for packets of this type on a raw DDP socket *** */
if (ddp_handler[socket].func) {
dPrintf(D_M_DDP,D_L_INPUT,
- ("ddp_input: skt %d hdnlr:0x%x\n",
+ ("ddp_input: skt %u hdnlr:0x%p\n",
(u_int) socket, ddp_handler[socket].func));
pktsHome++;
snmpStats.dd_inLocal++;
{
register at_ddp_t *ddp;
struct atalk_addr at_dest;
- int addr_flag;
+ int addr_flag = 0;
char *addr = NULL;
register gbuf_t *m;
aarp_send_data(m,ifID,&dest_at_addr, loop);
break;
case ET_ADDR :
- pat_output(ifID, m, &dest_addr, 0);
+ pat_output(ifID, m, (unsigned char *)&dest_addr, 0);
break;
}
} /* end block */
/*****************************************/
+#ifdef AURP_SUPPORT
+
void rt_delete(NetStop, NetStart)
unsigned short NetStop;
unsigned short NetStart;
{
RT_entry *found;
- int s;
if ((found = rt_bdelete(NetStop, NetStart)) != 0) {
bzero(found, sizeof(RT_entry));
}
}
-#ifdef AURP_SUPPORT
int ddp_AURPfuncx(code, param, node)
int code;
void *param;
unsigned char node;
{
- extern void rtmp_timeout();
- extern void rtmp_send_port();
at_ifaddr_t *ifID;
int k;