Class IPv4Packet
Defined in File PacketUtils.h
Inheritance Relationships
Base Type
public ska::pst::recv::PacketBuffer
(Class PacketBuffer)
Class Documentation
-
class IPv4Packet : public ska::pst::recv::PacketBuffer
Internet Protocol version 4 (IPV4) Interface to raw data stored in memory.
Public Functions
-
IPv4Packet() = default
Construct a new IPv4Packet object.
-
IPv4Packet(char *ptr, size_t size)
Construct a new IPv4Packet object from an existing address and size.
- Parameters
ptr – memory address of the packet
size – length of the packet
-
inline uint8_t version_ihl() const
Return the version and internet headler length of the packet.
-
inline uint8_t dscp_ecn() const
Return the Differentiated Services Code Point of the packet.
-
inline uint16_t total_length() const
Return the total length (header and data) of the packet in bytes.
-
inline uint16_t identification() const
Return the IPv4 Identification field of the packet.
-
inline uint16_t flags_frag_off() const
Return the Flags and Fragment Offset field of the packet.
-
inline uint8_t ttl() const
Return the Time to Live field of the packet.
-
inline uint8_t protocol() const
Return the Protocol field of the packet.
-
inline uint16_t checksum() const
Return the Header Checksum field of the packet.
-
inline ip_addr_v4 source_address() const
Return the IPv4 source address field of the packet.
-
inline ip_addr_v4 destination_address() const
Return the IPv4 destination address field of the packet.
-
bool is_fragment() const
Return true if the packet is fragmented.
-
size_t header_length() const
Return the length of the header in bytes.
-
int version() const
Return the version of the packet.
Public Static Attributes
-
static constexpr size_t min_size = 20
minimum size of an IPv4 packet
-
static constexpr uint16_t ethertype = 0x0800
value for the ethertype field in an IPv4 packet
-
static constexpr uint16_t flag_do_not_fragment = 0x4000
value of flags_frag_off field for do not fragment
-
static constexpr uint16_t flag_more_fragments = 0x2000
value of flags_frag_off field for more fragments
-
static constexpr uint16_t flag_more_fragments_bitmask = 0x1fff
bitmask to apply to flag_more_fragments to extract value
-
static constexpr uint8_t header_length_bitmask = 0xf
bitmask to applyo version_ihl() output to return header length
-
IPv4Packet() = default