nl-linux 0.2.4 → 0.4.1

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -0
  3. data/.yardopts +5 -0
  4. data/CHANGELOG.md +8 -0
  5. data/Rakefile +27 -5
  6. data/generated/nl/linux/binder.rb +227 -19
  7. data/generated/nl/linux/conntrack.rb +1325 -365
  8. data/generated/nl/linux/dev_energymodel.rb +357 -66
  9. data/generated/nl/linux/devlink.rb +6310 -1859
  10. data/generated/nl/linux/dpll.rb +2202 -376
  11. data/generated/nl/linux/drm_ras.rb +312 -63
  12. data/generated/nl/linux/ethtool.rb +7555 -2447
  13. data/generated/nl/linux/fou.rb +381 -133
  14. data/generated/nl/linux/handshake.rb +340 -70
  15. data/generated/nl/linux/lockd.rb +132 -27
  16. data/generated/nl/linux/mptcp_pm.rb +773 -161
  17. data/generated/nl/linux/net_shaper.rb +892 -211
  18. data/generated/nl/linux/netdev.rb +2366 -518
  19. data/generated/nl/linux/nfsd.rb +1299 -317
  20. data/generated/nl/linux/nftables.rb +5351 -1533
  21. data/generated/nl/linux/nl80211.rb +4601 -882
  22. data/generated/nl/linux/nlctrl.rb +460 -117
  23. data/generated/nl/linux/ovpn.rb +1360 -262
  24. data/generated/nl/linux/ovs_datapath.rb +312 -98
  25. data/generated/nl/linux/ovs_flow.rb +1866 -358
  26. data/generated/nl/linux/ovs_packet.rb +331 -45
  27. data/generated/nl/linux/ovs_vport.rb +374 -123
  28. data/generated/nl/linux/psp.rb +1093 -201
  29. data/generated/nl/linux/rt_addr.rb +423 -165
  30. data/generated/nl/linux/rt_link.rb +6928 -1336
  31. data/generated/nl/linux/rt_neigh.rb +1063 -297
  32. data/generated/nl/linux/rt_route.rb +1112 -483
  33. data/generated/nl/linux/rt_rule.rb +931 -262
  34. data/generated/nl/linux/sunrpc_cache.rb +407 -82
  35. data/generated/nl/linux/tc.rb +10081 -1763
  36. data/generated/nl/linux/tcp_metrics.rb +388 -109
  37. data/generated/nl/linux/team.rb +350 -84
  38. data/generated/nl/linux/wireguard.rb +525 -96
  39. data/generated/nl/linux.rb +1 -0
  40. data/lib/nl/linux/nlctrl_resolver.rb +31 -0
  41. data/lib/nl/linux/version.rb +1 -1
  42. data/sig/generated/nl/linux/binder.rbs +366 -0
  43. data/sig/generated/nl/linux/conntrack.rbs +2787 -0
  44. data/sig/generated/nl/linux/dev_energymodel.rbs +636 -0
  45. data/sig/generated/nl/linux/devlink.rbs +12496 -0
  46. data/sig/generated/nl/linux/dpll.rbs +3461 -0
  47. data/sig/generated/nl/linux/drm_ras.rbs +553 -0
  48. data/sig/generated/nl/linux/ethtool.rbs +15291 -0
  49. data/sig/generated/nl/linux/fou.rbs +702 -0
  50. data/sig/generated/nl/linux/handshake.rbs +622 -0
  51. data/sig/generated/nl/linux/lockd.rbs +234 -0
  52. data/sig/generated/nl/linux/mptcp_pm.rbs +1511 -0
  53. data/sig/generated/nl/linux/net_shaper.rbs +1645 -0
  54. data/sig/generated/nl/linux/netdev.rbs +4187 -0
  55. data/sig/generated/nl/linux/nfsd.rbs +2520 -0
  56. data/sig/generated/nl/linux/nftables.rbs +10304 -0
  57. data/sig/generated/nl/linux/nl80211.rbs +9786 -0
  58. data/sig/generated/nl/linux/nlctrl.rbs +944 -0
  59. data/sig/generated/nl/linux/nlctrl_resolver.rbs +20 -0
  60. data/sig/generated/nl/linux/ovpn.rbs +2564 -0
  61. data/sig/generated/nl/linux/ovs_datapath.rbs +640 -0
  62. data/sig/generated/nl/linux/ovs_flow.rbs +3659 -0
  63. data/sig/generated/nl/linux/ovs_packet.rbs +540 -0
  64. data/sig/generated/nl/linux/ovs_vport.rbs +777 -0
  65. data/sig/generated/nl/linux/psp.rbs +1846 -0
  66. data/sig/generated/nl/linux/rt_addr.rbs +866 -0
  67. data/sig/generated/nl/linux/rt_link.rbs +13438 -0
  68. data/sig/generated/nl/linux/rt_neigh.rbs +2124 -0
  69. data/sig/generated/nl/linux/rt_route.rbs +2218 -0
  70. data/sig/generated/nl/linux/rt_rule.rbs +1726 -0
  71. data/sig/generated/nl/linux/sunrpc_cache.rbs +739 -0
  72. data/sig/generated/nl/linux/tc.rbs +19931 -0
  73. data/sig/generated/nl/linux/tcp_metrics.rbs +740 -0
  74. data/sig/generated/nl/linux/team.rbs +733 -0
  75. data/sig/generated/nl/linux/version.rbs +7 -0
  76. data/sig/generated/nl/linux/wireguard.rbs +1006 -0
  77. data/sig/generated/nl/linux.rbs +6 -0
  78. data/sig/generated/nl-linux.rbs +2 -0
  79. metadata +51 -10
@@ -1,653 +1,1545 @@
1
1
  # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ #
3
+ # This file is based on Documentation/netlink/specs/psp.yaml from Linux v7.2.
2
4
  #--
3
5
  # frozen_string_literal: true
4
- # rbs_inline: enabled
5
6
  # This code is generated by Ynl::Generator. DO NOT EDIT.
6
7
  require 'nl'
7
8
  module Nl; module Linux
8
9
  # PSP Security Protocol Generic Netlink family.
9
- class Psp < ::Nl::Family
10
+ class Psp < ::Nl::Genl::Family
10
11
  NAME = "psp"
11
- PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("psp"))
12
+ VERSION = 1
13
+ # @rbs (?resolver: ^(::Nl::Genl::Client, ::String) -> ::Nl::Genl::FamilyInfo, ?executor: executor?, ?notification_capacity: ::Integer?) -> (::Nl::Family::Session & instance)
14
+ # @rbs | [R] (?resolver: ^(::Nl::Genl::Client, ::String) -> ::Nl::Genl::FamilyInfo, ?executor: executor?, ?notification_capacity: ::Integer?) { (instance) -> R } -> R
15
+ # @overload open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
16
+ # @param [#call] resolver
17
+ # @param [Symbol, nil] executor
18
+ # @param [Integer, nil] notification_capacity
19
+ # @return [Psp]
20
+ # @overload open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY, &block)
21
+ # @param [#call] resolver
22
+ # @param [Symbol, nil] executor
23
+ # @param [Integer, nil] notification_capacity
24
+ # @yieldparam [Psp] family
25
+ # @return [Object] the result of the block
26
+ def self.open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
27
+ super
28
+ end
29
+ # @private
30
+ MCAST_GROUPS = Ractor.make_shareable({:"mgmt" => ::Nl::McastGroup.new("mgmt", nil), :"use" => ::Nl::McastGroup.new("use", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
31
+ module Enums
32
+ module Version
33
+ Hdr0AesGcm128 = 0
34
+ Hdr0AesGcm256 = 1
35
+ Hdr0AesGmac128 = 2
36
+ Hdr0AesGmac256 = 3
37
+ end
38
+ end
39
+ module Flags
40
+ module Version
41
+ Hdr0AesGcm128 = 1
42
+ Hdr0AesGcm256 = 2
43
+ Hdr0AesGmac128 = 4
44
+ Hdr0AesGmac256 = 8
45
+ end
46
+ end
12
47
  module Structs
13
48
  end
14
49
  module AttributeSets
15
- class AssocDevInfo < ::Nl::Protocols::Genl::AttributeSet
50
+ class AssocDevInfo < ::Nl::AttributeSet
16
51
  # Abstract class
17
- class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
52
+ class Attribute < ::Nl::AttributeSet::Attribute
18
53
  end
54
+ # ifindex of an associated network device.
19
55
  class Ifindex < Attribute
20
56
  TYPE = 1
21
57
  NAME = :"ifindex"
22
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
58
+ # @private
59
+ ORDER = 0
60
+ # @private
61
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
23
62
  end
63
+ # Network namespace ID of the associated device.
24
64
  class Nsid < Attribute
25
65
  TYPE = 2
26
66
  NAME = :"nsid"
27
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
67
+ # @private
68
+ ORDER = 1
69
+ # @private
70
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
28
71
  end
29
- # :nodoc:
72
+ # @private
30
73
  BY_NAME = Ractor.make_shareable({:"ifindex" => Ifindex, :"nsid" => Nsid}) #: Hash[::Symbol, Attribute]
31
- # :nodoc:
74
+ # @private
32
75
  BY_TYPE = Ractor.make_shareable({1 => Ifindex, 2 => Nsid}) #: Hash[::Integer, Attribute]
76
+ # ifindex of an associated network device.
77
+ # @rbs return: ::Integer
78
+ # @return [Integer]
79
+ # @see Ifindex
80
+ def ifindex; self[:"ifindex"]&.value; end
81
+ # Network namespace ID of the associated device.
82
+ # @rbs return: ::Integer
83
+ # @return [Integer]
84
+ # @see Nsid
85
+ def nsid; self[:"nsid"]&.value; end
33
86
  class << self
34
87
  # Looks up Attribute class by name.
35
- #--
36
88
  # @rbs name: Symbol
37
89
  # @rbs return: Attribute
90
+ # @param [Symbol] name
91
+ # @return [Attribute]
38
92
  def by_name(name); BY_NAME.fetch(name); end
39
93
  # Looks up Attribute class by type value.
40
- #--
41
94
  # @rbs type: Integer
42
95
  # @rbs return: Attribute
96
+ # @param [Integer] type
97
+ # @return [Attribute]
43
98
  def by_type(type); BY_TYPE.fetch(type); end
44
99
  end
45
100
  end
46
- class Dev < ::Nl::Protocols::Genl::AttributeSet
101
+ class Dev < ::Nl::AttributeSet
47
102
  # Abstract class
48
- class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
103
+ class Attribute < ::Nl::AttributeSet::Attribute
49
104
  end
105
+ # PSP device ID.
50
106
  class Id < Attribute
51
107
  TYPE = 1
52
108
  NAME = :"id"
53
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
109
+ # @private
110
+ ORDER = 0
111
+ # @private
112
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
54
113
  end
114
+ # ifindex of the main netdevice linked to the PSP device,
115
+ # or the ifindex to associate with the PSP device.
55
116
  class Ifindex < Attribute
56
117
  TYPE = 2
57
118
  NAME = :"ifindex"
58
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
119
+ # @private
120
+ ORDER = 1
121
+ # @private
122
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
59
123
  end
124
+ # Bitmask of PSP versions supported by the device.
125
+ #
126
+ # Known flags are defined in {Flags::Version}.
60
127
  class PspVersionsCap < Attribute
61
128
  TYPE = 3
62
129
  NAME = :"psp_versions_cap"
63
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
130
+ # @private
131
+ ORDER = 2
132
+ # @private
133
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
64
134
  end
135
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
136
+ #
137
+ # Known flags are defined in {Flags::Version}.
65
138
  class PspVersionsEna < Attribute
66
139
  TYPE = 4
67
140
  NAME = :"psp_versions_ena"
68
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
141
+ # @private
142
+ ORDER = 3
143
+ # @private
144
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
69
145
  end
146
+ # List of associated virtual devices.
70
147
  class AssocList < Attribute
71
148
  TYPE = 5
72
149
  NAME = :"assoc_list"
150
+ # @private
151
+ MULTI = true
152
+ # @private
153
+ ORDER = 4
73
154
  end
155
+ # Network namespace ID for the device to associate/disassociate.
156
+ # Optional for dev-assoc and dev-disassoc; if not present, the
157
+ # device is looked up in the caller's network namespace.
74
158
  class Nsid < Attribute
75
159
  TYPE = 6
76
160
  NAME = :"nsid"
77
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
161
+ # @private
162
+ ORDER = 5
163
+ # @private
164
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
78
165
  end
166
+ # Flag indicating the PSP device is an associated device from a
167
+ # different network namespace.
168
+ # Present when in associated namespace, absent when in primary/host
169
+ # namespace.
79
170
  class ByAssociation < Attribute
80
171
  TYPE = 7
81
172
  NAME = :"by_association"
82
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Flag.new
173
+ # @private
174
+ ORDER = 6
175
+ # @private
176
+ DATATYPE = ::Nl::DataTypes::Flag.new
83
177
  end
84
- # :nodoc:
178
+ # @private
85
179
  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]
86
- # :nodoc:
180
+ # @private
87
181
  BY_TYPE = Ractor.make_shareable({1 => Id, 2 => Ifindex, 3 => PspVersionsCap, 4 => PspVersionsEna, 5 => AssocList, 6 => Nsid, 7 => ByAssociation}) #: Hash[::Integer, Attribute]
182
+ # PSP device ID.
183
+ # @rbs return: ::Integer
184
+ # @return [Integer]
185
+ # @see Id
186
+ def id; self[:"id"]&.value; end
187
+ # ifindex of the main netdevice linked to the PSP device,
188
+ # or the ifindex to associate with the PSP device.
189
+ # @rbs return: ::Integer
190
+ # @return [Integer]
191
+ # @see Ifindex
192
+ def ifindex; self[:"ifindex"]&.value; end
193
+ # Bitmask of PSP versions supported by the device.
194
+ #
195
+ # Known flags are defined in {Flags::Version}.
196
+ # @rbs return: ::Integer
197
+ # @return [Integer]
198
+ # @see PspVersionsCap
199
+ def psp_versions_cap; self[:"psp_versions_cap"]&.value; end
200
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
201
+ #
202
+ # Known flags are defined in {Flags::Version}.
203
+ # @rbs return: ::Integer
204
+ # @return [Integer]
205
+ # @see PspVersionsEna
206
+ def psp_versions_ena; self[:"psp_versions_ena"]&.value; end
207
+ # List of associated virtual devices.
208
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
209
+ # @return [Array<AttributeSets::AssocDevInfo>]
210
+ # @see AssocList
211
+ def assoc_list; self[:"assoc_list"].map(&:value); end
212
+ # Network namespace ID for the device to associate/disassociate.
213
+ # Optional for dev-assoc and dev-disassoc; if not present, the
214
+ # device is looked up in the caller's network namespace.
215
+ # @rbs return: ::Integer
216
+ # @return [Integer]
217
+ # @see Nsid
218
+ def nsid; self[:"nsid"]&.value; end
219
+ # Flag indicating the PSP device is an associated device from a
220
+ # different network namespace.
221
+ # Present when in associated namespace, absent when in primary/host
222
+ # namespace.
223
+ # @rbs return: ::Integer
224
+ # @return [Integer]
225
+ # @see ByAssociation
226
+ def by_association; self[:"by_association"]&.value; end
88
227
  class << self
89
228
  # Looks up Attribute class by name.
90
- #--
91
229
  # @rbs name: Symbol
92
230
  # @rbs return: Attribute
231
+ # @param [Symbol] name
232
+ # @return [Attribute]
93
233
  def by_name(name); BY_NAME.fetch(name); end
94
234
  # Looks up Attribute class by type value.
95
- #--
96
235
  # @rbs type: Integer
97
236
  # @rbs return: Attribute
237
+ # @param [Integer] type
238
+ # @return [Attribute]
98
239
  def by_type(type); BY_TYPE.fetch(type); end
99
240
  end
100
241
  end
101
- class Assoc < ::Nl::Protocols::Genl::AttributeSet
242
+ class Assoc < ::Nl::AttributeSet
102
243
  # Abstract class
103
- class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
244
+ class Attribute < ::Nl::AttributeSet::Attribute
104
245
  end
246
+ # PSP device ID.
105
247
  class DevId < Attribute
106
248
  TYPE = 1
107
249
  NAME = :"dev_id"
108
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
250
+ # @private
251
+ ORDER = 0
252
+ # @private
253
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
109
254
  end
255
+ # PSP versions (AEAD and protocol version) used by this association,
256
+ # dictates the size of the key.
257
+ #
258
+ #
259
+ # Known enum values are defined in {Enums::Version}.
110
260
  class Version < Attribute
111
261
  TYPE = 2
112
262
  NAME = :"version"
113
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
263
+ # @private
264
+ ORDER = 1
265
+ # @private
266
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
114
267
  end
115
268
  class RxKey < Attribute
116
269
  TYPE = 3
117
270
  NAME = :"rx_key"
271
+ # @private
272
+ ORDER = 2
118
273
  end
119
274
  class TxKey < Attribute
120
275
  TYPE = 4
121
276
  NAME = :"tx_key"
277
+ # @private
278
+ ORDER = 3
122
279
  end
280
+ # Sockets which should be bound to the association immediately.
123
281
  class SockFd < Attribute
124
282
  TYPE = 5
125
283
  NAME = :"sock_fd"
126
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
284
+ # @private
285
+ ORDER = 4
286
+ # @private
287
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
127
288
  end
128
- # :nodoc:
289
+ # @private
129
290
  BY_NAME = Ractor.make_shareable({:"dev_id" => DevId, :"version" => Version, :"rx_key" => RxKey, :"tx_key" => TxKey, :"sock_fd" => SockFd}) #: Hash[::Symbol, Attribute]
130
- # :nodoc:
291
+ # @private
131
292
  BY_TYPE = Ractor.make_shareable({1 => DevId, 2 => Version, 3 => RxKey, 4 => TxKey, 5 => SockFd}) #: Hash[::Integer, Attribute]
293
+ # PSP device ID.
294
+ # @rbs return: ::Integer
295
+ # @return [Integer]
296
+ # @see DevId
297
+ def dev_id; self[:"dev_id"]&.value; end
298
+ # PSP versions (AEAD and protocol version) used by this association,
299
+ # dictates the size of the key.
300
+ #
301
+ #
302
+ # Known enum values are defined in {Enums::Version}.
303
+ # @rbs return: ::Integer
304
+ # @return [Integer]
305
+ # @see Version
306
+ def version; self[:"version"]&.value; end
307
+ # @rbs return: AttributeSets::Keys
308
+ # @return [AttributeSets::Keys]
309
+ # @see RxKey
310
+ def rx_key; self[:"rx_key"]&.value; end
311
+ # @rbs return: AttributeSets::Keys
312
+ # @return [AttributeSets::Keys]
313
+ # @see TxKey
314
+ def tx_key; self[:"tx_key"]&.value; end
315
+ # Sockets which should be bound to the association immediately.
316
+ # @rbs return: ::Integer
317
+ # @return [Integer]
318
+ # @see SockFd
319
+ def sock_fd; self[:"sock_fd"]&.value; end
132
320
  class << self
133
321
  # Looks up Attribute class by name.
134
- #--
135
322
  # @rbs name: Symbol
136
323
  # @rbs return: Attribute
324
+ # @param [Symbol] name
325
+ # @return [Attribute]
137
326
  def by_name(name); BY_NAME.fetch(name); end
138
327
  # Looks up Attribute class by type value.
139
- #--
140
328
  # @rbs type: Integer
141
329
  # @rbs return: Attribute
330
+ # @param [Integer] type
331
+ # @return [Attribute]
142
332
  def by_type(type); BY_TYPE.fetch(type); end
143
333
  end
144
334
  end
145
- class Keys < ::Nl::Protocols::Genl::AttributeSet
335
+ class Keys < ::Nl::AttributeSet
146
336
  # Abstract class
147
- class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
337
+ class Attribute < ::Nl::AttributeSet::Attribute
148
338
  end
149
339
  class Key < Attribute
150
340
  TYPE = 1
151
341
  NAME = :"key"
152
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
342
+ # @private
343
+ ORDER = 0
344
+ # @private
345
+ DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
153
346
  end
347
+ # Security Parameters Index (SPI) of the association.
154
348
  class Spi < Attribute
155
349
  TYPE = 2
156
350
  NAME = :"spi"
157
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
351
+ # @private
352
+ ORDER = 1
353
+ # @private
354
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
158
355
  end
159
- # :nodoc:
356
+ # @private
160
357
  BY_NAME = Ractor.make_shareable({:"key" => Key, :"spi" => Spi}) #: Hash[::Symbol, Attribute]
161
- # :nodoc:
358
+ # @private
162
359
  BY_TYPE = Ractor.make_shareable({1 => Key, 2 => Spi}) #: Hash[::Integer, Attribute]
360
+ # @rbs return: ::String
361
+ # @return [String]
362
+ # @see Key
363
+ def key; self[:"key"]&.value; end
364
+ # Security Parameters Index (SPI) of the association.
365
+ # @rbs return: ::Integer
366
+ # @return [Integer]
367
+ # @see Spi
368
+ def spi; self[:"spi"]&.value; end
163
369
  class << self
164
370
  # Looks up Attribute class by name.
165
- #--
166
371
  # @rbs name: Symbol
167
372
  # @rbs return: Attribute
373
+ # @param [Symbol] name
374
+ # @return [Attribute]
168
375
  def by_name(name); BY_NAME.fetch(name); end
169
376
  # Looks up Attribute class by type value.
170
- #--
171
377
  # @rbs type: Integer
172
378
  # @rbs return: Attribute
379
+ # @param [Integer] type
380
+ # @return [Attribute]
173
381
  def by_type(type); BY_TYPE.fetch(type); end
174
382
  end
175
383
  end
176
- class Stats < ::Nl::Protocols::Genl::AttributeSet
384
+ class Stats < ::Nl::AttributeSet
177
385
  # Abstract class
178
- class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
386
+ class Attribute < ::Nl::AttributeSet::Attribute
179
387
  end
388
+ # PSP device ID.
180
389
  class DevId < Attribute
181
390
  TYPE = 1
182
391
  NAME = :"dev_id"
183
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
392
+ # @private
393
+ ORDER = 0
394
+ # @private
395
+ DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
184
396
  end
397
+ # Number of key rotations during the lifetime of the device.
398
+ # Kernel statistic.
185
399
  class KeyRotations < Attribute
186
400
  TYPE = 2
187
401
  NAME = :"key_rotations"
188
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
402
+ # @private
403
+ ORDER = 1
404
+ # @private
405
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
189
406
  end
407
+ # Number of times a socket's Rx got shut down due to using
408
+ # a key which went stale (fully rotated out).
409
+ # Kernel statistic.
190
410
  class StaleEvents < Attribute
191
411
  TYPE = 3
192
412
  NAME = :"stale_events"
193
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
413
+ # @private
414
+ ORDER = 2
415
+ # @private
416
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
194
417
  end
418
+ # Number of successfully processed and authenticated PSP packets.
419
+ # Device statistic (from the PSP spec).
195
420
  class RxPackets < Attribute
196
421
  TYPE = 4
197
422
  NAME = :"rx_packets"
198
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
423
+ # @private
424
+ ORDER = 3
425
+ # @private
426
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
199
427
  end
428
+ # Number of successfully authenticated PSP bytes received, counting from
429
+ # the first byte after the IV through the last byte of payload.
430
+ # The fixed initial portion of the PSP header (16 bytes)
431
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
432
+ # Device statistic (from the PSP spec).
200
433
  class RxBytes < Attribute
201
434
  TYPE = 5
202
435
  NAME = :"rx_bytes"
203
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
436
+ # @private
437
+ ORDER = 4
438
+ # @private
439
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
204
440
  end
441
+ # Number of received PSP packets with unsuccessful authentication.
442
+ # Device statistic (from the PSP spec).
205
443
  class RxAuthFail < Attribute
206
444
  TYPE = 6
207
445
  NAME = :"rx_auth_fail"
208
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
446
+ # @private
447
+ ORDER = 5
448
+ # @private
449
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
209
450
  end
451
+ # Number of received PSP packets with length/framing errors.
452
+ # Device statistic (from the PSP spec).
210
453
  class RxError < Attribute
211
454
  TYPE = 7
212
455
  NAME = :"rx_error"
213
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
456
+ # @private
457
+ ORDER = 6
458
+ # @private
459
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
214
460
  end
461
+ # Number of received PSP packets with miscellaneous errors
462
+ # (invalid master key indicated by SPI, unsupported version, etc.)
463
+ # Device statistic (from the PSP spec).
215
464
  class RxBad < Attribute
216
465
  TYPE = 8
217
466
  NAME = :"rx_bad"
218
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
467
+ # @private
468
+ ORDER = 7
469
+ # @private
470
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
219
471
  end
472
+ # Number of successfully processed PSP packets for transmission.
473
+ # Device statistic (from the PSP spec).
220
474
  class TxPackets < Attribute
221
475
  TYPE = 9
222
476
  NAME = :"tx_packets"
223
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
477
+ # @private
478
+ ORDER = 8
479
+ # @private
480
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
224
481
  end
482
+ # Number of successfully processed PSP bytes for transmit, counting from
483
+ # the first byte after the IV through the last byte of payload.
484
+ # The fixed initial portion of the PSP header (16 bytes)
485
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
486
+ # Device statistic (from the PSP spec).
225
487
  class TxBytes < Attribute
226
488
  TYPE = 10
227
489
  NAME = :"tx_bytes"
228
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
490
+ # @private
491
+ ORDER = 9
492
+ # @private
493
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
229
494
  end
495
+ # Number of PSP packets for transmission with errors.
496
+ # Device statistic (from the PSP spec).
230
497
  class TxError < Attribute
231
498
  TYPE = 11
232
499
  NAME = :"tx_error"
233
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
500
+ # @private
501
+ ORDER = 10
502
+ # @private
503
+ DATATYPE = ::Nl::DataTypes::VariableInteger.new(::Nl::Endian::Host, signed: false, check: nil)
234
504
  end
235
- # :nodoc:
505
+ # @private
236
506
  BY_NAME = Ractor.make_shareable({:"dev_id" => DevId, :"key_rotations" => KeyRotations, :"stale_events" => StaleEvents, :"rx_packets" => RxPackets, :"rx_bytes" => RxBytes, :"rx_auth_fail" => RxAuthFail, :"rx_error" => RxError, :"rx_bad" => RxBad, :"tx_packets" => TxPackets, :"tx_bytes" => TxBytes, :"tx_error" => TxError}) #: Hash[::Symbol, Attribute]
237
- # :nodoc:
507
+ # @private
238
508
  BY_TYPE = Ractor.make_shareable({1 => DevId, 2 => KeyRotations, 3 => StaleEvents, 4 => RxPackets, 5 => RxBytes, 6 => RxAuthFail, 7 => RxError, 8 => RxBad, 9 => TxPackets, 10 => TxBytes, 11 => TxError}) #: Hash[::Integer, Attribute]
509
+ # PSP device ID.
510
+ # @rbs return: ::Integer
511
+ # @return [Integer]
512
+ # @see DevId
513
+ def dev_id; self[:"dev_id"]&.value; end
514
+ # Number of key rotations during the lifetime of the device.
515
+ # Kernel statistic.
516
+ # @rbs return: ::Integer
517
+ # @return [Integer]
518
+ # @see KeyRotations
519
+ def key_rotations; self[:"key_rotations"]&.value; end
520
+ # Number of times a socket's Rx got shut down due to using
521
+ # a key which went stale (fully rotated out).
522
+ # Kernel statistic.
523
+ # @rbs return: ::Integer
524
+ # @return [Integer]
525
+ # @see StaleEvents
526
+ def stale_events; self[:"stale_events"]&.value; end
527
+ # Number of successfully processed and authenticated PSP packets.
528
+ # Device statistic (from the PSP spec).
529
+ # @rbs return: ::Integer
530
+ # @return [Integer]
531
+ # @see RxPackets
532
+ def rx_packets; self[:"rx_packets"]&.value; end
533
+ # Number of successfully authenticated PSP bytes received, counting from
534
+ # the first byte after the IV through the last byte of payload.
535
+ # The fixed initial portion of the PSP header (16 bytes)
536
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
537
+ # Device statistic (from the PSP spec).
538
+ # @rbs return: ::Integer
539
+ # @return [Integer]
540
+ # @see RxBytes
541
+ def rx_bytes; self[:"rx_bytes"]&.value; end
542
+ # Number of received PSP packets with unsuccessful authentication.
543
+ # Device statistic (from the PSP spec).
544
+ # @rbs return: ::Integer
545
+ # @return [Integer]
546
+ # @see RxAuthFail
547
+ def rx_auth_fail; self[:"rx_auth_fail"]&.value; end
548
+ # Number of received PSP packets with length/framing errors.
549
+ # Device statistic (from the PSP spec).
550
+ # @rbs return: ::Integer
551
+ # @return [Integer]
552
+ # @see RxError
553
+ def rx_error; self[:"rx_error"]&.value; end
554
+ # Number of received PSP packets with miscellaneous errors
555
+ # (invalid master key indicated by SPI, unsupported version, etc.)
556
+ # Device statistic (from the PSP spec).
557
+ # @rbs return: ::Integer
558
+ # @return [Integer]
559
+ # @see RxBad
560
+ def rx_bad; self[:"rx_bad"]&.value; end
561
+ # Number of successfully processed PSP packets for transmission.
562
+ # Device statistic (from the PSP spec).
563
+ # @rbs return: ::Integer
564
+ # @return [Integer]
565
+ # @see TxPackets
566
+ def tx_packets; self[:"tx_packets"]&.value; end
567
+ # Number of successfully processed PSP bytes for transmit, counting from
568
+ # the first byte after the IV through the last byte of payload.
569
+ # The fixed initial portion of the PSP header (16 bytes)
570
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
571
+ # Device statistic (from the PSP spec).
572
+ # @rbs return: ::Integer
573
+ # @return [Integer]
574
+ # @see TxBytes
575
+ def tx_bytes; self[:"tx_bytes"]&.value; end
576
+ # Number of PSP packets for transmission with errors.
577
+ # Device statistic (from the PSP spec).
578
+ # @rbs return: ::Integer
579
+ # @return [Integer]
580
+ # @see TxError
581
+ def tx_error; self[:"tx_error"]&.value; end
239
582
  class << self
240
583
  # Looks up Attribute class by name.
241
- #--
242
584
  # @rbs name: Symbol
243
585
  # @rbs return: Attribute
586
+ # @param [Symbol] name
587
+ # @return [Attribute]
244
588
  def by_name(name); BY_NAME.fetch(name); end
245
589
  # Looks up Attribute class by type value.
246
- #--
247
590
  # @rbs type: Integer
248
591
  # @rbs return: Attribute
592
+ # @param [Integer] type
593
+ # @return [Attribute]
249
594
  def by_type(type); BY_TYPE.fetch(type); end
250
595
  end
251
596
  end
252
- Dev::AssocList::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(AssocDevInfo)
253
- Assoc::RxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
254
- Assoc::TxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
597
+ # @private
598
+ Dev::AssocList::DATATYPE = ::Nl::DataTypes::NestedAttributes.new(AttributeSets::AssocDevInfo, selector_bindings: Ractor.make_shareable([]))
599
+ # @private
600
+ Assoc::RxKey::DATATYPE = ::Nl::DataTypes::NestedAttributes.new(AttributeSets::Keys, selector_bindings: Ractor.make_shareable([]))
601
+ # @private
602
+ Assoc::TxKey::DATATYPE = ::Nl::DataTypes::NestedAttributes.new(AttributeSets::Keys, selector_bindings: Ractor.make_shareable([]))
255
603
  end
256
604
  module Messages
257
605
  # Get / dump information about PSP capable devices on the system.
258
- class DoDevGetRequest < ::Nl::Protocols::Genl::Message
606
+ class DoDevGetRequest < ::Nl::Genl::Message
259
607
  TYPE = 1
260
608
  FIXED_HEADER = nil
261
609
  ATTRIBUTE_SET = AttributeSets::Dev
262
610
  ATTRIBUTES = Ractor.make_shareable(%i[id])
263
- # Gets the value of `id` attribute in the message.
264
- #--
611
+ # PSP device ID.
265
612
  # @rbs return: ::Integer
613
+ # @return [Integer]
614
+ # @see AttributeSets::Dev::Id
266
615
  def id; attributes[:"id"]&.value; end
267
616
  end
268
617
  # Get / dump information about PSP capable devices on the system.
269
- class DoDevGetReply < ::Nl::Protocols::Genl::Message
618
+ class DoDevGetReply < ::Nl::Genl::Message
270
619
  TYPE = 1
271
620
  FIXED_HEADER = nil
272
621
  ATTRIBUTE_SET = AttributeSets::Dev
273
622
  ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
274
- # Gets the value of `id` attribute in the message.
275
- #--
623
+ # PSP device ID.
276
624
  # @rbs return: ::Integer
625
+ # @return [Integer]
626
+ # @see AttributeSets::Dev::Id
277
627
  def id; attributes[:"id"]&.value; end
278
- # Gets the value of `ifindex` attribute in the message.
279
- #--
628
+ # ifindex of the main netdevice linked to the PSP device,
629
+ # or the ifindex to associate with the PSP device.
280
630
  # @rbs return: ::Integer
631
+ # @return [Integer]
632
+ # @see AttributeSets::Dev::Ifindex
281
633
  def ifindex; attributes[:"ifindex"]&.value; end
282
- # Gets the value of `psp-versions-cap` attribute in the message.
283
- #--
634
+ # Bitmask of PSP versions supported by the device.
635
+ #
636
+ # Known flags are defined in {Flags::Version}.
284
637
  # @rbs return: ::Integer
638
+ # @return [Integer]
639
+ # @see AttributeSets::Dev::PspVersionsCap
285
640
  def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
286
- # Gets the value of `psp-versions-ena` attribute in the message.
287
- #--
641
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
642
+ #
643
+ # Known flags are defined in {Flags::Version}.
288
644
  # @rbs return: ::Integer
645
+ # @return [Integer]
646
+ # @see AttributeSets::Dev::PspVersionsEna
289
647
  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
- #--
648
+ # List of associated virtual devices.
649
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
650
+ # @return [Array<AttributeSets::AssocDevInfo>]
651
+ # @see AttributeSets::Dev::AssocList
652
+ def assoc_list; attributes[:"assoc_list"].map(&:value); end
653
+ # Flag indicating the PSP device is an associated device from a
654
+ # different network namespace.
655
+ # Present when in associated namespace, absent when in primary/host
656
+ # namespace.
296
657
  # @rbs return: ::Integer
658
+ # @return [Integer]
659
+ # @see AttributeSets::Dev::ByAssociation
297
660
  def by_association; attributes[:"by_association"]&.value; end
298
661
  end
299
662
  # Get / dump information about PSP capable devices on the system.
300
- class DumpDevGetReply < ::Nl::Protocols::Genl::Message
663
+ class DumpDevGetRequest < ::Nl::Genl::Message
664
+ TYPE = 1
665
+ FIXED_HEADER = nil
666
+ ATTRIBUTE_SET = AttributeSets::Dev
667
+ ATTRIBUTES = Ractor.make_shareable(%i[])
668
+ end
669
+ # Get / dump information about PSP capable devices on the system.
670
+ class DumpDevGetReply < ::Nl::Genl::Message
301
671
  TYPE = 1
302
672
  FIXED_HEADER = nil
303
673
  ATTRIBUTE_SET = AttributeSets::Dev
304
674
  ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
305
- # Gets the value of `id` attribute in the message.
306
- #--
675
+ # PSP device ID.
307
676
  # @rbs return: ::Integer
677
+ # @return [Integer]
678
+ # @see AttributeSets::Dev::Id
308
679
  def id; attributes[:"id"]&.value; end
309
- # Gets the value of `ifindex` attribute in the message.
310
- #--
680
+ # ifindex of the main netdevice linked to the PSP device,
681
+ # or the ifindex to associate with the PSP device.
311
682
  # @rbs return: ::Integer
683
+ # @return [Integer]
684
+ # @see AttributeSets::Dev::Ifindex
312
685
  def ifindex; attributes[:"ifindex"]&.value; end
313
- # Gets the value of `psp-versions-cap` attribute in the message.
314
- #--
686
+ # Bitmask of PSP versions supported by the device.
687
+ #
688
+ # Known flags are defined in {Flags::Version}.
315
689
  # @rbs return: ::Integer
690
+ # @return [Integer]
691
+ # @see AttributeSets::Dev::PspVersionsCap
316
692
  def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
317
- # Gets the value of `psp-versions-ena` attribute in the message.
318
- #--
693
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
694
+ #
695
+ # Known flags are defined in {Flags::Version}.
319
696
  # @rbs return: ::Integer
697
+ # @return [Integer]
698
+ # @see AttributeSets::Dev::PspVersionsEna
320
699
  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
- #--
700
+ # List of associated virtual devices.
701
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
702
+ # @return [Array<AttributeSets::AssocDevInfo>]
703
+ # @see AttributeSets::Dev::AssocList
704
+ def assoc_list; attributes[:"assoc_list"].map(&:value); end
705
+ # Flag indicating the PSP device is an associated device from a
706
+ # different network namespace.
707
+ # Present when in associated namespace, absent when in primary/host
708
+ # namespace.
327
709
  # @rbs return: ::Integer
710
+ # @return [Integer]
711
+ # @see AttributeSets::Dev::ByAssociation
328
712
  def by_association; attributes[:"by_association"]&.value; end
329
713
  end
330
714
  # Set the configuration of a PSP device.
331
- class DoDevSetRequest < ::Nl::Protocols::Genl::Message
715
+ #
716
+ # Requires CAP_NET_ADMIN in the initial user namespace.
717
+ class DoDevSetRequest < ::Nl::Genl::Message
332
718
  TYPE = 4
333
719
  FIXED_HEADER = nil
334
720
  ATTRIBUTE_SET = AttributeSets::Dev
335
721
  ATTRIBUTES = Ractor.make_shareable(%i[id psp_versions_ena])
336
- # Gets the value of `id` attribute in the message.
337
- #--
722
+ # PSP device ID.
338
723
  # @rbs return: ::Integer
724
+ # @return [Integer]
725
+ # @see AttributeSets::Dev::Id
339
726
  def id; attributes[:"id"]&.value; end
340
- # Gets the value of `psp-versions-ena` attribute in the message.
341
- #--
727
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
728
+ #
729
+ # Known flags are defined in {Flags::Version}.
342
730
  # @rbs return: ::Integer
731
+ # @return [Integer]
732
+ # @see AttributeSets::Dev::PspVersionsEna
343
733
  def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
344
734
  end
345
735
  # Set the configuration of a PSP device.
346
- class DoDevSetReply < ::Nl::Protocols::Genl::Message
736
+ #
737
+ # Requires CAP_NET_ADMIN in the initial user namespace.
738
+ class DoDevSetReply < ::Nl::Genl::Message
347
739
  TYPE = 4
348
740
  FIXED_HEADER = nil
349
741
  ATTRIBUTE_SET = AttributeSets::Dev
350
742
  ATTRIBUTES = Ractor.make_shareable(%i[])
351
743
  end
352
744
  # Rotate the device key.
353
- class DoKeyRotateRequest < ::Nl::Protocols::Genl::Message
745
+ #
746
+ # Requires CAP_NET_ADMIN in the initial user namespace.
747
+ class DoKeyRotateRequest < ::Nl::Genl::Message
354
748
  TYPE = 6
355
749
  FIXED_HEADER = nil
356
750
  ATTRIBUTE_SET = AttributeSets::Dev
357
751
  ATTRIBUTES = Ractor.make_shareable(%i[id])
358
- # Gets the value of `id` attribute in the message.
359
- #--
752
+ # PSP device ID.
360
753
  # @rbs return: ::Integer
754
+ # @return [Integer]
755
+ # @see AttributeSets::Dev::Id
361
756
  def id; attributes[:"id"]&.value; end
362
757
  end
363
758
  # Rotate the device key.
364
- class DoKeyRotateReply < ::Nl::Protocols::Genl::Message
759
+ #
760
+ # Requires CAP_NET_ADMIN in the initial user namespace.
761
+ class DoKeyRotateReply < ::Nl::Genl::Message
365
762
  TYPE = 6
366
763
  FIXED_HEADER = nil
367
764
  ATTRIBUTE_SET = AttributeSets::Dev
368
765
  ATTRIBUTES = Ractor.make_shareable(%i[id])
369
- # Gets the value of `id` attribute in the message.
370
- #--
766
+ # PSP device ID.
371
767
  # @rbs return: ::Integer
768
+ # @return [Integer]
769
+ # @see AttributeSets::Dev::Id
372
770
  def id; attributes[:"id"]&.value; end
373
771
  end
374
772
  # Allocate a new Rx key + SPI pair, associate it with a socket.
375
- class DoRxAssocRequest < ::Nl::Protocols::Genl::Message
773
+ class DoRxAssocRequest < ::Nl::Genl::Message
376
774
  TYPE = 8
377
775
  FIXED_HEADER = nil
378
776
  ATTRIBUTE_SET = AttributeSets::Assoc
379
777
  ATTRIBUTES = Ractor.make_shareable(%i[dev_id version sock_fd])
380
- # Gets the value of `dev-id` attribute in the message.
381
- #--
778
+ # PSP device ID.
382
779
  # @rbs return: ::Integer
780
+ # @return [Integer]
781
+ # @see AttributeSets::Assoc::DevId
383
782
  def dev_id; attributes[:"dev_id"]&.value; end
384
- # Gets the value of `version` attribute in the message.
385
- #--
783
+ # PSP versions (AEAD and protocol version) used by this association,
784
+ # dictates the size of the key.
785
+ #
786
+ #
787
+ # Known enum values are defined in {Enums::Version}.
386
788
  # @rbs return: ::Integer
789
+ # @return [Integer]
790
+ # @see AttributeSets::Assoc::Version
387
791
  def version; attributes[:"version"]&.value; end
388
- # Gets the value of `sock-fd` attribute in the message.
389
- #--
792
+ # Sockets which should be bound to the association immediately.
390
793
  # @rbs return: ::Integer
794
+ # @return [Integer]
795
+ # @see AttributeSets::Assoc::SockFd
391
796
  def sock_fd; attributes[:"sock_fd"]&.value; end
392
797
  end
393
798
  # Allocate a new Rx key + SPI pair, associate it with a socket.
394
- class DoRxAssocReply < ::Nl::Protocols::Genl::Message
799
+ class DoRxAssocReply < ::Nl::Genl::Message
395
800
  TYPE = 8
396
801
  FIXED_HEADER = nil
397
802
  ATTRIBUTE_SET = AttributeSets::Assoc
398
803
  ATTRIBUTES = Ractor.make_shareable(%i[dev_id rx_key])
399
- # Gets the value of `dev-id` attribute in the message.
400
- #--
804
+ # PSP device ID.
401
805
  # @rbs return: ::Integer
806
+ # @return [Integer]
807
+ # @see AttributeSets::Assoc::DevId
402
808
  def dev_id; attributes[:"dev_id"]&.value; end
403
- # Gets the value of `rx-key` attribute in the message.
404
- #--
405
809
  # @rbs return: AttributeSets::Keys
810
+ # @return [AttributeSets::Keys]
811
+ # @see AttributeSets::Assoc::RxKey
406
812
  def rx_key; attributes[:"rx_key"]&.value; end
407
813
  end
408
814
  # Add a PSP Tx association.
409
- class DoTxAssocRequest < ::Nl::Protocols::Genl::Message
815
+ class DoTxAssocRequest < ::Nl::Genl::Message
410
816
  TYPE = 9
411
817
  FIXED_HEADER = nil
412
818
  ATTRIBUTE_SET = AttributeSets::Assoc
413
819
  ATTRIBUTES = Ractor.make_shareable(%i[dev_id version tx_key sock_fd])
414
- # Gets the value of `dev-id` attribute in the message.
415
- #--
820
+ # PSP device ID.
416
821
  # @rbs return: ::Integer
822
+ # @return [Integer]
823
+ # @see AttributeSets::Assoc::DevId
417
824
  def dev_id; attributes[:"dev_id"]&.value; end
418
- # Gets the value of `version` attribute in the message.
419
- #--
825
+ # PSP versions (AEAD and protocol version) used by this association,
826
+ # dictates the size of the key.
827
+ #
828
+ #
829
+ # Known enum values are defined in {Enums::Version}.
420
830
  # @rbs return: ::Integer
831
+ # @return [Integer]
832
+ # @see AttributeSets::Assoc::Version
421
833
  def version; attributes[:"version"]&.value; end
422
- # Gets the value of `tx-key` attribute in the message.
423
- #--
424
834
  # @rbs return: AttributeSets::Keys
835
+ # @return [AttributeSets::Keys]
836
+ # @see AttributeSets::Assoc::TxKey
425
837
  def tx_key; attributes[:"tx_key"]&.value; end
426
- # Gets the value of `sock-fd` attribute in the message.
427
- #--
838
+ # Sockets which should be bound to the association immediately.
428
839
  # @rbs return: ::Integer
840
+ # @return [Integer]
841
+ # @see AttributeSets::Assoc::SockFd
429
842
  def sock_fd; attributes[:"sock_fd"]&.value; end
430
843
  end
431
844
  # Add a PSP Tx association.
432
- class DoTxAssocReply < ::Nl::Protocols::Genl::Message
845
+ class DoTxAssocReply < ::Nl::Genl::Message
433
846
  TYPE = 9
434
847
  FIXED_HEADER = nil
435
848
  ATTRIBUTE_SET = AttributeSets::Assoc
436
849
  ATTRIBUTES = Ractor.make_shareable(%i[])
437
850
  end
438
851
  # Get device statistics.
439
- class DoGetStatsRequest < ::Nl::Protocols::Genl::Message
852
+ class DoGetStatsRequest < ::Nl::Genl::Message
440
853
  TYPE = 10
441
854
  FIXED_HEADER = nil
442
855
  ATTRIBUTE_SET = AttributeSets::Stats
443
856
  ATTRIBUTES = Ractor.make_shareable(%i[dev_id])
444
- # Gets the value of `dev-id` attribute in the message.
445
- #--
857
+ # PSP device ID.
446
858
  # @rbs return: ::Integer
859
+ # @return [Integer]
860
+ # @see AttributeSets::Stats::DevId
447
861
  def dev_id; attributes[:"dev_id"]&.value; end
448
862
  end
449
863
  # Get device statistics.
450
- class DoGetStatsReply < ::Nl::Protocols::Genl::Message
864
+ class DoGetStatsReply < ::Nl::Genl::Message
451
865
  TYPE = 10
452
866
  FIXED_HEADER = nil
453
867
  ATTRIBUTE_SET = AttributeSets::Stats
454
868
  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])
455
- # Gets the value of `dev-id` attribute in the message.
456
- #--
869
+ # PSP device ID.
457
870
  # @rbs return: ::Integer
871
+ # @return [Integer]
872
+ # @see AttributeSets::Stats::DevId
458
873
  def dev_id; attributes[:"dev_id"]&.value; end
459
- # Gets the value of `key-rotations` attribute in the message.
460
- #--
874
+ # Number of key rotations during the lifetime of the device.
875
+ # Kernel statistic.
461
876
  # @rbs return: ::Integer
877
+ # @return [Integer]
878
+ # @see AttributeSets::Stats::KeyRotations
462
879
  def key_rotations; attributes[:"key_rotations"]&.value; end
463
- # Gets the value of `stale-events` attribute in the message.
464
- #--
880
+ # Number of times a socket's Rx got shut down due to using
881
+ # a key which went stale (fully rotated out).
882
+ # Kernel statistic.
465
883
  # @rbs return: ::Integer
884
+ # @return [Integer]
885
+ # @see AttributeSets::Stats::StaleEvents
466
886
  def stale_events; attributes[:"stale_events"]&.value; end
467
- # Gets the value of `rx-packets` attribute in the message.
468
- #--
887
+ # Number of successfully processed and authenticated PSP packets.
888
+ # Device statistic (from the PSP spec).
469
889
  # @rbs return: ::Integer
890
+ # @return [Integer]
891
+ # @see AttributeSets::Stats::RxPackets
470
892
  def rx_packets; attributes[:"rx_packets"]&.value; end
471
- # Gets the value of `rx-bytes` attribute in the message.
472
- #--
893
+ # Number of successfully authenticated PSP bytes received, counting from
894
+ # the first byte after the IV through the last byte of payload.
895
+ # The fixed initial portion of the PSP header (16 bytes)
896
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
897
+ # Device statistic (from the PSP spec).
473
898
  # @rbs return: ::Integer
899
+ # @return [Integer]
900
+ # @see AttributeSets::Stats::RxBytes
474
901
  def rx_bytes; attributes[:"rx_bytes"]&.value; end
475
- # Gets the value of `rx-auth-fail` attribute in the message.
476
- #--
902
+ # Number of received PSP packets with unsuccessful authentication.
903
+ # Device statistic (from the PSP spec).
477
904
  # @rbs return: ::Integer
905
+ # @return [Integer]
906
+ # @see AttributeSets::Stats::RxAuthFail
478
907
  def rx_auth_fail; attributes[:"rx_auth_fail"]&.value; end
479
- # Gets the value of `rx-error` attribute in the message.
480
- #--
908
+ # Number of received PSP packets with length/framing errors.
909
+ # Device statistic (from the PSP spec).
481
910
  # @rbs return: ::Integer
911
+ # @return [Integer]
912
+ # @see AttributeSets::Stats::RxError
482
913
  def rx_error; attributes[:"rx_error"]&.value; end
483
- # Gets the value of `rx-bad` attribute in the message.
484
- #--
914
+ # Number of received PSP packets with miscellaneous errors
915
+ # (invalid master key indicated by SPI, unsupported version, etc.)
916
+ # Device statistic (from the PSP spec).
485
917
  # @rbs return: ::Integer
918
+ # @return [Integer]
919
+ # @see AttributeSets::Stats::RxBad
486
920
  def rx_bad; attributes[:"rx_bad"]&.value; end
487
- # Gets the value of `tx-packets` attribute in the message.
488
- #--
921
+ # Number of successfully processed PSP packets for transmission.
922
+ # Device statistic (from the PSP spec).
489
923
  # @rbs return: ::Integer
924
+ # @return [Integer]
925
+ # @see AttributeSets::Stats::TxPackets
490
926
  def tx_packets; attributes[:"tx_packets"]&.value; end
491
- # Gets the value of `tx-bytes` attribute in the message.
492
- #--
927
+ # Number of successfully processed PSP bytes for transmit, counting from
928
+ # the first byte after the IV through the last byte of payload.
929
+ # The fixed initial portion of the PSP header (16 bytes)
930
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
931
+ # Device statistic (from the PSP spec).
493
932
  # @rbs return: ::Integer
933
+ # @return [Integer]
934
+ # @see AttributeSets::Stats::TxBytes
494
935
  def tx_bytes; attributes[:"tx_bytes"]&.value; end
495
- # Gets the value of `tx-error` attribute in the message.
496
- #--
936
+ # Number of PSP packets for transmission with errors.
937
+ # Device statistic (from the PSP spec).
497
938
  # @rbs return: ::Integer
939
+ # @return [Integer]
940
+ # @see AttributeSets::Stats::TxError
498
941
  def tx_error; attributes[:"tx_error"]&.value; end
499
942
  end
500
943
  # Get device statistics.
501
- class DumpGetStatsReply < ::Nl::Protocols::Genl::Message
944
+ class DumpGetStatsRequest < ::Nl::Genl::Message
945
+ TYPE = 10
946
+ FIXED_HEADER = nil
947
+ ATTRIBUTE_SET = AttributeSets::Stats
948
+ ATTRIBUTES = Ractor.make_shareable(%i[])
949
+ end
950
+ # Get device statistics.
951
+ class DumpGetStatsReply < ::Nl::Genl::Message
502
952
  TYPE = 10
503
953
  FIXED_HEADER = nil
504
954
  ATTRIBUTE_SET = AttributeSets::Stats
505
955
  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])
506
- # Gets the value of `dev-id` attribute in the message.
507
- #--
956
+ # PSP device ID.
508
957
  # @rbs return: ::Integer
958
+ # @return [Integer]
959
+ # @see AttributeSets::Stats::DevId
509
960
  def dev_id; attributes[:"dev_id"]&.value; end
510
- # Gets the value of `key-rotations` attribute in the message.
511
- #--
961
+ # Number of key rotations during the lifetime of the device.
962
+ # Kernel statistic.
512
963
  # @rbs return: ::Integer
964
+ # @return [Integer]
965
+ # @see AttributeSets::Stats::KeyRotations
513
966
  def key_rotations; attributes[:"key_rotations"]&.value; end
514
- # Gets the value of `stale-events` attribute in the message.
515
- #--
967
+ # Number of times a socket's Rx got shut down due to using
968
+ # a key which went stale (fully rotated out).
969
+ # Kernel statistic.
516
970
  # @rbs return: ::Integer
971
+ # @return [Integer]
972
+ # @see AttributeSets::Stats::StaleEvents
517
973
  def stale_events; attributes[:"stale_events"]&.value; end
518
- # Gets the value of `rx-packets` attribute in the message.
519
- #--
974
+ # Number of successfully processed and authenticated PSP packets.
975
+ # Device statistic (from the PSP spec).
520
976
  # @rbs return: ::Integer
977
+ # @return [Integer]
978
+ # @see AttributeSets::Stats::RxPackets
521
979
  def rx_packets; attributes[:"rx_packets"]&.value; end
522
- # Gets the value of `rx-bytes` attribute in the message.
523
- #--
980
+ # Number of successfully authenticated PSP bytes received, counting from
981
+ # the first byte after the IV through the last byte of payload.
982
+ # The fixed initial portion of the PSP header (16 bytes)
983
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
984
+ # Device statistic (from the PSP spec).
524
985
  # @rbs return: ::Integer
986
+ # @return [Integer]
987
+ # @see AttributeSets::Stats::RxBytes
525
988
  def rx_bytes; attributes[:"rx_bytes"]&.value; end
526
- # Gets the value of `rx-auth-fail` attribute in the message.
527
- #--
989
+ # Number of received PSP packets with unsuccessful authentication.
990
+ # Device statistic (from the PSP spec).
528
991
  # @rbs return: ::Integer
992
+ # @return [Integer]
993
+ # @see AttributeSets::Stats::RxAuthFail
529
994
  def rx_auth_fail; attributes[:"rx_auth_fail"]&.value; end
530
- # Gets the value of `rx-error` attribute in the message.
531
- #--
995
+ # Number of received PSP packets with length/framing errors.
996
+ # Device statistic (from the PSP spec).
532
997
  # @rbs return: ::Integer
998
+ # @return [Integer]
999
+ # @see AttributeSets::Stats::RxError
533
1000
  def rx_error; attributes[:"rx_error"]&.value; end
534
- # Gets the value of `rx-bad` attribute in the message.
535
- #--
1001
+ # Number of received PSP packets with miscellaneous errors
1002
+ # (invalid master key indicated by SPI, unsupported version, etc.)
1003
+ # Device statistic (from the PSP spec).
536
1004
  # @rbs return: ::Integer
1005
+ # @return [Integer]
1006
+ # @see AttributeSets::Stats::RxBad
537
1007
  def rx_bad; attributes[:"rx_bad"]&.value; end
538
- # Gets the value of `tx-packets` attribute in the message.
539
- #--
1008
+ # Number of successfully processed PSP packets for transmission.
1009
+ # Device statistic (from the PSP spec).
540
1010
  # @rbs return: ::Integer
1011
+ # @return [Integer]
1012
+ # @see AttributeSets::Stats::TxPackets
541
1013
  def tx_packets; attributes[:"tx_packets"]&.value; end
542
- # Gets the value of `tx-bytes` attribute in the message.
543
- #--
1014
+ # Number of successfully processed PSP bytes for transmit, counting from
1015
+ # the first byte after the IV through the last byte of payload.
1016
+ # The fixed initial portion of the PSP header (16 bytes)
1017
+ # and the PSP trailer/ICV (16 bytes) are not included in this count.
1018
+ # Device statistic (from the PSP spec).
544
1019
  # @rbs return: ::Integer
1020
+ # @return [Integer]
1021
+ # @see AttributeSets::Stats::TxBytes
545
1022
  def tx_bytes; attributes[:"tx_bytes"]&.value; end
546
- # Gets the value of `tx-error` attribute in the message.
547
- #--
1023
+ # Number of PSP packets for transmission with errors.
1024
+ # Device statistic (from the PSP spec).
548
1025
  # @rbs return: ::Integer
1026
+ # @return [Integer]
1027
+ # @see AttributeSets::Stats::TxError
549
1028
  def tx_error; attributes[:"tx_error"]&.value; end
550
1029
  end
551
1030
  # Associate a network device with a PSP device.
552
- class DoDevAssocRequest < ::Nl::Protocols::Genl::Message
1031
+ #
1032
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1033
+ class DoDevAssocRequest < ::Nl::Genl::Message
553
1034
  TYPE = 11
554
1035
  FIXED_HEADER = nil
555
1036
  ATTRIBUTE_SET = AttributeSets::Dev
556
1037
  ATTRIBUTES = Ractor.make_shareable(%i[id ifindex nsid])
557
- # Gets the value of `id` attribute in the message.
558
- #--
1038
+ # PSP device ID.
559
1039
  # @rbs return: ::Integer
1040
+ # @return [Integer]
1041
+ # @see AttributeSets::Dev::Id
560
1042
  def id; attributes[:"id"]&.value; end
561
- # Gets the value of `ifindex` attribute in the message.
562
- #--
1043
+ # ifindex of the main netdevice linked to the PSP device,
1044
+ # or the ifindex to associate with the PSP device.
563
1045
  # @rbs return: ::Integer
1046
+ # @return [Integer]
1047
+ # @see AttributeSets::Dev::Ifindex
564
1048
  def ifindex; attributes[:"ifindex"]&.value; end
565
- # Gets the value of `nsid` attribute in the message.
566
- #--
1049
+ # Network namespace ID for the device to associate/disassociate.
1050
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1051
+ # device is looked up in the caller's network namespace.
567
1052
  # @rbs return: ::Integer
1053
+ # @return [Integer]
1054
+ # @see AttributeSets::Dev::Nsid
568
1055
  def nsid; attributes[:"nsid"]&.value; end
569
1056
  end
570
1057
  # Associate a network device with a PSP device.
571
- class DoDevAssocReply < ::Nl::Protocols::Genl::Message
1058
+ #
1059
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1060
+ class DoDevAssocReply < ::Nl::Genl::Message
572
1061
  TYPE = 11
573
1062
  FIXED_HEADER = nil
574
1063
  ATTRIBUTE_SET = AttributeSets::Dev
575
1064
  ATTRIBUTES = Ractor.make_shareable(%i[])
576
1065
  end
577
1066
  # Disassociate a network device from a PSP device.
578
- class DoDevDisassocRequest < ::Nl::Protocols::Genl::Message
1067
+ #
1068
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1069
+ class DoDevDisassocRequest < ::Nl::Genl::Message
579
1070
  TYPE = 12
580
1071
  FIXED_HEADER = nil
581
1072
  ATTRIBUTE_SET = AttributeSets::Dev
582
1073
  ATTRIBUTES = Ractor.make_shareable(%i[id ifindex nsid])
583
- # Gets the value of `id` attribute in the message.
584
- #--
1074
+ # PSP device ID.
585
1075
  # @rbs return: ::Integer
1076
+ # @return [Integer]
1077
+ # @see AttributeSets::Dev::Id
586
1078
  def id; attributes[:"id"]&.value; end
587
- # Gets the value of `ifindex` attribute in the message.
588
- #--
1079
+ # ifindex of the main netdevice linked to the PSP device,
1080
+ # or the ifindex to associate with the PSP device.
589
1081
  # @rbs return: ::Integer
1082
+ # @return [Integer]
1083
+ # @see AttributeSets::Dev::Ifindex
590
1084
  def ifindex; attributes[:"ifindex"]&.value; end
591
- # Gets the value of `nsid` attribute in the message.
592
- #--
1085
+ # Network namespace ID for the device to associate/disassociate.
1086
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1087
+ # device is looked up in the caller's network namespace.
593
1088
  # @rbs return: ::Integer
1089
+ # @return [Integer]
1090
+ # @see AttributeSets::Dev::Nsid
594
1091
  def nsid; attributes[:"nsid"]&.value; end
595
1092
  end
596
1093
  # Disassociate a network device from a PSP device.
597
- class DoDevDisassocReply < ::Nl::Protocols::Genl::Message
1094
+ #
1095
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1096
+ class DoDevDisassocReply < ::Nl::Genl::Message
598
1097
  TYPE = 12
599
1098
  FIXED_HEADER = nil
600
1099
  ATTRIBUTE_SET = AttributeSets::Dev
601
1100
  ATTRIBUTES = Ractor.make_shareable(%i[])
602
1101
  end
603
1102
  end
1103
+ module Notifications
1104
+ # Notification about device appearing.
1105
+ #
1106
+ # Multicast group: `mgmt`.
1107
+ class DevAddNtf < ::Nl::Genl::Message
1108
+ TYPE = 2
1109
+ FIXED_HEADER = nil
1110
+ ATTRIBUTE_SET = AttributeSets::Dev
1111
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
1112
+ # PSP device ID.
1113
+ # @rbs return: ::Integer
1114
+ # @return [Integer]
1115
+ # @see AttributeSets::Dev::Id
1116
+ def id; attributes[:"id"]&.value; end
1117
+ # ifindex of the main netdevice linked to the PSP device,
1118
+ # or the ifindex to associate with the PSP device.
1119
+ # @rbs return: ::Integer
1120
+ # @return [Integer]
1121
+ # @see AttributeSets::Dev::Ifindex
1122
+ def ifindex; attributes[:"ifindex"]&.value; end
1123
+ # Bitmask of PSP versions supported by the device.
1124
+ #
1125
+ # Known flags are defined in {Flags::Version}.
1126
+ # @rbs return: ::Integer
1127
+ # @return [Integer]
1128
+ # @see AttributeSets::Dev::PspVersionsCap
1129
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
1130
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
1131
+ #
1132
+ # Known flags are defined in {Flags::Version}.
1133
+ # @rbs return: ::Integer
1134
+ # @return [Integer]
1135
+ # @see AttributeSets::Dev::PspVersionsEna
1136
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
1137
+ # List of associated virtual devices.
1138
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
1139
+ # @return [Array<AttributeSets::AssocDevInfo>]
1140
+ # @see AttributeSets::Dev::AssocList
1141
+ def assoc_list; attributes[:"assoc_list"].map(&:value); end
1142
+ # Flag indicating the PSP device is an associated device from a
1143
+ # different network namespace.
1144
+ # Present when in associated namespace, absent when in primary/host
1145
+ # namespace.
1146
+ # @rbs return: ::Integer
1147
+ # @return [Integer]
1148
+ # @see AttributeSets::Dev::ByAssociation
1149
+ def by_association; attributes[:"by_association"]&.value; end
1150
+ end
1151
+ # Notification about device disappearing.
1152
+ #
1153
+ # Multicast group: `mgmt`.
1154
+ class DevDelNtf < ::Nl::Genl::Message
1155
+ TYPE = 3
1156
+ FIXED_HEADER = nil
1157
+ ATTRIBUTE_SET = AttributeSets::Dev
1158
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
1159
+ # PSP device ID.
1160
+ # @rbs return: ::Integer
1161
+ # @return [Integer]
1162
+ # @see AttributeSets::Dev::Id
1163
+ def id; attributes[:"id"]&.value; end
1164
+ # ifindex of the main netdevice linked to the PSP device,
1165
+ # or the ifindex to associate with the PSP device.
1166
+ # @rbs return: ::Integer
1167
+ # @return [Integer]
1168
+ # @see AttributeSets::Dev::Ifindex
1169
+ def ifindex; attributes[:"ifindex"]&.value; end
1170
+ # Bitmask of PSP versions supported by the device.
1171
+ #
1172
+ # Known flags are defined in {Flags::Version}.
1173
+ # @rbs return: ::Integer
1174
+ # @return [Integer]
1175
+ # @see AttributeSets::Dev::PspVersionsCap
1176
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
1177
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
1178
+ #
1179
+ # Known flags are defined in {Flags::Version}.
1180
+ # @rbs return: ::Integer
1181
+ # @return [Integer]
1182
+ # @see AttributeSets::Dev::PspVersionsEna
1183
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
1184
+ # List of associated virtual devices.
1185
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
1186
+ # @return [Array<AttributeSets::AssocDevInfo>]
1187
+ # @see AttributeSets::Dev::AssocList
1188
+ def assoc_list; attributes[:"assoc_list"].map(&:value); end
1189
+ # Flag indicating the PSP device is an associated device from a
1190
+ # different network namespace.
1191
+ # Present when in associated namespace, absent when in primary/host
1192
+ # namespace.
1193
+ # @rbs return: ::Integer
1194
+ # @return [Integer]
1195
+ # @see AttributeSets::Dev::ByAssociation
1196
+ def by_association; attributes[:"by_association"]&.value; end
1197
+ end
1198
+ # Notification about device configuration being changed.
1199
+ #
1200
+ # Multicast group: `mgmt`.
1201
+ class DevChangeNtf < ::Nl::Genl::Message
1202
+ TYPE = 5
1203
+ FIXED_HEADER = nil
1204
+ ATTRIBUTE_SET = AttributeSets::Dev
1205
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
1206
+ # PSP device ID.
1207
+ # @rbs return: ::Integer
1208
+ # @return [Integer]
1209
+ # @see AttributeSets::Dev::Id
1210
+ def id; attributes[:"id"]&.value; end
1211
+ # ifindex of the main netdevice linked to the PSP device,
1212
+ # or the ifindex to associate with the PSP device.
1213
+ # @rbs return: ::Integer
1214
+ # @return [Integer]
1215
+ # @see AttributeSets::Dev::Ifindex
1216
+ def ifindex; attributes[:"ifindex"]&.value; end
1217
+ # Bitmask of PSP versions supported by the device.
1218
+ #
1219
+ # Known flags are defined in {Flags::Version}.
1220
+ # @rbs return: ::Integer
1221
+ # @return [Integer]
1222
+ # @see AttributeSets::Dev::PspVersionsCap
1223
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
1224
+ # Bitmask of currently enabled (accepted on Rx) PSP versions.
1225
+ #
1226
+ # Known flags are defined in {Flags::Version}.
1227
+ # @rbs return: ::Integer
1228
+ # @return [Integer]
1229
+ # @see AttributeSets::Dev::PspVersionsEna
1230
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
1231
+ # List of associated virtual devices.
1232
+ # @rbs return: ::Array[AttributeSets::AssocDevInfo]
1233
+ # @return [Array<AttributeSets::AssocDevInfo>]
1234
+ # @see AttributeSets::Dev::AssocList
1235
+ def assoc_list; attributes[:"assoc_list"].map(&:value); end
1236
+ # Flag indicating the PSP device is an associated device from a
1237
+ # different network namespace.
1238
+ # Present when in associated namespace, absent when in primary/host
1239
+ # namespace.
1240
+ # @rbs return: ::Integer
1241
+ # @return [Integer]
1242
+ # @see AttributeSets::Dev::ByAssociation
1243
+ def by_association; attributes[:"by_association"]&.value; end
1244
+ end
1245
+ # Notification about device key getting rotated.
1246
+ #
1247
+ # Multicast group: `use`.
1248
+ class KeyRotateNtf < ::Nl::Genl::Message
1249
+ TYPE = 7
1250
+ FIXED_HEADER = nil
1251
+ ATTRIBUTE_SET = AttributeSets::Dev
1252
+ ATTRIBUTES = Ractor.make_shareable(%i[id])
1253
+ # PSP device ID.
1254
+ # @rbs return: ::Integer
1255
+ # @return [Integer]
1256
+ # @see AttributeSets::Dev::Id
1257
+ def id; attributes[:"id"]&.value; end
1258
+ end
1259
+ end
1260
+ # @private
1261
+ NOTIFICATIONS = Ractor.make_shareable({2 => Notifications::DevAddNtf, 3 => Notifications::DevDelNtf, 5 => Notifications::DevChangeNtf, 7 => Notifications::KeyRotateNtf}) #: Hash[::Integer, ::Class]
604
1262
  # Get / dump information about PSP capable devices on the system.
605
- #--
606
1263
  # @rbs (?id: ::Integer) -> Messages::DoDevGetReply
1264
+ # @param [Hash] args
1265
+ # @option args [Integer] id PSP device ID.
1266
+ # @return [Messages::DoDevGetReply]
1267
+ # @see Messages::DoDevGetRequest
607
1268
  def do_dev_get(**args)
608
1269
  exchange_message(:"do", Messages::DoDevGetRequest, Messages::DoDevGetReply, args)
609
1270
  end
1271
+ # Get / dump information about PSP capable devices on the system.
1272
+ # @rbs () -> Array[Messages::DumpDevGetReply]
1273
+ # | () { (Messages::DumpDevGetReply) -> void } -> void
1274
+ # @overload dump_dev_get(**args)
1275
+ # Returns an array when no block is given.
1276
+ # @param [Hash] args
1277
+ # @return [Array<Messages::DumpDevGetReply>]
1278
+ # @overload dump_dev_get(**args, &block)
1279
+ # Yields each reply when a block is given.
1280
+ # @param [Hash] args
1281
+ # @yieldparam [Messages::DumpDevGetReply] reply
1282
+ # @return [void]
1283
+ # @see Messages::DumpDevGetRequest
1284
+ def dump_dev_get(**args, &block)
1285
+ exchange_message(:"dump", Messages::DumpDevGetRequest, Messages::DumpDevGetReply, args, &block)
1286
+ end
610
1287
  # Set the configuration of a PSP device.
611
- #--
1288
+ #
1289
+ # Requires CAP_NET_ADMIN in the initial user namespace.
612
1290
  # @rbs (?id: ::Integer, ?psp_versions_ena: ::Integer) -> Messages::DoDevSetReply
1291
+ # @param [Hash] args
1292
+ # @option args [Integer] id PSP device ID.
1293
+ # @option args [Integer] psp_versions_ena Bitmask of currently enabled (accepted on Rx) PSP versions.
1294
+ #
1295
+ # Known flags are defined in {Flags::Version}.
1296
+ # @return [Messages::DoDevSetReply]
1297
+ # @see Messages::DoDevSetRequest
613
1298
  def do_dev_set(**args)
614
1299
  exchange_message(:"do", Messages::DoDevSetRequest, Messages::DoDevSetReply, args)
615
1300
  end
616
1301
  # Rotate the device key.
617
- #--
1302
+ #
1303
+ # Requires CAP_NET_ADMIN in the initial user namespace.
618
1304
  # @rbs (?id: ::Integer) -> Messages::DoKeyRotateReply
1305
+ # @param [Hash] args
1306
+ # @option args [Integer] id PSP device ID.
1307
+ # @return [Messages::DoKeyRotateReply]
1308
+ # @see Messages::DoKeyRotateRequest
619
1309
  def do_key_rotate(**args)
620
1310
  exchange_message(:"do", Messages::DoKeyRotateRequest, Messages::DoKeyRotateReply, args)
621
1311
  end
622
1312
  # Allocate a new Rx key + SPI pair, associate it with a socket.
623
- #--
624
1313
  # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?sock_fd: ::Integer) -> Messages::DoRxAssocReply
1314
+ # @param [Hash] args
1315
+ # @option args [Integer] dev_id PSP device ID.
1316
+ # @option args [Integer] version PSP versions (AEAD and protocol version) used by this association,
1317
+ # dictates the size of the key.
1318
+ #
1319
+ #
1320
+ # Known enum values are defined in {Enums::Version}.
1321
+ # @option args [Integer] sock_fd Sockets which should be bound to the association immediately.
1322
+ # @return [Messages::DoRxAssocReply]
1323
+ # @see Messages::DoRxAssocRequest
625
1324
  def do_rx_assoc(**args)
626
1325
  exchange_message(:"do", Messages::DoRxAssocRequest, Messages::DoRxAssocReply, args)
627
1326
  end
628
1327
  # Add a PSP Tx association.
629
- #--
630
- # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?tx_key: AttributeSets::Keys, ?sock_fd: ::Integer) -> Messages::DoTxAssocReply
1328
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?tx_key: (AttributeSets::Keys | ::Hash[::Symbol, untyped]), ?sock_fd: ::Integer) -> Messages::DoTxAssocReply
1329
+ # @param [Hash] args
1330
+ # @option args [Integer] dev_id PSP device ID.
1331
+ # @option args [Integer] version PSP versions (AEAD and protocol version) used by this association,
1332
+ # dictates the size of the key.
1333
+ #
1334
+ #
1335
+ # Known enum values are defined in {Enums::Version}.
1336
+ # @option args [AttributeSets::Keys, Hash<Symbol, Object>] tx_key
1337
+ # @option args [Integer] sock_fd Sockets which should be bound to the association immediately.
1338
+ # @return [Messages::DoTxAssocReply]
1339
+ # @see Messages::DoTxAssocRequest
631
1340
  def do_tx_assoc(**args)
632
1341
  exchange_message(:"do", Messages::DoTxAssocRequest, Messages::DoTxAssocReply, args)
633
1342
  end
634
1343
  # Get device statistics.
635
- #--
636
1344
  # @rbs (?dev_id: ::Integer) -> Messages::DoGetStatsReply
1345
+ # @param [Hash] args
1346
+ # @option args [Integer] dev_id PSP device ID.
1347
+ # @return [Messages::DoGetStatsReply]
1348
+ # @see Messages::DoGetStatsRequest
637
1349
  def do_get_stats(**args)
638
1350
  exchange_message(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
639
1351
  end
1352
+ # Get device statistics.
1353
+ # @rbs () -> Array[Messages::DumpGetStatsReply]
1354
+ # | () { (Messages::DumpGetStatsReply) -> void } -> void
1355
+ # @overload dump_get_stats(**args)
1356
+ # Returns an array when no block is given.
1357
+ # @param [Hash] args
1358
+ # @return [Array<Messages::DumpGetStatsReply>]
1359
+ # @overload dump_get_stats(**args, &block)
1360
+ # Yields each reply when a block is given.
1361
+ # @param [Hash] args
1362
+ # @yieldparam [Messages::DumpGetStatsReply] reply
1363
+ # @return [void]
1364
+ # @see Messages::DumpGetStatsRequest
1365
+ def dump_get_stats(**args, &block)
1366
+ exchange_message(:"dump", Messages::DumpGetStatsRequest, Messages::DumpGetStatsReply, args, &block)
1367
+ end
640
1368
  # Associate a network device with a PSP device.
641
- #--
1369
+ #
1370
+ # Requires CAP_NET_ADMIN in the initial user namespace.
642
1371
  # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevAssocReply
1372
+ # @param [Hash] args
1373
+ # @option args [Integer] id PSP device ID.
1374
+ # @option args [Integer] ifindex ifindex of the main netdevice linked to the PSP device,
1375
+ # or the ifindex to associate with the PSP device.
1376
+ # @option args [Integer] nsid Network namespace ID for the device to associate/disassociate.
1377
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1378
+ # device is looked up in the caller's network namespace.
1379
+ # @return [Messages::DoDevAssocReply]
1380
+ # @see Messages::DoDevAssocRequest
643
1381
  def do_dev_assoc(**args)
644
1382
  exchange_message(:"do", Messages::DoDevAssocRequest, Messages::DoDevAssocReply, args)
645
1383
  end
646
1384
  # Disassociate a network device from a PSP device.
647
- #--
1385
+ #
1386
+ # Requires CAP_NET_ADMIN in the initial user namespace.
648
1387
  # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevDisassocReply
1388
+ # @param [Hash] args
1389
+ # @option args [Integer] id PSP device ID.
1390
+ # @option args [Integer] ifindex ifindex of the main netdevice linked to the PSP device,
1391
+ # or the ifindex to associate with the PSP device.
1392
+ # @option args [Integer] nsid Network namespace ID for the device to associate/disassociate.
1393
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1394
+ # device is looked up in the caller's network namespace.
1395
+ # @return [Messages::DoDevDisassocReply]
1396
+ # @see Messages::DoDevDisassocRequest
649
1397
  def do_dev_disassoc(**args)
650
1398
  exchange_message(:"do", Messages::DoDevDisassocRequest, Messages::DoDevDisassocReply, args)
651
1399
  end
1400
+ class AsyncOperations
1401
+ # @private
1402
+ def initialize(&exchange)
1403
+ @exchange = exchange
1404
+ end
1405
+ # Get / dump information about PSP capable devices on the system.
1406
+ # @rbs (?id: ::Integer) -> ::Nl::Async::Future[Messages::DoDevGetReply]
1407
+ # @param [Hash] args
1408
+ # @option args [Integer] id PSP device ID.
1409
+ # @return [Nl::Async::Future<Messages::DoDevGetReply>]
1410
+ # @see Messages::DoDevGetRequest
1411
+ def do_dev_get(**args)
1412
+ @exchange.call(:"do", Messages::DoDevGetRequest, Messages::DoDevGetReply, args)
1413
+ end
1414
+ # Get / dump information about PSP capable devices on the system.
1415
+ # @rbs () -> ::Nl::Async::Stream[Messages::DumpDevGetReply]
1416
+ # @param [Hash] args
1417
+ # @return [Nl::Async::Stream<Messages::DumpDevGetReply>]
1418
+ # @see Messages::DumpDevGetRequest
1419
+ def dump_dev_get(**args)
1420
+ @exchange.call(:"dump", Messages::DumpDevGetRequest, Messages::DumpDevGetReply, args)
1421
+ end
1422
+ # Set the configuration of a PSP device.
1423
+ #
1424
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1425
+ # @rbs (?id: ::Integer, ?psp_versions_ena: ::Integer) -> ::Nl::Async::Future[Messages::DoDevSetReply]
1426
+ # @param [Hash] args
1427
+ # @option args [Integer] id PSP device ID.
1428
+ # @option args [Integer] psp_versions_ena Bitmask of currently enabled (accepted on Rx) PSP versions.
1429
+ #
1430
+ # Known flags are defined in {Flags::Version}.
1431
+ # @return [Nl::Async::Future<Messages::DoDevSetReply>]
1432
+ # @see Messages::DoDevSetRequest
1433
+ def do_dev_set(**args)
1434
+ @exchange.call(:"do", Messages::DoDevSetRequest, Messages::DoDevSetReply, args)
1435
+ end
1436
+ # Rotate the device key.
1437
+ #
1438
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1439
+ # @rbs (?id: ::Integer) -> ::Nl::Async::Future[Messages::DoKeyRotateReply]
1440
+ # @param [Hash] args
1441
+ # @option args [Integer] id PSP device ID.
1442
+ # @return [Nl::Async::Future<Messages::DoKeyRotateReply>]
1443
+ # @see Messages::DoKeyRotateRequest
1444
+ def do_key_rotate(**args)
1445
+ @exchange.call(:"do", Messages::DoKeyRotateRequest, Messages::DoKeyRotateReply, args)
1446
+ end
1447
+ # Allocate a new Rx key + SPI pair, associate it with a socket.
1448
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?sock_fd: ::Integer) -> ::Nl::Async::Future[Messages::DoRxAssocReply]
1449
+ # @param [Hash] args
1450
+ # @option args [Integer] dev_id PSP device ID.
1451
+ # @option args [Integer] version PSP versions (AEAD and protocol version) used by this association,
1452
+ # dictates the size of the key.
1453
+ #
1454
+ #
1455
+ # Known enum values are defined in {Enums::Version}.
1456
+ # @option args [Integer] sock_fd Sockets which should be bound to the association immediately.
1457
+ # @return [Nl::Async::Future<Messages::DoRxAssocReply>]
1458
+ # @see Messages::DoRxAssocRequest
1459
+ def do_rx_assoc(**args)
1460
+ @exchange.call(:"do", Messages::DoRxAssocRequest, Messages::DoRxAssocReply, args)
1461
+ end
1462
+ # Add a PSP Tx association.
1463
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?tx_key: (AttributeSets::Keys | ::Hash[::Symbol, untyped]), ?sock_fd: ::Integer) -> ::Nl::Async::Future[Messages::DoTxAssocReply]
1464
+ # @param [Hash] args
1465
+ # @option args [Integer] dev_id PSP device ID.
1466
+ # @option args [Integer] version PSP versions (AEAD and protocol version) used by this association,
1467
+ # dictates the size of the key.
1468
+ #
1469
+ #
1470
+ # Known enum values are defined in {Enums::Version}.
1471
+ # @option args [AttributeSets::Keys, Hash<Symbol, Object>] tx_key
1472
+ # @option args [Integer] sock_fd Sockets which should be bound to the association immediately.
1473
+ # @return [Nl::Async::Future<Messages::DoTxAssocReply>]
1474
+ # @see Messages::DoTxAssocRequest
1475
+ def do_tx_assoc(**args)
1476
+ @exchange.call(:"do", Messages::DoTxAssocRequest, Messages::DoTxAssocReply, args)
1477
+ end
1478
+ # Get device statistics.
1479
+ # @rbs (?dev_id: ::Integer) -> ::Nl::Async::Future[Messages::DoGetStatsReply]
1480
+ # @param [Hash] args
1481
+ # @option args [Integer] dev_id PSP device ID.
1482
+ # @return [Nl::Async::Future<Messages::DoGetStatsReply>]
1483
+ # @see Messages::DoGetStatsRequest
1484
+ def do_get_stats(**args)
1485
+ @exchange.call(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
1486
+ end
1487
+ # Get device statistics.
1488
+ # @rbs () -> ::Nl::Async::Stream[Messages::DumpGetStatsReply]
1489
+ # @param [Hash] args
1490
+ # @return [Nl::Async::Stream<Messages::DumpGetStatsReply>]
1491
+ # @see Messages::DumpGetStatsRequest
1492
+ def dump_get_stats(**args)
1493
+ @exchange.call(:"dump", Messages::DumpGetStatsRequest, Messages::DumpGetStatsReply, args)
1494
+ end
1495
+ # Associate a network device with a PSP device.
1496
+ #
1497
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1498
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> ::Nl::Async::Future[Messages::DoDevAssocReply]
1499
+ # @param [Hash] args
1500
+ # @option args [Integer] id PSP device ID.
1501
+ # @option args [Integer] ifindex ifindex of the main netdevice linked to the PSP device,
1502
+ # or the ifindex to associate with the PSP device.
1503
+ # @option args [Integer] nsid Network namespace ID for the device to associate/disassociate.
1504
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1505
+ # device is looked up in the caller's network namespace.
1506
+ # @return [Nl::Async::Future<Messages::DoDevAssocReply>]
1507
+ # @see Messages::DoDevAssocRequest
1508
+ def do_dev_assoc(**args)
1509
+ @exchange.call(:"do", Messages::DoDevAssocRequest, Messages::DoDevAssocReply, args)
1510
+ end
1511
+ # Disassociate a network device from a PSP device.
1512
+ #
1513
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1514
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> ::Nl::Async::Future[Messages::DoDevDisassocReply]
1515
+ # @param [Hash] args
1516
+ # @option args [Integer] id PSP device ID.
1517
+ # @option args [Integer] ifindex ifindex of the main netdevice linked to the PSP device,
1518
+ # or the ifindex to associate with the PSP device.
1519
+ # @option args [Integer] nsid Network namespace ID for the device to associate/disassociate.
1520
+ # Optional for dev-assoc and dev-disassoc; if not present, the
1521
+ # device is looked up in the caller's network namespace.
1522
+ # @return [Nl::Async::Future<Messages::DoDevDisassocReply>]
1523
+ # @see Messages::DoDevDisassocRequest
1524
+ def do_dev_disassoc(**args)
1525
+ @exchange.call(:"do", Messages::DoDevDisassocRequest, Messages::DoDevDisassocReply, args)
1526
+ end
1527
+ end
1528
+ # Returns the asynchronous operation facade for this family.
1529
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
1530
+ # @param [::Integer, nil] stream_capacity
1531
+ # @return [AsyncOperations]
1532
+ def async(stream_capacity: nil)
1533
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
1534
+ build_async_facade(AsyncOperations, stream_capacity:)
1535
+ end
1536
+ # @rbs (*(:mgmt | :use) groups) -> self
1537
+ # @param [Array<:mgmt, :use>] groups
1538
+ # @return [self]
1539
+ def subscribe(*groups) = super
1540
+ # @rbs (*(:mgmt | :use) groups) -> self
1541
+ # @param [Array<:mgmt, :use>] groups
1542
+ # @return [self]
1543
+ def unsubscribe(*groups) = super
652
1544
  end
653
1545
  end; end