Class: Libnet::IPv4
Overview
IPv4
Class to represent a version 4 RFC 791 Internet Protocol (IP) header.
Example
i = Libnet::IPv4.new
i.tos = 0x12
i.length = Libnet::HL_IPV4 + payload.length
i.id = 0x4321
i.frag_off = 0
i.ttl = 72
i.protocol = Libnet::IPPROTO_UDP
i.checksum = 0
i.src_ip = '192.168.1.2'
i.dst_ip = 0xc0a80103
i.payload = "this is the message"
Public Class Methods
decode(string) -> new IPv4 object
Decode a packed IPv4 packet.
Public Instance Methods
version, version?
Get/query the IP version.
ihl, ihl?
Get/query the IP header length.
tos, tos=, tos?
Get/set/query the type of service.
length, length=, length?
Get/set/query the total length of the IP packet.
id, id=, id?
Get/set/query the IP identification number.
frag_off, frag_off=, frag_off?
Get/set/query the fragmentation bits and offset.
ttl, ttl=, ttl?
Get/set/query the time to live.
protocol, protocol=, protocol?
Get/set/query the upper layer protocol.
checksum, checksum=, checksum?
Get/set/query the checksum. Set to 0 for Libnet to autofill.
src_ip, src_ip=, src_ip?
Get/set/query the source IP address.
dst_ip, dst_ip=, dst_ip?
Get/set/query the destination IP address.
payload, payload=, payload?
Get/set/query the payload.
ptag
Get the ptag value for this header object. Set by the Libnet builder method.
Constant Summary
Constants inherited from Header
Header::DEFAULT_OPTS, Header::HWADDR_RE, Header::IPADDR_RE, Header::UNIT_MULTIPLIERS
Instance Attribute Summary
Attributes inherited from Header
Method Summary
Methods inherited from Header
assignment_filter, decode, fields, inherited, #initialize, octets_field, unsigned_field
Methods included from Helpers
Constructor Details
This class inherits a constructor from Libnet::Header