nl-linux 0.4.2 → 0.5.0

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/NLSPEC_VERSION +1 -1
  4. data/generated/nl/linux/binder.rb +103 -187
  5. data/generated/nl/linux/conntrack.rb +1053 -1649
  6. data/generated/nl/linux/dev_energymodel.rb +303 -265
  7. data/generated/nl/linux/devlink.rb +4904 -5576
  8. data/generated/nl/linux/dpll.rb +1097 -1467
  9. data/generated/nl/linux/drm_ras.rb +235 -195
  10. data/generated/nl/linux/ethtool.rb +6652 -7415
  11. data/generated/nl/linux/fou.rb +234 -255
  12. data/generated/nl/linux/handshake.rb +208 -280
  13. data/generated/nl/linux/lockd.rb +99 -73
  14. data/generated/nl/linux/mptcp_pm.rb +589 -687
  15. data/generated/nl/linux/net_shaper.rb +520 -615
  16. data/generated/nl/linux/netdev.rb +1640 -1987
  17. data/generated/nl/linux/nfsd.rb +1341 -1215
  18. data/generated/nl/linux/nftables.rb +5143 -4870
  19. data/generated/nl/linux/nl80211.rb +2542 -6316
  20. data/generated/nl/linux/nlctrl.rb +338 -483
  21. data/generated/nl/linux/ovpn.rb +1006 -1522
  22. data/generated/nl/linux/ovs_datapath.rb +291 -186
  23. data/generated/nl/linux/ovs_flow.rb +1393 -2065
  24. data/generated/nl/linux/ovs_packet.rb +186 -223
  25. data/generated/nl/linux/ovs_vport.rb +328 -285
  26. data/generated/nl/linux/psp.rb +812 -717
  27. data/generated/nl/linux/rt_addr.rb +513 -243
  28. data/generated/nl/linux/rt_link.rb +4504 -7238
  29. data/generated/nl/linux/rt_neigh.rb +935 -847
  30. data/generated/nl/linux/rt_route.rb +1198 -871
  31. data/generated/nl/linux/rt_rule.rb +680 -659
  32. data/generated/nl/linux/sunrpc_cache.rb +323 -321
  33. data/generated/nl/linux/tc.rb +9058 -10454
  34. data/generated/nl/linux/tcp_metrics.rb +258 -367
  35. data/generated/nl/linux/team.rb +327 -345
  36. data/generated/nl/linux/wireguard.rb +270 -434
  37. data/lib/nl/linux/nlctrl_resolver.rb +1 -1
  38. data/lib/nl/linux/version.rb +1 -1
  39. data/linux/conntrack.yaml +18 -3
  40. data/linux/devlink.yaml +26 -4
  41. data/linux/dpll.yaml +19 -0
  42. data/linux/netdev.yaml +21 -0
  43. data/linux/nfsd.yaml +111 -0
  44. data/linux/nl80211.yaml +2 -2
  45. data/linux/rt-addr.yaml +4 -0
  46. data/linux/rt-link.yaml +7 -0
  47. data/linux/rt-neigh.yaml +3 -0
  48. data/linux/rt-route.yaml +83 -2
  49. data/sig/generated/nl/linux/binder.rbs +77 -220
  50. data/sig/generated/nl/linux/conntrack.rbs +770 -1954
  51. data/sig/generated/nl/linux/dev_energymodel.rbs +207 -291
  52. data/sig/generated/nl/linux/devlink.rbs +3318 -6068
  53. data/sig/generated/nl/linux/dpll.rbs +791 -1589
  54. data/sig/generated/nl/linux/drm_ras.rbs +160 -208
  55. data/sig/generated/nl/linux/ethtool.rbs +4205 -7581
  56. data/sig/generated/nl/linux/fou.rbs +139 -254
  57. data/sig/generated/nl/linux/handshake.rbs +144 -319
  58. data/sig/generated/nl/linux/lockd.rbs +64 -74
  59. data/sig/generated/nl/linux/mptcp_pm.rbs +426 -835
  60. data/sig/generated/nl/linux/net_shaper.rbs +351 -644
  61. data/sig/generated/nl/linux/netdev.rbs +1151 -2146
  62. data/sig/generated/nl/linux/nfsd.rbs +1047 -1409
  63. data/sig/generated/nl/linux/nftables.rbs +2907 -5030
  64. data/sig/generated/nl/linux/nl80211.rbs +1807 -7964
  65. data/sig/generated/nl/linux/nlctrl.rbs +220 -544
  66. data/sig/generated/nl/linux/ovpn.rbs +835 -1859
  67. data/sig/generated/nl/linux/ovs_datapath.rbs +141 -181
  68. data/sig/generated/nl/linux/ovs_flow.rbs +817 -2332
  69. data/sig/generated/nl/linux/ovs_packet.rbs +110 -237
  70. data/sig/generated/nl/linux/ovs_vport.rbs +174 -294
  71. data/sig/generated/nl/linux/psp.rbs +550 -741
  72. data/sig/generated/nl/linux/rt_addr.rbs +188 -226
  73. data/sig/generated/nl/linux/rt_link.rbs +2687 -8370
  74. data/sig/generated/nl/linux/rt_neigh.rbs +471 -1005
  75. data/sig/generated/nl/linux/rt_route.rbs +632 -862
  76. data/sig/generated/nl/linux/rt_rule.rbs +217 -639
  77. data/sig/generated/nl/linux/sunrpc_cache.rbs +233 -369
  78. data/sig/generated/nl/linux/tc.rbs +6199 -13391
  79. data/sig/generated/nl/linux/tcp_metrics.rbs +179 -421
  80. data/sig/generated/nl/linux/team.rbs +232 -391
  81. data/sig/generated/nl/linux/wireguard.rbs +197 -502
  82. metadata +6 -6
@@ -1,6 +1,6 @@
1
1
  # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
2
  #
3
- # This file is based on Documentation/netlink/specs/rt-addr.yaml from Linux v7.2.
3
+ # This file is based on Documentation/netlink/specs/rt-addr.yaml from Linux v7.3.
4
4
  #--
5
5
  # frozen_string_literal: true
6
6
  # This code is generated by Ynl::Generator. DO NOT EDIT.
@@ -25,7 +25,7 @@ class RtAddr < ::Nl::Raw::Family
25
25
  super
26
26
  end
27
27
  # @private
28
- MCAST_GROUPS = Ractor.make_shareable({:"rtnlgrp_ipv4_ifaddr" => ::Nl::McastGroup.new("rtnlgrp-ipv4-ifaddr", 5), :"rtnlgrp_ipv6_ifaddr" => ::Nl::McastGroup.new("rtnlgrp-ipv6-ifaddr", 9)}) #: Hash[::Symbol, ::Nl::McastGroup]
28
+ MCAST_GROUPS = {:"rtnlgrp_ipv4_ifaddr" => ::Nl::McastGroup.new("rtnlgrp-ipv4-ifaddr", 5), :"rtnlgrp_ipv6_ifaddr" => ::Nl::McastGroup.new("rtnlgrp-ipv6-ifaddr", 9)}.freeze #: Hash[::Symbol, ::Nl::McastGroup]
29
29
  module Flags
30
30
  module IfaFlags
31
31
  Secondary = 1
@@ -62,14 +62,34 @@ class RtAddr < ::Nl::Raw::Family
62
62
  # @!attribute [rw] ifa_index
63
63
  # @return [Integer]
64
64
  # @private
65
- MEMBERS = Ractor.make_shareable({ifa_family: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), ifa_prefixlen: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), ifa_flags: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), ifa_scope: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), ifa_index: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
65
+ MEMBERS = {ifa_family: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, ifa_prefixlen: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, ifa_flags: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, ifa_scope: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, ifa_index: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new}.freeze #: Hash[::Symbol, ::Nl::_DataType]
66
+ Ractor.make_shareable(MEMBERS) if defined?(Ractor)
67
+ # @private
68
+ # @rbs (Hash[Symbol, untyped] params, ?context: untyped) -> instance
69
+ def self.from_params(params, context: nil)
70
+ unknown = params.keys - members
71
+ raise ArgumentError, "unknown struct members: #{unknown.join(', ')}" unless unknown.empty?
72
+ self.new(
73
+ MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0), context:),
74
+ MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0), context:),
75
+ MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0), context:),
76
+ MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0), context:),
77
+ MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0), context:),
78
+ )
79
+ end
66
80
  # Decodes the struct.
67
81
  # @rbs decoder: ::Nl::Decoder
68
82
  # @rbs return: instance
69
83
  # @param [Nl::Decoder] decoder
70
84
  # @return [self]
71
85
  def self.decode(decoder)
72
- self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
86
+ word = decoder.get_u32
87
+ value_0 = ((word >> 0) & 0xff)
88
+ value_1 = ((word >> 8) & 0xff)
89
+ value_2 = ((word >> 16) & 0xff)
90
+ value_3 = ((word >> 24) & 0xff)
91
+ value_4 = decoder.get_host_u32
92
+ self.new(value_0, value_1, value_2, value_3, value_4)
73
93
  end
74
94
  # Encodes the struct.
75
95
  # @rbs encoder: ::Nl::Encoder
@@ -77,7 +97,11 @@ class RtAddr < ::Nl::Raw::Family
77
97
  # @param [Nl::Encoder] encoder
78
98
  # @return [void]
79
99
  def encode(encoder)
80
- MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
100
+ MEMBERS[:"ifa_family"].encode(encoder, public_send(:"ifa_family"))
101
+ MEMBERS[:"ifa_prefixlen"].encode(encoder, public_send(:"ifa_prefixlen"))
102
+ MEMBERS[:"ifa_flags"].encode(encoder, public_send(:"ifa_flags"))
103
+ MEMBERS[:"ifa_scope"].encode(encoder, public_send(:"ifa_scope"))
104
+ MEMBERS[:"ifa_index"].encode(encoder, public_send(:"ifa_index"))
81
105
  end
82
106
  end
83
107
  IfaCacheinfo = Struct.new(
@@ -96,14 +120,31 @@ class RtAddr < ::Nl::Raw::Family
96
120
  # @!attribute [rw] tstamp
97
121
  # @return [Integer]
98
122
  # @private
99
- MEMBERS = Ractor.make_shareable({ifa_prefered: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), ifa_valid: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), cstamp: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), tstamp: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
123
+ MEMBERS = {ifa_prefered: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, ifa_valid: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, cstamp: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, tstamp: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new}.freeze #: Hash[::Symbol, ::Nl::_DataType]
124
+ Ractor.make_shareable(MEMBERS) if defined?(Ractor)
125
+ # @private
126
+ # @rbs (Hash[Symbol, untyped] params, ?context: untyped) -> instance
127
+ def self.from_params(params, context: nil)
128
+ unknown = params.keys - members
129
+ raise ArgumentError, "unknown struct members: #{unknown.join(', ')}" unless unknown.empty?
130
+ self.new(
131
+ MEMBERS[:"ifa_prefered"].coerce(params.fetch(:"ifa_prefered", 0), context:),
132
+ MEMBERS[:"ifa_valid"].coerce(params.fetch(:"ifa_valid", 0), context:),
133
+ MEMBERS[:"cstamp"].coerce(params.fetch(:"cstamp", 0), context:),
134
+ MEMBERS[:"tstamp"].coerce(params.fetch(:"tstamp", 0), context:),
135
+ )
136
+ end
100
137
  # Decodes the struct.
101
138
  # @rbs decoder: ::Nl::Decoder
102
139
  # @rbs return: instance
103
140
  # @param [Nl::Decoder] decoder
104
141
  # @return [self]
105
142
  def self.decode(decoder)
106
- self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
143
+ value_0 = decoder.get_host_u32
144
+ value_1 = decoder.get_host_u32
145
+ value_2 = decoder.get_host_u32
146
+ value_3 = decoder.get_host_u32
147
+ self.new(value_0, value_1, value_2, value_3)
107
148
  end
108
149
  # Encodes the struct.
109
150
  # @rbs encoder: ::Nl::Encoder
@@ -111,407 +152,636 @@ class RtAddr < ::Nl::Raw::Family
111
152
  # @param [Nl::Encoder] encoder
112
153
  # @return [void]
113
154
  def encode(encoder)
114
- MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
155
+ MEMBERS[:"ifa_prefered"].encode(encoder, public_send(:"ifa_prefered"))
156
+ MEMBERS[:"ifa_valid"].encode(encoder, public_send(:"ifa_valid"))
157
+ MEMBERS[:"cstamp"].encode(encoder, public_send(:"cstamp"))
158
+ MEMBERS[:"tstamp"].encode(encoder, public_send(:"tstamp"))
115
159
  end
116
160
  end
117
161
  end
118
162
  module AttributeSets
119
163
  class AddrAttrs < ::Nl::AttributeSet
120
- # Abstract class
121
- class Attribute < ::Nl::AttributeSet::Attribute
122
- end
123
- class Address < Attribute
124
- TYPE = 1
125
- NAME = :"address"
126
- # @private
127
- ORDER = 0
128
- # @private
129
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
130
- end
131
- class Local < Attribute
132
- TYPE = 2
133
- NAME = :"local"
134
- # @private
135
- ORDER = 1
136
- # @private
137
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
138
- end
139
- class Label < Attribute
140
- TYPE = 3
141
- NAME = :"label"
142
- # @private
143
- ORDER = 2
144
- # @private
145
- DATATYPE = ::Nl::DataTypes::String.new(check: nil)
146
- end
147
- class Broadcast < Attribute
148
- TYPE = 4
149
- NAME = :"broadcast"
150
- # @private
151
- ORDER = 3
152
- # @private
153
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Big::U32, check: nil)
154
- end
155
- class Anycast < Attribute
156
- TYPE = 5
157
- NAME = :"anycast"
158
- # @private
159
- ORDER = 4
160
- # @private
161
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
162
- end
163
- class Cacheinfo < Attribute
164
- TYPE = 6
165
- NAME = :"cacheinfo"
166
- # @private
167
- ORDER = 5
168
- # @private
169
- DATATYPE = ::Nl::DataTypes::Struct.new(Structs::IfaCacheinfo, check: nil, consume_remaining: true)
170
- end
171
- class Multicast < Attribute
172
- TYPE = 7
173
- NAME = :"multicast"
174
- # @private
175
- ORDER = 6
176
- # @private
177
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
178
- end
179
- # Known flags are defined in {Flags::IfaFlags}.
180
- class Flags < Attribute
181
- TYPE = 8
182
- NAME = :"flags"
183
- # @private
184
- ORDER = 7
185
- # @private
186
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
164
+ module Definitions
165
+ # @rbs return: ::String
166
+ # @return [String]
167
+ def address; self[:"address"]; end
168
+ # @rbs return: ::String
169
+ # @return [String]
170
+ def local; self[:"local"]; end
171
+ # @rbs return: ::String
172
+ # @return [String]
173
+ def label; self[:"label"]; end
174
+ # @rbs return: ::Integer
175
+ # @return [Integer]
176
+ def broadcast; self[:"broadcast"]; end
177
+ # @rbs return: ::String
178
+ # @return [String]
179
+ def anycast; self[:"anycast"]; end
180
+ # @rbs return: Structs::IfaCacheinfo
181
+ # @return [Structs::IfaCacheinfo]
182
+ def cacheinfo; self[:"cacheinfo"]; end
183
+ # @rbs return: ::String
184
+ # @return [String]
185
+ def multicast; self[:"multicast"]; end
186
+ # Known flags are defined in {Flags::IfaFlags}.
187
+ # @rbs return: ::Integer
188
+ # @return [Integer]
189
+ def flags; self[:"flags"]; end
190
+ # @rbs return: ::Integer
191
+ # @return [Integer]
192
+ def rt_priority; self[:"rt_priority"]; end
193
+ # @rbs return: ::String
194
+ # @return [String]
195
+ def target_netnsid; self[:"target_netnsid"]; end
196
+ # @rbs return: ::Integer
197
+ # @return [Integer]
198
+ def proto; self[:"proto"]; end
199
+ # @rbs return: ::Integer
200
+ # @return [Integer]
201
+ def mc_users; self[:"mc_users"]; end
187
202
  end
188
- class RtPriority < Attribute
189
- TYPE = 9
190
- NAME = :"rt_priority"
191
- # @private
192
- ORDER = 8
193
- # @private
194
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
203
+ include Definitions
204
+ # Decodes attributes from the decoder into a new attribute set.
205
+ # @rbs (::Nl::Decoder decoder, ?external_selectors: ::Array[untyped]) -> instance
206
+ def self.decode(decoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
207
+ super(decoder, BY_TYPE, 0, external_selectors)
195
208
  end
196
- class TargetNetnsid < Attribute
197
- TYPE = 10
198
- NAME = :"target_netnsid"
199
- # @private
200
- ORDER = 9
201
- # @private
202
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
203
- end
204
- class Proto < Attribute
205
- TYPE = 11
206
- NAME = :"proto"
209
+ end
210
+ end
211
+ module AttributeSets
212
+ class AddrAttrs
213
+ module Definitions
207
214
  # @private
208
- ORDER = 10
215
+ BY_TYPE = ::Array.new(13).tap do |definitions|
216
+ definitions[1] = ::Nl::AttributeSet::Definition.new(id: 1, name: :"address", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 0, selector_slot: nil)
217
+ definitions[2] = ::Nl::AttributeSet::Definition.new(id: 2, name: :"local", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 1, selector_slot: nil)
218
+ definitions[3] = ::Nl::AttributeSet::Definition.new(id: 3, name: :"label", datatype: ::Nl::DataTypes::String.new, multi: false, order: 2, selector_slot: nil)
219
+ definitions[4] = ::Nl::AttributeSet::Definition.new(id: 4, name: :"broadcast", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Big::U32].new, multi: false, order: 3, selector_slot: nil)
220
+ definitions[5] = ::Nl::AttributeSet::Definition.new(id: 5, name: :"anycast", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 4, selector_slot: nil)
221
+ definitions[6] = ::Nl::AttributeSet::Definition.new(id: 6, name: :"cacheinfo", datatype: ::Nl::DataTypes::Struct.new(Structs::IfaCacheinfo, consume_remaining: true), multi: false, order: 5, selector_slot: nil)
222
+ definitions[7] = ::Nl::AttributeSet::Definition.new(id: 7, name: :"multicast", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 6, selector_slot: nil)
223
+ definitions[8] = ::Nl::AttributeSet::Definition.new(id: 8, name: :"flags", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 7, selector_slot: nil)
224
+ definitions[9] = ::Nl::AttributeSet::Definition.new(id: 9, name: :"rt_priority", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 8, selector_slot: nil)
225
+ definitions[10] = ::Nl::AttributeSet::Definition.new(id: 10, name: :"target_netnsid", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 9, selector_slot: nil)
226
+ definitions[11] = ::Nl::AttributeSet::Definition.new(id: 11, name: :"proto", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, multi: false, order: 10, selector_slot: nil)
227
+ definitions[12] = ::Nl::AttributeSet::Definition.new(id: 12, name: :"mc_users", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 11, selector_slot: nil)
228
+ end.freeze #: Array[::Nl::AttributeSet::Definition?]
229
+ Ractor.make_shareable(BY_TYPE) if defined?(Ractor)
209
230
  # @private
210
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
211
- end
212
- # @private
213
- BY_NAME = Ractor.make_shareable({:"address" => Address, :"local" => Local, :"label" => Label, :"broadcast" => Broadcast, :"anycast" => Anycast, :"cacheinfo" => Cacheinfo, :"multicast" => Multicast, :"flags" => Flags, :"rt_priority" => RtPriority, :"target_netnsid" => TargetNetnsid, :"proto" => Proto}) #: Hash[::Symbol, Attribute]
214
- # @private
215
- BY_TYPE = Ractor.make_shareable({1 => Address, 2 => Local, 3 => Label, 4 => Broadcast, 5 => Anycast, 6 => Cacheinfo, 7 => Multicast, 8 => Flags, 9 => RtPriority, 10 => TargetNetnsid, 11 => Proto}) #: Hash[::Integer, Attribute]
216
- # @rbs return: ::String
217
- # @return [String]
218
- # @see Address
219
- def address; self[:"address"]&.value; end
220
- # @rbs return: ::String
221
- # @return [String]
222
- # @see Local
223
- def local; self[:"local"]&.value; end
224
- # @rbs return: ::String
225
- # @return [String]
226
- # @see Label
227
- def label; self[:"label"]&.value; end
228
- # @rbs return: ::Integer
229
- # @return [Integer]
230
- # @see Broadcast
231
- def broadcast; self[:"broadcast"]&.value; end
232
- # @rbs return: ::String
233
- # @return [String]
234
- # @see Anycast
235
- def anycast; self[:"anycast"]&.value; end
236
- # @rbs return: Structs::IfaCacheinfo
237
- # @return [Structs::IfaCacheinfo]
238
- # @see Cacheinfo
239
- def cacheinfo; self[:"cacheinfo"]&.value; end
240
- # @rbs return: ::String
241
- # @return [String]
242
- # @see Multicast
243
- def multicast; self[:"multicast"]&.value; end
244
- # Known flags are defined in {Flags::IfaFlags}.
245
- # @rbs return: ::Integer
246
- # @return [Integer]
247
- # @see Flags
248
- def flags; self[:"flags"]&.value; end
249
- # @rbs return: ::Integer
250
- # @return [Integer]
251
- # @see RtPriority
252
- def rt_priority; self[:"rt_priority"]&.value; end
253
- # @rbs return: ::String
254
- # @return [String]
255
- # @see TargetNetnsid
256
- def target_netnsid; self[:"target_netnsid"]&.value; end
257
- # @rbs return: ::Integer
258
- # @return [Integer]
259
- # @see Proto
260
- def proto; self[:"proto"]&.value; end
261
- class << self
262
- # Looks up Attribute class by name.
263
- # @rbs name: Symbol
264
- # @rbs return: Attribute
265
- # @param [Symbol] name
266
- # @return [Attribute]
267
- def by_name(name); BY_NAME.fetch(name); end
268
- # Looks up Attribute class by type value.
269
- # @rbs type: Integer
270
- # @rbs return: Attribute
271
- # @param [Integer] type
272
- # @return [Attribute]
273
- def by_type(type); BY_TYPE.fetch(type); end
231
+ BY_NAME = BY_TYPE.compact.to_h { [it.name, it] }.freeze #: Hash[::Symbol, ::Nl::AttributeSet::Definition]
274
232
  end
275
233
  end
276
234
  end
277
235
  module Messages
278
236
  # Add new address
279
- class DoNewaddrRequest < ::Nl::Raw::Message
237
+ class DoNewaddrRequest < ::Nl::Message
280
238
  TYPE = 20
281
239
  FIXED_HEADER = Structs::Ifaddrmsg
282
240
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
283
- ATTRIBUTES = Ractor.make_shareable(%i[address local label cacheinfo])
241
+ ATTRIBUTES = %i[address local label cacheinfo].freeze
242
+ include ATTRIBUTE_SET::Definitions
243
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
244
+ @ifa_family = ifa_family
245
+ @ifa_prefixlen = ifa_prefixlen
246
+ @ifa_flags = ifa_flags
247
+ @ifa_scope = ifa_scope
248
+ @ifa_index = ifa_index
249
+ @attributes = attributes
250
+ end
251
+ # @private
252
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
253
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
254
+ new(
255
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
256
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
257
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
258
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
259
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
260
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
261
+ )
262
+ end
263
+ # Decodes a message payload from the decoder into a new instance.
264
+ # @rbs (::Nl::Decoder decoder) -> instance
265
+ def self.decode(decoder)
266
+ word = decoder.get_u32
267
+ value_0 = ((word >> 0) & 0xff)
268
+ value_1 = ((word >> 8) & 0xff)
269
+ value_2 = ((word >> 16) & 0xff)
270
+ value_3 = ((word >> 24) & 0xff)
271
+ value_4 = decoder.get_host_u32
272
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
273
+ end
274
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
275
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
276
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
277
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
278
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
279
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
280
+ encode_attributes(encoder, external_selectors:)
281
+ end
284
282
  # @rbs return: ::Integer
285
283
  # @return [Integer]
286
- def ifa_family; fixed_header.ifa_family; end
284
+ def ifa_family; @ifa_family; end
287
285
  # @rbs return: ::Integer
288
286
  # @return [Integer]
289
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
287
+ def ifa_prefixlen; @ifa_prefixlen; end
290
288
  # @rbs return: ::Integer
291
289
  # @return [Integer]
292
- def ifa_flags; fixed_header.ifa_flags; end
290
+ def ifa_flags; @ifa_flags; end
293
291
  # @rbs return: ::Integer
294
292
  # @return [Integer]
295
- def ifa_scope; fixed_header.ifa_scope; end
293
+ def ifa_scope; @ifa_scope; end
296
294
  # @rbs return: ::Integer
297
295
  # @return [Integer]
298
- def ifa_index; fixed_header.ifa_index; end
296
+ def ifa_index; @ifa_index; end
299
297
  # @rbs return: ::String
300
298
  # @return [String]
301
- # @see AttributeSets::AddrAttrs::Address
302
- def address; attributes[:"address"]&.value; end
299
+ def address; self[:"address"]; end
303
300
  # @rbs return: ::String
304
301
  # @return [String]
305
- # @see AttributeSets::AddrAttrs::Local
306
- def local; attributes[:"local"]&.value; end
302
+ def local; self[:"local"]; end
307
303
  # @rbs return: ::String
308
304
  # @return [String]
309
- # @see AttributeSets::AddrAttrs::Label
310
- def label; attributes[:"label"]&.value; end
305
+ def label; self[:"label"]; end
311
306
  # @rbs return: Structs::IfaCacheinfo
312
307
  # @return [Structs::IfaCacheinfo]
313
- # @see AttributeSets::AddrAttrs::Cacheinfo
314
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
308
+ def cacheinfo; self[:"cacheinfo"]; end
315
309
  end
316
310
  # Remove address
317
- class DoDeladdrRequest < ::Nl::Raw::Message
311
+ class DoDeladdrRequest < ::Nl::Message
318
312
  TYPE = 21
319
313
  FIXED_HEADER = Structs::Ifaddrmsg
320
314
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
321
- ATTRIBUTES = Ractor.make_shareable(%i[address local])
315
+ ATTRIBUTES = %i[address local].freeze
316
+ include ATTRIBUTE_SET::Definitions
317
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
318
+ @ifa_family = ifa_family
319
+ @ifa_prefixlen = ifa_prefixlen
320
+ @ifa_flags = ifa_flags
321
+ @ifa_scope = ifa_scope
322
+ @ifa_index = ifa_index
323
+ @attributes = attributes
324
+ end
325
+ # @private
326
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
327
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
328
+ new(
329
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
330
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
331
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
332
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
333
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
334
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
335
+ )
336
+ end
337
+ # Decodes a message payload from the decoder into a new instance.
338
+ # @rbs (::Nl::Decoder decoder) -> instance
339
+ def self.decode(decoder)
340
+ word = decoder.get_u32
341
+ value_0 = ((word >> 0) & 0xff)
342
+ value_1 = ((word >> 8) & 0xff)
343
+ value_2 = ((word >> 16) & 0xff)
344
+ value_3 = ((word >> 24) & 0xff)
345
+ value_4 = decoder.get_host_u32
346
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
347
+ end
348
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
349
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
350
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
351
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
352
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
353
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
354
+ encode_attributes(encoder, external_selectors:)
355
+ end
322
356
  # @rbs return: ::Integer
323
357
  # @return [Integer]
324
- def ifa_family; fixed_header.ifa_family; end
358
+ def ifa_family; @ifa_family; end
325
359
  # @rbs return: ::Integer
326
360
  # @return [Integer]
327
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
361
+ def ifa_prefixlen; @ifa_prefixlen; end
328
362
  # @rbs return: ::Integer
329
363
  # @return [Integer]
330
- def ifa_flags; fixed_header.ifa_flags; end
364
+ def ifa_flags; @ifa_flags; end
331
365
  # @rbs return: ::Integer
332
366
  # @return [Integer]
333
- def ifa_scope; fixed_header.ifa_scope; end
367
+ def ifa_scope; @ifa_scope; end
334
368
  # @rbs return: ::Integer
335
369
  # @return [Integer]
336
- def ifa_index; fixed_header.ifa_index; end
370
+ def ifa_index; @ifa_index; end
337
371
  # @rbs return: ::String
338
372
  # @return [String]
339
- # @see AttributeSets::AddrAttrs::Address
340
- def address; attributes[:"address"]&.value; end
373
+ def address; self[:"address"]; end
341
374
  # @rbs return: ::String
342
375
  # @return [String]
343
- # @see AttributeSets::AddrAttrs::Local
344
- def local; attributes[:"local"]&.value; end
376
+ def local; self[:"local"]; end
345
377
  end
346
378
  # Dump address information.
347
- class DumpGetaddrRequest < ::Nl::Raw::Message
379
+ class DumpGetaddrRequest < ::Nl::Message
348
380
  TYPE = 22
349
381
  FIXED_HEADER = Structs::Ifaddrmsg
350
382
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
351
- ATTRIBUTES = Ractor.make_shareable(%i[])
383
+ ATTRIBUTES = %i[].freeze
384
+ include ATTRIBUTE_SET::Definitions
385
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
386
+ @ifa_family = ifa_family
387
+ @ifa_prefixlen = ifa_prefixlen
388
+ @ifa_flags = ifa_flags
389
+ @ifa_scope = ifa_scope
390
+ @ifa_index = ifa_index
391
+ @attributes = attributes
392
+ end
393
+ # @private
394
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
395
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
396
+ new(
397
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
398
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
399
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
400
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
401
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
402
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
403
+ )
404
+ end
405
+ # Decodes a message payload from the decoder into a new instance.
406
+ # @rbs (::Nl::Decoder decoder) -> instance
407
+ def self.decode(decoder)
408
+ word = decoder.get_u32
409
+ value_0 = ((word >> 0) & 0xff)
410
+ value_1 = ((word >> 8) & 0xff)
411
+ value_2 = ((word >> 16) & 0xff)
412
+ value_3 = ((word >> 24) & 0xff)
413
+ value_4 = decoder.get_host_u32
414
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
415
+ end
416
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
417
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
418
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
419
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
420
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
421
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
422
+ encode_attributes(encoder, external_selectors:)
423
+ end
352
424
  # @rbs return: ::Integer
353
425
  # @return [Integer]
354
- def ifa_family; fixed_header.ifa_family; end
426
+ def ifa_family; @ifa_family; end
355
427
  # @rbs return: ::Integer
356
428
  # @return [Integer]
357
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
429
+ def ifa_prefixlen; @ifa_prefixlen; end
358
430
  # @rbs return: ::Integer
359
431
  # @return [Integer]
360
- def ifa_flags; fixed_header.ifa_flags; end
432
+ def ifa_flags; @ifa_flags; end
361
433
  # @rbs return: ::Integer
362
434
  # @return [Integer]
363
- def ifa_scope; fixed_header.ifa_scope; end
435
+ def ifa_scope; @ifa_scope; end
364
436
  # @rbs return: ::Integer
365
437
  # @return [Integer]
366
- def ifa_index; fixed_header.ifa_index; end
438
+ def ifa_index; @ifa_index; end
367
439
  end
368
440
  # Dump address information.
369
- class DumpGetaddrReply < ::Nl::Raw::Message
441
+ class DumpGetaddrReply < ::Nl::Message
370
442
  TYPE = 20
371
443
  FIXED_HEADER = Structs::Ifaddrmsg
372
444
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
373
- ATTRIBUTES = Ractor.make_shareable(%i[address local label cacheinfo])
445
+ ATTRIBUTES = %i[address local label cacheinfo].freeze
446
+ include ATTRIBUTE_SET::Definitions
447
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
448
+ @ifa_family = ifa_family
449
+ @ifa_prefixlen = ifa_prefixlen
450
+ @ifa_flags = ifa_flags
451
+ @ifa_scope = ifa_scope
452
+ @ifa_index = ifa_index
453
+ @attributes = attributes
454
+ end
455
+ # @private
456
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
457
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
458
+ new(
459
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
460
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
461
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
462
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
463
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
464
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
465
+ )
466
+ end
467
+ # Decodes a message payload from the decoder into a new instance.
468
+ # @rbs (::Nl::Decoder decoder) -> instance
469
+ def self.decode(decoder)
470
+ word = decoder.get_u32
471
+ value_0 = ((word >> 0) & 0xff)
472
+ value_1 = ((word >> 8) & 0xff)
473
+ value_2 = ((word >> 16) & 0xff)
474
+ value_3 = ((word >> 24) & 0xff)
475
+ value_4 = decoder.get_host_u32
476
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
477
+ end
478
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
479
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
480
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
481
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
482
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
483
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
484
+ encode_attributes(encoder, external_selectors:)
485
+ end
374
486
  # @rbs return: ::Integer
375
487
  # @return [Integer]
376
- def ifa_family; fixed_header.ifa_family; end
488
+ def ifa_family; @ifa_family; end
377
489
  # @rbs return: ::Integer
378
490
  # @return [Integer]
379
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
491
+ def ifa_prefixlen; @ifa_prefixlen; end
380
492
  # @rbs return: ::Integer
381
493
  # @return [Integer]
382
- def ifa_flags; fixed_header.ifa_flags; end
494
+ def ifa_flags; @ifa_flags; end
383
495
  # @rbs return: ::Integer
384
496
  # @return [Integer]
385
- def ifa_scope; fixed_header.ifa_scope; end
497
+ def ifa_scope; @ifa_scope; end
386
498
  # @rbs return: ::Integer
387
499
  # @return [Integer]
388
- def ifa_index; fixed_header.ifa_index; end
500
+ def ifa_index; @ifa_index; end
389
501
  # @rbs return: ::String
390
502
  # @return [String]
391
- # @see AttributeSets::AddrAttrs::Address
392
- def address; attributes[:"address"]&.value; end
503
+ def address; self[:"address"]; end
393
504
  # @rbs return: ::String
394
505
  # @return [String]
395
- # @see AttributeSets::AddrAttrs::Local
396
- def local; attributes[:"local"]&.value; end
506
+ def local; self[:"local"]; end
397
507
  # @rbs return: ::String
398
508
  # @return [String]
399
- # @see AttributeSets::AddrAttrs::Label
400
- def label; attributes[:"label"]&.value; end
509
+ def label; self[:"label"]; end
401
510
  # @rbs return: Structs::IfaCacheinfo
402
511
  # @return [Structs::IfaCacheinfo]
403
- # @see AttributeSets::AddrAttrs::Cacheinfo
404
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
512
+ def cacheinfo; self[:"cacheinfo"]; end
405
513
  end
406
514
  # Get / dump IPv4/IPv6 multicast addresses.
407
- class DoGetmulticastRequest < ::Nl::Raw::Message
515
+ class DoGetmulticastRequest < ::Nl::Message
408
516
  TYPE = 58
409
517
  FIXED_HEADER = Structs::Ifaddrmsg
410
518
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
411
- ATTRIBUTES = Ractor.make_shareable(%i[])
519
+ ATTRIBUTES = %i[].freeze
520
+ include ATTRIBUTE_SET::Definitions
521
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
522
+ @ifa_family = ifa_family
523
+ @ifa_prefixlen = ifa_prefixlen
524
+ @ifa_flags = ifa_flags
525
+ @ifa_scope = ifa_scope
526
+ @ifa_index = ifa_index
527
+ @attributes = attributes
528
+ end
529
+ # @private
530
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
531
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
532
+ new(
533
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
534
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
535
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
536
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
537
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
538
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
539
+ )
540
+ end
541
+ # Decodes a message payload from the decoder into a new instance.
542
+ # @rbs (::Nl::Decoder decoder) -> instance
543
+ def self.decode(decoder)
544
+ word = decoder.get_u32
545
+ value_0 = ((word >> 0) & 0xff)
546
+ value_1 = ((word >> 8) & 0xff)
547
+ value_2 = ((word >> 16) & 0xff)
548
+ value_3 = ((word >> 24) & 0xff)
549
+ value_4 = decoder.get_host_u32
550
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
551
+ end
552
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
553
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
554
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
555
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
556
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
557
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
558
+ encode_attributes(encoder, external_selectors:)
559
+ end
412
560
  # @rbs return: ::Integer
413
561
  # @return [Integer]
414
- def ifa_family; fixed_header.ifa_family; end
562
+ def ifa_family; @ifa_family; end
415
563
  # @rbs return: ::Integer
416
564
  # @return [Integer]
417
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
565
+ def ifa_prefixlen; @ifa_prefixlen; end
418
566
  # @rbs return: ::Integer
419
567
  # @return [Integer]
420
- def ifa_flags; fixed_header.ifa_flags; end
568
+ def ifa_flags; @ifa_flags; end
421
569
  # @rbs return: ::Integer
422
570
  # @return [Integer]
423
- def ifa_scope; fixed_header.ifa_scope; end
571
+ def ifa_scope; @ifa_scope; end
424
572
  # @rbs return: ::Integer
425
573
  # @return [Integer]
426
- def ifa_index; fixed_header.ifa_index; end
574
+ def ifa_index; @ifa_index; end
427
575
  end
428
576
  # Get / dump IPv4/IPv6 multicast addresses.
429
- class DoGetmulticastReply < ::Nl::Raw::Message
577
+ class DoGetmulticastReply < ::Nl::Message
430
578
  TYPE = 58
431
579
  FIXED_HEADER = Structs::Ifaddrmsg
432
580
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
433
- ATTRIBUTES = Ractor.make_shareable(%i[cacheinfo multicast])
581
+ ATTRIBUTES = %i[cacheinfo multicast mc_users].freeze
582
+ include ATTRIBUTE_SET::Definitions
583
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
584
+ @ifa_family = ifa_family
585
+ @ifa_prefixlen = ifa_prefixlen
586
+ @ifa_flags = ifa_flags
587
+ @ifa_scope = ifa_scope
588
+ @ifa_index = ifa_index
589
+ @attributes = attributes
590
+ end
591
+ # @private
592
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
593
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
594
+ new(
595
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
596
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
597
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
598
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
599
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
600
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
601
+ )
602
+ end
603
+ # Decodes a message payload from the decoder into a new instance.
604
+ # @rbs (::Nl::Decoder decoder) -> instance
605
+ def self.decode(decoder)
606
+ word = decoder.get_u32
607
+ value_0 = ((word >> 0) & 0xff)
608
+ value_1 = ((word >> 8) & 0xff)
609
+ value_2 = ((word >> 16) & 0xff)
610
+ value_3 = ((word >> 24) & 0xff)
611
+ value_4 = decoder.get_host_u32
612
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
613
+ end
614
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
615
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
616
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
617
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
618
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
619
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
620
+ encode_attributes(encoder, external_selectors:)
621
+ end
434
622
  # @rbs return: ::Integer
435
623
  # @return [Integer]
436
- def ifa_family; fixed_header.ifa_family; end
624
+ def ifa_family; @ifa_family; end
437
625
  # @rbs return: ::Integer
438
626
  # @return [Integer]
439
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
627
+ def ifa_prefixlen; @ifa_prefixlen; end
440
628
  # @rbs return: ::Integer
441
629
  # @return [Integer]
442
- def ifa_flags; fixed_header.ifa_flags; end
630
+ def ifa_flags; @ifa_flags; end
443
631
  # @rbs return: ::Integer
444
632
  # @return [Integer]
445
- def ifa_scope; fixed_header.ifa_scope; end
633
+ def ifa_scope; @ifa_scope; end
446
634
  # @rbs return: ::Integer
447
635
  # @return [Integer]
448
- def ifa_index; fixed_header.ifa_index; end
636
+ def ifa_index; @ifa_index; end
449
637
  # @rbs return: Structs::IfaCacheinfo
450
638
  # @return [Structs::IfaCacheinfo]
451
- # @see AttributeSets::AddrAttrs::Cacheinfo
452
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
639
+ def cacheinfo; self[:"cacheinfo"]; end
453
640
  # @rbs return: ::String
454
641
  # @return [String]
455
- # @see AttributeSets::AddrAttrs::Multicast
456
- def multicast; attributes[:"multicast"]&.value; end
642
+ def multicast; self[:"multicast"]; end
643
+ # @rbs return: ::Integer
644
+ # @return [Integer]
645
+ def mc_users; self[:"mc_users"]; end
457
646
  end
458
647
  # Get / dump IPv4/IPv6 multicast addresses.
459
- class DumpGetmulticastRequest < ::Nl::Raw::Message
648
+ class DumpGetmulticastRequest < ::Nl::Message
460
649
  TYPE = 58
461
650
  FIXED_HEADER = Structs::Ifaddrmsg
462
651
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
463
- ATTRIBUTES = Ractor.make_shareable(%i[])
652
+ ATTRIBUTES = %i[].freeze
653
+ include ATTRIBUTE_SET::Definitions
654
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
655
+ @ifa_family = ifa_family
656
+ @ifa_prefixlen = ifa_prefixlen
657
+ @ifa_flags = ifa_flags
658
+ @ifa_scope = ifa_scope
659
+ @ifa_index = ifa_index
660
+ @attributes = attributes
661
+ end
662
+ # @private
663
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
664
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
665
+ new(
666
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
667
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
668
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
669
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
670
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
671
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
672
+ )
673
+ end
674
+ # Decodes a message payload from the decoder into a new instance.
675
+ # @rbs (::Nl::Decoder decoder) -> instance
676
+ def self.decode(decoder)
677
+ word = decoder.get_u32
678
+ value_0 = ((word >> 0) & 0xff)
679
+ value_1 = ((word >> 8) & 0xff)
680
+ value_2 = ((word >> 16) & 0xff)
681
+ value_3 = ((word >> 24) & 0xff)
682
+ value_4 = decoder.get_host_u32
683
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
684
+ end
685
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
686
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
687
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
688
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
689
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
690
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
691
+ encode_attributes(encoder, external_selectors:)
692
+ end
464
693
  # @rbs return: ::Integer
465
694
  # @return [Integer]
466
- def ifa_family; fixed_header.ifa_family; end
695
+ def ifa_family; @ifa_family; end
467
696
  # @rbs return: ::Integer
468
697
  # @return [Integer]
469
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
698
+ def ifa_prefixlen; @ifa_prefixlen; end
470
699
  # @rbs return: ::Integer
471
700
  # @return [Integer]
472
- def ifa_flags; fixed_header.ifa_flags; end
701
+ def ifa_flags; @ifa_flags; end
473
702
  # @rbs return: ::Integer
474
703
  # @return [Integer]
475
- def ifa_scope; fixed_header.ifa_scope; end
704
+ def ifa_scope; @ifa_scope; end
476
705
  # @rbs return: ::Integer
477
706
  # @return [Integer]
478
- def ifa_index; fixed_header.ifa_index; end
707
+ def ifa_index; @ifa_index; end
479
708
  end
480
709
  # Get / dump IPv4/IPv6 multicast addresses.
481
- class DumpGetmulticastReply < ::Nl::Raw::Message
710
+ class DumpGetmulticastReply < ::Nl::Message
482
711
  TYPE = 58
483
712
  FIXED_HEADER = Structs::Ifaddrmsg
484
713
  ATTRIBUTE_SET = AttributeSets::AddrAttrs
485
- ATTRIBUTES = Ractor.make_shareable(%i[cacheinfo multicast])
714
+ ATTRIBUTES = %i[cacheinfo multicast mc_users].freeze
715
+ include ATTRIBUTE_SET::Definitions
716
+ def initialize(ifa_family, ifa_prefixlen, ifa_flags, ifa_scope, ifa_index, attributes = [])
717
+ @ifa_family = ifa_family
718
+ @ifa_prefixlen = ifa_prefixlen
719
+ @ifa_flags = ifa_flags
720
+ @ifa_scope = ifa_scope
721
+ @ifa_index = ifa_index
722
+ @attributes = attributes
723
+ end
724
+ # @private
725
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
726
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
727
+ new(
728
+ FIXED_HEADER::MEMBERS[:"ifa_family"].coerce(params.fetch(:"ifa_family", 0)),
729
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].coerce(params.fetch(:"ifa_prefixlen", 0)),
730
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].coerce(params.fetch(:"ifa_flags", 0)),
731
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].coerce(params.fetch(:"ifa_scope", 0)),
732
+ FIXED_HEADER::MEMBERS[:"ifa_index"].coerce(params.fetch(:"ifa_index", 0)),
733
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
734
+ )
735
+ end
736
+ # Decodes a message payload from the decoder into a new instance.
737
+ # @rbs (::Nl::Decoder decoder) -> instance
738
+ def self.decode(decoder)
739
+ word = decoder.get_u32
740
+ value_0 = ((word >> 0) & 0xff)
741
+ value_1 = ((word >> 8) & 0xff)
742
+ value_2 = ((word >> 16) & 0xff)
743
+ value_3 = ((word >> 24) & 0xff)
744
+ value_4 = decoder.get_host_u32
745
+ new(value_0, value_1, value_2, value_3, value_4, decode_attributes(decoder, BY_TYPE, 0))
746
+ end
747
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
748
+ FIXED_HEADER::MEMBERS[:"ifa_family"].encode(encoder, @ifa_family)
749
+ FIXED_HEADER::MEMBERS[:"ifa_prefixlen"].encode(encoder, @ifa_prefixlen)
750
+ FIXED_HEADER::MEMBERS[:"ifa_flags"].encode(encoder, @ifa_flags)
751
+ FIXED_HEADER::MEMBERS[:"ifa_scope"].encode(encoder, @ifa_scope)
752
+ FIXED_HEADER::MEMBERS[:"ifa_index"].encode(encoder, @ifa_index)
753
+ encode_attributes(encoder, external_selectors:)
754
+ end
486
755
  # @rbs return: ::Integer
487
756
  # @return [Integer]
488
- def ifa_family; fixed_header.ifa_family; end
757
+ def ifa_family; @ifa_family; end
489
758
  # @rbs return: ::Integer
490
759
  # @return [Integer]
491
- def ifa_prefixlen; fixed_header.ifa_prefixlen; end
760
+ def ifa_prefixlen; @ifa_prefixlen; end
492
761
  # @rbs return: ::Integer
493
762
  # @return [Integer]
494
- def ifa_flags; fixed_header.ifa_flags; end
763
+ def ifa_flags; @ifa_flags; end
495
764
  # @rbs return: ::Integer
496
765
  # @return [Integer]
497
- def ifa_scope; fixed_header.ifa_scope; end
766
+ def ifa_scope; @ifa_scope; end
498
767
  # @rbs return: ::Integer
499
768
  # @return [Integer]
500
- def ifa_index; fixed_header.ifa_index; end
769
+ def ifa_index; @ifa_index; end
501
770
  # @rbs return: Structs::IfaCacheinfo
502
771
  # @return [Structs::IfaCacheinfo]
503
- # @see AttributeSets::AddrAttrs::Cacheinfo
504
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
772
+ def cacheinfo; self[:"cacheinfo"]; end
505
773
  # @rbs return: ::String
506
774
  # @return [String]
507
- # @see AttributeSets::AddrAttrs::Multicast
508
- def multicast; attributes[:"multicast"]&.value; end
775
+ def multicast; self[:"multicast"]; end
776
+ # @rbs return: ::Integer
777
+ # @return [Integer]
778
+ def mc_users; self[:"mc_users"]; end
509
779
  end
510
780
  end
511
781
  module Notifications
512
782
  end
513
783
  # @private
514
- NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
784
+ NOTIFICATIONS = {}.freeze #: Hash[::Integer, ::Class]
515
785
  # Add new address
516
786
  # @rbs (?ifa_family: ::Integer, ?ifa_prefixlen: ::Integer, ?ifa_flags: ::Integer, ?ifa_scope: ::Integer, ?ifa_index: ::Integer, ?address: ::String, ?local: ::String, ?label: ::String, ?cacheinfo: (Structs::IfaCacheinfo | ::Hash[::Symbol, untyped])) -> void
517
787
  # @param [Hash] args