class Mu::Pcap::IP

Constants

IPPROTO_AH
IPPROTO_DSTOPTS
IPPROTO_FRAGMENT
IPPROTO_HOPOPTS
IPPROTO_NONE
IPPROTO_ROUTING
IPPROTO_SCTP
IPPROTO_TCP
IPPROTO_UDP

Attributes

dst[RW]
src[RW]

Public Class Methods

checksum(bytes) click to toggle source
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 49
def self.checksum bytes
    if bytes.size & 1 == 1
        bytes = bytes + "\0"
    end
    sum = 0
    bytes.unpack("n*").each { |n| sum += n }
    sum = (sum & 0xffff) + (sum >> 16 & 0xffff)
    ~sum & 0xffff
end
new(src=nil, dst=nil) click to toggle source
Calls superclass method
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 21
def initialize src=nil, dst=nil
    super()
    @src = src
    @dst = dst
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 43
def == other
    return super &&
        self.src == other.src &&
        self.dst == other.dst
end
proto() click to toggle source
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 35
def proto
    raise NotImplementedError
end
pseudo_header(payload_length) click to toggle source
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 39
def pseudo_header payload_length
    raise NotImplementedError
end
v4?() click to toggle source
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 27
def v4?
    return false
end
v6?() click to toggle source
# File lib/woolen_common/pcap/mu/pcap/ip.rb, line 31
def v6?
    return false
end