Class: PacketGen::Plugin::IKE::TSi
- Defined in:
- lib/packetgen/plugin/ike/ts.rb
Overview
This class handles Traffic Selector - Initiator payloads, denoted TSi.
A TSi payload consists of the IKE generic payload Plugin (see Payload) and some specific fields:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Payload |C| RESERVED | Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Number of TSs | RESERVED |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ <Traffic Selectors> ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
These specific fields are:
-
and #traffic_selectors.
Create a TSi payload
# Create a IKE packet with a TSi payload
pkt = PacketGen.gen('IP').add('UDP').add('IKE').add('IKE::TSi')
# add a traffic selector to this payload
pkt.ike_tsi.traffic_selectors << { protocol: 'tcp', ports: 1..1024, start_addr: '20.0.0.1', end_addr: '21.255.255.254' }
# add another traffic selector (IPv6, all protocols)
pkt.ike_tsi.traffic_selectors << { start_addr: '2001::1', end_addr: '200a:ffff:ffff:ffff:ffff:ffff:ffff:ffff' }
Direct Known Subclasses
Constant Summary collapse
- PAYLOAD_TYPE =
Payload type number
44
Instance Attribute Summary collapse
-
#num_ts ⇒ Integer
8-bit Number of TSs.
-
#rsv ⇒ Integer
24-bit RESERVED field.
-
#traffic_selectors ⇒ TrafficSelectors
(also: #selectors)
Set of TrafficSelector.
Attributes inherited from Payload
#content, #critical, #flags, #hreserved, #length, #next
Instance Method Summary collapse
-
#calc_length ⇒ Integer
Compute length and set Payload#length field.
Methods inherited from Payload
Constructor Details
This class inherits a constructor from PacketGen::Plugin::IKE::Payload
Instance Attribute Details
#num_ts ⇒ Integer
8-bit Number of TSs
231 |
# File 'lib/packetgen/plugin/ike/ts.rb', line 231 define_field_before :body, :num_ts, PacketGen::Types::Int8 |
#rsv ⇒ Integer
24-bit RESERVED field
235 |
# File 'lib/packetgen/plugin/ike/ts.rb', line 235 define_field_before :body, :rsv, PacketGen::Types::Int24 |
#traffic_selectors ⇒ TrafficSelectors Also known as: selectors
240 241 |
# File 'lib/packetgen/plugin/ike/ts.rb', line 240 define_field_before :body, :traffic_selectors, TrafficSelectors, builder: ->(h, t) { t.new(counter: h[:num_ts]) } |
Instance Method Details
#calc_length ⇒ Integer
Compute length and set Payload#length field
246 247 248 249 |
# File 'lib/packetgen/plugin/ike/ts.rb', line 246 def calc_length selectors.each(&:calc_length) super end |