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,330 @@
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
+ # Foo-over-UDP.
8
+ class Nl::Linux::Fou < ::Nl::Family
9
+ NAME = "fou"
10
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("fou"))
11
+ module Structs
12
+ end
13
+ module AttributeSets
14
+ class Fou < ::Nl::Protocols::Genl::AttributeSet
15
+ # Abstract class
16
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
17
+ end
18
+ class Port < Attribute
19
+ TYPE = 1
20
+ NAME = :"port"
21
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Big::U16, check: nil)
22
+ end
23
+ class Af < Attribute
24
+ TYPE = 2
25
+ NAME = :"af"
26
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
27
+ end
28
+ class Ipproto < Attribute
29
+ TYPE = 3
30
+ NAME = :"ipproto"
31
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: -> { raise ArgumentError, "Value #{it.inspect} is less than minimum 1" unless it >= 1 })
32
+ end
33
+ class Type < Attribute
34
+ TYPE = 4
35
+ NAME = :"type"
36
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
37
+ end
38
+ class RemcsumNopartial < Attribute
39
+ TYPE = 5
40
+ NAME = :"remcsum_nopartial"
41
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Flag.new
42
+ end
43
+ class LocalV4 < Attribute
44
+ TYPE = 6
45
+ NAME = :"local_v4"
46
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
47
+ end
48
+ class LocalV6 < Attribute
49
+ TYPE = 7
50
+ NAME = :"local_v6"
51
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 16" unless it.bytesize == 16 })
52
+ end
53
+ class PeerV4 < Attribute
54
+ TYPE = 8
55
+ NAME = :"peer_v4"
56
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
57
+ end
58
+ class PeerV6 < Attribute
59
+ TYPE = 9
60
+ NAME = :"peer_v6"
61
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 16" unless it.bytesize == 16 })
62
+ end
63
+ class PeerPort < Attribute
64
+ TYPE = 10
65
+ NAME = :"peer_port"
66
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Big::U16, check: nil)
67
+ end
68
+ class Ifindex < Attribute
69
+ TYPE = 11
70
+ NAME = :"ifindex"
71
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
72
+ end
73
+ # :nodoc:
74
+ BY_NAME = Ractor.make_shareable({:"port" => Port, :"af" => Af, :"ipproto" => Ipproto, :"type" => Type, :"remcsum_nopartial" => RemcsumNopartial, :"local_v4" => LocalV4, :"local_v6" => LocalV6, :"peer_v4" => PeerV4, :"peer_v6" => PeerV6, :"peer_port" => PeerPort, :"ifindex" => Ifindex}) #: Hash[::Symbol, Attribute]
75
+ # :nodoc:
76
+ BY_TYPE = Ractor.make_shareable({1 => Port, 2 => Af, 3 => Ipproto, 4 => Type, 5 => RemcsumNopartial, 6 => LocalV4, 7 => LocalV6, 8 => PeerV4, 9 => PeerV6, 10 => PeerPort, 11 => Ifindex}) #: Hash[::Integer, Attribute]
77
+ class << self
78
+ # Looks up Attribute class by name.
79
+ #--
80
+ # @rbs name: Symbol
81
+ # @rbs return: Attribute
82
+ def by_name(name); BY_NAME.fetch(name); end
83
+ # Looks up Attribute class by type value.
84
+ #--
85
+ # @rbs type: Integer
86
+ # @rbs return: Attribute
87
+ def by_type(type); BY_TYPE.fetch(type); end
88
+ end
89
+ end
90
+ end
91
+ module Messages
92
+ # Add port.
93
+ class DoAddRequest < ::Nl::Protocols::Genl::Message
94
+ TYPE = 1
95
+ FIXED_HEADER = nil
96
+ ATTRIBUTE_SET = AttributeSets::Fou
97
+ ATTRIBUTES = Ractor.make_shareable(%i[port ipproto type remcsum_nopartial local_v4 local_v6 peer_v4 peer_v6 peer_port ifindex])
98
+ # Gets the value of `port` attribute in the message.
99
+ #--
100
+ # @rbs return: ::Integer
101
+ def port; attributes[:"port"]&.value; end
102
+ # Gets the value of `ipproto` attribute in the message.
103
+ #--
104
+ # @rbs return: ::Integer
105
+ def ipproto; attributes[:"ipproto"]&.value; end
106
+ # Gets the value of `type` attribute in the message.
107
+ #--
108
+ # @rbs return: ::Integer
109
+ def type; attributes[:"type"]&.value; end
110
+ # Gets the value of `remcsum-nopartial` attribute in the message.
111
+ #--
112
+ # @rbs return: ::Integer
113
+ def remcsum_nopartial; attributes[:"remcsum_nopartial"]&.value; end
114
+ # Gets the value of `local-v4` attribute in the message.
115
+ #--
116
+ # @rbs return: ::Integer
117
+ def local_v4; attributes[:"local_v4"]&.value; end
118
+ # Gets the value of `local-v6` attribute in the message.
119
+ #--
120
+ # @rbs return: untyped
121
+ def local_v6; attributes[:"local_v6"]&.value; end
122
+ # Gets the value of `peer-v4` attribute in the message.
123
+ #--
124
+ # @rbs return: ::Integer
125
+ def peer_v4; attributes[:"peer_v4"]&.value; end
126
+ # Gets the value of `peer-v6` attribute in the message.
127
+ #--
128
+ # @rbs return: untyped
129
+ def peer_v6; attributes[:"peer_v6"]&.value; end
130
+ # Gets the value of `peer-port` attribute in the message.
131
+ #--
132
+ # @rbs return: ::Integer
133
+ def peer_port; attributes[:"peer_port"]&.value; end
134
+ # Gets the value of `ifindex` attribute in the message.
135
+ #--
136
+ # @rbs return: ::Integer
137
+ def ifindex; attributes[:"ifindex"]&.value; end
138
+ end
139
+ # Delete port.
140
+ class DoDelRequest < ::Nl::Protocols::Genl::Message
141
+ TYPE = 2
142
+ FIXED_HEADER = nil
143
+ ATTRIBUTE_SET = AttributeSets::Fou
144
+ ATTRIBUTES = Ractor.make_shareable(%i[port af local_v4 local_v6 peer_v4 peer_v6 peer_port ifindex])
145
+ # Gets the value of `port` attribute in the message.
146
+ #--
147
+ # @rbs return: ::Integer
148
+ def port; attributes[:"port"]&.value; end
149
+ # Gets the value of `af` attribute in the message.
150
+ #--
151
+ # @rbs return: ::Integer
152
+ def af; attributes[:"af"]&.value; end
153
+ # Gets the value of `local-v4` attribute in the message.
154
+ #--
155
+ # @rbs return: ::Integer
156
+ def local_v4; attributes[:"local_v4"]&.value; end
157
+ # Gets the value of `local-v6` attribute in the message.
158
+ #--
159
+ # @rbs return: untyped
160
+ def local_v6; attributes[:"local_v6"]&.value; end
161
+ # Gets the value of `peer-v4` attribute in the message.
162
+ #--
163
+ # @rbs return: ::Integer
164
+ def peer_v4; attributes[:"peer_v4"]&.value; end
165
+ # Gets the value of `peer-v6` attribute in the message.
166
+ #--
167
+ # @rbs return: untyped
168
+ def peer_v6; attributes[:"peer_v6"]&.value; end
169
+ # Gets the value of `peer-port` attribute in the message.
170
+ #--
171
+ # @rbs return: ::Integer
172
+ def peer_port; attributes[:"peer_port"]&.value; end
173
+ # Gets the value of `ifindex` attribute in the message.
174
+ #--
175
+ # @rbs return: ::Integer
176
+ def ifindex; attributes[:"ifindex"]&.value; end
177
+ end
178
+ # Get tunnel info.
179
+ class DoGetRequest < ::Nl::Protocols::Genl::Message
180
+ TYPE = 3
181
+ FIXED_HEADER = nil
182
+ ATTRIBUTE_SET = AttributeSets::Fou
183
+ ATTRIBUTES = Ractor.make_shareable(%i[port af local_v4 local_v6 peer_v4 peer_v6 peer_port ifindex])
184
+ # Gets the value of `port` attribute in the message.
185
+ #--
186
+ # @rbs return: ::Integer
187
+ def port; attributes[:"port"]&.value; end
188
+ # Gets the value of `af` attribute in the message.
189
+ #--
190
+ # @rbs return: ::Integer
191
+ def af; attributes[:"af"]&.value; end
192
+ # Gets the value of `local-v4` attribute in the message.
193
+ #--
194
+ # @rbs return: ::Integer
195
+ def local_v4; attributes[:"local_v4"]&.value; end
196
+ # Gets the value of `local-v6` attribute in the message.
197
+ #--
198
+ # @rbs return: untyped
199
+ def local_v6; attributes[:"local_v6"]&.value; end
200
+ # Gets the value of `peer-v4` attribute in the message.
201
+ #--
202
+ # @rbs return: ::Integer
203
+ def peer_v4; attributes[:"peer_v4"]&.value; end
204
+ # Gets the value of `peer-v6` attribute in the message.
205
+ #--
206
+ # @rbs return: untyped
207
+ def peer_v6; attributes[:"peer_v6"]&.value; end
208
+ # Gets the value of `peer-port` attribute in the message.
209
+ #--
210
+ # @rbs return: ::Integer
211
+ def peer_port; attributes[:"peer_port"]&.value; end
212
+ # Gets the value of `ifindex` attribute in the message.
213
+ #--
214
+ # @rbs return: ::Integer
215
+ def ifindex; attributes[:"ifindex"]&.value; end
216
+ end
217
+ # Get tunnel info.
218
+ class DoGetReply < ::Nl::Protocols::Genl::Message
219
+ TYPE = 3
220
+ FIXED_HEADER = nil
221
+ ATTRIBUTE_SET = AttributeSets::Fou
222
+ ATTRIBUTES = Ractor.make_shareable(%i[port ipproto type remcsum_nopartial local_v4 local_v6 peer_v4 peer_v6 peer_port ifindex])
223
+ # Gets the value of `port` attribute in the message.
224
+ #--
225
+ # @rbs return: ::Integer
226
+ def port; attributes[:"port"]&.value; end
227
+ # Gets the value of `ipproto` attribute in the message.
228
+ #--
229
+ # @rbs return: ::Integer
230
+ def ipproto; attributes[:"ipproto"]&.value; end
231
+ # Gets the value of `type` attribute in the message.
232
+ #--
233
+ # @rbs return: ::Integer
234
+ def type; attributes[:"type"]&.value; end
235
+ # Gets the value of `remcsum-nopartial` attribute in the message.
236
+ #--
237
+ # @rbs return: ::Integer
238
+ def remcsum_nopartial; attributes[:"remcsum_nopartial"]&.value; end
239
+ # Gets the value of `local-v4` attribute in the message.
240
+ #--
241
+ # @rbs return: ::Integer
242
+ def local_v4; attributes[:"local_v4"]&.value; end
243
+ # Gets the value of `local-v6` attribute in the message.
244
+ #--
245
+ # @rbs return: untyped
246
+ def local_v6; attributes[:"local_v6"]&.value; end
247
+ # Gets the value of `peer-v4` attribute in the message.
248
+ #--
249
+ # @rbs return: ::Integer
250
+ def peer_v4; attributes[:"peer_v4"]&.value; end
251
+ # Gets the value of `peer-v6` attribute in the message.
252
+ #--
253
+ # @rbs return: untyped
254
+ def peer_v6; attributes[:"peer_v6"]&.value; end
255
+ # Gets the value of `peer-port` attribute in the message.
256
+ #--
257
+ # @rbs return: ::Integer
258
+ def peer_port; attributes[:"peer_port"]&.value; end
259
+ # Gets the value of `ifindex` attribute in the message.
260
+ #--
261
+ # @rbs return: ::Integer
262
+ def ifindex; attributes[:"ifindex"]&.value; end
263
+ end
264
+ # Get tunnel info.
265
+ class DumpGetReply < ::Nl::Protocols::Genl::Message
266
+ TYPE = 3
267
+ FIXED_HEADER = nil
268
+ ATTRIBUTE_SET = AttributeSets::Fou
269
+ ATTRIBUTES = Ractor.make_shareable(%i[port ipproto type remcsum_nopartial local_v4 local_v6 peer_v4 peer_v6 peer_port ifindex])
270
+ # Gets the value of `port` attribute in the message.
271
+ #--
272
+ # @rbs return: ::Integer
273
+ def port; attributes[:"port"]&.value; end
274
+ # Gets the value of `ipproto` attribute in the message.
275
+ #--
276
+ # @rbs return: ::Integer
277
+ def ipproto; attributes[:"ipproto"]&.value; end
278
+ # Gets the value of `type` attribute in the message.
279
+ #--
280
+ # @rbs return: ::Integer
281
+ def type; attributes[:"type"]&.value; end
282
+ # Gets the value of `remcsum-nopartial` attribute in the message.
283
+ #--
284
+ # @rbs return: ::Integer
285
+ def remcsum_nopartial; attributes[:"remcsum_nopartial"]&.value; end
286
+ # Gets the value of `local-v4` attribute in the message.
287
+ #--
288
+ # @rbs return: ::Integer
289
+ def local_v4; attributes[:"local_v4"]&.value; end
290
+ # Gets the value of `local-v6` attribute in the message.
291
+ #--
292
+ # @rbs return: untyped
293
+ def local_v6; attributes[:"local_v6"]&.value; end
294
+ # Gets the value of `peer-v4` attribute in the message.
295
+ #--
296
+ # @rbs return: ::Integer
297
+ def peer_v4; attributes[:"peer_v4"]&.value; end
298
+ # Gets the value of `peer-v6` attribute in the message.
299
+ #--
300
+ # @rbs return: untyped
301
+ def peer_v6; attributes[:"peer_v6"]&.value; end
302
+ # Gets the value of `peer-port` attribute in the message.
303
+ #--
304
+ # @rbs return: ::Integer
305
+ def peer_port; attributes[:"peer_port"]&.value; end
306
+ # Gets the value of `ifindex` attribute in the message.
307
+ #--
308
+ # @rbs return: ::Integer
309
+ def ifindex; attributes[:"ifindex"]&.value; end
310
+ end
311
+ end
312
+ # Add port.
313
+ #--
314
+ # @rbs (?port: ::Integer, ?ipproto: ::Integer, ?type: ::Integer, ?remcsum_nopartial: ::Integer, ?local_v4: ::Integer, ?local_v6: untyped, ?peer_v4: ::Integer, ?peer_v6: untyped, ?peer_port: ::Integer, ?ifindex: ::Integer) -> void
315
+ def do_add(**args)
316
+ exchange_message(:"do", Messages::DoAddRequest, nil, args)
317
+ end
318
+ # Delete port.
319
+ #--
320
+ # @rbs (?port: ::Integer, ?af: ::Integer, ?local_v4: ::Integer, ?local_v6: untyped, ?peer_v4: ::Integer, ?peer_v6: untyped, ?peer_port: ::Integer, ?ifindex: ::Integer) -> void
321
+ def do_del(**args)
322
+ exchange_message(:"do", Messages::DoDelRequest, nil, args)
323
+ end
324
+ # Get tunnel info.
325
+ #--
326
+ # @rbs (?port: ::Integer, ?af: ::Integer, ?local_v4: ::Integer, ?local_v6: untyped, ?peer_v4: ::Integer, ?peer_v6: untyped, ?peer_port: ::Integer, ?ifindex: ::Integer) -> Messages::DoGetReply
327
+ def do_get(**args)
328
+ exchange_message(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
329
+ end
330
+ end
@@ -0,0 +1,236 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ #
3
+ # Author: Chuck Lever <chuck.lever@oracle.com>
4
+ #
5
+ # Copyright (c) 2023, Oracle and/or its affiliates.
6
+ #
7
+ #--
8
+ # frozen_string_literal: true
9
+ # rbs_inline: enabled
10
+ # This code is generated by Ynl::Generator. DO NOT EDIT.
11
+ require 'nl'
12
+ # Netlink protocol to request a transport layer security handshake.
13
+ class Nl::Linux::Handshake < ::Nl::Family
14
+ NAME = "handshake"
15
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("handshake"))
16
+ module Structs
17
+ end
18
+ module AttributeSets
19
+ class X509 < ::Nl::Protocols::Genl::AttributeSet
20
+ # Abstract class
21
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
22
+ end
23
+ class Cert < Attribute
24
+ TYPE = 1
25
+ NAME = :"cert"
26
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
27
+ end
28
+ class Privkey < Attribute
29
+ TYPE = 2
30
+ NAME = :"privkey"
31
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
32
+ end
33
+ # :nodoc:
34
+ BY_NAME = Ractor.make_shareable({:"cert" => Cert, :"privkey" => Privkey}) #: Hash[::Symbol, Attribute]
35
+ # :nodoc:
36
+ BY_TYPE = Ractor.make_shareable({1 => Cert, 2 => Privkey}) #: Hash[::Integer, Attribute]
37
+ class << self
38
+ # Looks up Attribute class by name.
39
+ #--
40
+ # @rbs name: Symbol
41
+ # @rbs return: Attribute
42
+ def by_name(name); BY_NAME.fetch(name); end
43
+ # Looks up Attribute class by type value.
44
+ #--
45
+ # @rbs type: Integer
46
+ # @rbs return: Attribute
47
+ def by_type(type); BY_TYPE.fetch(type); end
48
+ end
49
+ end
50
+ class Accept < ::Nl::Protocols::Genl::AttributeSet
51
+ # Abstract class
52
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
53
+ end
54
+ class Sockfd < Attribute
55
+ TYPE = 1
56
+ NAME = :"sockfd"
57
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
58
+ end
59
+ class HandlerClass < Attribute
60
+ TYPE = 2
61
+ NAME = :"handler_class"
62
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
63
+ end
64
+ class MessageType < Attribute
65
+ TYPE = 3
66
+ NAME = :"message_type"
67
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
68
+ end
69
+ class Timeout < Attribute
70
+ TYPE = 4
71
+ NAME = :"timeout"
72
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
73
+ end
74
+ class AuthMode < Attribute
75
+ TYPE = 5
76
+ NAME = :"auth_mode"
77
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
78
+ end
79
+ class PeerIdentity < Attribute
80
+ TYPE = 6
81
+ NAME = :"peer_identity"
82
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
83
+ end
84
+ class Certificate < Attribute
85
+ TYPE = 7
86
+ NAME = :"certificate"
87
+ end
88
+ class Peername < Attribute
89
+ TYPE = 8
90
+ NAME = :"peername"
91
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::String.new(check: nil)
92
+ end
93
+ class Keyring < Attribute
94
+ TYPE = 9
95
+ NAME = :"keyring"
96
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
97
+ end
98
+ # :nodoc:
99
+ BY_NAME = Ractor.make_shareable({:"sockfd" => Sockfd, :"handler_class" => HandlerClass, :"message_type" => MessageType, :"timeout" => Timeout, :"auth_mode" => AuthMode, :"peer_identity" => PeerIdentity, :"certificate" => Certificate, :"peername" => Peername, :"keyring" => Keyring}) #: Hash[::Symbol, Attribute]
100
+ # :nodoc:
101
+ BY_TYPE = Ractor.make_shareable({1 => Sockfd, 2 => HandlerClass, 3 => MessageType, 4 => Timeout, 5 => AuthMode, 6 => PeerIdentity, 7 => Certificate, 8 => Peername, 9 => Keyring}) #: Hash[::Integer, Attribute]
102
+ class << self
103
+ # Looks up Attribute class by name.
104
+ #--
105
+ # @rbs name: Symbol
106
+ # @rbs return: Attribute
107
+ def by_name(name); BY_NAME.fetch(name); end
108
+ # Looks up Attribute class by type value.
109
+ #--
110
+ # @rbs type: Integer
111
+ # @rbs return: Attribute
112
+ def by_type(type); BY_TYPE.fetch(type); end
113
+ end
114
+ end
115
+ class Done < ::Nl::Protocols::Genl::AttributeSet
116
+ # Abstract class
117
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
118
+ end
119
+ class Status < Attribute
120
+ TYPE = 1
121
+ NAME = :"status"
122
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
123
+ end
124
+ class Sockfd < Attribute
125
+ TYPE = 2
126
+ NAME = :"sockfd"
127
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::S32, check: nil)
128
+ end
129
+ class RemoteAuth < Attribute
130
+ TYPE = 3
131
+ NAME = :"remote_auth"
132
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
133
+ end
134
+ # :nodoc:
135
+ BY_NAME = Ractor.make_shareable({:"status" => Status, :"sockfd" => Sockfd, :"remote_auth" => RemoteAuth}) #: Hash[::Symbol, Attribute]
136
+ # :nodoc:
137
+ BY_TYPE = Ractor.make_shareable({1 => Status, 2 => Sockfd, 3 => RemoteAuth}) #: Hash[::Integer, Attribute]
138
+ class << self
139
+ # Looks up Attribute class by name.
140
+ #--
141
+ # @rbs name: Symbol
142
+ # @rbs return: Attribute
143
+ def by_name(name); BY_NAME.fetch(name); end
144
+ # Looks up Attribute class by type value.
145
+ #--
146
+ # @rbs type: Integer
147
+ # @rbs return: Attribute
148
+ def by_type(type); BY_TYPE.fetch(type); end
149
+ end
150
+ end
151
+ Accept::Certificate::DATATYPE = ::Nl::Protocols::Genl::DataTypes::NestedAttributes.new(X509)
152
+ end
153
+ module Messages
154
+ # Handler retrieves next queued handshake request
155
+ class DoAcceptRequest < ::Nl::Protocols::Genl::Message
156
+ TYPE = 2
157
+ FIXED_HEADER = nil
158
+ ATTRIBUTE_SET = AttributeSets::Accept
159
+ ATTRIBUTES = Ractor.make_shareable(%i[handler_class])
160
+ # Gets the value of `handler-class` attribute in the message.
161
+ #--
162
+ # @rbs return: ::Integer
163
+ def handler_class; attributes[:"handler_class"]&.value; end
164
+ end
165
+ # Handler retrieves next queued handshake request
166
+ class DoAcceptReply < ::Nl::Protocols::Genl::Message
167
+ TYPE = 2
168
+ FIXED_HEADER = nil
169
+ ATTRIBUTE_SET = AttributeSets::Accept
170
+ ATTRIBUTES = Ractor.make_shareable(%i[sockfd message_type timeout auth_mode peer_identity certificate peername keyring])
171
+ # Gets the value of `sockfd` attribute in the message.
172
+ #--
173
+ # @rbs return: ::Integer
174
+ def sockfd; attributes[:"sockfd"]&.value; end
175
+ # Gets the value of `message-type` attribute in the message.
176
+ #--
177
+ # @rbs return: ::Integer
178
+ def message_type; attributes[:"message_type"]&.value; end
179
+ # Gets the value of `timeout` attribute in the message.
180
+ #--
181
+ # @rbs return: ::Integer
182
+ def timeout; attributes[:"timeout"]&.value; end
183
+ # Gets the value of `auth-mode` attribute in the message.
184
+ #--
185
+ # @rbs return: ::Integer
186
+ def auth_mode; attributes[:"auth_mode"]&.value; end
187
+ # Gets the value of `peer-identity` attribute in the message.
188
+ #--
189
+ # @rbs return: ::Integer
190
+ def peer_identity; attributes[:"peer_identity"]&.value; end
191
+ # Gets the value of `certificate` attribute in the message.
192
+ #--
193
+ # @rbs return: AttributeSets::X509
194
+ def certificate; attributes[:"certificate"]&.value; end
195
+ # Gets the value of `peername` attribute in the message.
196
+ #--
197
+ # @rbs return: ::String
198
+ def peername; attributes[:"peername"]&.value; end
199
+ # Gets the value of `keyring` attribute in the message.
200
+ #--
201
+ # @rbs return: ::Integer
202
+ def keyring; attributes[:"keyring"]&.value; end
203
+ end
204
+ # Handler reports handshake completion
205
+ class DoDoneRequest < ::Nl::Protocols::Genl::Message
206
+ TYPE = 3
207
+ FIXED_HEADER = nil
208
+ ATTRIBUTE_SET = AttributeSets::Done
209
+ ATTRIBUTES = Ractor.make_shareable(%i[status sockfd remote_auth])
210
+ # Gets the value of `status` attribute in the message.
211
+ #--
212
+ # @rbs return: ::Integer
213
+ def status; attributes[:"status"]&.value; end
214
+ # Gets the value of `sockfd` attribute in the message.
215
+ #--
216
+ # @rbs return: ::Integer
217
+ def sockfd; attributes[:"sockfd"]&.value; end
218
+ # Gets the value of `remote-auth` attribute in the message.
219
+ #--
220
+ # @rbs return: ::Integer
221
+ def remote_auth; attributes[:"remote_auth"]&.value; end
222
+ end
223
+ end
224
+ # Handler retrieves next queued handshake request
225
+ #--
226
+ # @rbs (?handler_class: ::Integer) -> Messages::DoAcceptReply
227
+ def do_accept(**args)
228
+ exchange_message(:"do", Messages::DoAcceptRequest, Messages::DoAcceptReply, args)
229
+ end
230
+ # Handler reports handshake completion
231
+ #--
232
+ # @rbs (?status: ::Integer, ?sockfd: ::Integer, ?remote_auth: ::Integer) -> void
233
+ def do_done(**args)
234
+ exchange_message(:"do", Messages::DoDoneRequest, nil, args)
235
+ end
236
+ end
@@ -0,0 +1,97 @@
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
+ # lockd configuration over generic netlink
8
+ class Nl::Linux::Lockd < ::Nl::Family
9
+ NAME = "lockd"
10
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("lockd"))
11
+ module Structs
12
+ end
13
+ module AttributeSets
14
+ class Server < ::Nl::Protocols::Genl::AttributeSet
15
+ # Abstract class
16
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
17
+ end
18
+ class Gracetime < Attribute
19
+ TYPE = 1
20
+ NAME = :"gracetime"
21
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
22
+ end
23
+ class TcpPort < Attribute
24
+ TYPE = 2
25
+ NAME = :"tcp_port"
26
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
27
+ end
28
+ class UdpPort < Attribute
29
+ TYPE = 3
30
+ NAME = :"udp_port"
31
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
32
+ end
33
+ # :nodoc:
34
+ BY_NAME = Ractor.make_shareable({:"gracetime" => Gracetime, :"tcp_port" => TcpPort, :"udp_port" => UdpPort}) #: Hash[::Symbol, Attribute]
35
+ # :nodoc:
36
+ BY_TYPE = Ractor.make_shareable({1 => Gracetime, 2 => TcpPort, 3 => UdpPort}) #: Hash[::Integer, Attribute]
37
+ class << self
38
+ # Looks up Attribute class by name.
39
+ #--
40
+ # @rbs name: Symbol
41
+ # @rbs return: Attribute
42
+ def by_name(name); BY_NAME.fetch(name); end
43
+ # Looks up Attribute class by type value.
44
+ #--
45
+ # @rbs type: Integer
46
+ # @rbs return: Attribute
47
+ def by_type(type); BY_TYPE.fetch(type); end
48
+ end
49
+ end
50
+ end
51
+ module Messages
52
+ # set the lockd server parameters
53
+ class DoServerSetRequest < ::Nl::Protocols::Genl::Message
54
+ TYPE = 1
55
+ FIXED_HEADER = nil
56
+ ATTRIBUTE_SET = AttributeSets::Server
57
+ ATTRIBUTES = Ractor.make_shareable(%i[gracetime tcp_port udp_port])
58
+ # Gets the value of `gracetime` attribute in the message.
59
+ #--
60
+ # @rbs return: ::Integer
61
+ def gracetime; attributes[:"gracetime"]&.value; end
62
+ # Gets the value of `tcp-port` attribute in the message.
63
+ #--
64
+ # @rbs return: ::Integer
65
+ def tcp_port; attributes[:"tcp_port"]&.value; end
66
+ # Gets the value of `udp-port` attribute in the message.
67
+ #--
68
+ # @rbs return: ::Integer
69
+ def udp_port; attributes[:"udp_port"]&.value; end
70
+ end
71
+ # get the lockd server parameters
72
+ class DoServerGetReply < ::Nl::Protocols::Genl::Message
73
+ TYPE = 2
74
+ FIXED_HEADER = nil
75
+ ATTRIBUTE_SET = AttributeSets::Server
76
+ ATTRIBUTES = Ractor.make_shareable(%i[gracetime tcp_port udp_port])
77
+ # Gets the value of `gracetime` attribute in the message.
78
+ #--
79
+ # @rbs return: ::Integer
80
+ def gracetime; attributes[:"gracetime"]&.value; end
81
+ # Gets the value of `tcp-port` attribute in the message.
82
+ #--
83
+ # @rbs return: ::Integer
84
+ def tcp_port; attributes[:"tcp_port"]&.value; end
85
+ # Gets the value of `udp-port` attribute in the message.
86
+ #--
87
+ # @rbs return: ::Integer
88
+ def udp_port; attributes[:"udp_port"]&.value; end
89
+ end
90
+ end
91
+ # set the lockd server parameters
92
+ #--
93
+ # @rbs (?gracetime: ::Integer, ?tcp_port: ::Integer, ?udp_port: ::Integer) -> void
94
+ def do_server_set(**args)
95
+ exchange_message(:"do", Messages::DoServerSetRequest, nil, args)
96
+ end
97
+ end