Class: Packetnom::Packet::Udp
- Inherits:
-
Object
- Object
- Packetnom::Packet::Udp
- Defined in:
- lib/packet/udp.rb
Instance Attribute Summary collapse
-
#dst_port ⇒ Object
(also: #dest_port, #dport)
Returns the value of attribute dst_port.
-
#length ⇒ Object
(also: #len)
Returns the value of attribute length.
-
#src_port ⇒ Object
(also: #source_port, #sport)
Attributes.
-
#sum ⇒ Object
(also: #checksum)
Returns the value of attribute sum.
Instance Method Summary collapse
-
#initialize(bytes) ⇒ Udp
constructor
Initialize the packet.
Constructor Details
#initialize(bytes) ⇒ Udp
Initialize the packet
14 15 16 17 18 19 20 |
# File 'lib/packet/udp.rb', line 14 def initialize( bytes ) @src_port = bytes[34..35].join().to_i(16).to_s(10).to_i @dst_port = bytes[36..37].join().to_i(16).to_s(10).to_i @length = bytes[38..39].join().to_i(16).to_s(10).to_i @sum = bytes[40..41].join().to_i(16).to_s(10).to_i end |
Instance Attribute Details
#dst_port ⇒ Object Also known as: dest_port, dport
Returns the value of attribute dst_port.
9 10 11 |
# File 'lib/packet/udp.rb', line 9 def dst_port @dst_port end |
#length ⇒ Object Also known as: len
Returns the value of attribute length.
10 11 12 |
# File 'lib/packet/udp.rb', line 10 def length @length end |
#src_port ⇒ Object Also known as: source_port, sport
Attributes
8 9 10 |
# File 'lib/packet/udp.rb', line 8 def src_port @src_port end |
#sum ⇒ Object Also known as: checksum
Returns the value of attribute sum.
11 12 13 |
# File 'lib/packet/udp.rb', line 11 def sum @sum end |