nl-linux 0.2.4 → 0.3.0

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +2 -0
  4. data/Rakefile +13 -3
  5. data/generated/nl/linux/binder.rb +80 -0
  6. data/generated/nl/linux/conntrack.rb +39 -2
  7. data/generated/nl/linux/dev_energymodel.rb +106 -0
  8. data/generated/nl/linux/devlink.rb +751 -0
  9. data/generated/nl/linux/dpll.rb +712 -55
  10. data/generated/nl/linux/drm_ras.rb +87 -0
  11. data/generated/nl/linux/ethtool.rb +1569 -259
  12. data/generated/nl/linux/fou.rb +82 -13
  13. data/generated/nl/linux/handshake.rb +92 -0
  14. data/generated/nl/linux/lockd.rb +50 -0
  15. data/generated/nl/linux/mptcp_pm.rb +159 -0
  16. data/generated/nl/linux/net_shaper.rb +123 -0
  17. data/generated/nl/linux/netdev.rb +374 -0
  18. data/generated/nl/linux/nfsd.rb +316 -6
  19. data/generated/nl/linux/nftables.rb +414 -25
  20. data/generated/nl/linux/nl80211.rb +81 -22
  21. data/generated/nl/linux/nlctrl.rb +59 -8
  22. data/generated/nl/linux/ovpn.rb +180 -0
  23. data/generated/nl/linux/ovs_datapath.rb +55 -6
  24. data/generated/nl/linux/ovs_flow.rb +63 -20
  25. data/generated/nl/linux/ovs_packet.rb +115 -4
  26. data/generated/nl/linux/ovs_vport.rb +55 -6
  27. data/generated/nl/linux/psp.rb +257 -0
  28. data/generated/nl/linux/rt_addr.rb +69 -14
  29. data/generated/nl/linux/rt_link.rb +381 -47
  30. data/generated/nl/linux/rt_neigh.rb +227 -16
  31. data/generated/nl/linux/rt_route.rb +92 -49
  32. data/generated/nl/linux/rt_rule.rb +300 -11
  33. data/generated/nl/linux/sunrpc_cache.rb +130 -0
  34. data/generated/nl/linux/tc.rb +161 -52
  35. data/generated/nl/linux/tcp_metrics.rb +69 -12
  36. data/generated/nl/linux/team.rb +80 -0
  37. data/generated/nl/linux/wireguard.rb +99 -7
  38. data/lib/nl/linux/version.rb +1 -1
  39. metadata +11 -9
@@ -1,4 +1,6 @@
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/ovs_packet.yaml from Linux v7.2.
2
4
  #--
3
5
  # frozen_string_literal: true
4
6
  # rbs_inline: enabled
@@ -19,6 +21,7 @@ module Nl; module Linux
19
21
  class OvsPacket < ::Nl::Family
20
22
  NAME = "ovs_packet"
21
23
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_packet"))
24
+ MCAST_GROUPS = Ractor.make_shareable({}) #: Hash[::Symbol, ::Nl::McastGroup]
22
25
  module Structs
23
26
  OvsHeader = Struct.new(
24
27
  :"dp_ifindex", #: ::Integer
@@ -128,15 +131,15 @@ class OvsPacket < ::Nl::Family
128
131
  def dp_ifindex; fixed_header.dp_ifindex; end
129
132
  # Gets the value of `packet` attribute in the message.
130
133
  #--
131
- # @rbs return: untyped
134
+ # @rbs return: ::String
132
135
  def packet; attributes[:"packet"]&.value; end
133
136
  # Gets the value of `key` attribute in the message.
134
137
  #--
135
- # @rbs return: untyped
138
+ # @rbs return: ::String
136
139
  def key; attributes[:"key"]&.value; end
137
140
  # Gets the value of `actions` attribute in the message.
138
141
  #--
139
- # @rbs return: untyped
142
+ # @rbs return: ::String
140
143
  def actions; attributes[:"actions"]&.value; end
141
144
  # Gets the value of `probe` attribute in the message.
142
145
  #--
@@ -156,11 +159,119 @@ class OvsPacket < ::Nl::Family
156
159
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
157
160
  end
158
161
  end
162
+ module Notifications
163
+ # Notify userspace of a flow table miss for a received packet.
164
+ class Miss < ::Nl::Protocols::Genl::Message
165
+ TYPE = 1
166
+ FIXED_HEADER = Structs::OvsHeader
167
+ ATTRIBUTE_SET = AttributeSets::Packet
168
+ ATTRIBUTES = Ractor.make_shareable(%i[packet key actions userdata egress_tun_key mru len hash])
169
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
170
+ #--
171
+ # @rbs return: ::Integer
172
+ def dp_ifindex; fixed_header.dp_ifindex; end
173
+ # Gets the value of `packet` attribute in the message.
174
+ #--
175
+ # @rbs return: ::String
176
+ def packet; attributes[:"packet"]&.value; end
177
+ # Gets the value of `key` attribute in the message.
178
+ #--
179
+ # @rbs return: ::String
180
+ def key; attributes[:"key"]&.value; end
181
+ # Gets the value of `actions` attribute in the message.
182
+ #--
183
+ # @rbs return: ::String
184
+ def actions; attributes[:"actions"]&.value; end
185
+ # Gets the value of `userdata` attribute in the message.
186
+ #--
187
+ # @rbs return: ::String
188
+ def userdata; attributes[:"userdata"]&.value; end
189
+ # Gets the value of `egress-tun-key` attribute in the message.
190
+ #--
191
+ # @rbs return: ::String
192
+ def egress_tun_key; attributes[:"egress_tun_key"]&.value; end
193
+ # Gets the value of `mru` attribute in the message.
194
+ #--
195
+ # @rbs return: ::Integer
196
+ def mru; attributes[:"mru"]&.value; end
197
+ # Gets the value of `len` attribute in the message.
198
+ #--
199
+ # @rbs return: ::Integer
200
+ def len; attributes[:"len"]&.value; end
201
+ # Gets the value of `hash` attribute in the message.
202
+ #--
203
+ # @rbs return: ::Integer
204
+ def hash; attributes[:"hash"]&.value; end
205
+ end
206
+ # Notify userspace as requested by an OVS_ACTION_ATTR_USERSPACE action.
207
+ class Action < ::Nl::Protocols::Genl::Message
208
+ TYPE = 2
209
+ FIXED_HEADER = Structs::OvsHeader
210
+ ATTRIBUTE_SET = AttributeSets::Packet
211
+ ATTRIBUTES = Ractor.make_shareable(%i[packet key actions userdata egress_tun_key mru len hash])
212
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
213
+ #--
214
+ # @rbs return: ::Integer
215
+ def dp_ifindex; fixed_header.dp_ifindex; end
216
+ # Gets the value of `packet` attribute in the message.
217
+ #--
218
+ # @rbs return: ::String
219
+ def packet; attributes[:"packet"]&.value; end
220
+ # Gets the value of `key` attribute in the message.
221
+ #--
222
+ # @rbs return: ::String
223
+ def key; attributes[:"key"]&.value; end
224
+ # Gets the value of `actions` attribute in the message.
225
+ #--
226
+ # @rbs return: ::String
227
+ def actions; attributes[:"actions"]&.value; end
228
+ # Gets the value of `userdata` attribute in the message.
229
+ #--
230
+ # @rbs return: ::String
231
+ def userdata; attributes[:"userdata"]&.value; end
232
+ # Gets the value of `egress-tun-key` attribute in the message.
233
+ #--
234
+ # @rbs return: ::String
235
+ def egress_tun_key; attributes[:"egress_tun_key"]&.value; end
236
+ # Gets the value of `mru` attribute in the message.
237
+ #--
238
+ # @rbs return: ::Integer
239
+ def mru; attributes[:"mru"]&.value; end
240
+ # Gets the value of `len` attribute in the message.
241
+ #--
242
+ # @rbs return: ::Integer
243
+ def len; attributes[:"len"]&.value; end
244
+ # Gets the value of `hash` attribute in the message.
245
+ #--
246
+ # @rbs return: ::Integer
247
+ def hash; attributes[:"hash"]&.value; end
248
+ end
249
+ end
250
+ NOTIFICATIONS = Ractor.make_shareable({1 => Notifications::Miss, 2 => Notifications::Action}) #: Hash[::Integer, ::Class]
159
251
  # Apply actions to a packet.
160
252
  #--
161
- # @rbs (?dp_ifindex: ::Integer, ?packet: untyped, ?key: untyped, ?actions: untyped, ?probe: ::Integer, ?mru: ::Integer, ?hash: ::Integer, ?upcall_pid: ::Integer) -> void
253
+ # @rbs (?dp_ifindex: ::Integer, ?packet: ::String, ?key: ::String, ?actions: ::String, ?probe: ::Integer, ?mru: ::Integer, ?hash: ::Integer, ?upcall_pid: ::Integer) -> void
162
254
  def do_execute(**args)
163
255
  exchange_message(:"do", Messages::DoExecuteRequest, nil, args)
164
256
  end
257
+ class AsyncOperations
258
+ # :nodoc:
259
+ def initialize(&exchange)
260
+ @exchange = exchange
261
+ end
262
+ # Apply actions to a packet.
263
+ #--
264
+ # @rbs (?dp_ifindex: ::Integer, ?packet: ::String, ?key: ::String, ?actions: ::String, ?probe: ::Integer, ?mru: ::Integer, ?hash: ::Integer, ?upcall_pid: ::Integer) -> ::Nl::Async::Future[void]
265
+ def do_execute(**args)
266
+ @exchange.call(:"do", Messages::DoExecuteRequest, nil, args)
267
+ end
268
+ end
269
+ # Returns the asynchronous operation facade for this family.
270
+ #--
271
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
272
+ def async(stream_capacity: nil)
273
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
274
+ build_async_facade(AsyncOperations, stream_capacity:)
275
+ end
165
276
  end
166
277
  end; end
@@ -1,4 +1,6 @@
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/ovs_vport.yaml from Linux v7.2.
2
4
  #--
3
5
  # frozen_string_literal: true
4
6
  # rbs_inline: enabled
@@ -9,6 +11,7 @@ module Nl; module Linux
9
11
  class OvsVport < ::Nl::Family
10
12
  NAME = "ovs_vport"
11
13
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_vport"))
14
+ MCAST_GROUPS = Ractor.make_shareable({:"ovs_vport" => ::Nl::McastGroup.new("ovs_vport", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
12
15
  module Structs
13
16
  OvsHeader = Struct.new(
14
17
  :"dp_ifindex", #: ::Integer
@@ -215,7 +218,7 @@ class OvsVport < ::Nl::Family
215
218
  def options; attributes[:"options"]&.value; end
216
219
  # Gets the value of `upcall-pid` attribute in the message.
217
220
  #--
218
- # @rbs return: untyped
221
+ # @rbs return: ::String
219
222
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
220
223
  # Gets the value of `ifindex` attribute in the message.
221
224
  #--
@@ -284,11 +287,11 @@ class OvsVport < ::Nl::Family
284
287
  def name; attributes[:"name"]&.value; end
285
288
  # Gets the value of `upcall-pid` attribute in the message.
286
289
  #--
287
- # @rbs return: untyped
290
+ # @rbs return: ::String
288
291
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
289
292
  # Gets the value of `stats` attribute in the message.
290
293
  #--
291
- # @rbs return: untyped
294
+ # @rbs return: ::String
292
295
  def stats; attributes[:"stats"]&.value; end
293
296
  # Gets the value of `ifindex` attribute in the message.
294
297
  #--
@@ -342,11 +345,11 @@ class OvsVport < ::Nl::Family
342
345
  def name; attributes[:"name"]&.value; end
343
346
  # Gets the value of `upcall-pid` attribute in the message.
344
347
  #--
345
- # @rbs return: untyped
348
+ # @rbs return: ::String
346
349
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
347
350
  # Gets the value of `stats` attribute in the message.
348
351
  #--
349
- # @rbs return: untyped
352
+ # @rbs return: ::String
350
353
  def stats; attributes[:"stats"]&.value; end
351
354
  # Gets the value of `ifindex` attribute in the message.
352
355
  #--
@@ -362,9 +365,12 @@ class OvsVport < ::Nl::Family
362
365
  def upcall_stats; attributes[:"upcall_stats"]&.value; end
363
366
  end
364
367
  end
368
+ module Notifications
369
+ end
370
+ NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
365
371
  # Create a new OVS vport
366
372
  #--
367
- # @rbs (?dp_ifindex: ::Integer, ?type: ::Integer, ?name: ::String, ?options: AttributeSets::VportOptions, ?upcall_pid: untyped, ?ifindex: ::Integer) -> void
373
+ # @rbs (?dp_ifindex: ::Integer, ?type: ::Integer, ?name: ::String, ?options: AttributeSets::VportOptions, ?upcall_pid: ::String, ?ifindex: ::Integer) -> void
368
374
  def do_new(**args)
369
375
  exchange_message(:"do", Messages::DoNewRequest, nil, args)
370
376
  end
@@ -387,5 +393,48 @@ class OvsVport < ::Nl::Family
387
393
  def dump_get(**args, &block)
388
394
  exchange_message(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args, &block)
389
395
  end
396
+ class AsyncOperations
397
+ # :nodoc:
398
+ def initialize(&exchange)
399
+ @exchange = exchange
400
+ end
401
+ # Create a new OVS vport
402
+ #--
403
+ # @rbs (?dp_ifindex: ::Integer, ?type: ::Integer, ?name: ::String, ?options: AttributeSets::VportOptions, ?upcall_pid: ::String, ?ifindex: ::Integer) -> ::Nl::Async::Future[void]
404
+ def do_new(**args)
405
+ @exchange.call(:"do", Messages::DoNewRequest, nil, args)
406
+ end
407
+ # Delete existing OVS vport from a data path
408
+ #--
409
+ # @rbs (?dp_ifindex: ::Integer, ?port_no: ::Integer, ?type: ::Integer, ?name: ::String) -> ::Nl::Async::Future[void]
410
+ def do_del(**args)
411
+ @exchange.call(:"do", Messages::DoDelRequest, nil, args)
412
+ end
413
+ # Get / dump OVS vport configuration and state
414
+ #--
415
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> ::Nl::Async::Future[Messages::DoGetReply]
416
+ def do_get(**args)
417
+ @exchange.call(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
418
+ end
419
+ # Get / dump OVS vport configuration and state
420
+ #--
421
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> ::Nl::Async::Stream[Messages::DumpGetReply]
422
+ def dump_get(**args)
423
+ @exchange.call(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args)
424
+ end
425
+ end
426
+ # Returns the asynchronous operation facade for this family.
427
+ #--
428
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
429
+ def async(stream_capacity: nil)
430
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
431
+ build_async_facade(AsyncOperations, stream_capacity:)
432
+ end
433
+ #--
434
+ # @rbs (*(:ovs_vport) groups) -> self
435
+ def subscribe(*groups) = super
436
+ #--
437
+ # @rbs (*(:ovs_vport) groups) -> self
438
+ def unsubscribe(*groups) = super
390
439
  end
391
440
  end; end
@@ -1,4 +1,6 @@
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
6
  # rbs_inline: enabled
@@ -9,6 +11,7 @@ module Nl; module Linux
9
11
  class Psp < ::Nl::Family
10
12
  NAME = "psp"
11
13
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("psp"))
14
+ MCAST_GROUPS = Ractor.make_shareable({:"mgmt" => ::Nl::McastGroup.new("mgmt", nil), :"use" => ::Nl::McastGroup.new("use", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
12
15
  module Structs
13
16
  end
14
17
  module AttributeSets
@@ -297,6 +300,13 @@ class Psp < ::Nl::Family
297
300
  def by_association; attributes[:"by_association"]&.value; end
298
301
  end
299
302
  # Get / dump information about PSP capable devices on the system.
303
+ class DumpDevGetRequest < ::Nl::Protocols::Genl::Message
304
+ TYPE = 1
305
+ FIXED_HEADER = nil
306
+ ATTRIBUTE_SET = AttributeSets::Dev
307
+ ATTRIBUTES = Ractor.make_shareable(%i[])
308
+ end
309
+ # Get / dump information about PSP capable devices on the system.
300
310
  class DumpDevGetReply < ::Nl::Protocols::Genl::Message
301
311
  TYPE = 1
302
312
  FIXED_HEADER = nil
@@ -328,6 +338,8 @@ class Psp < ::Nl::Family
328
338
  def by_association; attributes[:"by_association"]&.value; end
329
339
  end
330
340
  # Set the configuration of a PSP device.
341
+ #
342
+ # Requires CAP_NET_ADMIN in the initial user namespace.
331
343
  class DoDevSetRequest < ::Nl::Protocols::Genl::Message
332
344
  TYPE = 4
333
345
  FIXED_HEADER = nil
@@ -343,6 +355,8 @@ class Psp < ::Nl::Family
343
355
  def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
344
356
  end
345
357
  # Set the configuration of a PSP device.
358
+ #
359
+ # Requires CAP_NET_ADMIN in the initial user namespace.
346
360
  class DoDevSetReply < ::Nl::Protocols::Genl::Message
347
361
  TYPE = 4
348
362
  FIXED_HEADER = nil
@@ -350,6 +364,8 @@ class Psp < ::Nl::Family
350
364
  ATTRIBUTES = Ractor.make_shareable(%i[])
351
365
  end
352
366
  # Rotate the device key.
367
+ #
368
+ # Requires CAP_NET_ADMIN in the initial user namespace.
353
369
  class DoKeyRotateRequest < ::Nl::Protocols::Genl::Message
354
370
  TYPE = 6
355
371
  FIXED_HEADER = nil
@@ -361,6 +377,8 @@ class Psp < ::Nl::Family
361
377
  def id; attributes[:"id"]&.value; end
362
378
  end
363
379
  # Rotate the device key.
380
+ #
381
+ # Requires CAP_NET_ADMIN in the initial user namespace.
364
382
  class DoKeyRotateReply < ::Nl::Protocols::Genl::Message
365
383
  TYPE = 6
366
384
  FIXED_HEADER = nil
@@ -498,6 +516,13 @@ class Psp < ::Nl::Family
498
516
  def tx_error; attributes[:"tx_error"]&.value; end
499
517
  end
500
518
  # Get device statistics.
519
+ class DumpGetStatsRequest < ::Nl::Protocols::Genl::Message
520
+ TYPE = 10
521
+ FIXED_HEADER = nil
522
+ ATTRIBUTE_SET = AttributeSets::Stats
523
+ ATTRIBUTES = Ractor.make_shareable(%i[])
524
+ end
525
+ # Get device statistics.
501
526
  class DumpGetStatsReply < ::Nl::Protocols::Genl::Message
502
527
  TYPE = 10
503
528
  FIXED_HEADER = nil
@@ -549,6 +574,8 @@ class Psp < ::Nl::Family
549
574
  def tx_error; attributes[:"tx_error"]&.value; end
550
575
  end
551
576
  # Associate a network device with a PSP device.
577
+ #
578
+ # Requires CAP_NET_ADMIN in the initial user namespace.
552
579
  class DoDevAssocRequest < ::Nl::Protocols::Genl::Message
553
580
  TYPE = 11
554
581
  FIXED_HEADER = nil
@@ -568,6 +595,8 @@ class Psp < ::Nl::Family
568
595
  def nsid; attributes[:"nsid"]&.value; end
569
596
  end
570
597
  # Associate a network device with a PSP device.
598
+ #
599
+ # Requires CAP_NET_ADMIN in the initial user namespace.
571
600
  class DoDevAssocReply < ::Nl::Protocols::Genl::Message
572
601
  TYPE = 11
573
602
  FIXED_HEADER = nil
@@ -575,6 +604,8 @@ class Psp < ::Nl::Family
575
604
  ATTRIBUTES = Ractor.make_shareable(%i[])
576
605
  end
577
606
  # Disassociate a network device from a PSP device.
607
+ #
608
+ # Requires CAP_NET_ADMIN in the initial user namespace.
578
609
  class DoDevDisassocRequest < ::Nl::Protocols::Genl::Message
579
610
  TYPE = 12
580
611
  FIXED_HEADER = nil
@@ -594,6 +625,8 @@ class Psp < ::Nl::Family
594
625
  def nsid; attributes[:"nsid"]&.value; end
595
626
  end
596
627
  # Disassociate a network device from a PSP device.
628
+ #
629
+ # Requires CAP_NET_ADMIN in the initial user namespace.
597
630
  class DoDevDisassocReply < ::Nl::Protocols::Genl::Message
598
631
  TYPE = 12
599
632
  FIXED_HEADER = nil
@@ -601,19 +634,145 @@ class Psp < ::Nl::Family
601
634
  ATTRIBUTES = Ractor.make_shareable(%i[])
602
635
  end
603
636
  end
637
+ module Notifications
638
+ # Notification about device appearing.
639
+ #
640
+ # Multicast group: `mgmt`.
641
+ class DevAddNtf < ::Nl::Protocols::Genl::Message
642
+ TYPE = 2
643
+ FIXED_HEADER = nil
644
+ ATTRIBUTE_SET = AttributeSets::Dev
645
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
646
+ # Gets the value of `id` attribute in the message.
647
+ #--
648
+ # @rbs return: ::Integer
649
+ def id; attributes[:"id"]&.value; end
650
+ # Gets the value of `ifindex` attribute in the message.
651
+ #--
652
+ # @rbs return: ::Integer
653
+ def ifindex; attributes[:"ifindex"]&.value; end
654
+ # Gets the value of `psp-versions-cap` attribute in the message.
655
+ #--
656
+ # @rbs return: ::Integer
657
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
658
+ # Gets the value of `psp-versions-ena` attribute in the message.
659
+ #--
660
+ # @rbs return: ::Integer
661
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
662
+ # Gets the value of `assoc-list` attribute in the message.
663
+ #--
664
+ # @rbs return: AttributeSets::AssocDevInfo
665
+ def assoc_list; attributes[:"assoc_list"]&.value; end
666
+ # Gets the value of `by-association` attribute in the message.
667
+ #--
668
+ # @rbs return: ::Integer
669
+ def by_association; attributes[:"by_association"]&.value; end
670
+ end
671
+ # Notification about device disappearing.
672
+ #
673
+ # Multicast group: `mgmt`.
674
+ class DevDelNtf < ::Nl::Protocols::Genl::Message
675
+ TYPE = 3
676
+ FIXED_HEADER = nil
677
+ ATTRIBUTE_SET = AttributeSets::Dev
678
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
679
+ # Gets the value of `id` attribute in the message.
680
+ #--
681
+ # @rbs return: ::Integer
682
+ def id; attributes[:"id"]&.value; end
683
+ # Gets the value of `ifindex` attribute in the message.
684
+ #--
685
+ # @rbs return: ::Integer
686
+ def ifindex; attributes[:"ifindex"]&.value; end
687
+ # Gets the value of `psp-versions-cap` attribute in the message.
688
+ #--
689
+ # @rbs return: ::Integer
690
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
691
+ # Gets the value of `psp-versions-ena` attribute in the message.
692
+ #--
693
+ # @rbs return: ::Integer
694
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
695
+ # Gets the value of `assoc-list` attribute in the message.
696
+ #--
697
+ # @rbs return: AttributeSets::AssocDevInfo
698
+ def assoc_list; attributes[:"assoc_list"]&.value; end
699
+ # Gets the value of `by-association` attribute in the message.
700
+ #--
701
+ # @rbs return: ::Integer
702
+ def by_association; attributes[:"by_association"]&.value; end
703
+ end
704
+ # Notification about device configuration being changed.
705
+ #
706
+ # Multicast group: `mgmt`.
707
+ class DevChangeNtf < ::Nl::Protocols::Genl::Message
708
+ TYPE = 5
709
+ FIXED_HEADER = nil
710
+ ATTRIBUTE_SET = AttributeSets::Dev
711
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena assoc_list by_association])
712
+ # Gets the value of `id` attribute in the message.
713
+ #--
714
+ # @rbs return: ::Integer
715
+ def id; attributes[:"id"]&.value; end
716
+ # Gets the value of `ifindex` attribute in the message.
717
+ #--
718
+ # @rbs return: ::Integer
719
+ def ifindex; attributes[:"ifindex"]&.value; end
720
+ # Gets the value of `psp-versions-cap` attribute in the message.
721
+ #--
722
+ # @rbs return: ::Integer
723
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
724
+ # Gets the value of `psp-versions-ena` attribute in the message.
725
+ #--
726
+ # @rbs return: ::Integer
727
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
728
+ # Gets the value of `assoc-list` attribute in the message.
729
+ #--
730
+ # @rbs return: AttributeSets::AssocDevInfo
731
+ def assoc_list; attributes[:"assoc_list"]&.value; end
732
+ # Gets the value of `by-association` attribute in the message.
733
+ #--
734
+ # @rbs return: ::Integer
735
+ def by_association; attributes[:"by_association"]&.value; end
736
+ end
737
+ # Notification about device key getting rotated.
738
+ #
739
+ # Multicast group: `use`.
740
+ class KeyRotateNtf < ::Nl::Protocols::Genl::Message
741
+ TYPE = 7
742
+ FIXED_HEADER = nil
743
+ ATTRIBUTE_SET = AttributeSets::Dev
744
+ ATTRIBUTES = Ractor.make_shareable(%i[id])
745
+ # Gets the value of `id` attribute in the message.
746
+ #--
747
+ # @rbs return: ::Integer
748
+ def id; attributes[:"id"]&.value; end
749
+ end
750
+ end
751
+ NOTIFICATIONS = Ractor.make_shareable({2 => Notifications::DevAddNtf, 3 => Notifications::DevDelNtf, 5 => Notifications::DevChangeNtf, 7 => Notifications::KeyRotateNtf}) #: Hash[::Integer, ::Class]
604
752
  # Get / dump information about PSP capable devices on the system.
605
753
  #--
606
754
  # @rbs (?id: ::Integer) -> Messages::DoDevGetReply
607
755
  def do_dev_get(**args)
608
756
  exchange_message(:"do", Messages::DoDevGetRequest, Messages::DoDevGetReply, args)
609
757
  end
758
+ # Get / dump information about PSP capable devices on the system.
759
+ #--
760
+ # @rbs () -> Enumerable[Messages::DumpDevGetReply]
761
+ # | () { (Messages::DumpDevGetReply) -> void } -> void
762
+ def dump_dev_get(**args, &block)
763
+ exchange_message(:"dump", Messages::DumpDevGetRequest, Messages::DumpDevGetReply, args, &block)
764
+ end
610
765
  # Set the configuration of a PSP device.
766
+ #
767
+ # Requires CAP_NET_ADMIN in the initial user namespace.
611
768
  #--
612
769
  # @rbs (?id: ::Integer, ?psp_versions_ena: ::Integer) -> Messages::DoDevSetReply
613
770
  def do_dev_set(**args)
614
771
  exchange_message(:"do", Messages::DoDevSetRequest, Messages::DoDevSetReply, args)
615
772
  end
616
773
  # Rotate the device key.
774
+ #
775
+ # Requires CAP_NET_ADMIN in the initial user namespace.
617
776
  #--
618
777
  # @rbs (?id: ::Integer) -> Messages::DoKeyRotateReply
619
778
  def do_key_rotate(**args)
@@ -637,17 +796,115 @@ class Psp < ::Nl::Family
637
796
  def do_get_stats(**args)
638
797
  exchange_message(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
639
798
  end
799
+ # Get device statistics.
800
+ #--
801
+ # @rbs () -> Enumerable[Messages::DumpGetStatsReply]
802
+ # | () { (Messages::DumpGetStatsReply) -> void } -> void
803
+ def dump_get_stats(**args, &block)
804
+ exchange_message(:"dump", Messages::DumpGetStatsRequest, Messages::DumpGetStatsReply, args, &block)
805
+ end
640
806
  # Associate a network device with a PSP device.
807
+ #
808
+ # Requires CAP_NET_ADMIN in the initial user namespace.
641
809
  #--
642
810
  # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevAssocReply
643
811
  def do_dev_assoc(**args)
644
812
  exchange_message(:"do", Messages::DoDevAssocRequest, Messages::DoDevAssocReply, args)
645
813
  end
646
814
  # Disassociate a network device from a PSP device.
815
+ #
816
+ # Requires CAP_NET_ADMIN in the initial user namespace.
647
817
  #--
648
818
  # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> Messages::DoDevDisassocReply
649
819
  def do_dev_disassoc(**args)
650
820
  exchange_message(:"do", Messages::DoDevDisassocRequest, Messages::DoDevDisassocReply, args)
651
821
  end
822
+ class AsyncOperations
823
+ # :nodoc:
824
+ def initialize(&exchange)
825
+ @exchange = exchange
826
+ end
827
+ # Get / dump information about PSP capable devices on the system.
828
+ #--
829
+ # @rbs (?id: ::Integer) -> ::Nl::Async::Future[Messages::DoDevGetReply]
830
+ def do_dev_get(**args)
831
+ @exchange.call(:"do", Messages::DoDevGetRequest, Messages::DoDevGetReply, args)
832
+ end
833
+ # Get / dump information about PSP capable devices on the system.
834
+ #--
835
+ # @rbs () -> ::Nl::Async::Stream[Messages::DumpDevGetReply]
836
+ def dump_dev_get(**args)
837
+ @exchange.call(:"dump", Messages::DumpDevGetRequest, Messages::DumpDevGetReply, args)
838
+ end
839
+ # Set the configuration of a PSP device.
840
+ #
841
+ # Requires CAP_NET_ADMIN in the initial user namespace.
842
+ #--
843
+ # @rbs (?id: ::Integer, ?psp_versions_ena: ::Integer) -> ::Nl::Async::Future[Messages::DoDevSetReply]
844
+ def do_dev_set(**args)
845
+ @exchange.call(:"do", Messages::DoDevSetRequest, Messages::DoDevSetReply, args)
846
+ end
847
+ # Rotate the device key.
848
+ #
849
+ # Requires CAP_NET_ADMIN in the initial user namespace.
850
+ #--
851
+ # @rbs (?id: ::Integer) -> ::Nl::Async::Future[Messages::DoKeyRotateReply]
852
+ def do_key_rotate(**args)
853
+ @exchange.call(:"do", Messages::DoKeyRotateRequest, Messages::DoKeyRotateReply, args)
854
+ end
855
+ # Allocate a new Rx key + SPI pair, associate it with a socket.
856
+ #--
857
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?sock_fd: ::Integer) -> ::Nl::Async::Future[Messages::DoRxAssocReply]
858
+ def do_rx_assoc(**args)
859
+ @exchange.call(:"do", Messages::DoRxAssocRequest, Messages::DoRxAssocReply, args)
860
+ end
861
+ # Add a PSP Tx association.
862
+ #--
863
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?tx_key: AttributeSets::Keys, ?sock_fd: ::Integer) -> ::Nl::Async::Future[Messages::DoTxAssocReply]
864
+ def do_tx_assoc(**args)
865
+ @exchange.call(:"do", Messages::DoTxAssocRequest, Messages::DoTxAssocReply, args)
866
+ end
867
+ # Get device statistics.
868
+ #--
869
+ # @rbs (?dev_id: ::Integer) -> ::Nl::Async::Future[Messages::DoGetStatsReply]
870
+ def do_get_stats(**args)
871
+ @exchange.call(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
872
+ end
873
+ # Get device statistics.
874
+ #--
875
+ # @rbs () -> ::Nl::Async::Stream[Messages::DumpGetStatsReply]
876
+ def dump_get_stats(**args)
877
+ @exchange.call(:"dump", Messages::DumpGetStatsRequest, Messages::DumpGetStatsReply, args)
878
+ end
879
+ # Associate a network device with a PSP device.
880
+ #
881
+ # Requires CAP_NET_ADMIN in the initial user namespace.
882
+ #--
883
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> ::Nl::Async::Future[Messages::DoDevAssocReply]
884
+ def do_dev_assoc(**args)
885
+ @exchange.call(:"do", Messages::DoDevAssocRequest, Messages::DoDevAssocReply, args)
886
+ end
887
+ # Disassociate a network device from a PSP device.
888
+ #
889
+ # Requires CAP_NET_ADMIN in the initial user namespace.
890
+ #--
891
+ # @rbs (?id: ::Integer, ?ifindex: ::Integer, ?nsid: ::Integer) -> ::Nl::Async::Future[Messages::DoDevDisassocReply]
892
+ def do_dev_disassoc(**args)
893
+ @exchange.call(:"do", Messages::DoDevDisassocRequest, Messages::DoDevDisassocReply, args)
894
+ end
895
+ end
896
+ # Returns the asynchronous operation facade for this family.
897
+ #--
898
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
899
+ def async(stream_capacity: nil)
900
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
901
+ build_async_facade(AsyncOperations, stream_capacity:)
902
+ end
903
+ #--
904
+ # @rbs (*(:mgmt | :use) groups) -> self
905
+ def subscribe(*groups) = super
906
+ #--
907
+ # @rbs (*(:mgmt | :use) groups) -> self
908
+ def unsubscribe(*groups) = super
652
909
  end
653
910
  end; end