struct Tuntap::IpPacket
- Tuntap::IpPacket
- Struct
- Value
- Object
Overview
Provides easy access to the IP header and its payload.
Defined in:
tuntap/ip_packet.crConstructors
-
.new(frame : Bytes, has_pi : Bool = true, has_ethernet : Bool = false)
Encapsulates frame as a IPv4 packet with or without the PI header (has_pi).
Instance Method Summary
- #[](*args, **options)
- #[](*args, **options, &)
-
#destination_address : String
The destination address of the IP header as readable string.
-
#destination_mac : String
The destination hardware address.
-
#ethernet : Header::Ethernet
Returns the ethernet header.
-
#frame : Bytes
The whole packet
-
#has_ethernet? : Bool
Does the frame have an ethernet header?
-
#has_pi? : Bool
Does the frame has the PI header?
-
#ip_header_length
Length of the IP header
-
#ipv4 : Header::Ipv4
Returns the IPv4 header from the packet.
-
#pi : Header::Pi
Returns the PI header.
- #size(*args, **options)
- #size(*args, **options, &)
-
#source_address : String
The source address of the IP header as readable string.
-
#source_mac : String
The source hardware address.
-
#without_ethernet : Bytes
Returns the frame without the ethernet header (if there is one).
-
#without_ip : Bytes
Returns the IP payload
-
#without_pi : Bytes
Returns the frame without the PI header (if there is one)
Constructor Detail
Encapsulates frame as a IPv4 packet with or without the PI header
(has_pi). has_ethernet commonly refers to the source being a
TUN (= false
) or TAP (= true
) device.
Instance Method Detail
Returns the ethernet header. If this packet does not have it, the returned header will contain junk data.
Returns the IPv4 header from the packet. No check is done if the packet really contains IPv4 data.
Returns the PI header. If this packet does not have it, the returned header will contain junk data.