nl-linux 0.2.0 → 0.2.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.
@@ -0,0 +1,461 @@
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
+ # PSP Security Protocol Generic Netlink family.
8
+ class Nl::Linux::Psp < ::Nl::Family
9
+ NAME = "psp"
10
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("psp"))
11
+ module Structs
12
+ end
13
+ module AttributeSets
14
+ class Dev < ::Nl::Protocols::Genl::AttributeSet
15
+ # Abstract class
16
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
17
+ end
18
+ class Id < Attribute
19
+ TYPE = 1
20
+ NAME = :"id"
21
+ 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 })
22
+ end
23
+ class Ifindex < Attribute
24
+ TYPE = 2
25
+ NAME = :"ifindex"
26
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
27
+ end
28
+ class PspVersionsCap < Attribute
29
+ TYPE = 3
30
+ NAME = :"psp_versions_cap"
31
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
32
+ end
33
+ class PspVersionsEna < Attribute
34
+ TYPE = 4
35
+ NAME = :"psp_versions_ena"
36
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
37
+ end
38
+ # :nodoc:
39
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"ifindex" => Ifindex, :"psp_versions_cap" => PspVersionsCap, :"psp_versions_ena" => PspVersionsEna}) #: Hash[::Symbol, Attribute]
40
+ # :nodoc:
41
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => Ifindex, 3 => PspVersionsCap, 4 => PspVersionsEna}) #: Hash[::Integer, Attribute]
42
+ class << self
43
+ # Looks up Attribute class by name.
44
+ #--
45
+ # @rbs name: Symbol
46
+ # @rbs return: Attribute
47
+ def by_name(name); BY_NAME.fetch(name); end
48
+ # Looks up Attribute class by type value.
49
+ #--
50
+ # @rbs type: Integer
51
+ # @rbs return: Attribute
52
+ def by_type(type); BY_TYPE.fetch(type); end
53
+ end
54
+ end
55
+ class Assoc < ::Nl::Protocols::Genl::AttributeSet
56
+ # Abstract class
57
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
58
+ end
59
+ class DevId < Attribute
60
+ TYPE = 1
61
+ NAME = :"dev_id"
62
+ 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 })
63
+ end
64
+ class Version < Attribute
65
+ TYPE = 2
66
+ NAME = :"version"
67
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
68
+ end
69
+ class RxKey < Attribute
70
+ TYPE = 3
71
+ NAME = :"rx_key"
72
+ end
73
+ class TxKey < Attribute
74
+ TYPE = 4
75
+ NAME = :"tx_key"
76
+ end
77
+ class SockFd < Attribute
78
+ TYPE = 5
79
+ NAME = :"sock_fd"
80
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
81
+ end
82
+ # :nodoc:
83
+ BY_NAME = Ractor.make_shareable({:"dev_id" => DevId, :"version" => Version, :"rx_key" => RxKey, :"tx_key" => TxKey, :"sock_fd" => SockFd}) #: Hash[::Symbol, Attribute]
84
+ # :nodoc:
85
+ BY_TYPE = Ractor.make_shareable({1 => DevId, 2 => Version, 3 => RxKey, 4 => TxKey, 5 => SockFd}) #: Hash[::Integer, Attribute]
86
+ class << self
87
+ # Looks up Attribute class by name.
88
+ #--
89
+ # @rbs name: Symbol
90
+ # @rbs return: Attribute
91
+ def by_name(name); BY_NAME.fetch(name); end
92
+ # Looks up Attribute class by type value.
93
+ #--
94
+ # @rbs type: Integer
95
+ # @rbs return: Attribute
96
+ def by_type(type); BY_TYPE.fetch(type); end
97
+ end
98
+ end
99
+ class Keys < ::Nl::Protocols::Genl::AttributeSet
100
+ # Abstract class
101
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
102
+ end
103
+ class Key < Attribute
104
+ TYPE = 1
105
+ NAME = :"key"
106
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
107
+ end
108
+ class Spi < Attribute
109
+ TYPE = 2
110
+ NAME = :"spi"
111
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
112
+ end
113
+ # :nodoc:
114
+ BY_NAME = Ractor.make_shareable({:"key" => Key, :"spi" => Spi}) #: Hash[::Symbol, Attribute]
115
+ # :nodoc:
116
+ BY_TYPE = Ractor.make_shareable({1 => Key, 2 => Spi}) #: Hash[::Integer, Attribute]
117
+ class << self
118
+ # Looks up Attribute class by name.
119
+ #--
120
+ # @rbs name: Symbol
121
+ # @rbs return: Attribute
122
+ def by_name(name); BY_NAME.fetch(name); end
123
+ # Looks up Attribute class by type value.
124
+ #--
125
+ # @rbs type: Integer
126
+ # @rbs return: Attribute
127
+ def by_type(type); BY_TYPE.fetch(type); end
128
+ end
129
+ end
130
+ class Stats < ::Nl::Protocols::Genl::AttributeSet
131
+ # Abstract class
132
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
133
+ end
134
+ class DevId < Attribute
135
+ TYPE = 1
136
+ NAME = :"dev_id"
137
+ 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 })
138
+ end
139
+ class KeyRotations < Attribute
140
+ TYPE = 2
141
+ NAME = :"key_rotations"
142
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
143
+ end
144
+ class StaleEvents < Attribute
145
+ TYPE = 3
146
+ NAME = :"stale_events"
147
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
148
+ end
149
+ class RxPackets < Attribute
150
+ TYPE = 4
151
+ NAME = :"rx_packets"
152
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
153
+ end
154
+ class RxBytes < Attribute
155
+ TYPE = 5
156
+ NAME = :"rx_bytes"
157
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
158
+ end
159
+ class RxAuthFail < Attribute
160
+ TYPE = 6
161
+ NAME = :"rx_auth_fail"
162
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
163
+ end
164
+ class RxError < Attribute
165
+ TYPE = 7
166
+ NAME = :"rx_error"
167
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
168
+ end
169
+ class RxBad < Attribute
170
+ TYPE = 8
171
+ NAME = :"rx_bad"
172
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
173
+ end
174
+ class TxPackets < Attribute
175
+ TYPE = 9
176
+ NAME = :"tx_packets"
177
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
178
+ end
179
+ class TxBytes < Attribute
180
+ TYPE = 10
181
+ NAME = :"tx_bytes"
182
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
183
+ end
184
+ class TxError < Attribute
185
+ TYPE = 11
186
+ NAME = :"tx_error"
187
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
188
+ end
189
+ # :nodoc:
190
+ 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]
191
+ # :nodoc:
192
+ 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]
193
+ class << self
194
+ # Looks up Attribute class by name.
195
+ #--
196
+ # @rbs name: Symbol
197
+ # @rbs return: Attribute
198
+ def by_name(name); BY_NAME.fetch(name); end
199
+ # Looks up Attribute class by type value.
200
+ #--
201
+ # @rbs type: Integer
202
+ # @rbs return: Attribute
203
+ def by_type(type); BY_TYPE.fetch(type); end
204
+ end
205
+ end
206
+ Assoc::RxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
207
+ Assoc::TxKey::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(Keys)
208
+ end
209
+ module Messages
210
+ # Get / dump information about PSP capable devices on the system.
211
+ class DoDevGetRequest < ::Nl::Protocols::Genl::Message
212
+ TYPE = 1
213
+ FIXED_HEADER = nil
214
+ ATTRIBUTE_SET = AttributeSets::Dev
215
+ ATTRIBUTES = Ractor.make_shareable(%i[id])
216
+ # Gets the value of `id` attribute in the message.
217
+ #--
218
+ # @rbs return: ::Integer
219
+ def id; attributes[:"id"]&.value; end
220
+ end
221
+ # Get / dump information about PSP capable devices on the system.
222
+ class DoDevGetReply < ::Nl::Protocols::Genl::Message
223
+ TYPE = 1
224
+ FIXED_HEADER = nil
225
+ ATTRIBUTE_SET = AttributeSets::Dev
226
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena])
227
+ # Gets the value of `id` attribute in the message.
228
+ #--
229
+ # @rbs return: ::Integer
230
+ def id; attributes[:"id"]&.value; end
231
+ # Gets the value of `ifindex` attribute in the message.
232
+ #--
233
+ # @rbs return: ::Integer
234
+ def ifindex; attributes[:"ifindex"]&.value; end
235
+ # Gets the value of `psp-versions-cap` attribute in the message.
236
+ #--
237
+ # @rbs return: ::Integer
238
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
239
+ # Gets the value of `psp-versions-ena` attribute in the message.
240
+ #--
241
+ # @rbs return: ::Integer
242
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
243
+ end
244
+ # Get / dump information about PSP capable devices on the system.
245
+ class DumpDevGetReply < ::Nl::Protocols::Genl::Message
246
+ TYPE = 1
247
+ FIXED_HEADER = nil
248
+ ATTRIBUTE_SET = AttributeSets::Dev
249
+ ATTRIBUTES = Ractor.make_shareable(%i[id ifindex psp_versions_cap psp_versions_ena])
250
+ # Gets the value of `id` attribute in the message.
251
+ #--
252
+ # @rbs return: ::Integer
253
+ def id; attributes[:"id"]&.value; end
254
+ # Gets the value of `ifindex` attribute in the message.
255
+ #--
256
+ # @rbs return: ::Integer
257
+ def ifindex; attributes[:"ifindex"]&.value; end
258
+ # Gets the value of `psp-versions-cap` attribute in the message.
259
+ #--
260
+ # @rbs return: ::Integer
261
+ def psp_versions_cap; attributes[:"psp_versions_cap"]&.value; end
262
+ # Gets the value of `psp-versions-ena` attribute in the message.
263
+ #--
264
+ # @rbs return: ::Integer
265
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
266
+ end
267
+ # Set the configuration of a PSP device.
268
+ class DoDevSetRequest < ::Nl::Protocols::Genl::Message
269
+ TYPE = 4
270
+ FIXED_HEADER = nil
271
+ ATTRIBUTE_SET = AttributeSets::Dev
272
+ ATTRIBUTES = Ractor.make_shareable(%i[id psp_versions_ena])
273
+ # Gets the value of `id` attribute in the message.
274
+ #--
275
+ # @rbs return: ::Integer
276
+ def id; attributes[:"id"]&.value; end
277
+ # Gets the value of `psp-versions-ena` attribute in the message.
278
+ #--
279
+ # @rbs return: ::Integer
280
+ def psp_versions_ena; attributes[:"psp_versions_ena"]&.value; end
281
+ end
282
+ # Set the configuration of a PSP device.
283
+ class DoDevSetReply < ::Nl::Protocols::Genl::Message
284
+ TYPE = 4
285
+ FIXED_HEADER = nil
286
+ ATTRIBUTE_SET = AttributeSets::Dev
287
+ ATTRIBUTES = Ractor.make_shareable(%i[])
288
+ end
289
+ # Rotate the device key.
290
+ class DoKeyRotateRequest < ::Nl::Protocols::Genl::Message
291
+ TYPE = 6
292
+ FIXED_HEADER = nil
293
+ ATTRIBUTE_SET = AttributeSets::Dev
294
+ ATTRIBUTES = Ractor.make_shareable(%i[id])
295
+ # Gets the value of `id` attribute in the message.
296
+ #--
297
+ # @rbs return: ::Integer
298
+ def id; attributes[:"id"]&.value; end
299
+ end
300
+ # Rotate the device key.
301
+ class DoKeyRotateReply < ::Nl::Protocols::Genl::Message
302
+ TYPE = 6
303
+ FIXED_HEADER = nil
304
+ ATTRIBUTE_SET = AttributeSets::Dev
305
+ ATTRIBUTES = Ractor.make_shareable(%i[id])
306
+ # Gets the value of `id` attribute in the message.
307
+ #--
308
+ # @rbs return: ::Integer
309
+ def id; attributes[:"id"]&.value; end
310
+ end
311
+ # Allocate a new Rx key + SPI pair, associate it with a socket.
312
+ class DoRxAssocRequest < ::Nl::Protocols::Genl::Message
313
+ TYPE = 8
314
+ FIXED_HEADER = nil
315
+ ATTRIBUTE_SET = AttributeSets::Assoc
316
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id version sock_fd])
317
+ # Gets the value of `dev-id` attribute in the message.
318
+ #--
319
+ # @rbs return: ::Integer
320
+ def dev_id; attributes[:"dev_id"]&.value; end
321
+ # Gets the value of `version` attribute in the message.
322
+ #--
323
+ # @rbs return: ::Integer
324
+ def version; attributes[:"version"]&.value; end
325
+ # Gets the value of `sock-fd` attribute in the message.
326
+ #--
327
+ # @rbs return: ::Integer
328
+ def sock_fd; attributes[:"sock_fd"]&.value; end
329
+ end
330
+ # Allocate a new Rx key + SPI pair, associate it with a socket.
331
+ class DoRxAssocReply < ::Nl::Protocols::Genl::Message
332
+ TYPE = 8
333
+ FIXED_HEADER = nil
334
+ ATTRIBUTE_SET = AttributeSets::Assoc
335
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id rx_key])
336
+ # Gets the value of `dev-id` attribute in the message.
337
+ #--
338
+ # @rbs return: ::Integer
339
+ def dev_id; attributes[:"dev_id"]&.value; end
340
+ # Gets the value of `rx-key` attribute in the message.
341
+ #--
342
+ # @rbs return: AttributeSets::Keys
343
+ def rx_key; attributes[:"rx_key"]&.value; end
344
+ end
345
+ # Add a PSP Tx association.
346
+ class DoTxAssocRequest < ::Nl::Protocols::Genl::Message
347
+ TYPE = 9
348
+ FIXED_HEADER = nil
349
+ ATTRIBUTE_SET = AttributeSets::Assoc
350
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id version tx_key sock_fd])
351
+ # Gets the value of `dev-id` attribute in the message.
352
+ #--
353
+ # @rbs return: ::Integer
354
+ def dev_id; attributes[:"dev_id"]&.value; end
355
+ # Gets the value of `version` attribute in the message.
356
+ #--
357
+ # @rbs return: ::Integer
358
+ def version; attributes[:"version"]&.value; end
359
+ # Gets the value of `tx-key` attribute in the message.
360
+ #--
361
+ # @rbs return: AttributeSets::Keys
362
+ def tx_key; attributes[:"tx_key"]&.value; end
363
+ # Gets the value of `sock-fd` attribute in the message.
364
+ #--
365
+ # @rbs return: ::Integer
366
+ def sock_fd; attributes[:"sock_fd"]&.value; end
367
+ end
368
+ # Add a PSP Tx association.
369
+ class DoTxAssocReply < ::Nl::Protocols::Genl::Message
370
+ TYPE = 9
371
+ FIXED_HEADER = nil
372
+ ATTRIBUTE_SET = AttributeSets::Assoc
373
+ ATTRIBUTES = Ractor.make_shareable(%i[])
374
+ end
375
+ # Get device statistics.
376
+ class DoGetStatsRequest < ::Nl::Protocols::Genl::Message
377
+ TYPE = 10
378
+ FIXED_HEADER = nil
379
+ ATTRIBUTE_SET = AttributeSets::Stats
380
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id])
381
+ # Gets the value of `dev-id` attribute in the message.
382
+ #--
383
+ # @rbs return: ::Integer
384
+ def dev_id; attributes[:"dev_id"]&.value; end
385
+ end
386
+ # Get device statistics.
387
+ class DoGetStatsReply < ::Nl::Protocols::Genl::Message
388
+ TYPE = 10
389
+ FIXED_HEADER = nil
390
+ ATTRIBUTE_SET = AttributeSets::Stats
391
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events])
392
+ # Gets the value of `dev-id` attribute in the message.
393
+ #--
394
+ # @rbs return: ::Integer
395
+ def dev_id; attributes[:"dev_id"]&.value; end
396
+ # Gets the value of `key-rotations` attribute in the message.
397
+ #--
398
+ # @rbs return: ::Integer
399
+ def key_rotations; attributes[:"key_rotations"]&.value; end
400
+ # Gets the value of `stale-events` attribute in the message.
401
+ #--
402
+ # @rbs return: ::Integer
403
+ def stale_events; attributes[:"stale_events"]&.value; end
404
+ end
405
+ # Get device statistics.
406
+ class DumpGetStatsReply < ::Nl::Protocols::Genl::Message
407
+ TYPE = 10
408
+ FIXED_HEADER = nil
409
+ ATTRIBUTE_SET = AttributeSets::Stats
410
+ ATTRIBUTES = Ractor.make_shareable(%i[dev_id key_rotations stale_events])
411
+ # Gets the value of `dev-id` attribute in the message.
412
+ #--
413
+ # @rbs return: ::Integer
414
+ def dev_id; attributes[:"dev_id"]&.value; end
415
+ # Gets the value of `key-rotations` attribute in the message.
416
+ #--
417
+ # @rbs return: ::Integer
418
+ def key_rotations; attributes[:"key_rotations"]&.value; end
419
+ # Gets the value of `stale-events` attribute in the message.
420
+ #--
421
+ # @rbs return: ::Integer
422
+ def stale_events; attributes[:"stale_events"]&.value; end
423
+ end
424
+ end
425
+ # Get / dump information about PSP capable devices on the system.
426
+ #--
427
+ # @rbs (?id: ::Integer) -> Messages::DoDevGetReply
428
+ def do_dev_get(**args)
429
+ exchange_message(:"do", Messages::DoDevGetRequest, Messages::DoDevGetReply, args)
430
+ end
431
+ # Set the configuration of a PSP device.
432
+ #--
433
+ # @rbs (?id: ::Integer, ?psp_versions_ena: ::Integer) -> Messages::DoDevSetReply
434
+ def do_dev_set(**args)
435
+ exchange_message(:"do", Messages::DoDevSetRequest, Messages::DoDevSetReply, args)
436
+ end
437
+ # Rotate the device key.
438
+ #--
439
+ # @rbs (?id: ::Integer) -> Messages::DoKeyRotateReply
440
+ def do_key_rotate(**args)
441
+ exchange_message(:"do", Messages::DoKeyRotateRequest, Messages::DoKeyRotateReply, args)
442
+ end
443
+ # Allocate a new Rx key + SPI pair, associate it with a socket.
444
+ #--
445
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?sock_fd: ::Integer) -> Messages::DoRxAssocReply
446
+ def do_rx_assoc(**args)
447
+ exchange_message(:"do", Messages::DoRxAssocRequest, Messages::DoRxAssocReply, args)
448
+ end
449
+ # Add a PSP Tx association.
450
+ #--
451
+ # @rbs (?dev_id: ::Integer, ?version: ::Integer, ?tx_key: AttributeSets::Keys, ?sock_fd: ::Integer) -> Messages::DoTxAssocReply
452
+ def do_tx_assoc(**args)
453
+ exchange_message(:"do", Messages::DoTxAssocRequest, Messages::DoTxAssocReply, args)
454
+ end
455
+ # Get device statistics.
456
+ #--
457
+ # @rbs (?dev_id: ::Integer) -> Messages::DoGetStatsReply
458
+ def do_get_stats(**args)
459
+ exchange_message(:"do", Messages::DoGetStatsRequest, Messages::DoGetStatsReply, args)
460
+ end
461
+ end