#include <netinet/if_ether.h>

netinet/if_ether.h

includes: sys/appleapiopts.h, net/ethernet.h, netinet/in.h, net/if_arp.h
12 macros · 2 structs

macroea_byte

#define ea_byte ether_addr_octet

macroETHER_MAP_IP_MULTICAST

Macro to map an IP multicast address to an Ethernet multicast address. The high-order 25 bits of the Ethernet address are statically assigned, and the low-order 23 bits are taken from the low end of the IP address.
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) /* struct in_addr *ipaddr; */
	/* u_char enaddr[ETHER_ADDR_LEN];	   */
{
	(enaddr)[0] = 0x01;
	(enaddr)[1] = 0x00;
	(enaddr)[2] = 0x5e;
	(enaddr)[3] = ((const u_char *)ipaddr)[1] & 0x7f;
	(enaddr)[4] = ((const u_char *)ipaddr)[2];
	(enaddr)[5] = ((const u_char *)ipaddr)[3];
}

macroETHER_MAP_IPV6_MULTICAST

Macro to map an IP6 multicast address to an Ethernet multicast address. The high-order 16 bits of the Ethernet address are statically assigned, and the low-order 32 bits are taken from the low end of the IP6 address.
#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) /* struct	in6_addr *ip6addr; */
/* u_char	enaddr[ETHER_ADDR_LEN]; */
{
	(enaddr)[0] = 0x33;
	(enaddr)[1] = 0x33;
	(enaddr)[2] = ((const u_char *)ip6addr)[12];
	(enaddr)[3] = ((const u_char *)ip6addr)[13];
	(enaddr)[4] = ((const u_char *)ip6addr)[14];
	(enaddr)[5] = ((const u_char *)ip6addr)[15];
}

structether_arp

Ethernet Address Resolution Protocol. See RFC 826 for protocol description. Structure below is adapted to resolving internet addresses. Field names used correspond to RFC 826.
size 28, align 2
struct arphdrea_hdrfixed-size header
u_char[6]arp_shasender hardware address
u_char[4]arp_spasender protocol address
u_char[6]arp_thatarget hardware address
u_char[4]arp_tpatarget protocol address

macroarp_hrd

#define arp_hrd ea_hdr.ar_hrd

macroarp_pro

#define arp_pro ea_hdr.ar_pro

macroarp_hln

#define arp_hln ea_hdr.ar_hln

macroarp_pln

#define arp_pln ea_hdr.ar_pln

macroarp_op

#define arp_op ea_hdr.ar_op

structsockaddr_inarp

size 16, align 4
u_charsin_len
u_charsin_family
u_shortsin_port
struct in_addrsin_addr
struct in_addrsin_srcaddr
u_shortsin_tos
u_shortsin_other

macroSIN_PROXY

#define SIN_PROXY 0x1

macroSIN_ROUTER

#define SIN_ROUTER 0x2

macroRTF_USETRAILERS

IP and ethernet specific routing flags
#define RTF_USETRAILERS RTF_PROTO1
use trailers

macroRTF_ANNOUNCE

#define RTF_ANNOUNCE RTF_PROTO2
announce new arp entry