nl-linux 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84,12 +84,12 @@ class Ovpn < ::Nl::Family
84
84
  class KeepaliveInterval < Attribute
85
85
  TYPE = 13
86
86
  NAME = :"keepalive_interval"
87
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
87
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
88
88
  end
89
89
  class KeepaliveTimeout < Attribute
90
90
  TYPE = 14
91
91
  NAME = :"keepalive_timeout"
92
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
92
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
93
93
  end
94
94
  class DelReason < Attribute
95
95
  TYPE = 15
@@ -136,10 +136,15 @@ class Ovpn < ::Nl::Family
136
136
  NAME = :"link_tx_packets"
137
137
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
138
138
  end
139
+ class TxId < Attribute
140
+ TYPE = 24
141
+ NAME = :"tx_id"
142
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
143
+ end
139
144
  # :nodoc:
140
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"socket_netnsid" => SocketNetnsid, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"local_port" => LocalPort, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"del_reason" => DelReason, :"vpn_rx_bytes" => VpnRxBytes, :"vpn_tx_bytes" => VpnTxBytes, :"vpn_rx_packets" => VpnRxPackets, :"vpn_tx_packets" => VpnTxPackets, :"link_rx_bytes" => LinkRxBytes, :"link_tx_bytes" => LinkTxBytes, :"link_rx_packets" => LinkRxPackets, :"link_tx_packets" => LinkTxPackets}) #: Hash[::Symbol, Attribute]
145
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"socket_netnsid" => SocketNetnsid, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"local_port" => LocalPort, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"del_reason" => DelReason, :"vpn_rx_bytes" => VpnRxBytes, :"vpn_tx_bytes" => VpnTxBytes, :"vpn_rx_packets" => VpnRxPackets, :"vpn_tx_packets" => VpnTxPackets, :"link_rx_bytes" => LinkRxBytes, :"link_tx_bytes" => LinkTxBytes, :"link_rx_packets" => LinkRxPackets, :"link_tx_packets" => LinkTxPackets, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
141
146
  # :nodoc:
142
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 7 => SocketNetnsid, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 12 => LocalPort, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 15 => DelReason, 16 => VpnRxBytes, 17 => VpnTxBytes, 18 => VpnRxPackets, 19 => VpnTxPackets, 20 => LinkRxBytes, 21 => LinkTxBytes, 22 => LinkRxPackets, 23 => LinkTxPackets}) #: Hash[::Integer, Attribute]
147
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 7 => SocketNetnsid, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 12 => LocalPort, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 15 => DelReason, 16 => VpnRxBytes, 17 => VpnTxBytes, 18 => VpnRxPackets, 19 => VpnTxPackets, 20 => LinkRxBytes, 21 => LinkTxBytes, 22 => LinkRxPackets, 23 => LinkTxPackets, 24 => TxId}) #: Hash[::Integer, Attribute]
143
148
  class << self
144
149
  # Looks up Attribute class by name.
145
150
  #--
@@ -210,17 +215,22 @@ class Ovpn < ::Nl::Family
210
215
  class KeepaliveInterval < Attribute
211
216
  TYPE = 13
212
217
  NAME = :"keepalive_interval"
213
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
218
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
214
219
  end
215
220
  class KeepaliveTimeout < Attribute
216
221
  TYPE = 14
217
222
  NAME = :"keepalive_timeout"
218
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
223
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
224
+ end
225
+ class TxId < Attribute
226
+ TYPE = 24
227
+ NAME = :"tx_id"
228
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
219
229
  end
220
230
  # :nodoc:
221
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout}) #: Hash[::Symbol, Attribute]
231
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
222
232
  # :nodoc:
223
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout}) #: Hash[::Integer, Attribute]
233
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 24 => TxId}) #: Hash[::Integer, Attribute]
224
234
  class << self
225
235
  # Looks up Attribute class by name.
226
236
  #--
@@ -286,17 +296,22 @@ class Ovpn < ::Nl::Family
286
296
  class KeepaliveInterval < Attribute
287
297
  TYPE = 13
288
298
  NAME = :"keepalive_interval"
289
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
299
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
290
300
  end
291
301
  class KeepaliveTimeout < Attribute
292
302
  TYPE = 14
293
303
  NAME = :"keepalive_timeout"
294
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
304
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
305
+ end
306
+ class TxId < Attribute
307
+ TYPE = 24
308
+ NAME = :"tx_id"
309
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
295
310
  end
296
311
  # :nodoc:
297
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout}) #: Hash[::Symbol, Attribute]
312
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
298
313
  # :nodoc:
299
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout}) #: Hash[::Integer, Attribute]
314
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 24 => TxId}) #: Hash[::Integer, Attribute]
300
315
  class << self
301
316
  # Looks up Attribute class by name.
302
317
  #--
@@ -112,24 +112,24 @@ class OvsDatapath < ::Nl::Family
112
112
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
113
113
  end
114
114
  class MasksCacheSize < Attribute
115
- TYPE = 6
115
+ TYPE = 7
116
116
  NAME = :"masks_cache_size"
117
117
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
118
118
  end
119
119
  class PerCpuPids < Attribute
120
- TYPE = 7
120
+ TYPE = 8
121
121
  NAME = :"per_cpu_pids"
122
122
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
123
123
  end
124
124
  class Ifindex < Attribute
125
- TYPE = 8
125
+ TYPE = 9
126
126
  NAME = :"ifindex"
127
127
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
128
128
  end
129
129
  # :nodoc:
130
130
  BY_NAME = Ractor.make_shareable({:"name" => Name, :"upcall_pid" => UpcallPid, :"stats" => Stats, :"megaflow_stats" => MegaflowStats, :"user_features" => UserFeatures, :"masks_cache_size" => MasksCacheSize, :"per_cpu_pids" => PerCpuPids, :"ifindex" => Ifindex}) #: Hash[::Symbol, Attribute]
131
131
  # :nodoc:
132
- BY_TYPE = Ractor.make_shareable({1 => Name, 2 => UpcallPid, 3 => Stats, 4 => MegaflowStats, 5 => UserFeatures, 6 => MasksCacheSize, 7 => PerCpuPids, 8 => Ifindex}) #: Hash[::Integer, Attribute]
132
+ BY_TYPE = Ractor.make_shareable({1 => Name, 2 => UpcallPid, 3 => Stats, 4 => MegaflowStats, 5 => UserFeatures, 7 => MasksCacheSize, 8 => PerCpuPids, 9 => Ifindex}) #: Hash[::Integer, Attribute]
133
133
  class << self
134
134
  # Looks up Attribute class by name.
135
135
  #--
@@ -0,0 +1,166 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ #--
3
+ # frozen_string_literal: true
4
+ # rbs_inline: enabled
5
+ # This code is generated by Ynl::Generator. DO NOT EDIT.
6
+ require 'nl'
7
+ module Nl; module Linux
8
+ # OVS packet execution over generic netlink.
9
+ #
10
+ # Only OVS_PACKET_CMD_EXECUTE is exposed as a genl operation.
11
+ # OVS_PACKET_CMD_MISS and OVS_PACKET_CMD_ACTION are kernel-to-userspace
12
+ # upcalls sent via genlmsg_unicast() to the vport's upcall_pid and have
13
+ # no associated genl_ops or multicast group.
14
+ #
15
+ # Several attributes in the attribute set (userdata, egress-tun-key, len)
16
+ # exist for the upcall path and are not used by the EXECUTE operation.
17
+ # For EXECUTE, packet, key, and actions are mandatory (kernel returns
18
+ # -EINVAL without them).
19
+ class OvsPacket < ::Nl::Family
20
+ NAME = "ovs_packet"
21
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_packet"))
22
+ module Structs
23
+ OvsHeader = Struct.new(
24
+ :"dp_ifindex", #: ::Integer
25
+ )
26
+ class OvsHeader
27
+ # :nodoc:
28
+ MEMBERS = Ractor.make_shareable({dp_ifindex: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
29
+ # Decodes the struct.
30
+ #--
31
+ # @rbs decoder: ::Nl::Decoder
32
+ # @rbs return: instance
33
+ def self.decode(decoder)
34
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
35
+ end
36
+ # Encodes the struct.
37
+ #--
38
+ # @rbs encoder: ::Nl::Encoder
39
+ # @rbs return: void
40
+ def encode(encoder)
41
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
42
+ end
43
+ end
44
+ end
45
+ module AttributeSets
46
+ class Packet < ::Nl::Protocols::Genl::AttributeSet
47
+ # Abstract class
48
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
49
+ end
50
+ class Packet < Attribute
51
+ TYPE = 1
52
+ NAME = :"packet"
53
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 14" unless it.bytesize >= 14 })
54
+ end
55
+ class Key < Attribute
56
+ TYPE = 2
57
+ NAME = :"key"
58
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
59
+ end
60
+ class Actions < Attribute
61
+ TYPE = 3
62
+ NAME = :"actions"
63
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
64
+ end
65
+ class Userdata < Attribute
66
+ TYPE = 4
67
+ NAME = :"userdata"
68
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
69
+ end
70
+ class EgressTunKey < Attribute
71
+ TYPE = 5
72
+ NAME = :"egress_tun_key"
73
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
74
+ end
75
+ class Probe < Attribute
76
+ TYPE = 8
77
+ NAME = :"probe"
78
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Flag.new
79
+ end
80
+ class Mru < Attribute
81
+ TYPE = 9
82
+ NAME = :"mru"
83
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
84
+ end
85
+ class Len < Attribute
86
+ TYPE = 10
87
+ NAME = :"len"
88
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
89
+ end
90
+ class Hash < Attribute
91
+ TYPE = 11
92
+ NAME = :"hash"
93
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
94
+ end
95
+ class UpcallPid < Attribute
96
+ TYPE = 12
97
+ NAME = :"upcall_pid"
98
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
99
+ end
100
+ # :nodoc:
101
+ BY_NAME = Ractor.make_shareable({:"packet" => Packet, :"key" => Key, :"actions" => Actions, :"userdata" => Userdata, :"egress_tun_key" => EgressTunKey, :"probe" => Probe, :"mru" => Mru, :"len" => Len, :"hash" => Hash, :"upcall_pid" => UpcallPid}) #: Hash[::Symbol, Attribute]
102
+ # :nodoc:
103
+ BY_TYPE = Ractor.make_shareable({1 => Packet, 2 => Key, 3 => Actions, 4 => Userdata, 5 => EgressTunKey, 8 => Probe, 9 => Mru, 10 => Len, 11 => Hash, 12 => UpcallPid}) #: Hash[::Integer, Attribute]
104
+ class << self
105
+ # Looks up Attribute class by name.
106
+ #--
107
+ # @rbs name: Symbol
108
+ # @rbs return: Attribute
109
+ def by_name(name); BY_NAME.fetch(name); end
110
+ # Looks up Attribute class by type value.
111
+ #--
112
+ # @rbs type: Integer
113
+ # @rbs return: Attribute
114
+ def by_type(type); BY_TYPE.fetch(type); end
115
+ end
116
+ end
117
+ end
118
+ module Messages
119
+ # Apply actions to a packet.
120
+ class DoExecuteRequest < ::Nl::Protocols::Genl::Message
121
+ TYPE = 3
122
+ FIXED_HEADER = Structs::OvsHeader
123
+ ATTRIBUTE_SET = AttributeSets::Packet
124
+ ATTRIBUTES = Ractor.make_shareable(%i[packet key actions probe mru hash upcall_pid])
125
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
126
+ #--
127
+ # @rbs return: ::Integer
128
+ def dp_ifindex; fixed_header.dp_ifindex; end
129
+ # Gets the value of `packet` attribute in the message.
130
+ #--
131
+ # @rbs return: untyped
132
+ def packet; attributes[:"packet"]&.value; end
133
+ # Gets the value of `key` attribute in the message.
134
+ #--
135
+ # @rbs return: untyped
136
+ def key; attributes[:"key"]&.value; end
137
+ # Gets the value of `actions` attribute in the message.
138
+ #--
139
+ # @rbs return: untyped
140
+ def actions; attributes[:"actions"]&.value; end
141
+ # Gets the value of `probe` attribute in the message.
142
+ #--
143
+ # @rbs return: ::Integer
144
+ def probe; attributes[:"probe"]&.value; end
145
+ # Gets the value of `mru` attribute in the message.
146
+ #--
147
+ # @rbs return: ::Integer
148
+ def mru; attributes[:"mru"]&.value; end
149
+ # Gets the value of `hash` attribute in the message.
150
+ #--
151
+ # @rbs return: ::Integer
152
+ def hash; attributes[:"hash"]&.value; end
153
+ # Gets the value of `upcall-pid` attribute in the message.
154
+ #--
155
+ # @rbs return: ::Integer
156
+ def upcall_pid; attributes[:"upcall_pid"]&.value; end
157
+ end
158
+ end
159
+ # Apply actions to a packet.
160
+ #--
161
+ # @rbs (?dp_ifindex: ::Integer, ?packet: untyped, ?key: untyped, ?actions: untyped, ?probe: ::Integer, ?mru: ::Integer, ?hash: ::Integer, ?upcall_pid: ::Integer) -> void
162
+ def do_execute(**args)
163
+ exchange_message(:"do", Messages::DoExecuteRequest, nil, args)
164
+ end
165
+ end
166
+ end; end
@@ -157,23 +157,23 @@ class OvsVport < ::Nl::Family
157
157
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
158
158
  end
159
159
  class Ifindex < Attribute
160
- TYPE = 7
160
+ TYPE = 8
161
161
  NAME = :"ifindex"
162
162
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
163
163
  end
164
164
  class Netnsid < Attribute
165
- TYPE = 8
165
+ TYPE = 9
166
166
  NAME = :"netnsid"
167
167
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
168
168
  end
169
169
  class UpcallStats < Attribute
170
- TYPE = 9
170
+ TYPE = 10
171
171
  NAME = :"upcall_stats"
172
172
  end
173
173
  # :nodoc:
174
174
  BY_NAME = Ractor.make_shareable({:"port_no" => PortNo, :"type" => Type, :"name" => Name, :"options" => Options, :"upcall_pid" => UpcallPid, :"stats" => Stats, :"ifindex" => Ifindex, :"netnsid" => Netnsid, :"upcall_stats" => UpcallStats}) #: Hash[::Symbol, Attribute]
175
175
  # :nodoc:
176
- BY_TYPE = Ractor.make_shareable({1 => PortNo, 2 => Type, 3 => Name, 4 => Options, 5 => UpcallPid, 6 => Stats, 7 => Ifindex, 8 => Netnsid, 9 => UpcallStats}) #: Hash[::Integer, Attribute]
176
+ BY_TYPE = Ractor.make_shareable({1 => PortNo, 2 => Type, 3 => Name, 4 => Options, 5 => UpcallPid, 6 => Stats, 8 => Ifindex, 9 => Netnsid, 10 => UpcallStats}) #: Hash[::Integer, Attribute]
177
177
  class << self
178
178
  # Looks up Attribute class by name.
179
179
  #--
@@ -12,6 +12,37 @@ class Psp < ::Nl::Family
12
12
  module Structs
13
13
  end
14
14
  module AttributeSets
15
+ class AssocDevInfo < ::Nl::Protocols::Genl::AttributeSet
16
+ # Abstract class
17
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
18
+ end
19
+ class Ifindex < Attribute
20
+ TYPE = 1
21
+ NAME = :"ifindex"
22
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
23
+ end
24
+ class Nsid < Attribute
25
+ TYPE = 2
26
+ NAME = :"nsid"
27
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
28
+ end
29
+ # :nodoc:
30
+ BY_NAME = Ractor.make_shareable({:"ifindex" => Ifindex, :"nsid" => Nsid}) #: Hash[::Symbol, Attribute]
31
+ # :nodoc:
32
+ BY_TYPE = Ractor.make_shareable({1 => Ifindex, 2 => Nsid}) #: Hash[::Integer, Attribute]
33
+ class << self
34
+ # Looks up Attribute class by name.
35
+ #--
36
+ # @rbs name: Symbol
37
+ # @rbs return: Attribute
38
+ def by_name(name); BY_NAME.fetch(name); end
39
+ # Looks up Attribute class by type value.
40
+ #--
41
+ # @rbs type: Integer
42
+ # @rbs return: Attribute
43
+ def by_type(type); BY_TYPE.fetch(type); end
44
+ end
45
+ end
15
46
  class Dev < ::Nl::Protocols::Genl::AttributeSet
16
47
  # Abstract class
17
48
  class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
@@ -36,10 +67,24 @@ class Psp < ::Nl::Family
36
67
  NAME = :"psp_versions_ena"
37
68
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
38
69
  end
70
+ class AssocList < Attribute
71
+ TYPE = 5
72
+ NAME = :"assoc_list"
73
+ end
74
+ class Nsid < Attribute
75
+ TYPE = 6
76
+ NAME = :"nsid"
77
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
78
+ end
79
+ class ByAssociation < Attribute
80
+ TYPE = 7
81
+ NAME = :"by_association"
82
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Flag.new
83
+ end
39
84
  # :nodoc:
40
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"ifindex" => Ifindex, :"psp_versions_cap" => PspVersionsCap, :"psp_versions_ena" => PspVersionsEna}) #: Hash[::Symbol, Attribute]
85
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"ifindex" => Ifindex, :"psp_versions_cap" => PspVersionsCap, :"psp_versions_ena" => PspVersionsEna, :"assoc_list" => AssocList, :"nsid" => Nsid, :"by_association" => ByAssociation}) #: Hash[::Symbol, Attribute]
41
86
  # :nodoc:
42
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => Ifindex, 3 => PspVersionsCap, 4 => PspVersionsEna}) #: Hash[::Integer, Attribute]
87
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => Ifindex, 3 => PspVersionsCap, 4 => PspVersionsEna, 5 => AssocList, 6 => Nsid, 7 => ByAssociation}) #: Hash[::Integer, Attribute]
43
88
  class << self
44
89
  # Looks up Attribute class by name.
45
90
  #--
@@ -204,6 +249,7 @@ class Psp < ::Nl::Family
204
249
  def by_type(type); BY_TYPE.fetch(type); end
205
250
  end
206
251
  end
252
+ Dev::AssocList::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(AssocDevInfo)
207
253
  Assoc::RxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
208
254
  Assoc::TxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
209
255
  end
@@ -224,7 +270,7 @@ class Psp < ::Nl::Family
224
270
  TYPE = 1
225
271
  FIXED_HEADER = nil
226
272
  ATTRIBUTE_SET = AttributeSets::Dev
227
- ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena])
273
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
228
274
  # Gets the value of `id` attribute in the message.
229
275
  #--
230
276
  # @rbs return: ::Integer
@@ -241,13 +287,21 @@ class Psp < ::Nl::Family
241
287
  #--
242
288
  # @rbs return: ::Integer
243
289
  def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
290
+ # Gets the value of `assoc-list` attribute in the message.
291
+ #--
292
+ # @rbs return: AttributeSets::AssocDevInfo
293
+ def assoc_list; attributes[:"assoc_list"]&.value; end
294
+ # Gets the value of `by-association` attribute in the message.
295
+ #--
296
+ # @rbs return: ::Integer
297
+ def by_association; attributes[:"by_association"]&.value; end
244
298
  end
245
299
  # Get / dump information about PSP capable devices on the system.
246
300
  class DumpDevGetReply < ::Nl::Protocols::Genl::Message
247
301
  TYPE = 1
248
302
  FIXED_HEADER = nil
249
303
  ATTRIBUTE_SET = AttributeSets::Dev
250
- ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena])
304
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
251
305
  # Gets the value of `id` attribute in the message.
252
306
  #--
253
307
  # @rbs return: ::Integer
@@ -264,6 +318,14 @@ class Psp < ::Nl::Family
264
318
  #--
265
319
  # @rbs return: ::Integer
266
320
  def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
321
+ # Gets the value of `assoc-list` attribute in the message.
322
+ #--
323
+ # @rbs return: AttributeSets::AssocDevInfo
324
+ def assoc_list; attributes[:"assoc_list"]&.value; end
325
+ # Gets the value of `by-association` attribute in the message.
326
+ #--
327
+ # @rbs return: ::Integer
328
+ def by_association; attributes[:"by_association"]&.value; end
267
329
  end
268
330
  # Set the configuration of a PSP device.
269
331
  class DoDevSetRequest < ::Nl::Protocols::Genl::Message
@@ -389,7 +451,7 @@ class Psp < ::Nl::Family
389
451
  TYPE = 10
390
452
  FIXED_HEADER = nil
391
453
  ATTRIBUTE_SET = AttributeSets::Stats
392
- ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events])
454
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events rx_packets rx_bytes rx_auth_fail rx_error rx_bad tx_packets tx_bytes tx_error])
393
455
  # Gets the value of `dev-id` attribute in the message.
394
456
  #--
395
457
  # @rbs return: ::Integer
@@ -402,13 +464,45 @@ class Psp < ::Nl::Family
402
464
  #--
403
465
  # @rbs return: ::Integer
404
466
  def stale_events; attributes[:"stale_events"]&.value; end
467
+ # Gets the value of `rx-packets` attribute in the message.
468
+ #--
469
+ # @rbs return: ::Integer
470
+ def rx_packets; attributes[:"rx_packets"]&.value; end
471
+ # Gets the value of `rx-bytes` attribute in the message.
472
+ #--
473
+ # @rbs return: ::Integer
474
+ def rx_bytes; attributes[:"rx_bytes"]&.value; end
475
+ # Gets the value of `rx-auth-fail` attribute in the message.
476
+ #--
477
+ # @rbs return: ::Integer
478
+ def rx_auth_fail; attributes[:"rx_auth_fail"]&.value; end
479
+ # Gets the value of `rx-error` attribute in the message.
480
+ #--
481
+ # @rbs return: ::Integer
482
+ def rx_error; attributes[:"rx_error"]&.value; end
483
+ # Gets the value of `rx-bad` attribute in the message.
484
+ #--
485
+ # @rbs return: ::Integer
486
+ def rx_bad; attributes[:"rx_bad"]&.value; end
487
+ # Gets the value of `tx-packets` attribute in the message.
488
+ #--
489
+ # @rbs return: ::Integer
490
+ def tx_packets; attributes[:"tx_packets"]&.value; end
491
+ # Gets the value of `tx-bytes` attribute in the message.
492
+ #--
493
+ # @rbs return: ::Integer
494
+ def tx_bytes; attributes[:"tx_bytes"]&.value; end
495
+ # Gets the value of `tx-error` attribute in the message.
496
+ #--
497
+ # @rbs return: ::Integer
498
+ def tx_error; attributes[:"tx_error"]&.value; end
405
499
  end
406
500
  # Get device statistics.
407
501
  class DumpGetStatsReply < ::Nl::Protocols::Genl::Message
408
502
  TYPE = 10
409
503
  FIXED_HEADER = nil
410
504
  ATTRIBUTE_SET = AttributeSets::Stats
411
- ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events])
505
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events rx_packets rx_bytes rx_auth_fail rx_error rx_bad tx_packets tx_bytes tx_error])
412
506
  # Gets the value of `dev-id` attribute in the message.
413
507
  #--
414
508
  # @rbs return: ::Integer
@@ -421,6 +515,90 @@ class Psp < ::Nl::Family
421
515
  #--
422
516
  # @rbs return: ::Integer
423
517
  def stale_events; attributes[:"stale_events"]&.value; end
518
+ # Gets the value of `rx-packets` attribute in the message.
519
+ #--
520
+ # @rbs return: ::Integer
521
+ def rx_packets; attributes[:"rx_packets"]&.value; end
522
+ # Gets the value of `rx-bytes` attribute in the message.
523
+ #--
524
+ # @rbs return: ::Integer
525
+ def rx_bytes; attributes[:"rx_bytes"]&.value; end
526
+ # Gets the value of `rx-auth-fail` attribute in the message.
527
+ #--
528
+ # @rbs return: ::Integer
529
+ def rx_auth_fail; attributes[:"rx_auth_fail"]&.value; end
530
+ # Gets the value of `rx-error` attribute in the message.
531
+ #--
532
+ # @rbs return: ::Integer
533
+ def rx_error; attributes[:"rx_error"]&.value; end
534
+ # Gets the value of `rx-bad` attribute in the message.
535
+ #--
536
+ # @rbs return: ::Integer
537
+ def rx_bad; attributes[:"rx_bad"]&.value; end
538
+ # Gets the value of `tx-packets` attribute in the message.
539
+ #--
540
+ # @rbs return: ::Integer
541
+ def tx_packets; attributes[:"tx_packets"]&.value; end
542
+ # Gets the value of `tx-bytes` attribute in the message.
543
+ #--
544
+ # @rbs return: ::Integer
545
+ def tx_bytes; attributes[:"tx_bytes"]&.value; end
546
+ # Gets the value of `tx-error` attribute in the message.
547
+ #--
548
+ # @rbs return: ::Integer
549
+ def tx_error; attributes[:"tx_error"]&.value; end
550
+ end
551
+ # Associate a network device with a PSP device.
552
+ class DoDevAssocRequest < ::Nl::Protocols::Genl::Message
553
+ TYPE = 11
554
+ FIXED_HEADER = nil
555
+ ATTRIBUTE_SET = AttributeSets::Dev
556
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex nsid])
557
+ # Gets the value of `id` attribute in the message.
558
+ #--
559
+ # @rbs return: ::Integer
560
+ def id; attributes[:"id"]&.value; end
561
+ # Gets the value of `ifindex` attribute in the message.
562
+ #--
563
+ # @rbs return: ::Integer
564
+ def ifindex; attributes[:"ifindex"]&.value; end
565
+ # Gets the value of `nsid` attribute in the message.
566
+ #--
567
+ # @rbs return: ::Integer
568
+ def nsid; attributes[:"nsid"]&.value; end
569
+ end
570
+ # Associate a network device with a PSP device.
571
+ class DoDevAssocReply < ::Nl::Protocols::Genl::Message
572
+ TYPE = 11
573
+ FIXED_HEADER = nil
574
+ ATTRIBUTE_SET = AttributeSets::Dev
575
+ ATTRIBUTES = Ractor.make_shareable(%i[])
576
+ end
577
+ # Disassociate a network device from a PSP device.
578
+ class DoDevDisassocRequest < ::Nl::Protocols::Genl::Message
579
+ TYPE = 12
580
+ FIXED_HEADER = nil
581
+ ATTRIBUTE_SET = AttributeSets::Dev
582
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex nsid])
583
+ # Gets the value of `id` attribute in the message.
584
+ #--
585
+ # @rbs return: ::Integer
586
+ def id; attributes[:"id"]&.value; end
587
+ # Gets the value of `ifindex` attribute in the message.
588
+ #--
589
+ # @rbs return: ::Integer
590
+ def ifindex; attributes[:"ifindex"]&.value; end
591
+ # Gets the value of `nsid` attribute in the message.
592
+ #--
593
+ # @rbs return: ::Integer
594
+ def nsid; attributes[:"nsid"]&.value; end
595
+ end
596
+ # Disassociate a network device from a PSP device.
597
+ class DoDevDisassocReply < ::Nl::Protocols::Genl::Message
598
+ TYPE = 12
599
+ FIXED_HEADER = nil
600
+ ATTRIBUTE_SET = AttributeSets::Dev
601
+ ATTRIBUTES = Ractor.make_shareable(%i[])
424
602
  end
425
603
  end
426
604
  # Get / dump information about PSP capable devices on the system.
@@ -459,5 +637,17 @@ class Psp < ::Nl::Family
459
637
  def do_get_stats(**args)
460
638
  exchange_message(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
461
639
  end
640
+ # Associate a network device with a PSP device.
641
+ #--
642
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevAssocReply
643
+ def do_dev_assoc(**args)
644
+ exchange_message(:"do", Messages::DoDevAssocRequest, Messages::DoDevAssocReply, args)
645
+ end
646
+ # Disassociate a network device from a PSP device.
647
+ #--
648
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevDisassocReply
649
+ def do_dev_disassoc(**args)
650
+ exchange_message(:"do", Messages::DoDevDisassocRequest, Messages::DoDevDisassocReply, args)
651
+ end
462
652
  end
463
653
  end; end