#ifndef _NETAT_AT_AARP_H_
#define _NETAT_AT_AARP_H_
#include <sys/appleapiopts.h>
#ifdef KERNEL_PRIVATE
#include <netat/at_var.h>
#endif KERNEL_PRIVATE
#ifdef __APPLE_API_OBSOLETE
typedef struct {
u_short hardware_type;
u_short stack_type;
u_char hw_addr_len;
u_char stack_addr_len;
u_short aarp_cmd;
struct etalk_addr src_addr;
struct atalk_addr src_at_addr;
struct etalk_addr dest_addr;
struct atalk_addr dest_at_addr;
} aarp_pkt_t;
#define AARP_AT_TYPE 0x80F3
#define AARP_ETHER_HW_TYPE 0x1
#define AARP_AT_PROTO 0x809B
#define AARP_ETHER_ADDR_LEN 6
#define AARP_AT_ADDR_LEN 4
#define AARP_REQ_CMD 0x1
#define AARP_RESP_CMD 0x2
#define AARP_PROBE_CMD 0x3
#define AARP_MAX_PROBE_RETRIES 20
#define AARP_PROBE_TIMER_INT HZ/30
#define AARP_MAX_REQ_RETRIES 10
#define AARP_REQ_TIMER_INT HZ/30
#define AARP_MAX_NODES_TRIED 200
#define AARP_MAX_NETS_TRIED 10
#define PROBE_IDLE 0x1
#define PROBE_TENTATIVE 0x2
#define PROBE_DONE 0x3
#define AARP_ERR_NOT_OURS 1
#ifdef KERNEL_PRIVATE
typedef struct {
struct atalk_addr dest_at_addr;
struct etalk_addr dest_addr;
char dummy[2];
time_t last_time;
int no_of_retries;
gbuf_t *m;
at_ifaddr_t *elapp;
int error;
int tmo;
} aarp_amt_t;
#define AMT_BSIZ 4
#define AMT_NB 64
#define AMTSIZE (AMT_BSIZ * AMT_NB)
typedef struct {
aarp_amt_t et_aarp_amt[AMTSIZE];
} aarp_amt_array;
#define AMT_HASH(a) \
((NET_VALUE(((struct atalk_addr *)&a)->atalk_net) + ((struct atalk_addr *)&a)->atalk_node) % AMT_NB)
#define AMT_LOOK(at, at_addr, elapp) { \
int n; \
at = &aarp_table[elapp->ifPort]->et_aarp_amt[AMT_HASH(at_addr) * AMT_BSIZ]; \
for (n = 0 ; ; at++) { \
if (at->dest_at_addr.atalk_node == (at_addr).atalk_node && \
NET_EQUAL(at->dest_at_addr.atalk_net, (at_addr).atalk_net)) \
break; \
if (++n >= AMT_BSIZ) { \
at = NULL; \
break; \
} \
} \
}
#define NEW_AMT(at, at_addr, elapp) { \
int n; \
aarp_amt_t *myat; \
myat = at = &aarp_table[elapp->ifPort]->et_aarp_amt[AMT_HASH(at_addr) * AMT_BSIZ]; \
for (n = 0 ; ; at++) { \
if (at->last_time == 0) \
break; \
if (++n >= AMT_BSIZ) { \
at = aarp_lru_entry(myat); \
break; \
} \
} \
}
#define AARP_NET_MCAST(p, elapp) \
(NET_VALUE((p)->dst_net) == elapp->ifThisNode.s_net) \
)
#define AARP_CABLE_MCAST(p) \
(NET_VALUE((p)->dst_net) == 0x0000 \
)
#define AARP_BROADCAST(p, elapp) \
(((p)->dst_node == 0xff) && \
( \
(NET_VALUE((p)->dst_net) == 0x0000) || \
(NET_VALUE((p)->dst_net) == elapp->ifThisNode.s_net)) \
)
#define ETHER_ADDR_EQUAL(addr1p, addr2p) \
(( \
((addr1p)->etalk_addr_octet[0]==(addr2p)->etalk_addr_octet[0]) && \
((addr1p)->etalk_addr_octet[1]==(addr2p)->etalk_addr_octet[1]) && \
((addr1p)->etalk_addr_octet[2]==(addr2p)->etalk_addr_octet[2]) && \
((addr1p)->etalk_addr_octet[3]==(addr2p)->etalk_addr_octet[3]) && \
((addr1p)->etalk_addr_octet[4]==(addr2p)->etalk_addr_octet[4]) && \
((addr1p)->etalk_addr_octet[5]==(addr2p)->etalk_addr_octet[5]) \
) ? 1 : 0 \
)
int aarp_chk_addr(at_ddp_t *, at_ifaddr_t *);
int aarp_rcv_pkt(aarp_pkt_t *, at_ifaddr_t *);
void AARPwakeup(aarp_amt_t *);
int aarp_send_data(gbuf_t *, at_ifaddr_t *, struct atalk_addr *, int);
#endif
#endif
#endif