Sha256: a4a98cf0bcb33c0daceede2c080f7b1ca7730ad7a42a87a09cefc807764be162
Contents?: true
Size: 817 Bytes
Versions: 1
Compression:
Stored size: 817 Bytes
Contents
class UDPHeader attr_reader :sndr_port,:dist_port,:packet_length,:checksum, :data_length,:lower def initialize(packet,offset=0,length=nil,lower=nil) @packet = packet @offset = offset header = packet.unpack("x#{offset}n4") @sndr_port = header[0] @dist_port = header[1] @packet_length = header[2] @checksum = header[3] @data_length = @packet_length - 8 @lower = lower end def data if(@packet_length>8) @packet[@offset+8..@offset+@packet_length] else "" end end def to_s "" << "UDP Header\n" << " Sender Port : #{@sndr_port}\n" << " Distication Port: #{@dist_port}\n" << " Packet Length : #{@packet_length}\n" << " Checksum : #{@checksum}\n" << " (Data Length) : #{@data_length}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-sflow-0.1.0 | lib/sflow/lib/sflow/models/udpheader.rb |