Class: Dot11::Packet
- Inherits:
-
Object
show all
- Defined in:
- lib/dot11/packet.rb
Direct Known Subclasses
Dot11, Dot11::Dot11ATIM, Dot11::Dot11AssoReq, Dot11::Dot11AssoResp, Dot11::Dot11Auth, Dot11::Dot11Beacon, Dot11::Dot11Data, Dot11::Dot11Deauth, Dot11::Dot11Disas, Dot11::Dot11Elt, Dot11::Dot11NullData, Dot11::Dot11ProbeReq, Dot11::Dot11ProbeResp, Dot11::Dot11ReassoReq, Dot11::Dot11ReassoResp, Dot11::Dot11WEP, Dot11::LLC, Dot11::SNAP, Radiotap, Raw
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(parameters = {}) ⇒ Packet
Returns a new instance of Packet.
18
19
20
21
22
23
24
25
26
|
# File 'lib/dot11/packet.rb', line 18
def initialize(parameters = {})
if parameters.kind_of?(String)
dissect(parameters)
elsif parameters.kind_of?(Hash)
parameters.each_pair do |key, value|
send((key.to_s + "=").intern, value)
end
end
end
|
Class Method Details
.new(parameters = {}) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/dot11/packet.rb', line 8
def new(parameters = {})
if !parameters.kind_of?(String) && parameters.values.any? {|v| v.kind_of?(Array) || v.kind_of?(Range)}
PacketSet.new(self, parameters)
else
older_new(parameters)
end
end
|
.older_new ⇒ Object
6
|
# File 'lib/dot11/packet.rb', line 6
alias older_new new
|
Instance Method Details
#=~(other) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/dot11/packet.rb', line 28
def =~(other)
if other.kind_of?(Hash)
other.each_pair do |key, value|
return false if self.send(key) != value
end
return true
end
end
|
#to_filter ⇒ Object
38
39
40
41
42
43
|
# File 'lib/dot11/packet.rb', line 38
def to_filter
PacketSet.new(self.class, self.instance_variables.inject({}) do |accum, var|
accum[var[1..-1].intern] = self.instance_variable_get(var).kind_of?(MACAddress) ? self.instance_variable_get(var).to_s : self.instance_variable_get(var).to_s
accum
end).to_filter
end
|