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,319 @@
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
+ # OVS datapath configuration over generic netlink.
8
+ class Nl::Linux::OvsDatapath < ::Nl::Family
9
+ NAME = "ovs_datapath"
10
+ PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_datapath"))
11
+ module Structs
12
+ OvsHeader = Struct.new(
13
+ :"dp_ifindex", #: ::Integer
14
+ )
15
+ class OvsHeader
16
+ # :nodoc:
17
+ MEMBERS = Ractor.make_shareable({dp_ifindex: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
18
+ # Decodes the struct.
19
+ #--
20
+ # @rbs decoder: ::Nl::Decoder
21
+ # @rbs return: instance
22
+ def self.decode(decoder)
23
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
24
+ end
25
+ # Encodes the struct.
26
+ #--
27
+ # @rbs encoder: ::Nl::Encoder
28
+ # @rbs return: void
29
+ def encode(encoder)
30
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
31
+ end
32
+ end
33
+ OvsDpStats = Struct.new(
34
+ :"n_hit", #: ::Integer
35
+ :"n_missed", #: ::Integer
36
+ :"n_lost", #: ::Integer
37
+ :"n_flows", #: ::Integer
38
+ )
39
+ class OvsDpStats
40
+ # :nodoc:
41
+ MEMBERS = Ractor.make_shareable({n_hit: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), n_missed: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), n_lost: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), n_flows: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
42
+ # Decodes the struct.
43
+ #--
44
+ # @rbs decoder: ::Nl::Decoder
45
+ # @rbs return: instance
46
+ def self.decode(decoder)
47
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
48
+ end
49
+ # Encodes the struct.
50
+ #--
51
+ # @rbs encoder: ::Nl::Encoder
52
+ # @rbs return: void
53
+ def encode(encoder)
54
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
55
+ end
56
+ end
57
+ OvsDpMegaflowStats = Struct.new(
58
+ :"n_mask_hit", #: ::Integer
59
+ :"n_masks", #: ::Integer
60
+ :"padding", #: ::Integer
61
+ :"n_cache_hit", #: ::Integer
62
+ :"pad1", #: ::Integer
63
+ )
64
+ class OvsDpMegaflowStats
65
+ # :nodoc:
66
+ MEMBERS = Ractor.make_shareable({n_mask_hit: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), n_masks: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), padding: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), n_cache_hit: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), pad1: ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
67
+ # Decodes the struct.
68
+ #--
69
+ # @rbs decoder: ::Nl::Decoder
70
+ # @rbs return: instance
71
+ def self.decode(decoder)
72
+ self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
73
+ end
74
+ # Encodes the struct.
75
+ #--
76
+ # @rbs encoder: ::Nl::Encoder
77
+ # @rbs return: void
78
+ def encode(encoder)
79
+ MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
80
+ end
81
+ end
82
+ end
83
+ module AttributeSets
84
+ class Datapath < ::Nl::Protocols::Genl::AttributeSet
85
+ # Abstract class
86
+ class Attribute < ::Nl::Protocols::Genl::AttributeSet::Attribute
87
+ end
88
+ class Name < Attribute
89
+ TYPE = 1
90
+ NAME = :"name"
91
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::String.new(check: nil)
92
+ end
93
+ class UpcallPid < Attribute
94
+ TYPE = 2
95
+ NAME = :"upcall_pid"
96
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
97
+ end
98
+ class Stats < Attribute
99
+ TYPE = 3
100
+ NAME = :"stats"
101
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
102
+ end
103
+ class MegaflowStats < Attribute
104
+ TYPE = 4
105
+ NAME = :"megaflow_stats"
106
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
107
+ end
108
+ class UserFeatures < Attribute
109
+ TYPE = 5
110
+ NAME = :"user_features"
111
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
112
+ end
113
+ class MasksCacheSize < Attribute
114
+ TYPE = 6
115
+ NAME = :"masks_cache_size"
116
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
117
+ end
118
+ class PerCpuPids < Attribute
119
+ TYPE = 7
120
+ NAME = :"per_cpu_pids"
121
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
122
+ end
123
+ class Ifindex < Attribute
124
+ TYPE = 8
125
+ NAME = :"ifindex"
126
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
127
+ end
128
+ # :nodoc:
129
+ BY_NAME = Ractor.make_shareable({:"name" => Name, :"upcall_pid" => UpcallPid, :"stats" => Stats, :"megaflow_stats" => MegaflowStats, :"user_features" => UserFeatures, :"masks_cache_size" => MasksCacheSize, :"per_cpu_pids" => PerCpuPids, :"ifindex" => Ifindex}) #: Hash[::Symbol, Attribute]
130
+ # :nodoc:
131
+ BY_TYPE = Ractor.make_shareable({1 => Name, 2 => UpcallPid, 3 => Stats, 4 => MegaflowStats, 5 => UserFeatures, 6 => MasksCacheSize, 7 => PerCpuPids, 8 => Ifindex}) #: Hash[::Integer, Attribute]
132
+ class << self
133
+ # Looks up Attribute class by name.
134
+ #--
135
+ # @rbs name: Symbol
136
+ # @rbs return: Attribute
137
+ def by_name(name); BY_NAME.fetch(name); end
138
+ # Looks up Attribute class by type value.
139
+ #--
140
+ # @rbs type: Integer
141
+ # @rbs return: Attribute
142
+ def by_type(type); BY_TYPE.fetch(type); end
143
+ end
144
+ end
145
+ end
146
+ module Messages
147
+ # Get / dump OVS data path configuration and state
148
+ class DoGetRequest < ::Nl::Protocols::Genl::Message
149
+ TYPE = 3
150
+ FIXED_HEADER = Structs::OvsHeader
151
+ ATTRIBUTE_SET = AttributeSets::Datapath
152
+ ATTRIBUTES = Ractor.make_shareable(%i[name])
153
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
154
+ #--
155
+ # @rbs return: ::Integer
156
+ def dp_ifindex; fixed_header.dp_ifindex; end
157
+ # Gets the value of `name` attribute in the message.
158
+ #--
159
+ # @rbs return: ::String
160
+ def name; attributes[:"name"]&.value; end
161
+ end
162
+ # Get / dump OVS data path configuration and state
163
+ class DoGetReply < ::Nl::Protocols::Genl::Message
164
+ TYPE = 3
165
+ FIXED_HEADER = Structs::OvsHeader
166
+ ATTRIBUTE_SET = AttributeSets::Datapath
167
+ ATTRIBUTES = Ractor.make_shareable(%i[name upcall_pid stats megaflow_stats user_features masks_cache_size per_cpu_pids])
168
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
169
+ #--
170
+ # @rbs return: ::Integer
171
+ def dp_ifindex; fixed_header.dp_ifindex; end
172
+ # Gets the value of `name` attribute in the message.
173
+ #--
174
+ # @rbs return: ::String
175
+ def name; attributes[:"name"]&.value; end
176
+ # Gets the value of `upcall-pid` attribute in the message.
177
+ #--
178
+ # @rbs return: ::Integer
179
+ def upcall_pid; attributes[:"upcall_pid"]&.value; end
180
+ # Gets the value of `stats` attribute in the message.
181
+ #--
182
+ # @rbs return: untyped
183
+ def stats; attributes[:"stats"]&.value; end
184
+ # Gets the value of `megaflow-stats` attribute in the message.
185
+ #--
186
+ # @rbs return: untyped
187
+ def megaflow_stats; attributes[:"megaflow_stats"]&.value; end
188
+ # Gets the value of `user-features` attribute in the message.
189
+ #--
190
+ # @rbs return: ::Integer
191
+ def user_features; attributes[:"user_features"]&.value; end
192
+ # Gets the value of `masks-cache-size` attribute in the message.
193
+ #--
194
+ # @rbs return: ::Integer
195
+ def masks_cache_size; attributes[:"masks_cache_size"]&.value; end
196
+ # Gets the value of `per-cpu-pids` attribute in the message.
197
+ #--
198
+ # @rbs return: untyped
199
+ def per_cpu_pids; attributes[:"per_cpu_pids"]&.value; end
200
+ end
201
+ # Get / dump OVS data path configuration and state
202
+ class DumpGetRequest < ::Nl::Protocols::Genl::Message
203
+ TYPE = 3
204
+ FIXED_HEADER = Structs::OvsHeader
205
+ ATTRIBUTE_SET = AttributeSets::Datapath
206
+ ATTRIBUTES = Ractor.make_shareable(%i[name])
207
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
208
+ #--
209
+ # @rbs return: ::Integer
210
+ def dp_ifindex; fixed_header.dp_ifindex; end
211
+ # Gets the value of `name` attribute in the message.
212
+ #--
213
+ # @rbs return: ::String
214
+ def name; attributes[:"name"]&.value; end
215
+ end
216
+ # Get / dump OVS data path configuration and state
217
+ class DumpGetReply < ::Nl::Protocols::Genl::Message
218
+ TYPE = 3
219
+ FIXED_HEADER = Structs::OvsHeader
220
+ ATTRIBUTE_SET = AttributeSets::Datapath
221
+ ATTRIBUTES = Ractor.make_shareable(%i[name upcall_pid stats megaflow_stats user_features masks_cache_size per_cpu_pids])
222
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
223
+ #--
224
+ # @rbs return: ::Integer
225
+ def dp_ifindex; fixed_header.dp_ifindex; end
226
+ # Gets the value of `name` attribute in the message.
227
+ #--
228
+ # @rbs return: ::String
229
+ def name; attributes[:"name"]&.value; end
230
+ # Gets the value of `upcall-pid` attribute in the message.
231
+ #--
232
+ # @rbs return: ::Integer
233
+ def upcall_pid; attributes[:"upcall_pid"]&.value; end
234
+ # Gets the value of `stats` attribute in the message.
235
+ #--
236
+ # @rbs return: untyped
237
+ def stats; attributes[:"stats"]&.value; end
238
+ # Gets the value of `megaflow-stats` attribute in the message.
239
+ #--
240
+ # @rbs return: untyped
241
+ def megaflow_stats; attributes[:"megaflow_stats"]&.value; end
242
+ # Gets the value of `user-features` attribute in the message.
243
+ #--
244
+ # @rbs return: ::Integer
245
+ def user_features; attributes[:"user_features"]&.value; end
246
+ # Gets the value of `masks-cache-size` attribute in the message.
247
+ #--
248
+ # @rbs return: ::Integer
249
+ def masks_cache_size; attributes[:"masks_cache_size"]&.value; end
250
+ # Gets the value of `per-cpu-pids` attribute in the message.
251
+ #--
252
+ # @rbs return: untyped
253
+ def per_cpu_pids; attributes[:"per_cpu_pids"]&.value; end
254
+ end
255
+ # Create new OVS data path
256
+ class DoNewRequest < ::Nl::Protocols::Genl::Message
257
+ TYPE = 1
258
+ FIXED_HEADER = Structs::OvsHeader
259
+ ATTRIBUTE_SET = AttributeSets::Datapath
260
+ ATTRIBUTES = Ractor.make_shareable(%i[name upcall_pid user_features])
261
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
262
+ #--
263
+ # @rbs return: ::Integer
264
+ def dp_ifindex; fixed_header.dp_ifindex; end
265
+ # Gets the value of `name` attribute in the message.
266
+ #--
267
+ # @rbs return: ::String
268
+ def name; attributes[:"name"]&.value; end
269
+ # Gets the value of `upcall-pid` attribute in the message.
270
+ #--
271
+ # @rbs return: ::Integer
272
+ def upcall_pid; attributes[:"upcall_pid"]&.value; end
273
+ # Gets the value of `user-features` attribute in the message.
274
+ #--
275
+ # @rbs return: ::Integer
276
+ def user_features; attributes[:"user_features"]&.value; end
277
+ end
278
+ # Delete existing OVS data path
279
+ class DoDelRequest < ::Nl::Protocols::Genl::Message
280
+ TYPE = 2
281
+ FIXED_HEADER = Structs::OvsHeader
282
+ ATTRIBUTE_SET = AttributeSets::Datapath
283
+ ATTRIBUTES = Ractor.make_shareable(%i[name])
284
+ # Gets the value of `dp-ifindex` field in the message's fixed header.
285
+ #--
286
+ # @rbs return: ::Integer
287
+ def dp_ifindex; fixed_header.dp_ifindex; end
288
+ # Gets the value of `name` attribute in the message.
289
+ #--
290
+ # @rbs return: ::String
291
+ def name; attributes[:"name"]&.value; end
292
+ end
293
+ end
294
+ # Get / dump OVS data path configuration and state
295
+ #--
296
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> Messages::DoGetReply
297
+ def do_get(**args)
298
+ exchange_message(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
299
+ end
300
+ # Get / dump OVS data path configuration and state
301
+ #--
302
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> Enumerable[Messages::DumpGetReply]
303
+ # | (?dp_ifindex: ::Integer, ?name: ::String) { (Messages::DumpGetReply) -> void } -> void
304
+ def dump_get(**args, &block)
305
+ exchange_message(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args, &block)
306
+ end
307
+ # Create new OVS data path
308
+ #--
309
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String, ?upcall_pid: ::Integer, ?user_features: ::Integer) -> void
310
+ def do_new(**args)
311
+ exchange_message(:"do", Messages::DoNewRequest, nil, args)
312
+ end
313
+ # Delete existing OVS data path
314
+ #--
315
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> void
316
+ def do_del(**args)
317
+ exchange_message(:"do", Messages::DoDelRequest, nil, args)
318
+ end
319
+ end