#include <net/ndrv.h>

net/ndrv.h

@(#)ndrv.h 1.1 (MacOSX) 6/10/43 Justin Walker - 970604
includes: net/dlil.h, net/if_var.h, sys/appleapiopts.h, sys/types.h
12 macros · 3 structs

structsockaddr_ndrv

size 18, align 1
unsigned charsnd_len
unsigned charsnd_family
unsigned char[16]snd_namefrom if.h

macroNDRV_DEMUXTYPE_ETHERTYPE

#define NDRV_DEMUXTYPE_ETHERTYPE 4

macroNDRV_DEMUXTYPE_SAP

#define NDRV_DEMUXTYPE_SAP 5

macroNDRV_DEMUXTYPE_SNAP

#define NDRV_DEMUXTYPE_SNAP 6

macroNDRVPROTO_NDRV

#define NDRVPROTO_NDRV 0

structndrv_demux_desc

Struct: ndrv_demux_desc Purpose: To uniquely identify a packet based on its low-level framing information. Fields: type : type of protocol in data field, must be understood by the interface family of the interface the socket is bound to length : length of protocol data in "data" field data : union of framing-specific data, in network byte order ether_type : ethernet type in network byte order, assuming ethernet type II framing sap : first 3 bytes of sap header, network byte order snap : first 5 bytes of snap header, network byte order other : up to 28 bytes of protocol data for different protocol type Examples: 1) 802.1x uses ether_type 0x888e, so the descriptor would be set as: struct ndrv_demux_desc desc; desc.type = NDRV_DEMUXTYPE_ETHERTYPE desc.length = sizeof(unsigned short); desc.ether_type = htons(0x888e); 2) AppleTalk uses SNAP 0x080007809B struct ndrv_demux_desc desc; desc.type = NDRV_DEMUXTYPE_SNAP; desc.length = 5; desc.data.snap[0] = 08; desc.data.snap[1] = 00; desc.data.snap[2] = 07; desc.data.snap[3] = 80; desc.data.snap[4] = 9B;
size 32, align 2
u_int16_ttype
u_int16_tlength
unnamed union at net/ndrv.h:93:2data
u_int16_tether_type
u_int8_t[3]sap
u_int8_t[5]snap
u_int8_t[28]other

macroNDRV_PROTOCOL_DESC_VERS

#define NDRV_PROTOCOL_DESC_VERS 1

structndrv_protocol_desc

Struct: ndrv_protocol_desc Purpose: Used to "bind" an NDRV socket so that packets that match given protocol demux descriptions can be received: Field: version : must be NDRV_PROTOCOL_DESC_VERS protocol_family : unique identifier for this protocol demux_count : number of demux_list descriptors in demux_list; maximum of 10 demux_list : pointer to array of demux descriptors
size 24, align 8
u_int32_tversion
u_int32_tprotocol_family
u_int32_tdemux_count
struct ndrv_demux_desc *demux_list

macroSOL_NDRVPROTO

#define SOL_NDRVPROTO NDRVPROTO_NDRV
Use this socket level

macroNDRV_DELDMXSPEC

#define NDRV_DELDMXSPEC 0x02
Delete the registered protocol

macroNDRV_SETDMXSPEC

#define NDRV_SETDMXSPEC 0x04
Set the protocol spec

macroNDRV_ADDMULTICAST

#define NDRV_ADDMULTICAST 0x05
Add a physical multicast address

macroNDRV_DELMULTICAST

#define NDRV_DELMULTICAST 0x06
Delete a phyiscal multicast

macroNDRV_DMUX_MAX_DESCR

Max number of descriptions allowed by default
#define NDRV_DMUX_MAX_DESCR 1024

macroNRDV_MULTICAST_ADDRS_PER_SOCK

sysctl MIB tags at the kern.ipc.nrdv level
#define NRDV_MULTICAST_ADDRS_PER_SOCK 1
to toggle NDRV_DMUX_MAX_DESCR value