nl-linux 0.2.0 → 0.2.2

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Rakefile +31 -5
  4. data/generated/nl/linux/binder.rb +96 -0
  5. data/generated/nl/linux/conntrack.rb +1227 -0
  6. data/generated/nl/linux/dev_energymodel.rb +235 -0
  7. data/generated/nl/linux/devlink.rb +5177 -0
  8. data/generated/nl/linux/dpll.rb +944 -0
  9. data/generated/nl/linux/ethtool.rb +7121 -0
  10. data/generated/nl/linux/fou.rb +332 -0
  11. data/generated/nl/linux/handshake.rb +238 -0
  12. data/generated/nl/linux/lockd.rb +99 -0
  13. data/generated/nl/linux/mptcp_pm.rb +607 -0
  14. data/generated/nl/linux/net_shaper.rb +731 -0
  15. data/generated/nl/linux/netdev.rb +1450 -0
  16. data/generated/nl/linux/nfsd.rb +500 -0
  17. data/generated/nl/linux/nftables.rb +2924 -0
  18. data/generated/nl/linux/nl80211.rb +3393 -0
  19. data/generated/nl/linux/nlctrl.rb +397 -0
  20. data/generated/nl/linux/ovpn.rb +964 -0
  21. data/generated/nl/linux/ovs_datapath.rb +321 -0
  22. data/generated/nl/linux/ovs_flow.rb +1447 -0
  23. data/generated/nl/linux/ovs_vport.rb +391 -0
  24. data/generated/nl/linux/psp.rb +463 -0
  25. data/generated/nl/linux/rt_addr.rb +448 -0
  26. data/generated/nl/linux/rt_link.rb +4613 -0
  27. data/generated/nl/linux/rt_neigh.rb +897 -0
  28. data/generated/nl/linux/rt_route.rb +1126 -0
  29. data/generated/nl/linux/rt_rule.rb +708 -0
  30. data/generated/nl/linux/tc.rb +7066 -0
  31. data/generated/nl/linux/tcp_metrics.rb +317 -0
  32. data/generated/nl/linux/team.rb +339 -0
  33. data/generated/nl/linux/wireguard.rb +430 -0
  34. data/generated/nl/linux.rb +35 -0
  35. data/lib/nl/linux/version.rb +1 -1
  36. data/lib/nl-linux.rb +1 -1
  37. metadata +37 -7
  38. data/lib/nl/linux.rb +0 -3
@@ -0,0 +1,430 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ #--
3
+ # frozen_string_literal: true
4
+ # rbs_inline: enabled
5
+ # This code is generated by Ynl::Generator. DO NOT EDIT.
6
+ require 'nl'
7
+ module Nl; module Linux
8
+ # **Netlink protocol to control WireGuard network devices.**
9
+ #
10
+ # The below enums and macros are for interfacing with WireGuard, using generic
11
+ # netlink, with family ``WG_GENL_NAME`` and version ``WG_GENL_VERSION``. It
12
+ # defines two commands: get and set. Note that while they share many common
13
+ # attributes, these two commands actually accept a slightly different set of
14
+ # inputs and outputs. These differences are noted under the individual
15
+ # attributes.
16
+ class Wireguard < ::Nl::Family
17
+ NAME = "wireguard"
18
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("wireguard"))
19
+ module Structs
20
+ KernelTimespec = Struct.new(
21
+ :"sec", #: ::Integer
22
+ :"nsec", #: ::Integer
23
+ )
24
+ class KernelTimespec
25
+ # :nodoc:
26
+ MEMBERS = Ractor.make_shareable({sec: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), nsec: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
27
+ # Decodes the struct.
28
+ #--
29
+ # @rbs decoder: ::Nl::Decoder
30
+ # @rbs return: instance
31
+ def self.decode(decoder)
32
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
33
+ end
34
+ # Encodes the struct.
35
+ #--
36
+ # @rbs encoder: ::Nl::Encoder
37
+ # @rbs return: void
38
+ def encode(encoder)
39
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
40
+ end
41
+ end
42
+ end
43
+ module AttributeSets
44
+ class Wgdevice < ::Nl::Protocols::Genl::AttributeSet
45
+ # Abstract class
46
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
47
+ end
48
+ class Ifindex < Attribute
49
+ TYPE = 1
50
+ NAME = :"ifindex"
51
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
52
+ end
53
+ class Ifname < Attribute
54
+ TYPE = 2
55
+ NAME = :"ifname"
56
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::String.new(check: -> { raise ArgumentError, "Value #{it.inspect} is longer than maximum length 15" unless it.bytesize <= 15 })
57
+ end
58
+ class PrivateKey < Attribute
59
+ TYPE = 3
60
+ NAME = :"private_key"
61
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 32" unless it.bytesize == 32 })
62
+ end
63
+ class PublicKey < Attribute
64
+ TYPE = 4
65
+ NAME = :"public_key"
66
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 32" unless it.bytesize == 32 })
67
+ end
68
+ class Flags < Attribute
69
+ TYPE = 5
70
+ NAME = :"flags"
71
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
72
+ end
73
+ class ListenPort < Attribute
74
+ TYPE = 6
75
+ NAME = :"listen_port"
76
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
77
+ end
78
+ class Fwmark < Attribute
79
+ TYPE = 7
80
+ NAME = :"fwmark"
81
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
82
+ end
83
+ class Peers < Attribute
84
+ TYPE = 8
85
+ NAME = :"peers"
86
+ end
87
+ # :nodoc:
88
+ BY_NAME = Ractor.make_shareable({:"ifindex" => Ifindex, :"ifname" => Ifname, :"private_key" => PrivateKey, :"public_key" => PublicKey, :"flags" => Flags, :"listen_port" => ListenPort, :"fwmark" => Fwmark, :"peers" => Peers}) #: Hash[::Symbol, Attribute]
89
+ # :nodoc:
90
+ BY_TYPE = Ractor.make_shareable({1 => Ifindex, 2 => Ifname, 3 => PrivateKey, 4 => PublicKey, 5 => Flags, 6 => ListenPort, 7 => Fwmark, 8 => Peers}) #: Hash[::Integer, Attribute]
91
+ class << self
92
+ # Looks up Attribute class by name.
93
+ #--
94
+ # @rbs name: Symbol
95
+ # @rbs return: Attribute
96
+ def by_name(name); BY_NAME.fetch(name); end
97
+ # Looks up Attribute class by type value.
98
+ #--
99
+ # @rbs type: Integer
100
+ # @rbs return: Attribute
101
+ def by_type(type); BY_TYPE.fetch(type); end
102
+ end
103
+ end
104
+ class Wgpeer < ::Nl::Protocols::Genl::AttributeSet
105
+ # Abstract class
106
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
107
+ end
108
+ class PublicKey < Attribute
109
+ TYPE = 1
110
+ NAME = :"public_key"
111
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 32" unless it.bytesize == 32 })
112
+ end
113
+ class PresharedKey < Attribute
114
+ TYPE = 2
115
+ NAME = :"preshared_key"
116
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 32" unless it.bytesize == 32 })
117
+ end
118
+ class Flags < Attribute
119
+ TYPE = 3
120
+ NAME = :"flags"
121
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
122
+ end
123
+ class Endpoint < Attribute
124
+ TYPE = 4
125
+ NAME = :"endpoint"
126
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 16" unless it.bytesize >= 16 })
127
+ end
128
+ class PersistentKeepaliveInterval < Attribute
129
+ TYPE = 5
130
+ NAME = :"persistent_keepalive_interval"
131
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
132
+ end
133
+ class LastHandshakeTime < Attribute
134
+ TYPE = 6
135
+ NAME = :"last_handshake_time"
136
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 16" unless it.bytesize == 16 })
137
+ end
138
+ class RxBytes < Attribute
139
+ TYPE = 7
140
+ NAME = :"rx_bytes"
141
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
142
+ end
143
+ class TxBytes < Attribute
144
+ TYPE = 8
145
+ NAME = :"tx_bytes"
146
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
147
+ end
148
+ class Allowedips < Attribute
149
+ TYPE = 9
150
+ NAME = :"allowedips"
151
+ end
152
+ class ProtocolVersion < Attribute
153
+ TYPE = 10
154
+ NAME = :"protocol_version"
155
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
156
+ end
157
+ # :nodoc:
158
+ BY_NAME = Ractor.make_shareable({:"public_key" => PublicKey, :"preshared_key" => PresharedKey, :"flags" => Flags, :"endpoint" => Endpoint, :"persistent_keepalive_interval" => PersistentKeepaliveInterval, :"last_handshake_time" => LastHandshakeTime, :"rx_bytes" => RxBytes, :"tx_bytes" => TxBytes, :"allowedips" => Allowedips, :"protocol_version" => ProtocolVersion}) #: Hash[::Symbol, Attribute]
159
+ # :nodoc:
160
+ BY_TYPE = Ractor.make_shareable({1 => PublicKey, 2 => PresharedKey, 3 => Flags, 4 => Endpoint, 5 => PersistentKeepaliveInterval, 6 => LastHandshakeTime, 7 => RxBytes, 8 => TxBytes, 9 => Allowedips, 10 => ProtocolVersion}) #: Hash[::Integer, Attribute]
161
+ class << self
162
+ # Looks up Attribute class by name.
163
+ #--
164
+ # @rbs name: Symbol
165
+ # @rbs return: Attribute
166
+ def by_name(name); BY_NAME.fetch(name); end
167
+ # Looks up Attribute class by type value.
168
+ #--
169
+ # @rbs type: Integer
170
+ # @rbs return: Attribute
171
+ def by_type(type); BY_TYPE.fetch(type); end
172
+ end
173
+ end
174
+ class Wgallowedip < ::Nl::Protocols::Genl::AttributeSet
175
+ # Abstract class
176
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
177
+ end
178
+ class Family < Attribute
179
+ TYPE = 1
180
+ NAME = :"family"
181
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
182
+ end
183
+ class Ipaddr < Attribute
184
+ TYPE = 2
185
+ NAME = :"ipaddr"
186
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 4" unless it.bytesize >= 4 })
187
+ end
188
+ class CidrMask < Attribute
189
+ TYPE = 3
190
+ NAME = :"cidr_mask"
191
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
192
+ end
193
+ class Flags < Attribute
194
+ TYPE = 4
195
+ NAME = :"flags"
196
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
197
+ end
198
+ # :nodoc:
199
+ BY_NAME = Ractor.make_shareable({:"family" => Family, :"ipaddr" => Ipaddr, :"cidr_mask" => CidrMask, :"flags" => Flags}) #: Hash[::Symbol, Attribute]
200
+ # :nodoc:
201
+ BY_TYPE = Ractor.make_shareable({1 => Family, 2 => Ipaddr, 3 => CidrMask, 4 => Flags}) #: Hash[::Integer, Attribute]
202
+ class << self
203
+ # Looks up Attribute class by name.
204
+ #--
205
+ # @rbs name: Symbol
206
+ # @rbs return: Attribute
207
+ def by_name(name); BY_NAME.fetch(name); end
208
+ # Looks up Attribute class by type value.
209
+ #--
210
+ # @rbs type: Integer
211
+ # @rbs return: Attribute
212
+ def by_type(type); BY_TYPE.fetch(type); end
213
+ end
214
+ end
215
+ Wgdevice::Peers::DATATYPE = ::Nl::Protocols::Genl::DataTypes::IndexedArray.new(::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Wgpeer))
216
+ Wgpeer::Allowedips::DATATYPE = ::Nl::Protocols::Genl::DataTypes::IndexedArray.new(::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Wgallowedip))
217
+ end
218
+ module Messages
219
+ # Retrieve WireGuard device
220
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~
221
+ #
222
+ # The command should be called with one but not both of:
223
+ #
224
+ # - ``WGDEVICE_A_IFINDEX``
225
+ # - ``WGDEVICE_A_IFNAME``
226
+ #
227
+ # The kernel will then return several messages (``NLM_F_MULTI``). It is
228
+ # possible that all of the allowed IPs of a single peer will not fit
229
+ # within a single netlink message. In that case, the same peer will be
230
+ # written in the following message, except it will only contain
231
+ # ``WGPEER_A_PUBLIC_KEY`` and ``WGPEER_A_ALLOWEDIPS``. This may occur
232
+ # several times in a row for the same peer. It is then up to the receiver
233
+ # to coalesce adjacent peers. Likewise, it is possible that all peers will
234
+ # not fit within a single message. So, subsequent peers will be sent in
235
+ # following messages, except those will only contain ``WGDEVICE_A_IFNAME``
236
+ # and ``WGDEVICE_A_PEERS``. It is then up to the receiver to coalesce
237
+ # these messages to form the complete list of peers.
238
+ #
239
+ # Since this is an ``NLA_F_DUMP`` command, the final message will always
240
+ # be ``NLMSG_DONE``, even if an error occurs. However, this ``NLMSG_DONE``
241
+ # message contains an integer error code. It is either zero or a negative
242
+ # error code corresponding to the errno.
243
+ class DumpGetDeviceRequest < ::Nl::Protocols::Genl::Message
244
+ TYPE = 0
245
+ FIXED_HEADER = nil
246
+ ATTRIBUTE_SET = AttributeSets::Wgdevice
247
+ ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname])
248
+ # Gets the value of `ifindex` attribute in the message.
249
+ #--
250
+ # @rbs return: ::Integer
251
+ def ifindex; attributes[:"ifindex"]&.value; end
252
+ # Gets the value of `ifname` attribute in the message.
253
+ #--
254
+ # @rbs return: ::String
255
+ def ifname; attributes[:"ifname"]&.value; end
256
+ end
257
+ # Retrieve WireGuard device
258
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~
259
+ #
260
+ # The command should be called with one but not both of:
261
+ #
262
+ # - ``WGDEVICE_A_IFINDEX``
263
+ # - ``WGDEVICE_A_IFNAME``
264
+ #
265
+ # The kernel will then return several messages (``NLM_F_MULTI``). It is
266
+ # possible that all of the allowed IPs of a single peer will not fit
267
+ # within a single netlink message. In that case, the same peer will be
268
+ # written in the following message, except it will only contain
269
+ # ``WGPEER_A_PUBLIC_KEY`` and ``WGPEER_A_ALLOWEDIPS``. This may occur
270
+ # several times in a row for the same peer. It is then up to the receiver
271
+ # to coalesce adjacent peers. Likewise, it is possible that all peers will
272
+ # not fit within a single message. So, subsequent peers will be sent in
273
+ # following messages, except those will only contain ``WGDEVICE_A_IFNAME``
274
+ # and ``WGDEVICE_A_PEERS``. It is then up to the receiver to coalesce
275
+ # these messages to form the complete list of peers.
276
+ #
277
+ # Since this is an ``NLA_F_DUMP`` command, the final message will always
278
+ # be ``NLMSG_DONE``, even if an error occurs. However, this ``NLMSG_DONE``
279
+ # message contains an integer error code. It is either zero or a negative
280
+ # error code corresponding to the errno.
281
+ class DumpGetDeviceReply < ::Nl::Protocols::Genl::Message
282
+ TYPE = 0
283
+ FIXED_HEADER = nil
284
+ ATTRIBUTE_SET = AttributeSets::Wgdevice
285
+ ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname private_key public_key flags listen_port fwmark peers])
286
+ # Gets the value of `ifindex` attribute in the message.
287
+ #--
288
+ # @rbs return: ::Integer
289
+ def ifindex; attributes[:"ifindex"]&.value; end
290
+ # Gets the value of `ifname` attribute in the message.
291
+ #--
292
+ # @rbs return: ::String
293
+ def ifname; attributes[:"ifname"]&.value; end
294
+ # Gets the value of `private-key` attribute in the message.
295
+ #--
296
+ # @rbs return: untyped
297
+ def private_key; attributes[:"private_key"]&.value; end
298
+ # Gets the value of `public-key` attribute in the message.
299
+ #--
300
+ # @rbs return: untyped
301
+ def public_key; attributes[:"public_key"]&.value; end
302
+ # Gets the value of `flags` attribute in the message.
303
+ #--
304
+ # @rbs return: ::Integer
305
+ def flags; attributes[:"flags"]&.value; end
306
+ # Gets the value of `listen-port` attribute in the message.
307
+ #--
308
+ # @rbs return: ::Integer
309
+ def listen_port; attributes[:"listen_port"]&.value; end
310
+ # Gets the value of `fwmark` attribute in the message.
311
+ #--
312
+ # @rbs return: ::Integer
313
+ def fwmark; attributes[:"fwmark"]&.value; end
314
+ # Gets the value of `peers` attribute in the message.
315
+ #--
316
+ # @rbs return: untyped
317
+ def peers; attributes[:"peers"]&.value; end
318
+ end
319
+ # Set WireGuard device
320
+ # ~~~~~~~~~~~~~~~~~~~~
321
+ #
322
+ # This command should be called with a wgdevice set, containing one but
323
+ # not both of ``WGDEVICE_A_IFINDEX`` and ``WGDEVICE_A_IFNAME``.
324
+ #
325
+ # It is possible that the amount of configuration data exceeds that of the
326
+ # maximum message length accepted by the kernel. In that case, several
327
+ # messages should be sent one after another, with each successive one
328
+ # filling in information not contained in the prior. Note that if
329
+ # ``WGDEVICE_F_REPLACE_PEERS`` is specified in the first message, it
330
+ # probably should not be specified in fragments that come after, so that
331
+ # the list of peers is only cleared the first time but appended after.
332
+ # Likewise for peers, if ``WGPEER_F_REPLACE_ALLOWEDIPS`` is specified in
333
+ # the first message of a peer, it likely should not be specified in
334
+ # subsequent fragments.
335
+ #
336
+ # If an error occurs, ``NLMSG_ERROR`` will reply containing an errno.
337
+ class DoSetDeviceRequest < ::Nl::Protocols::Genl::Message
338
+ TYPE = 1
339
+ FIXED_HEADER = nil
340
+ ATTRIBUTE_SET = AttributeSets::Wgdevice
341
+ ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname private_key public_key flags listen_port fwmark peers])
342
+ # Gets the value of `ifindex` attribute in the message.
343
+ #--
344
+ # @rbs return: ::Integer
345
+ def ifindex; attributes[:"ifindex"]&.value; end
346
+ # Gets the value of `ifname` attribute in the message.
347
+ #--
348
+ # @rbs return: ::String
349
+ def ifname; attributes[:"ifname"]&.value; end
350
+ # Gets the value of `private-key` attribute in the message.
351
+ #--
352
+ # @rbs return: untyped
353
+ def private_key; attributes[:"private_key"]&.value; end
354
+ # Gets the value of `public-key` attribute in the message.
355
+ #--
356
+ # @rbs return: untyped
357
+ def public_key; attributes[:"public_key"]&.value; end
358
+ # Gets the value of `flags` attribute in the message.
359
+ #--
360
+ # @rbs return: ::Integer
361
+ def flags; attributes[:"flags"]&.value; end
362
+ # Gets the value of `listen-port` attribute in the message.
363
+ #--
364
+ # @rbs return: ::Integer
365
+ def listen_port; attributes[:"listen_port"]&.value; end
366
+ # Gets the value of `fwmark` attribute in the message.
367
+ #--
368
+ # @rbs return: ::Integer
369
+ def fwmark; attributes[:"fwmark"]&.value; end
370
+ # Gets the value of `peers` attribute in the message.
371
+ #--
372
+ # @rbs return: untyped
373
+ def peers; attributes[:"peers"]&.value; end
374
+ end
375
+ end
376
+ # Retrieve WireGuard device
377
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~
378
+ #
379
+ # The command should be called with one but not both of:
380
+ #
381
+ # - ``WGDEVICE_A_IFINDEX``
382
+ # - ``WGDEVICE_A_IFNAME``
383
+ #
384
+ # The kernel will then return several messages (``NLM_F_MULTI``). It is
385
+ # possible that all of the allowed IPs of a single peer will not fit
386
+ # within a single netlink message. In that case, the same peer will be
387
+ # written in the following message, except it will only contain
388
+ # ``WGPEER_A_PUBLIC_KEY`` and ``WGPEER_A_ALLOWEDIPS``. This may occur
389
+ # several times in a row for the same peer. It is then up to the receiver
390
+ # to coalesce adjacent peers. Likewise, it is possible that all peers will
391
+ # not fit within a single message. So, subsequent peers will be sent in
392
+ # following messages, except those will only contain ``WGDEVICE_A_IFNAME``
393
+ # and ``WGDEVICE_A_PEERS``. It is then up to the receiver to coalesce
394
+ # these messages to form the complete list of peers.
395
+ #
396
+ # Since this is an ``NLA_F_DUMP`` command, the final message will always
397
+ # be ``NLMSG_DONE``, even if an error occurs. However, this ``NLMSG_DONE``
398
+ # message contains an integer error code. It is either zero or a negative
399
+ # error code corresponding to the errno.
400
+ #--
401
+ # @rbs (?ifindex: ::Integer, ?ifname: ::String) -> Enumerable[Messages::DumpGetDeviceReply]
402
+ # | (?ifindex: ::Integer, ?ifname: ::String) { (Messages::DumpGetDeviceReply) -> void } -> void
403
+ def dump_get_device(**args, &block)
404
+ exchange_message(:"dump", Messages::DumpGetDeviceRequest, Messages::DumpGetDeviceReply, args, &block)
405
+ end
406
+ # Set WireGuard device
407
+ # ~~~~~~~~~~~~~~~~~~~~
408
+ #
409
+ # This command should be called with a wgdevice set, containing one but
410
+ # not both of ``WGDEVICE_A_IFINDEX`` and ``WGDEVICE_A_IFNAME``.
411
+ #
412
+ # It is possible that the amount of configuration data exceeds that of the
413
+ # maximum message length accepted by the kernel. In that case, several
414
+ # messages should be sent one after another, with each successive one
415
+ # filling in information not contained in the prior. Note that if
416
+ # ``WGDEVICE_F_REPLACE_PEERS`` is specified in the first message, it
417
+ # probably should not be specified in fragments that come after, so that
418
+ # the list of peers is only cleared the first time but appended after.
419
+ # Likewise for peers, if ``WGPEER_F_REPLACE_ALLOWEDIPS`` is specified in
420
+ # the first message of a peer, it likely should not be specified in
421
+ # subsequent fragments.
422
+ #
423
+ # If an error occurs, ``NLMSG_ERROR`` will reply containing an errno.
424
+ #--
425
+ # @rbs (?ifindex: ::Integer, ?ifname: ::String, ?private_key: untyped, ?public_key: untyped, ?flags: ::Integer, ?listen_port: ::Integer, ?fwmark: ::Integer, ?peers: untyped) -> void
426
+ def do_set_device(**args)
427
+ exchange_message(:"do", Messages::DoSetDeviceRequest, nil, args)
428
+ end
429
+ end
430
+ end; end
@@ -0,0 +1,35 @@
1
+ require 'nl/linux/version'
2
+ module Nl
3
+ module Linux
4
+ autoload :Binder, "nl/linux/binder.rb"
5
+ autoload :Conntrack, "nl/linux/conntrack.rb"
6
+ autoload :DevEnergymodel, "nl/linux/dev_energymodel.rb"
7
+ autoload :Devlink, "nl/linux/devlink.rb"
8
+ autoload :Dpll, "nl/linux/dpll.rb"
9
+ autoload :Ethtool, "nl/linux/ethtool.rb"
10
+ autoload :Fou, "nl/linux/fou.rb"
11
+ autoload :Handshake, "nl/linux/handshake.rb"
12
+ autoload :Lockd, "nl/linux/lockd.rb"
13
+ autoload :MptcpPm, "nl/linux/mptcp_pm.rb"
14
+ autoload :NetShaper, "nl/linux/net_shaper.rb"
15
+ autoload :Netdev, "nl/linux/netdev.rb"
16
+ autoload :Nfsd, "nl/linux/nfsd.rb"
17
+ autoload :Nftables, "nl/linux/nftables.rb"
18
+ autoload :Nl80211, "nl/linux/nl80211.rb"
19
+ autoload :Nlctrl, "nl/linux/nlctrl.rb"
20
+ autoload :Ovpn, "nl/linux/ovpn.rb"
21
+ autoload :OvsDatapath, "nl/linux/ovs_datapath.rb"
22
+ autoload :OvsFlow, "nl/linux/ovs_flow.rb"
23
+ autoload :OvsVport, "nl/linux/ovs_vport.rb"
24
+ autoload :Psp, "nl/linux/psp.rb"
25
+ autoload :RtAddr, "nl/linux/rt_addr.rb"
26
+ autoload :RtLink, "nl/linux/rt_link.rb"
27
+ autoload :RtNeigh, "nl/linux/rt_neigh.rb"
28
+ autoload :RtRoute, "nl/linux/rt_route.rb"
29
+ autoload :RtRule, "nl/linux/rt_rule.rb"
30
+ autoload :Tc, "nl/linux/tc.rb"
31
+ autoload :TcpMetrics, "nl/linux/tcp_metrics.rb"
32
+ autoload :Team, "nl/linux/team.rb"
33
+ autoload :Wireguard, "nl/linux/wireguard.rb"
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  module Nl
2
2
  module Linux
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
data/lib/nl-linux.rb CHANGED
@@ -1 +1 @@
1
- require_relative 'nl/linux'
1
+ require 'nl/linux'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nl-linux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasumi Hanazuki
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.0
18
+ version: 0.2.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.0
25
+ version: 0.2.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: ynl
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.0
32
+ version: 0.2.2
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.2.0
39
+ version: 0.2.2
40
40
  description: Linux Netlink client
41
41
  email:
42
42
  - kasumi@rollingapple.net
@@ -48,8 +48,38 @@ files:
48
48
  - NLSPEC_VERSION
49
49
  - README.md
50
50
  - Rakefile
51
+ - generated/nl/linux.rb
52
+ - generated/nl/linux/binder.rb
53
+ - generated/nl/linux/conntrack.rb
54
+ - generated/nl/linux/dev_energymodel.rb
55
+ - generated/nl/linux/devlink.rb
56
+ - generated/nl/linux/dpll.rb
57
+ - generated/nl/linux/ethtool.rb
58
+ - generated/nl/linux/fou.rb
59
+ - generated/nl/linux/handshake.rb
60
+ - generated/nl/linux/lockd.rb
61
+ - generated/nl/linux/mptcp_pm.rb
62
+ - generated/nl/linux/net_shaper.rb
63
+ - generated/nl/linux/netdev.rb
64
+ - generated/nl/linux/nfsd.rb
65
+ - generated/nl/linux/nftables.rb
66
+ - generated/nl/linux/nl80211.rb
67
+ - generated/nl/linux/nlctrl.rb
68
+ - generated/nl/linux/ovpn.rb
69
+ - generated/nl/linux/ovs_datapath.rb
70
+ - generated/nl/linux/ovs_flow.rb
71
+ - generated/nl/linux/ovs_vport.rb
72
+ - generated/nl/linux/psp.rb
73
+ - generated/nl/linux/rt_addr.rb
74
+ - generated/nl/linux/rt_link.rb
75
+ - generated/nl/linux/rt_neigh.rb
76
+ - generated/nl/linux/rt_route.rb
77
+ - generated/nl/linux/rt_rule.rb
78
+ - generated/nl/linux/tc.rb
79
+ - generated/nl/linux/tcp_metrics.rb
80
+ - generated/nl/linux/team.rb
81
+ - generated/nl/linux/wireguard.rb
51
82
  - lib/nl-linux.rb
52
- - lib/nl/linux.rb
53
83
  - lib/nl/linux/version.rb
54
84
  - linux/BSD-3-Clause
55
85
  - linux/GPL-2.0
@@ -89,7 +119,7 @@ licenses:
89
119
  - "(GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause"
90
120
  metadata:
91
121
  homepage_uri: https://github.com/hanazuki/nl
92
- source_code_uri: https://github.com/hanazuki/nl/tree/v0.2.0
122
+ source_code_uri: https://github.com/hanazuki/nl/tree/v0.2.2
93
123
  changelog_uri: https://github.com/hanazuki/nl/blob/master/CHANGELOG.md
94
124
  rdoc_options: []
95
125
  require_paths:
data/lib/nl/linux.rb DELETED
@@ -1,3 +0,0 @@
1
- Dir['../../generated/nl/linux/*.rb', base: __dir__].each do |file|
2
- require_relative file
3
- end