Compiler Constants

Platform Constants

Platform constants conditionaly compile source code blocks based on the hardware architecture and host operating system. Hardware architecture constants are normally defined in system header files. Operating system constants are often compiler intrinsic or defined in system header files.

__APPLE__

A intrinsic compiler constant indicating Mac OS X™ operating system support.

__BYTE_ORDER

A standard constant indicating big or little endian host architecture. Some systems may not define this constant and so an alternative should be used.

LIBPCAP

An Atheros constant, that must be manually defined in your makefile or solution file, to indicate that the target host will have LibPcap support. It is not used by the toolkit, at this time, and so the associated code has not been tested.

__linux__

A standard constant indicating GNU/Linux™ kernel support. It is automatically defined on GNU/Linux™ systems.

__OpenBSD__

A standard constant indicating OpenBSD™ kernel support. It is automatically define on OpenBSD™ systems. It is not used by the toolkit, at this time, and so the associated code has not been extensively tested.

WIN32

A standard constant indicating Microsoft Windows™ support. It is automatically defined in Microsoft Windows™ environments.

WINPCAP

An Atheros constant, that must be manually defined in your makefile or solution file, to indicate that the target host will have WinPcap support. The toolkit only defines this constant in Windows Microsoft project files for programs that perform raw Ethernet I/O.

Ethernet Constants

The toolkit attempts to use existing definitions for Ethernet related constants where possible. This has been problematic due to inconsistencies in the way different systems structure their header files. Most of the following definitions already exist on Linux™, OpenBSD™ and OS X™ but there are still some differences between Linux™ distributions and many constants are undefined on Windows™.

The Windows™ version of the toolkit includes an abbreviated net/ethernet.h that provides constant definitions mentioned in this section.

ETHER_ADDR_LEN

The length of an Ethernet hardware address in bytes. The value is 6 bytes. On Linux™ and OS X™, this is defined in net/ethernet.h.

ETHER_CRC_LEN

The length of an Ethernet frame FCS trailer. The value is 4 bytes. On Linux™ and OS X™, this is defined in net/ethernet.h. Atheros also includes a conditional definition in int6k/int6k.h because some Linux™ system do not define it anywhere.

ETHER_HDR_LEN

The length of an Ethernet frame header including the source address, destination address and type/length field. The value is 14 bytes or ETHER_ADDR_LEN + ETHER_ADDR_LEN + ETHER_TYPE_LEN. On Linux™ and OS X™, this is defined in net/ethernet.h.

ETHER_MAX_LEN

The maximum length of an Ethernet frame in bytes. The value is 1518 bytes of ETHER_HDR_LEN + ETHERMTU + ETHER_CRC_LEN. On Linux™ and OS X™, this is defined in net/ethernet.h.

ETHER_MIN_LEN

The minimum length of an Ethernet frame in bytes. The value is 64 bytes. On Linux™ and OS X™ this is defined in net/ethernet.h

ETHER_TYPE_LEN

The length of Ethernet type/length, or ethertype, field in bytes. The value is 2. On Linux™ and OS X™, it is defined in net/ethernet.h.

ETHERMTU

The maximum transfer unit (ie; data handling capacity) for an Ethernet frame in bytes. The value is 1500 bytes. On Linux™ and OS X™, this is defined in net/ethernet.h