#ifndef _NETAT_DDP_H_
#define _NETAT_DDP_H_
#include <sys/appleapiopts.h>
#ifdef __APPLE_API_OBSOLETE
#define DDP_HDR_SIZE 5
#define DDP_X_HDR_SIZE 13
#define DDP_DATA_SIZE 586
#define DDP_DATAGRAM_SIZE 599
#define DDP_SOCKET_1st_RESERVED 1
#define DDP_SOCKET_1st_EXPERIMENTAL 64
#define DDP_SOCKET_1st_DYNAMIC 128
#define DDP_SOCKET_LAST 253
#define DEFAULT_OT_DDPTYPE 11
#define RTMP_SOCKET 1
#define NBP_SOCKET 2
#define EP_SOCKET 4
#define ZIP_SOCKET 6
typedef struct {
unsigned unused:2,
hopcount:4,
length:10;
ua_short checksum;
at_net dst_net;
at_net src_net;
at_node dst_node;
at_node src_node;
at_socket dst_socket;
at_socket src_socket;
u_char type;
char data[DDP_DATA_SIZE];
} at_ddp_t;
#define DDPLEN_ASSIGN(ddp, len) ddp->length = len
#define DDPLEN_VALUE(ddp) ddp->length
typedef struct at_ddp_stats {
u_int rcv_bytes;
u_int rcv_packets;
u_int rcv_bad_length;
u_int rcv_unreg_socket;
u_int rcv_bad_socket;
u_int rcv_bad_checksum;
u_int rcv_dropped_nobuf;
u_int xmit_bytes;
u_int xmit_packets;
u_int xmit_BRT_used;
u_int xmit_bad_length;
u_int xmit_bad_addr;
u_int xmit_dropped_nobuf;
} at_ddp_stats_t;
#define AT_MID_DDP 203
#define DDP_IOC_MYIOCTL(i) ((i>>8) == AT_MID_DDP)
#define DDP_IOC_GET_CFG ((AT_MID_DDP<<8) | 1)
#ifdef NOT_USED
#define DDP_IOC_BIND_SOCK ((AT_MID_DDP<<8) | 2)
#define DDP_IOC_GET_STATS ((AT_MID_DDP<<8) | 3)
#define DDP_IOC_LSTATUS_TABLE ((AT_MID_DDP<<8) | 4)
#define DDP_IOC_ULSTATUS_TABLE ((AT_MID_DDP<<8) | 5)
#define DDP_IOC_RSTATUS_TABLE ((AT_MID_DDP<<8) | 6)
#define DDP_IOC_SET_WROFF ((AT_MID_DDP<<8) | 7 )
#define DDP_IOC_SET_OPTS ((AT_MID_DDP<<8) | 8 )
#define DDP_IOC_GET_OPTS ((AT_MID_DDP<<8) | 9 )
#define DDP_IOC_GET_SOCK ((AT_MID_DDP<<8) | 10)
#define DDP_IOC_GET_PEER ((AT_MID_DDP<<8) | 11)
#define DDP_IOC_SET_PEER ((AT_MID_DDP<<8) | 12)
#define DDP_IOC_SET_PROTO ((AT_MID_DDP<<8) | 13)
#endif
#ifdef KERNEL_PRIVATE
#define DDP_MIN_NETWORK 0x0001
#define DDP_MAX_NETWORK 0xfffe
#define DDP_STARTUP_LOW 0xff00
#define DDP_STARTUP_HIGH DDP_MAX_NETWORK
typedef struct {
void **inputQ;
int *pidM;
char **socketM;
char *dbgBits;
} proto_reg_t;
#define FROM_US(ddp) ((NET_VALUE(ddp->src_net) ==\
ifID_home->ifThisNode.s_net) && \
ifID_home->ifThisNode.s_node == ddp->src_node)
#define RT_LOOKUP_OKAY(ifID, ddp) \
((ROUTING_MODE && ifID->ifRoutingState==PORT_ONLINE) || \
(MULTIHOME_MODE && FROM_US(ddp)))
#ifdef NOT_YET
int ddp_adjmsg(gbuf_t *m, int len);
gbuf_t *ddp_growmsg(gbuf_t *mp, int len);
int ddp_add_if(at_ifaddr_t *ifID);
int ddp_rem_if(at_ifaddr_t *ifID);
int ddp_bind_socket(ddp_socket_t *socketp);
int ddp_close_socket(ddp_socket_t *socketp);
int ddp_output(gbuf_t **mp, at_socket src_socket, int src_addr_included);
void ddp_input(gbuf_t *mp, at_ifaddr_t *ifID);
int ddp_router_output(
gbuf_t *mp,
at_ifaddr_t *ifID,
int addr_type,
at_net_al router_net,
at_node router_node,
etalk_addr_t *enet_addr);
int ddp_close(gref_t *gref);
void ddp_putmsg(gref_t *gref, gbuf_t *mp);
gbuf_t *ddp_compress_msg(gbuf_t *mp);
void ddp_stop(gbuf_t *mioc, gref_t *gref);
void ddp_bit_reverse(unsigned char *);
#endif
int ddp_shutdown(int);
#endif
#endif
#endif