nl-linux 0.2.3 → 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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +8 -0
  4. data/NLSPEC_VERSION +1 -1
  5. data/Rakefile +13 -3
  6. data/generated/nl/linux/binder.rb +80 -0
  7. data/generated/nl/linux/conntrack.rb +39 -2
  8. data/generated/nl/linux/dev_energymodel.rb +106 -0
  9. data/generated/nl/linux/devlink.rb +1478 -200
  10. data/generated/nl/linux/dpll.rb +790 -66
  11. data/generated/nl/linux/drm_ras.rb +309 -0
  12. data/generated/nl/linux/ethtool.rb +1597 -248
  13. data/generated/nl/linux/fou.rb +82 -13
  14. data/generated/nl/linux/handshake.rb +93 -1
  15. data/generated/nl/linux/lockd.rb +50 -0
  16. data/generated/nl/linux/mptcp_pm.rb +159 -0
  17. data/generated/nl/linux/net_shaper.rb +124 -1
  18. data/generated/nl/linux/netdev.rb +515 -6
  19. data/generated/nl/linux/nfsd.rb +878 -10
  20. data/generated/nl/linux/nftables.rb +2134 -179
  21. data/generated/nl/linux/nl80211.rb +81 -22
  22. data/generated/nl/linux/nlctrl.rb +59 -8
  23. data/generated/nl/linux/ovpn.rb +207 -12
  24. data/generated/nl/linux/ovs_datapath.rb +59 -10
  25. data/generated/nl/linux/ovs_flow.rb +63 -20
  26. data/generated/nl/linux/ovs_packet.rb +277 -0
  27. data/generated/nl/linux/ovs_vport.rb +59 -10
  28. data/generated/nl/linux/psp.rb +453 -6
  29. data/generated/nl/linux/rt_addr.rb +69 -14
  30. data/generated/nl/linux/rt_link.rb +452 -112
  31. data/generated/nl/linux/rt_neigh.rb +227 -16
  32. data/generated/nl/linux/rt_route.rb +92 -49
  33. data/generated/nl/linux/rt_rule.rb +300 -11
  34. data/generated/nl/linux/sunrpc_cache.rb +423 -0
  35. data/generated/nl/linux/tc.rb +168 -54
  36. data/generated/nl/linux/tcp_metrics.rb +69 -12
  37. data/generated/nl/linux/team.rb +80 -0
  38. data/generated/nl/linux/wireguard.rb +99 -7
  39. data/generated/nl/linux.rb +3 -0
  40. data/lib/nl/linux/version.rb +1 -1
  41. data/linux/devlink.yaml +92 -2
  42. data/linux/dpll.yaml +94 -5
  43. data/linux/drm_ras.yaml +126 -0
  44. data/linux/ethtool.yaml +21 -4
  45. data/linux/handshake.yaml +9 -0
  46. data/linux/mptcp_pm.yaml +1 -0
  47. data/linux/net_shaper.yaml +13 -6
  48. data/linux/netdev.yaml +61 -2
  49. data/linux/nfsd.yaml +303 -2
  50. data/linux/nftables.yaml +640 -49
  51. data/linux/ovpn.yaml +26 -1
  52. data/linux/ovs_packet.yaml +130 -0
  53. data/linux/psp.yaml +80 -3
  54. data/linux/rt-link.yaml +70 -24
  55. data/linux/sunrpc_cache.yaml +149 -0
  56. data/linux/tc.yaml +3 -0
  57. metadata +17 -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_flow.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 OvsFlow < ::Nl::Family
10
12
  NAME = "ovs_flow"
11
13
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_flow"))
14
+ MCAST_GROUPS = Ractor.make_shareable({:"ovs_flow" => ::Nl::McastGroup.new("ovs_flow", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
12
15
  module Structs
13
16
  # Header for OVS Generic Netlink messages.
14
17
  OvsHeader = Struct.new(
@@ -55,8 +58,8 @@ class OvsFlow < ::Nl::Family
55
58
  end
56
59
  end
57
60
  OvsKeyEthernet = Struct.new(
58
- :"eth_src", #: untyped
59
- :"eth_dst", #: untyped
61
+ :"eth_src", #: ::String
62
+ :"eth_dst", #: ::String
60
63
  )
61
64
  class OvsKeyEthernet
62
65
  # :nodoc:
@@ -124,8 +127,8 @@ class OvsFlow < ::Nl::Family
124
127
  end
125
128
  end
126
129
  OvsKeyIpv6 = Struct.new(
127
- :"ipv6_src", #: untyped
128
- :"ipv6_dst", #: untyped
130
+ :"ipv6_src", #: ::String
131
+ :"ipv6_dst", #: ::String
129
132
  :"ipv6_label", #: ::Integer
130
133
  :"ipv6_proto", #: ::Integer
131
134
  :"ipv6_tclass", #: ::Integer
@@ -263,8 +266,8 @@ class OvsFlow < ::Nl::Family
263
266
  :"arp_sip", #: ::Integer
264
267
  :"arp_tip", #: ::Integer
265
268
  :"arp_op", #: ::Integer
266
- :"arp_sha", #: untyped
267
- :"arp_tha", #: untyped
269
+ :"arp_sha", #: ::String
270
+ :"arp_tha", #: ::String
268
271
  )
269
272
  class OvsKeyArp
270
273
  # :nodoc:
@@ -285,9 +288,9 @@ class OvsFlow < ::Nl::Family
285
288
  end
286
289
  end
287
290
  OvsKeyNd = Struct.new(
288
- :"nd_target", #: untyped
289
- :"nd_sll", #: untyped
290
- :"nd_tll", #: untyped
291
+ :"nd_target", #: ::String
292
+ :"nd_sll", #: ::String
293
+ :"nd_tll", #: ::String
291
294
  )
292
295
  class OvsKeyNd
293
296
  # :nodoc:
@@ -1304,7 +1307,7 @@ class OvsFlow < ::Nl::Family
1304
1307
  def key; attributes[:"key"]&.value; end
1305
1308
  # Gets the value of `ufid` attribute in the message.
1306
1309
  #--
1307
- # @rbs return: untyped
1310
+ # @rbs return: ::String
1308
1311
  def ufid; attributes[:"ufid"]&.value; end
1309
1312
  # Gets the value of `ufid-flags` attribute in the message.
1310
1313
  #--
@@ -1331,7 +1334,7 @@ class OvsFlow < ::Nl::Family
1331
1334
  def actions; attributes[:"actions"]&.value; end
1332
1335
  # Gets the value of `stats` attribute in the message.
1333
1336
  #--
1334
- # @rbs return: untyped
1337
+ # @rbs return: ::String
1335
1338
  def stats; attributes[:"stats"]&.value; end
1336
1339
  # Gets the value of `mask` attribute in the message.
1337
1340
  #--
@@ -1339,7 +1342,7 @@ class OvsFlow < ::Nl::Family
1339
1342
  def mask; attributes[:"mask"]&.value; end
1340
1343
  # Gets the value of `ufid` attribute in the message.
1341
1344
  #--
1342
- # @rbs return: untyped
1345
+ # @rbs return: ::String
1343
1346
  def ufid; attributes[:"ufid"]&.value; end
1344
1347
  end
1345
1348
  # Get / dump OVS flow configuration and state
@@ -1358,7 +1361,7 @@ class OvsFlow < ::Nl::Family
1358
1361
  def key; attributes[:"key"]&.value; end
1359
1362
  # Gets the value of `ufid` attribute in the message.
1360
1363
  #--
1361
- # @rbs return: untyped
1364
+ # @rbs return: ::String
1362
1365
  def ufid; attributes[:"ufid"]&.value; end
1363
1366
  # Gets the value of `ufid-flags` attribute in the message.
1364
1367
  #--
@@ -1385,7 +1388,7 @@ class OvsFlow < ::Nl::Family
1385
1388
  def actions; attributes[:"actions"]&.value; end
1386
1389
  # Gets the value of `stats` attribute in the message.
1387
1390
  #--
1388
- # @rbs return: untyped
1391
+ # @rbs return: ::String
1389
1392
  def stats; attributes[:"stats"]&.value; end
1390
1393
  # Gets the value of `mask` attribute in the message.
1391
1394
  #--
@@ -1393,7 +1396,7 @@ class OvsFlow < ::Nl::Family
1393
1396
  def mask; attributes[:"mask"]&.value; end
1394
1397
  # Gets the value of `ufid` attribute in the message.
1395
1398
  #--
1396
- # @rbs return: untyped
1399
+ # @rbs return: ::String
1397
1400
  def ufid; attributes[:"ufid"]&.value; end
1398
1401
  end
1399
1402
  # Create OVS flow configuration in a data path
@@ -1420,28 +1423,68 @@ class OvsFlow < ::Nl::Family
1420
1423
  def mask; attributes[:"mask"]&.value; end
1421
1424
  # Gets the value of `ufid` attribute in the message.
1422
1425
  #--
1423
- # @rbs return: untyped
1426
+ # @rbs return: ::String
1424
1427
  def ufid; attributes[:"ufid"]&.value; end
1425
1428
  end
1426
1429
  end
1430
+ module Notifications
1431
+ end
1432
+ NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
1427
1433
  # Get / dump OVS flow configuration and state
1428
1434
  #--
1429
- # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: untyped, ?ufid_flags: ::Integer) -> Messages::DoGetReply
1435
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: ::String, ?ufid_flags: ::Integer) -> Messages::DoGetReply
1430
1436
  def do_get(**args)
1431
1437
  exchange_message(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
1432
1438
  end
1433
1439
  # Get / dump OVS flow configuration and state
1434
1440
  #--
1435
- # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: untyped, ?ufid_flags: ::Integer) -> Enumerable[Messages::DumpGetReply]
1436
- # | (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: untyped, ?ufid_flags: ::Integer) { (Messages::DumpGetReply) -> void } -> void
1441
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: ::String, ?ufid_flags: ::Integer) -> Enumerable[Messages::DumpGetReply]
1442
+ # | (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: ::String, ?ufid_flags: ::Integer) { (Messages::DumpGetReply) -> void } -> void
1437
1443
  def dump_get(**args, &block)
1438
1444
  exchange_message(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args, &block)
1439
1445
  end
1440
1446
  # Create OVS flow configuration in a data path
1441
1447
  #--
1442
- # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?actions: AttributeSets::ActionAttrs, ?mask: AttributeSets::KeyAttrs, ?ufid: untyped) -> void
1448
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?actions: AttributeSets::ActionAttrs, ?mask: AttributeSets::KeyAttrs, ?ufid: ::String) -> void
1443
1449
  def do_new(**args)
1444
1450
  exchange_message(:"do", Messages::DoNewRequest, nil, args)
1445
1451
  end
1452
+ class AsyncOperations
1453
+ # :nodoc:
1454
+ def initialize(&exchange)
1455
+ @exchange = exchange
1456
+ end
1457
+ # Get / dump OVS flow configuration and state
1458
+ #--
1459
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: ::String, ?ufid_flags: ::Integer) -> ::Nl::Async::Future[Messages::DoGetReply]
1460
+ def do_get(**args)
1461
+ @exchange.call(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
1462
+ end
1463
+ # Get / dump OVS flow configuration and state
1464
+ #--
1465
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?ufid: ::String, ?ufid_flags: ::Integer) -> ::Nl::Async::Stream[Messages::DumpGetReply]
1466
+ def dump_get(**args)
1467
+ @exchange.call(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args)
1468
+ end
1469
+ # Create OVS flow configuration in a data path
1470
+ #--
1471
+ # @rbs (?dp_ifindex: ::Integer, ?key: AttributeSets::KeyAttrs, ?actions: AttributeSets::ActionAttrs, ?mask: AttributeSets::KeyAttrs, ?ufid: ::String) -> ::Nl::Async::Future[void]
1472
+ def do_new(**args)
1473
+ @exchange.call(:"do", Messages::DoNewRequest, nil, args)
1474
+ end
1475
+ end
1476
+ # Returns the asynchronous operation facade for this family.
1477
+ #--
1478
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
1479
+ def async(stream_capacity: nil)
1480
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
1481
+ build_async_facade(AsyncOperations, stream_capacity:)
1482
+ end
1483
+ #--
1484
+ # @rbs (*(:ovs_flow) groups) -> self
1485
+ def subscribe(*groups) = super
1486
+ #--
1487
+ # @rbs (*(:ovs_flow) groups) -> self
1488
+ def unsubscribe(*groups) = super
1446
1489
  end
1447
1490
  end; end
@@ -0,0 +1,277 @@
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.
4
+ #--
5
+ # frozen_string_literal: true
6
+ # rbs_inline: enabled
7
+ # This code is generated by Ynl::Generator. DO NOT EDIT.
8
+ require 'nl'
9
+ module Nl; module Linux
10
+ # OVS packet execution over generic netlink.
11
+ #
12
+ # Only OVS_PACKET_CMD_EXECUTE is exposed as a genl operation.
13
+ # OVS_PACKET_CMD_MISS and OVS_PACKET_CMD_ACTION are kernel-to-userspace
14
+ # upcalls sent via genlmsg_unicast() to the vport's upcall_pid and have
15
+ # no associated genl_ops or multicast group.
16
+ #
17
+ # Several attributes in the attribute set (userdata, egress-tun-key, len)
18
+ # exist for the upcall path and are not used by the EXECUTE operation.
19
+ # For EXECUTE, packet, key, and actions are mandatory (kernel returns
20
+ # -EINVAL without them).
21
+ class OvsPacket < ::Nl::Family
22
+ NAME = "ovs_packet"
23
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_packet"))
24
+ MCAST_GROUPS = Ractor.make_shareable({}) #: Hash[::Symbol, ::Nl::McastGroup]
25
+ module Structs
26
+ OvsHeader = Struct.new(
27
+ :"dp_ifindex", #: ::Integer
28
+ )
29
+ class OvsHeader
30
+ # :nodoc:
31
+ MEMBERS = Ractor.make_shareable({dp_ifindex: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
32
+ # Decodes the struct.
33
+ #--
34
+ # @rbs decoder: ::Nl::Decoder
35
+ # @rbs return: instance
36
+ def self.decode(decoder)
37
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
38
+ end
39
+ # Encodes the struct.
40
+ #--
41
+ # @rbs encoder: ::Nl::Encoder
42
+ # @rbs return: void
43
+ def encode(encoder)
44
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
45
+ end
46
+ end
47
+ end
48
+ module AttributeSets
49
+ class Packet < ::Nl::Protocols::Genl::AttributeSet
50
+ # Abstract class
51
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
52
+ end
53
+ class Packet < Attribute
54
+ TYPE = 1
55
+ NAME = :"packet"
56
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 14" unless it.bytesize >= 14 })
57
+ end
58
+ class Key < Attribute
59
+ TYPE = 2
60
+ NAME = :"key"
61
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
62
+ end
63
+ class Actions < Attribute
64
+ TYPE = 3
65
+ NAME = :"actions"
66
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
67
+ end
68
+ class Userdata < Attribute
69
+ TYPE = 4
70
+ NAME = :"userdata"
71
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
72
+ end
73
+ class EgressTunKey < Attribute
74
+ TYPE = 5
75
+ NAME = :"egress_tun_key"
76
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
77
+ end
78
+ class Probe < Attribute
79
+ TYPE = 8
80
+ NAME = :"probe"
81
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Flag.new
82
+ end
83
+ class Mru < Attribute
84
+ TYPE = 9
85
+ NAME = :"mru"
86
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
87
+ end
88
+ class Len < Attribute
89
+ TYPE = 10
90
+ NAME = :"len"
91
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
92
+ end
93
+ class Hash < Attribute
94
+ TYPE = 11
95
+ NAME = :"hash"
96
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
97
+ end
98
+ class UpcallPid < Attribute
99
+ TYPE = 12
100
+ NAME = :"upcall_pid"
101
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
102
+ end
103
+ # :nodoc:
104
+ BY_NAME = Ractor.make_shareable({:"packet" => Packet, :"key" => Key, :"actions" => Actions, :"userdata" => Userdata, :"egress_tun_key" => EgressTunKey, :"probe" => Probe, :"mru" => Mru, :"len" => Len, :"hash" => Hash, :"upcall_pid" => UpcallPid}) #: Hash[::Symbol, Attribute]
105
+ # :nodoc:
106
+ BY_TYPE = Ractor.make_shareable({1 => Packet, 2 => Key, 3 => Actions, 4 => Userdata, 5 => EgressTunKey, 8 => Probe, 9 => Mru, 10 => Len, 11 => Hash, 12 => UpcallPid}) #: Hash[::Integer, Attribute]
107
+ class << self
108
+ # Looks up Attribute class by name.
109
+ #--
110
+ # @rbs name: Symbol
111
+ # @rbs return: Attribute
112
+ def by_name(name); BY_NAME.fetch(name); end
113
+ # Looks up Attribute class by type value.
114
+ #--
115
+ # @rbs type: Integer
116
+ # @rbs return: Attribute
117
+ def by_type(type); BY_TYPE.fetch(type); end
118
+ end
119
+ end
120
+ end
121
+ module Messages
122
+ # Apply actions to a packet.
123
+ class DoExecuteRequest < ::Nl::Protocols::Genl::Message
124
+ TYPE = 3
125
+ FIXED_HEADER = Structs::OvsHeader
126
+ ATTRIBUTE_SET = AttributeSets::Packet
127
+ ATTRIBUTES = Ractor.make_shareable(%i[packet key actions probe mru hash upcall_pid])
128
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
129
+ #--
130
+ # @rbs return: ::Integer
131
+ def dp_ifindex; fixed_header.dp_ifindex; end
132
+ # Gets the value of `packet` attribute in the message.
133
+ #--
134
+ # @rbs return: ::String
135
+ def packet; attributes[:"packet"]&.value; end
136
+ # Gets the value of `key` attribute in the message.
137
+ #--
138
+ # @rbs return: ::String
139
+ def key; attributes[:"key"]&.value; end
140
+ # Gets the value of `actions` attribute in the message.
141
+ #--
142
+ # @rbs return: ::String
143
+ def actions; attributes[:"actions"]&.value; end
144
+ # Gets the value of `probe` attribute in the message.
145
+ #--
146
+ # @rbs return: ::Integer
147
+ def probe; attributes[:"probe"]&.value; end
148
+ # Gets the value of `mru` attribute in the message.
149
+ #--
150
+ # @rbs return: ::Integer
151
+ def mru; attributes[:"mru"]&.value; end
152
+ # Gets the value of `hash` attribute in the message.
153
+ #--
154
+ # @rbs return: ::Integer
155
+ def hash; attributes[:"hash"]&.value; end
156
+ # Gets the value of `upcall-pid` attribute in the message.
157
+ #--
158
+ # @rbs return: ::Integer
159
+ def upcall_pid; attributes[:"upcall_pid"]&.value; end
160
+ end
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]
251
+ # Apply actions to a packet.
252
+ #--
253
+ # @rbs (?dp_ifindex: ::Integer, ?packet: ::String, ?key: ::String, ?actions: ::String, ?probe: ::Integer, ?mru: ::Integer, ?hash: ::Integer, ?upcall_pid: ::Integer) -> void
254
+ def do_execute(**args)
255
+ exchange_message(:"do", Messages::DoExecuteRequest, nil, args)
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
276
+ end
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
@@ -157,23 +160,23 @@ class OvsVport < ::Nl::Family
157
160
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
158
161
  end
159
162
  class Ifindex < Attribute
160
- TYPE = 7
163
+ TYPE = 8
161
164
  NAME = :"ifindex"
162
165
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
163
166
  end
164
167
  class Netnsid < Attribute
165
- TYPE = 8
168
+ TYPE = 9
166
169
  NAME = :"netnsid"
167
170
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
168
171
  end
169
172
  class UpcallStats < Attribute
170
- TYPE = 9
173
+ TYPE = 10
171
174
  NAME = :"upcall_stats"
172
175
  end
173
176
  # :nodoc:
174
177
  BY_NAME = Ractor.make_shareable({:"port_no" => PortNo, :"type" => Type, :"name" => Name, :"options" => Options, :"upcall_pid" => UpcallPid, :"stats" => Stats, :"ifindex" => Ifindex, :"netnsid" => Netnsid, :"upcall_stats" => UpcallStats}) #: Hash[::Symbol, Attribute]
175
178
  # :nodoc:
176
- BY_TYPE = Ractor.make_shareable({1 => PortNo, 2 => Type, 3 => Name, 4 => Options, 5 => UpcallPid, 6 => Stats, 7 => Ifindex, 8 => Netnsid, 9 => UpcallStats}) #: Hash[::Integer, Attribute]
179
+ BY_TYPE = Ractor.make_shareable({1 => PortNo, 2 => Type, 3 => Name, 4 => Options, 5 => UpcallPid, 6 => Stats, 8 => Ifindex, 9 => Netnsid, 10 => UpcallStats}) #: Hash[::Integer, Attribute]
177
180
  class << self
178
181
  # Looks up Attribute class by name.
179
182
  #--
@@ -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