Class: Pcap::Packet
- Inherits:
-
Object
show all
- Defined in:
- lib/pcap/packet.rb,
ext/pcap/packet.c
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
._load ⇒ Object
152
153
154
|
# File 'ext/pcap/packet.c', line 152
static VALUE
packet_load(class, str)
VALUE class;
|
._load_from ⇒ Object
marshal backward compatibility
152
153
154
|
# File 'ext/pcap/packet.c', line 152
static VALUE
packet_load(class, str)
VALUE class;
|
Instance Method Details
#=~ ⇒ Object
273
274
275
|
# File 'ext/pcap/packet.c', line 273
static VALUE
packet_match(self, expr)
VALUE self;
|
#_dump ⇒ Object
208
209
210
|
# File 'ext/pcap/packet.c', line 208
static VALUE
packet_dump(self, limit)
VALUE self;
|
#_dump_to ⇒ Object
208
209
210
|
# File 'ext/pcap/packet.c', line 208
static VALUE
packet_dump(self, limit)
VALUE self;
|
#caplen ⇒ Object
#datalink ⇒ Object
#dst_mac_address ⇒ Object
14
15
16
|
# File 'lib/pcap/packet.rb', line 14
def dst_mac_address
return unpack_hex_string(raw_data[0, 6])
end
|
#ethertype ⇒ Object
18
19
20
|
# File 'lib/pcap/packet.rb', line 18
def ethertype
raw_data[12, 14].unpack('n')[0]
end
|
#inspect ⇒ Object
7
8
9
|
# File 'lib/pcap/packet.rb', line 7
def inspect
"#<#{self.class}: #{self}>"
end
|
#length ⇒ Object
#raw_data ⇒ Object
#size ⇒ Object
#src_mac_address ⇒ Object
10
11
12
|
# File 'lib/pcap/packet.rb', line 10
def src_mac_address
return unpack_hex_string(raw_data[6, 12])
end
|
#time ⇒ Object
#time_i ⇒ Object
#time_i= ⇒ Object
256
257
258
|
# File 'ext/pcap/packet.c', line 256
static VALUE
packet_set_time_i(self, val)
VALUE self;
|
#to_s ⇒ Object
3
4
5
|
# File 'lib/pcap/packet.rb', line 3
def to_s
'Some packet'
end
|
#udata ⇒ Object
#udata= ⇒ Object
241
242
243
|
# File 'ext/pcap/packet.c', line 241
static VALUE
packet_set_udata(self, val)
VALUE self;
|
#unpack_hex_string(hex) ⇒ Object
22
23
24
|
# File 'lib/pcap/packet.rb', line 22
def unpack_hex_string(hex)
hex.unpack('H2H2H2H2H2H2').join('')
end
|