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,395 @@
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
+ # genetlink meta-family that exposes information about all genetlink
8
+ # families registered in the kernel (including itself).
9
+ class Nl::Linux::Nlctrl < ::Nl::Family
10
+ NAME = "nlctrl"
11
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("nlctrl"))
12
+ module Structs
13
+ end
14
+ module AttributeSets
15
+ class CtrlAttrs < ::Nl::Protocols::Genl::AttributeSet
16
+ # Abstract class
17
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
18
+ end
19
+ class FamilyId < Attribute
20
+ TYPE = 1
21
+ NAME = :"family_id"
22
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
23
+ end
24
+ class FamilyName < Attribute
25
+ TYPE = 2
26
+ NAME = :"family_name"
27
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::String.new(check: nil)
28
+ end
29
+ class Version < Attribute
30
+ TYPE = 3
31
+ NAME = :"version"
32
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
33
+ end
34
+ class Hdrsize < Attribute
35
+ TYPE = 4
36
+ NAME = :"hdrsize"
37
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
38
+ end
39
+ class Maxattr < Attribute
40
+ TYPE = 5
41
+ NAME = :"maxattr"
42
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
43
+ end
44
+ class Ops < Attribute
45
+ TYPE = 6
46
+ NAME = :"ops"
47
+ end
48
+ class McastGroups < Attribute
49
+ TYPE = 7
50
+ NAME = :"mcast_groups"
51
+ end
52
+ class Policy < Attribute
53
+ TYPE = 8
54
+ NAME = :"policy"
55
+ end
56
+ class OpPolicy < Attribute
57
+ TYPE = 9
58
+ NAME = :"op_policy"
59
+ end
60
+ class Op < Attribute
61
+ TYPE = 10
62
+ NAME = :"op"
63
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
64
+ end
65
+ # :nodoc:
66
+ BY_NAME = Ractor.make_shareable({:"family_id" => FamilyId, :"family_name" => FamilyName, :"version" => Version, :"hdrsize" => Hdrsize, :"maxattr" => Maxattr, :"ops" => Ops, :"mcast_groups" => McastGroups, :"policy" => Policy, :"op_policy" => OpPolicy, :"op" => Op}) #: Hash[::Symbol, Attribute]
67
+ # :nodoc:
68
+ BY_TYPE = Ractor.make_shareable({1 => FamilyId, 2 => FamilyName, 3 => Version, 4 => Hdrsize, 5 => Maxattr, 6 => Ops, 7 => McastGroups, 8 => Policy, 9 => OpPolicy, 10 => Op}) #: Hash[::Integer, Attribute]
69
+ class << self
70
+ # Looks up Attribute class by name.
71
+ #--
72
+ # @rbs name: Symbol
73
+ # @rbs return: Attribute
74
+ def by_name(name); BY_NAME.fetch(name); end
75
+ # Looks up Attribute class by type value.
76
+ #--
77
+ # @rbs type: Integer
78
+ # @rbs return: Attribute
79
+ def by_type(type); BY_TYPE.fetch(type); end
80
+ end
81
+ end
82
+ class McastGroupAttrs < ::Nl::Protocols::Genl::AttributeSet
83
+ # Abstract class
84
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
85
+ end
86
+ class Name < Attribute
87
+ TYPE = 1
88
+ NAME = :"name"
89
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::String.new(check: nil)
90
+ end
91
+ class Id < Attribute
92
+ TYPE = 2
93
+ NAME = :"id"
94
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
95
+ end
96
+ # :nodoc:
97
+ BY_NAME = Ractor.make_shareable({:"name" => Name, :"id" => Id}) #: Hash[::Symbol, Attribute]
98
+ # :nodoc:
99
+ BY_TYPE = Ractor.make_shareable({1 => Name, 2 => Id}) #: Hash[::Integer, Attribute]
100
+ class << self
101
+ # Looks up Attribute class by name.
102
+ #--
103
+ # @rbs name: Symbol
104
+ # @rbs return: Attribute
105
+ def by_name(name); BY_NAME.fetch(name); end
106
+ # Looks up Attribute class by type value.
107
+ #--
108
+ # @rbs type: Integer
109
+ # @rbs return: Attribute
110
+ def by_type(type); BY_TYPE.fetch(type); end
111
+ end
112
+ end
113
+ class OpAttrs < ::Nl::Protocols::Genl::AttributeSet
114
+ # Abstract class
115
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
116
+ end
117
+ class Id < Attribute
118
+ TYPE = 1
119
+ NAME = :"id"
120
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
121
+ end
122
+ class Flags < Attribute
123
+ TYPE = 2
124
+ NAME = :"flags"
125
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
126
+ end
127
+ # :nodoc:
128
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"flags" => Flags}) #: Hash[::Symbol, Attribute]
129
+ # :nodoc:
130
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => Flags}) #: Hash[::Integer, Attribute]
131
+ class << self
132
+ # Looks up Attribute class by name.
133
+ #--
134
+ # @rbs name: Symbol
135
+ # @rbs return: Attribute
136
+ def by_name(name); BY_NAME.fetch(name); end
137
+ # Looks up Attribute class by type value.
138
+ #--
139
+ # @rbs type: Integer
140
+ # @rbs return: Attribute
141
+ def by_type(type); BY_TYPE.fetch(type); end
142
+ end
143
+ end
144
+ class PolicyAttrs < ::Nl::Protocols::Genl::AttributeSet
145
+ # Abstract class
146
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
147
+ end
148
+ class Type < Attribute
149
+ TYPE = 1
150
+ NAME = :"type"
151
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
152
+ end
153
+ class MinValueS < Attribute
154
+ TYPE = 2
155
+ NAME = :"min_value_s"
156
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S64, check: nil)
157
+ end
158
+ class MaxValueS < Attribute
159
+ TYPE = 3
160
+ NAME = :"max_value_s"
161
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S64, check: nil)
162
+ end
163
+ class MinValueU < Attribute
164
+ TYPE = 4
165
+ NAME = :"min_value_u"
166
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
167
+ end
168
+ class MaxValueU < Attribute
169
+ TYPE = 5
170
+ NAME = :"max_value_u"
171
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
172
+ end
173
+ class MinLength < Attribute
174
+ TYPE = 6
175
+ NAME = :"min_length"
176
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
177
+ end
178
+ class MaxLength < Attribute
179
+ TYPE = 7
180
+ NAME = :"max_length"
181
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
182
+ end
183
+ class PolicyIdx < Attribute
184
+ TYPE = 8
185
+ NAME = :"policy_idx"
186
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
187
+ end
188
+ class PolicyMaxtype < Attribute
189
+ TYPE = 9
190
+ NAME = :"policy_maxtype"
191
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
192
+ end
193
+ class Bitfield32Mask < Attribute
194
+ TYPE = 10
195
+ NAME = :"bitfield32_mask"
196
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
197
+ end
198
+ class Mask < Attribute
199
+ TYPE = 11
200
+ NAME = :"mask"
201
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
202
+ end
203
+ class Pad < Attribute
204
+ TYPE = 12
205
+ NAME = :"pad"
206
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Pad.new()
207
+ end
208
+ # :nodoc:
209
+ BY_NAME = Ractor.make_shareable({:"type" => Type, :"min_value_s" => MinValueS, :"max_value_s" => MaxValueS, :"min_value_u" => MinValueU, :"max_value_u" => MaxValueU, :"min_length" => MinLength, :"max_length" => MaxLength, :"policy_idx" => PolicyIdx, :"policy_maxtype" => PolicyMaxtype, :"bitfield32_mask" => Bitfield32Mask, :"mask" => Mask, :"pad" => Pad}) #: Hash[::Symbol, Attribute]
210
+ # :nodoc:
211
+ BY_TYPE = Ractor.make_shareable({1 => Type, 2 => MinValueS, 3 => MaxValueS, 4 => MinValueU, 5 => MaxValueU, 6 => MinLength, 7 => MaxLength, 8 => PolicyIdx, 9 => PolicyMaxtype, 10 => Bitfield32Mask, 11 => Mask, 12 => Pad}) #: Hash[::Integer, Attribute]
212
+ class << self
213
+ # Looks up Attribute class by name.
214
+ #--
215
+ # @rbs name: Symbol
216
+ # @rbs return: Attribute
217
+ def by_name(name); BY_NAME.fetch(name); end
218
+ # Looks up Attribute class by type value.
219
+ #--
220
+ # @rbs type: Integer
221
+ # @rbs return: Attribute
222
+ def by_type(type); BY_TYPE.fetch(type); end
223
+ end
224
+ end
225
+ class OpPolicyAttrs < ::Nl::Protocols::Genl::AttributeSet
226
+ # Abstract class
227
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
228
+ end
229
+ class Do < Attribute
230
+ TYPE = 1
231
+ NAME = :"do"
232
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
233
+ end
234
+ class Dump < Attribute
235
+ TYPE = 2
236
+ NAME = :"dump"
237
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
238
+ end
239
+ # :nodoc:
240
+ BY_NAME = Ractor.make_shareable({:"do" => Do, :"dump" => Dump}) #: Hash[::Symbol, Attribute]
241
+ # :nodoc:
242
+ BY_TYPE = Ractor.make_shareable({1 => Do, 2 => Dump}) #: Hash[::Integer, Attribute]
243
+ class << self
244
+ # Looks up Attribute class by name.
245
+ #--
246
+ # @rbs name: Symbol
247
+ # @rbs return: Attribute
248
+ def by_name(name); BY_NAME.fetch(name); end
249
+ # Looks up Attribute class by type value.
250
+ #--
251
+ # @rbs type: Integer
252
+ # @rbs return: Attribute
253
+ def by_type(type); BY_TYPE.fetch(type); end
254
+ end
255
+ end
256
+ CtrlAttrs::Ops::DATATYPE = ::Nl::Protocols::Genl::DataTypes::IndexedArray.new(::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(OpAttrs))
257
+ CtrlAttrs::McastGroups::DATATYPE = ::Nl::Protocols::Genl::DataTypes::IndexedArray.new(::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(McastGroupAttrs))
258
+ CtrlAttrs::Policy::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(PolicyAttrs)
259
+ CtrlAttrs::OpPolicy::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(OpPolicyAttrs)
260
+ end
261
+ module Messages
262
+ # Get / dump genetlink families
263
+ class DoGetfamilyRequest < ::Nl::Protocols::Genl::Message
264
+ TYPE = 3
265
+ FIXED_HEADER = nil
266
+ ATTRIBUTE_SET = AttributeSets::CtrlAttrs
267
+ ATTRIBUTES = Ractor.make_shareable(%i[family_name])
268
+ # Gets the value of `family-name` attribute in the message.
269
+ #--
270
+ # @rbs return: ::String
271
+ def family_name; attributes[:"family_name"]&.value; end
272
+ end
273
+ # Get / dump genetlink families
274
+ class DoGetfamilyReply < ::Nl::Protocols::Genl::Message
275
+ TYPE = 1
276
+ FIXED_HEADER = nil
277
+ ATTRIBUTE_SET = AttributeSets::CtrlAttrs
278
+ ATTRIBUTES = Ractor.make_shareable(%i[family_id family_name version hdrsize maxattr ops mcast_groups])
279
+ # Gets the value of `family-id` attribute in the message.
280
+ #--
281
+ # @rbs return: ::Integer
282
+ def family_id; attributes[:"family_id"]&.value; end
283
+ # Gets the value of `family-name` attribute in the message.
284
+ #--
285
+ # @rbs return: ::String
286
+ def family_name; attributes[:"family_name"]&.value; end
287
+ # Gets the value of `version` attribute in the message.
288
+ #--
289
+ # @rbs return: ::Integer
290
+ def version; attributes[:"version"]&.value; end
291
+ # Gets the value of `hdrsize` attribute in the message.
292
+ #--
293
+ # @rbs return: ::Integer
294
+ def hdrsize; attributes[:"hdrsize"]&.value; end
295
+ # Gets the value of `maxattr` attribute in the message.
296
+ #--
297
+ # @rbs return: ::Integer
298
+ def maxattr; attributes[:"maxattr"]&.value; end
299
+ # Gets the value of `ops` attribute in the message.
300
+ #--
301
+ # @rbs return: untyped
302
+ def ops; attributes[:"ops"]&.value; end
303
+ # Gets the value of `mcast-groups` attribute in the message.
304
+ #--
305
+ # @rbs return: untyped
306
+ def mcast_groups; attributes[:"mcast_groups"]&.value; end
307
+ end
308
+ # Get / dump genetlink families
309
+ class DumpGetfamilyReply < ::Nl::Protocols::Genl::Message
310
+ TYPE = 1
311
+ FIXED_HEADER = nil
312
+ ATTRIBUTE_SET = AttributeSets::CtrlAttrs
313
+ ATTRIBUTES = Ractor.make_shareable(%i[family_id family_name version hdrsize maxattr ops mcast_groups])
314
+ # Gets the value of `family-id` attribute in the message.
315
+ #--
316
+ # @rbs return: ::Integer
317
+ def family_id; attributes[:"family_id"]&.value; end
318
+ # Gets the value of `family-name` attribute in the message.
319
+ #--
320
+ # @rbs return: ::String
321
+ def family_name; attributes[:"family_name"]&.value; end
322
+ # Gets the value of `version` attribute in the message.
323
+ #--
324
+ # @rbs return: ::Integer
325
+ def version; attributes[:"version"]&.value; end
326
+ # Gets the value of `hdrsize` attribute in the message.
327
+ #--
328
+ # @rbs return: ::Integer
329
+ def hdrsize; attributes[:"hdrsize"]&.value; end
330
+ # Gets the value of `maxattr` attribute in the message.
331
+ #--
332
+ # @rbs return: ::Integer
333
+ def maxattr; attributes[:"maxattr"]&.value; end
334
+ # Gets the value of `ops` attribute in the message.
335
+ #--
336
+ # @rbs return: untyped
337
+ def ops; attributes[:"ops"]&.value; end
338
+ # Gets the value of `mcast-groups` attribute in the message.
339
+ #--
340
+ # @rbs return: untyped
341
+ def mcast_groups; attributes[:"mcast_groups"]&.value; end
342
+ end
343
+ # Get / dump genetlink policies
344
+ class DumpGetpolicyRequest < ::Nl::Protocols::Genl::Message
345
+ TYPE = 10
346
+ FIXED_HEADER = nil
347
+ ATTRIBUTE_SET = AttributeSets::CtrlAttrs
348
+ ATTRIBUTES = Ractor.make_shareable(%i[family_id family_name op])
349
+ # Gets the value of `family-id` attribute in the message.
350
+ #--
351
+ # @rbs return: ::Integer
352
+ def family_id; attributes[:"family_id"]&.value; end
353
+ # Gets the value of `family-name` attribute in the message.
354
+ #--
355
+ # @rbs return: ::String
356
+ def family_name; attributes[:"family_name"]&.value; end
357
+ # Gets the value of `op` attribute in the message.
358
+ #--
359
+ # @rbs return: ::Integer
360
+ def op; attributes[:"op"]&.value; end
361
+ end
362
+ # Get / dump genetlink policies
363
+ class DumpGetpolicyReply < ::Nl::Protocols::Genl::Message
364
+ TYPE = 10
365
+ FIXED_HEADER = nil
366
+ ATTRIBUTE_SET = AttributeSets::CtrlAttrs
367
+ ATTRIBUTES = Ractor.make_shareable(%i[family_id policy op_policy])
368
+ # Gets the value of `family-id` attribute in the message.
369
+ #--
370
+ # @rbs return: ::Integer
371
+ def family_id; attributes[:"family_id"]&.value; end
372
+ # Gets the value of `policy` attribute in the message.
373
+ #--
374
+ # @rbs return: AttributeSets::PolicyAttrs
375
+ def policy; attributes[:"policy"]&.value; end
376
+ # Gets the value of `op-policy` attribute in the message.
377
+ #--
378
+ # @rbs return: AttributeSets::OpPolicyAttrs
379
+ def op_policy; attributes[:"op_policy"]&.value; end
380
+ end
381
+ end
382
+ # Get / dump genetlink families
383
+ #--
384
+ # @rbs (?family_name: ::String) -> Messages::DoGetfamilyReply
385
+ def do_getfamily(**args)
386
+ exchange_message(:"do", Messages::DoGetfamilyRequest, Messages::DoGetfamilyReply, args)
387
+ end
388
+ # Get / dump genetlink policies
389
+ #--
390
+ # @rbs (?family_id: ::Integer, ?family_name: ::String, ?op: ::Integer) -> Enumerable[Messages::DumpGetpolicyReply]
391
+ # | (?family_id: ::Integer, ?family_name: ::String, ?op: ::Integer) { (Messages::DumpGetpolicyReply) -> void } -> void
392
+ def dump_getpolicy(**args, &block)
393
+ exchange_message(:"dump", Messages::DumpGetpolicyRequest, Messages::DumpGetpolicyReply, args, &block)
394
+ end
395
+ end