EtherRaw
Public Types | Public Member Functions
PacketIPv4 Class Reference

Support for IP PAcket Headers. More...

#include <EtherRaw.h>

List of all members.

Public Types

enum  IPProto {
  IPPROTO_IP = 0, IPPROTO_HOPOPTS = 0, IPPROTO_ICMP = 1, IPPROTO_IGMP = 2,
  IPPROTO_IPIP = 4, IPPROTO_TCP = 6, IPPROTO_EGP = 8, IPPROTO_PUP = 12,
  IPPROTO_UDP = 17, IPPROTO_IDP = 22, IPPROTO_TP = 29, IPPROTO_DCCP = 33,
  IPPROTO_IPV6 = 41, IPPROTO_ROUTING = 43, IPPROTO_FRAGMENT = 44, IPPROTO_RSVP = 46,
  IPPROTO_GRE = 47, IPPROTO_ESP = 50, IPPROTO_AH = 51, IPPROTO_ICMPV6 = 58,
  IPPROTO_NONE = 59, IPPROTO_DSTOPTS = 60, IPPROTO_MTP = 92, IPPROTO_ENCAP = 98,
  IPPROTO_PIM = 103, IPPROTO_COMP = 108, IPPROTO_SCTP = 132, IPPROTO_UDPLITE = 136,
  IPPROTO_RAW = 255, IPPROTO_MAX
}
 Definitions of protocol number for protocol() More...

Public Member Functions

uint8_t version () const
uint8_t headerlen () const
uint8_t service () const
uint8_t precedence () const
uint16_t length () const
uint16_t id () const
uint8_t flags () const
uint16_t offset () const
uint8_t ttl () const
uint8_t protocol () const
const IPv4Addresssource () const
const IPv4Addressdest () const
uint16_t checksum () const
uint8_t * payload ()
size_t printTo (Print &p) const

Detailed Description

Support for IP PAcket Headers.

This class allows easy access to the contents of an IP Packet Header in on-the-wire format.


Member Enumeration Documentation

Definitions of protocol number for protocol()

Enumerator:
IPPROTO_HOPOPTS 

Dummy protocol for TCP.

IPPROTO_ICMP 

IPv6 Hop-by-Hop options.

IPPROTO_IGMP 

Internet Control Message Protocol.

IPPROTO_IPIP 

Internet Group Management Protocol.

IPPROTO_TCP 

IPIP tunnels (older KA9Q tunnels use 94).

IPPROTO_EGP 

Transmission Control Protocol.

IPPROTO_PUP 

Exterior Gateway Protocol.

IPPROTO_UDP 

PUP protocol.

IPPROTO_IDP 

User Datagram Protocol.

IPPROTO_TP 

XNS IDP protocol.

IPPROTO_DCCP 

SO Transport Protocol Class 4.

IPPROTO_IPV6 

Datagram Congestion Control Protocol.

IPPROTO_ROUTING 

IPv6 header.

IPPROTO_FRAGMENT 

IPv6 routing header.

IPPROTO_RSVP 

IPv6 fragmentation header.

IPPROTO_GRE 

Reservation Protocol.

IPPROTO_ESP 

General Routing Encapsulation.

IPPROTO_AH 

encapsulating security payload.

IPPROTO_ICMPV6 

authentication header.

IPPROTO_NONE 

ICMPv6.

IPPROTO_DSTOPTS 

IPv6 no next header.

IPPROTO_MTP 

IPv6 destination options.

IPPROTO_ENCAP 

Multicast Transport Protocol.

IPPROTO_PIM 

Encapsulation Header.

IPPROTO_COMP 

Protocol Independent Multicast.

IPPROTO_SCTP 

Compression Header Protocol.

IPPROTO_UDPLITE 

Stream Control Transmission Protocol.

IPPROTO_RAW 

UDP-Lite protocol.

IPPROTO_MAX 

Raw IP packets.


Member Function Documentation

uint16_t PacketIPv4::checksum ( ) const

Access the packet checksum return the checksum in native byte order.

Referenced by printTo().

const IPv4Address & PacketIPv4::dest ( ) const

Access the destination IP address

Returns:
A reference to the destination address
uint8_t PacketIPv4::flags ( ) const

Access the packet flags

Returns:
The packet flags
uint8_t PacketIPv4::headerlen ( ) const

Access the packet header len.

Returns:
The header length in 32bit words

Referenced by payload().

uint16_t PacketIPv4::id ( ) const

Access the packet ID.

Returns:
The packet ID in native byte order.
uint16_t PacketIPv4::length ( ) const

Access the packet length

Returns:
The total packet length including payload and header in native byte order.

Referenced by printTo().

uint16_t PacketIPv4::offset ( ) const

Access the packet fragment offset

Returns:
The packet fragment offset in native byte order.
uint8_t * PacketIPv4::payload ( )

Access the packet payload

Returns:
A pointer to the packet payload data

References headerlen().

uint8_t PacketIPv4::precedence ( ) const

Access the packet precendence.

Returns:
The precendence
size_t PacketIPv4::printTo ( Print &  p) const

Print. Prints an ASCII formatted version of the header to a Printable such as Serial.

Returns:
The number of characters printed

References checksum(), length(), protocol(), service(), and ttl().

uint8_t PacketIPv4::protocol ( ) const

Access the packet protocol

Returns:
The packet protocol, one of IPProto.

Referenced by printTo().

uint8_t PacketIPv4::service ( ) const

Access the service type (also called TOS).

Returns:
The service type, one of IPTOS_*

Referenced by printTo().

const IPv4Address & PacketIPv4::source ( ) const

Access the source IP address

Returns:
A reference to the source address
uint8_t PacketIPv4::ttl ( ) const

Access the packet time-to-live.

Returns:
the packet time-to-live.

Referenced by printTo().

uint8_t PacketIPv4::version ( ) const

Access the packet header version.

Returns:
The header version

The documentation for this class was generated from the following files: