O'Reilly logo

iOS and OS X Network Programming Cookbook by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Decoding Ethernet headers

If we recall how the headers are layered from this chapter's introduction, the first layer we will need to peel off is the Ethernet (Link layer) header. It looks like this:

Decoding Ethernet headers

The hardware will filter out the preamble, so we will not have access to it, but we need to retrieve the following elements:

  • Destination Address: This is the MAC address of the computer that this packet is being sent to
  • Source Address: This is the MAC address of the computer that this packet came from
  • Type: This is used to indicate the type of protocol that is encapsulated. Some of the common protocols are as follows:
    • 0x0800—IPv4
    • 0x0806—ARP
    • 0x8035—RARP
    • 0x86DD—IPv6 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required