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-route.yaml from Linux v7.2.
3
+ # This file is based on Documentation/netlink/specs/rt-route.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 RtRoute < ::Nl::Raw::Family
25
25
  super
26
26
  end
27
27
  # @private
28
- MCAST_GROUPS = Ractor.make_shareable({}) #: Hash[::Symbol, ::Nl::McastGroup]
28
+ MCAST_GROUPS = {:"rtnlgrp_ipv4_route" => ::Nl::McastGroup.new("rtnlgrp-ipv4-route", 7), :"rtnlgrp_ipv6_route" => ::Nl::McastGroup.new("rtnlgrp-ipv6-route", 11)}.freeze #: Hash[::Symbol, ::Nl::McastGroup]
29
29
  module Enums
30
30
  module RtmType
31
31
  Unspec = 0
@@ -41,6 +41,17 @@ class RtRoute < ::Nl::Raw::Family
41
41
  Nat = 10
42
42
  Xresolve = 11
43
43
  end
44
+ # Why the kernel deleted a route. New causes may be appended. The
45
+ # value space is family-agnostic, a value is never reinterpreted
46
+ # per address family.
47
+ module DelReason
48
+ # The deletion path does not record a cause.
49
+ Unspec = 0
50
+ # The RTF_EXPIRES lifetime ran out and the route was garbage collected.
51
+ Expired = 1
52
+ # A Router Advertisement withdrew the route with a zero lifetime.
53
+ RaWithdrawn = 2
54
+ end
44
55
  end
45
56
  module Structs
46
57
  Rtmsg = Struct.new(
@@ -74,14 +85,43 @@ class RtRoute < ::Nl::Raw::Family
74
85
  # @!attribute [rw] rtm_flags
75
86
  # @return [Integer]
76
87
  # @private
77
- MEMBERS = Ractor.make_shareable({rtm_family: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_dst_len: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_src_len: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_tos: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_table: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_protocol: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_scope: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_type: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil), rtm_flags: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
88
+ MEMBERS = {rtm_family: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_dst_len: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_src_len: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_tos: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_table: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_protocol: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_scope: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_type: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, rtm_flags: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new}.freeze #: Hash[::Symbol, ::Nl::_DataType]
89
+ Ractor.make_shareable(MEMBERS) if defined?(Ractor)
90
+ # @private
91
+ # @rbs (Hash[Symbol, untyped] params, ?context: untyped) -> instance
92
+ def self.from_params(params, context: nil)
93
+ unknown = params.keys - members
94
+ raise ArgumentError, "unknown struct members: #{unknown.join(', ')}" unless unknown.empty?
95
+ self.new(
96
+ MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0), context:),
97
+ MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0), context:),
98
+ MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0), context:),
99
+ MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0), context:),
100
+ MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0), context:),
101
+ MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0), context:),
102
+ MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0), context:),
103
+ MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0), context:),
104
+ MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0), context:),
105
+ )
106
+ end
78
107
  # Decodes the struct.
79
108
  # @rbs decoder: ::Nl::Decoder
80
109
  # @rbs return: instance
81
110
  # @param [Nl::Decoder] decoder
82
111
  # @return [self]
83
112
  def self.decode(decoder)
84
- self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
113
+ word = decoder.get_u32
114
+ value_0 = ((word >> 0) & 0xff)
115
+ value_1 = ((word >> 8) & 0xff)
116
+ value_2 = ((word >> 16) & 0xff)
117
+ value_3 = ((word >> 24) & 0xff)
118
+ word = decoder.get_u32
119
+ value_4 = ((word >> 0) & 0xff)
120
+ value_5 = ((word >> 8) & 0xff)
121
+ value_6 = ((word >> 16) & 0xff)
122
+ value_7 = ((word >> 24) & 0xff)
123
+ value_8 = decoder.get_host_u32
124
+ self.new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8)
85
125
  end
86
126
  # Encodes the struct.
87
127
  # @rbs encoder: ::Nl::Encoder
@@ -89,7 +129,15 @@ class RtRoute < ::Nl::Raw::Family
89
129
  # @param [Nl::Encoder] encoder
90
130
  # @return [void]
91
131
  def encode(encoder)
92
- MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
132
+ MEMBERS[:"rtm_family"].encode(encoder, public_send(:"rtm_family"))
133
+ MEMBERS[:"rtm_dst_len"].encode(encoder, public_send(:"rtm_dst_len"))
134
+ MEMBERS[:"rtm_src_len"].encode(encoder, public_send(:"rtm_src_len"))
135
+ MEMBERS[:"rtm_tos"].encode(encoder, public_send(:"rtm_tos"))
136
+ MEMBERS[:"rtm_table"].encode(encoder, public_send(:"rtm_table"))
137
+ MEMBERS[:"rtm_protocol"].encode(encoder, public_send(:"rtm_protocol"))
138
+ MEMBERS[:"rtm_scope"].encode(encoder, public_send(:"rtm_scope"))
139
+ MEMBERS[:"rtm_type"].encode(encoder, public_send(:"rtm_type"))
140
+ MEMBERS[:"rtm_flags"].encode(encoder, public_send(:"rtm_flags"))
93
141
  end
94
142
  end
95
143
  RtaCacheinfo = Struct.new(
@@ -111,14 +159,33 @@ class RtRoute < ::Nl::Raw::Family
111
159
  # @!attribute [rw] rta_used
112
160
  # @return [Integer]
113
161
  # @private
114
- MEMBERS = Ractor.make_shareable({rta_clntref: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), rta_lastuse: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), rta_expires: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), rta_error: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil), rta_used: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
162
+ MEMBERS = {rta_clntref: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, rta_lastuse: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, rta_expires: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, rta_error: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, rta_used: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new}.freeze #: Hash[::Symbol, ::Nl::_DataType]
163
+ Ractor.make_shareable(MEMBERS) if defined?(Ractor)
164
+ # @private
165
+ # @rbs (Hash[Symbol, untyped] params, ?context: untyped) -> instance
166
+ def self.from_params(params, context: nil)
167
+ unknown = params.keys - members
168
+ raise ArgumentError, "unknown struct members: #{unknown.join(', ')}" unless unknown.empty?
169
+ self.new(
170
+ MEMBERS[:"rta_clntref"].coerce(params.fetch(:"rta_clntref", 0), context:),
171
+ MEMBERS[:"rta_lastuse"].coerce(params.fetch(:"rta_lastuse", 0), context:),
172
+ MEMBERS[:"rta_expires"].coerce(params.fetch(:"rta_expires", 0), context:),
173
+ MEMBERS[:"rta_error"].coerce(params.fetch(:"rta_error", 0), context:),
174
+ MEMBERS[:"rta_used"].coerce(params.fetch(:"rta_used", 0), context:),
175
+ )
176
+ end
115
177
  # Decodes the struct.
116
178
  # @rbs decoder: ::Nl::Decoder
117
179
  # @rbs return: instance
118
180
  # @param [Nl::Decoder] decoder
119
181
  # @return [self]
120
182
  def self.decode(decoder)
121
- self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
183
+ value_0 = decoder.get_host_u32
184
+ value_1 = decoder.get_host_u32
185
+ value_2 = decoder.get_host_u32
186
+ value_3 = decoder.get_host_u32
187
+ value_4 = decoder.get_host_u32
188
+ self.new(value_0, value_1, value_2, value_3, value_4)
122
189
  end
123
190
  # Encodes the struct.
124
191
  # @rbs encoder: ::Nl::Encoder
@@ -126,1332 +193,1584 @@ class RtRoute < ::Nl::Raw::Family
126
193
  # @param [Nl::Encoder] encoder
127
194
  # @return [void]
128
195
  def encode(encoder)
129
- MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
196
+ MEMBERS[:"rta_clntref"].encode(encoder, public_send(:"rta_clntref"))
197
+ MEMBERS[:"rta_lastuse"].encode(encoder, public_send(:"rta_lastuse"))
198
+ MEMBERS[:"rta_expires"].encode(encoder, public_send(:"rta_expires"))
199
+ MEMBERS[:"rta_error"].encode(encoder, public_send(:"rta_error"))
200
+ MEMBERS[:"rta_used"].encode(encoder, public_send(:"rta_used"))
130
201
  end
131
202
  end
132
203
  end
133
204
  module AttributeSets
134
205
  class RouteAttrs < ::Nl::AttributeSet
135
- # Abstract class
136
- class Attribute < ::Nl::AttributeSet::Attribute
137
- end
138
- class Dst < Attribute
139
- TYPE = 1
140
- NAME = :"dst"
141
- # @private
142
- ORDER = 0
143
- # @private
144
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
145
- end
146
- class Src < Attribute
147
- TYPE = 2
148
- NAME = :"src"
149
- # @private
150
- ORDER = 1
151
- # @private
152
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
153
- end
154
- class Iif < Attribute
155
- TYPE = 3
156
- NAME = :"iif"
157
- # @private
158
- ORDER = 2
159
- # @private
160
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
161
- end
162
- class Oif < Attribute
163
- TYPE = 4
164
- NAME = :"oif"
165
- # @private
166
- ORDER = 3
167
- # @private
168
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
169
- end
170
- class Gateway < Attribute
171
- TYPE = 5
172
- NAME = :"gateway"
173
- # @private
174
- ORDER = 4
175
- # @private
176
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
177
- end
178
- class Priority < Attribute
179
- TYPE = 6
180
- NAME = :"priority"
181
- # @private
182
- ORDER = 5
183
- # @private
184
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
185
- end
186
- class Prefsrc < Attribute
187
- TYPE = 7
188
- NAME = :"prefsrc"
189
- # @private
190
- ORDER = 6
191
- # @private
192
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
193
- end
194
- class Metrics < Attribute
195
- TYPE = 8
196
- NAME = :"metrics"
197
- # @private
198
- ORDER = 7
199
- end
200
- class Multipath < Attribute
201
- TYPE = 9
202
- NAME = :"multipath"
203
- # @private
204
- ORDER = 8
205
- # @private
206
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
207
- end
208
- class Protoinfo < Attribute
209
- TYPE = 10
210
- NAME = :"protoinfo"
211
- # @private
212
- ORDER = 9
213
- # @private
214
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
215
- end
216
- class Flow < Attribute
217
- TYPE = 11
218
- NAME = :"flow"
219
- # @private
220
- ORDER = 10
221
- # @private
222
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
223
- end
224
- class Cacheinfo < Attribute
225
- TYPE = 12
226
- NAME = :"cacheinfo"
227
- # @private
228
- ORDER = 11
229
- # @private
230
- DATATYPE = ::Nl::DataTypes::Struct.new(Structs::RtaCacheinfo, check: nil, consume_remaining: true)
231
- end
232
- class Session < Attribute
233
- TYPE = 13
234
- NAME = :"session"
235
- # @private
236
- ORDER = 12
237
- # @private
238
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
239
- end
240
- class MpAlgo < Attribute
241
- TYPE = 14
242
- NAME = :"mp_algo"
243
- # @private
244
- ORDER = 13
245
- # @private
246
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
247
- end
248
- class Table < Attribute
249
- TYPE = 15
250
- NAME = :"table"
251
- # @private
252
- ORDER = 14
253
- # @private
254
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
255
- end
256
- class Mark < Attribute
257
- TYPE = 16
258
- NAME = :"mark"
259
- # @private
260
- ORDER = 15
261
- # @private
262
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
263
- end
264
- class MfcStats < Attribute
265
- TYPE = 17
266
- NAME = :"mfc_stats"
267
- # @private
268
- ORDER = 16
269
- # @private
270
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
206
+ module Definitions
207
+ # @rbs return: ::String
208
+ # @return [String]
209
+ def dst; self[:"dst"]; end
210
+ # @rbs return: ::String
211
+ # @return [String]
212
+ def src; self[:"src"]; end
213
+ # @rbs return: ::Integer
214
+ # @return [Integer]
215
+ def iif; self[:"iif"]; end
216
+ # @rbs return: ::Integer
217
+ # @return [Integer]
218
+ def oif; self[:"oif"]; end
219
+ # @rbs return: ::String
220
+ # @return [String]
221
+ def gateway; self[:"gateway"]; end
222
+ # @rbs return: ::Integer
223
+ # @return [Integer]
224
+ def priority; self[:"priority"]; end
225
+ # @rbs return: ::String
226
+ # @return [String]
227
+ def prefsrc; self[:"prefsrc"]; end
228
+ # @rbs return: AttributeSets::Metrics
229
+ # @return [AttributeSets::Metrics]
230
+ def metrics; self[:"metrics"]; end
231
+ # @rbs return: ::String
232
+ # @return [String]
233
+ def multipath; self[:"multipath"]; end
234
+ # @rbs return: ::String
235
+ # @return [String]
236
+ def protoinfo; self[:"protoinfo"]; end
237
+ # @rbs return: ::Integer
238
+ # @return [Integer]
239
+ def flow; self[:"flow"]; end
240
+ # @rbs return: Structs::RtaCacheinfo
241
+ # @return [Structs::RtaCacheinfo]
242
+ def cacheinfo; self[:"cacheinfo"]; end
243
+ # @rbs return: ::String
244
+ # @return [String]
245
+ def session; self[:"session"]; end
246
+ # @rbs return: ::String
247
+ # @return [String]
248
+ def mp_algo; self[:"mp_algo"]; end
249
+ # @rbs return: ::Integer
250
+ # @return [Integer]
251
+ def table; self[:"table"]; end
252
+ # @rbs return: ::Integer
253
+ # @return [Integer]
254
+ def mark; self[:"mark"]; end
255
+ # @rbs return: ::String
256
+ # @return [String]
257
+ def mfc_stats; self[:"mfc_stats"]; end
258
+ # @rbs return: ::String
259
+ # @return [String]
260
+ def via; self[:"via"]; end
261
+ # @rbs return: ::String
262
+ # @return [String]
263
+ def newdst; self[:"newdst"]; end
264
+ # @rbs return: ::Integer
265
+ # @return [Integer]
266
+ def pref; self[:"pref"]; end
267
+ # @rbs return: ::Integer
268
+ # @return [Integer]
269
+ def encap_type; self[:"encap_type"]; end
270
+ # @rbs return: ::String
271
+ # @return [String]
272
+ def encap; self[:"encap"]; end
273
+ # @rbs return: ::Integer
274
+ # @return [Integer]
275
+ def expires; self[:"expires"]; end
276
+ # @rbs return: ::String
277
+ # @return [String]
278
+ def pad; self[:"pad"]; end
279
+ # @rbs return: ::Integer
280
+ # @return [Integer]
281
+ def uid; self[:"uid"]; end
282
+ # @rbs return: ::Integer
283
+ # @return [Integer]
284
+ def ttl_propagate; self[:"ttl_propagate"]; end
285
+ # @rbs return: ::Integer
286
+ # @return [Integer]
287
+ def ip_proto; self[:"ip_proto"]; end
288
+ # @rbs return: ::Integer
289
+ # @return [Integer]
290
+ def sport; self[:"sport"]; end
291
+ # @rbs return: ::Integer
292
+ # @return [Integer]
293
+ def dport; self[:"dport"]; end
294
+ # @rbs return: ::Integer
295
+ # @return [Integer]
296
+ def nh_id; self[:"nh_id"]; end
297
+ # @rbs return: ::Integer
298
+ # @return [Integer]
299
+ def flowlabel; self[:"flowlabel"]; end
300
+ # Emitted only on RTM_DELROUTE notifications, and only when the
301
+ # deletion path records a cause. An absent attribute means
302
+ # either an older kernel or a deletion path that does not
303
+ # record its cause, consumers must treat absent and unspec
304
+ # identically. Currently only IPv6 deletion paths record a
305
+ # cause. The attribute is notification-only, the kernel rejects
306
+ # it in requests.
307
+ #
308
+ #
309
+ # Known enum values are defined in {Enums::DelReason}.
310
+ # @rbs return: ::Integer
311
+ # @return [Integer]
312
+ def del_reason; self[:"del_reason"]; end
271
313
  end
272
- class Via < Attribute
273
- TYPE = 18
274
- NAME = :"via"
275
- # @private
276
- ORDER = 17
277
- # @private
278
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
314
+ include Definitions
315
+ # Decodes attributes from the decoder into a new attribute set.
316
+ # @rbs (::Nl::Decoder decoder, ?external_selectors: ::Array[untyped]) -> instance
317
+ def self.decode(decoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
318
+ super(decoder, BY_TYPE, 0, external_selectors)
279
319
  end
280
- class Newdst < Attribute
281
- TYPE = 19
282
- NAME = :"newdst"
283
- # @private
284
- ORDER = 18
285
- # @private
286
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
320
+ end
321
+ class Metrics < ::Nl::AttributeSet
322
+ module Definitions
323
+ # @rbs return: ::Integer
324
+ # @return [Integer]
325
+ def lock; self[:"lock"]; end
326
+ # @rbs return: ::Integer
327
+ # @return [Integer]
328
+ def mtu; self[:"mtu"]; end
329
+ # @rbs return: ::Integer
330
+ # @return [Integer]
331
+ def window; self[:"window"]; end
332
+ # @rbs return: ::Integer
333
+ # @return [Integer]
334
+ def rtt; self[:"rtt"]; end
335
+ # @rbs return: ::Integer
336
+ # @return [Integer]
337
+ def rttvar; self[:"rttvar"]; end
338
+ # @rbs return: ::Integer
339
+ # @return [Integer]
340
+ def ssthresh; self[:"ssthresh"]; end
341
+ # @rbs return: ::Integer
342
+ # @return [Integer]
343
+ def cwnd; self[:"cwnd"]; end
344
+ # @rbs return: ::Integer
345
+ # @return [Integer]
346
+ def advmss; self[:"advmss"]; end
347
+ # @rbs return: ::Integer
348
+ # @return [Integer]
349
+ def reordering; self[:"reordering"]; end
350
+ # @rbs return: ::Integer
351
+ # @return [Integer]
352
+ def hoplimit; self[:"hoplimit"]; end
353
+ # @rbs return: ::Integer
354
+ # @return [Integer]
355
+ def initcwnd; self[:"initcwnd"]; end
356
+ # @rbs return: ::Integer
357
+ # @return [Integer]
358
+ def features; self[:"features"]; end
359
+ # @rbs return: ::Integer
360
+ # @return [Integer]
361
+ def rto_min; self[:"rto_min"]; end
362
+ # @rbs return: ::Integer
363
+ # @return [Integer]
364
+ def initrwnd; self[:"initrwnd"]; end
365
+ # @rbs return: ::Integer
366
+ # @return [Integer]
367
+ def quickack; self[:"quickack"]; end
368
+ # @rbs return: ::String
369
+ # @return [String]
370
+ def cc_algo; self[:"cc_algo"]; end
371
+ # @rbs return: ::Integer
372
+ # @return [Integer]
373
+ def fastopen_no_cookie; self[:"fastopen_no_cookie"]; end
287
374
  end
288
- class Pref < Attribute
289
- TYPE = 20
290
- NAME = :"pref"
291
- # @private
292
- ORDER = 19
293
- # @private
294
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
375
+ include Definitions
376
+ # Decodes attributes from the decoder into a new attribute set.
377
+ # @rbs (::Nl::Decoder decoder, ?external_selectors: ::Array[untyped]) -> instance
378
+ def self.decode(decoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
379
+ super(decoder, BY_TYPE, 0, external_selectors)
295
380
  end
296
- class EncapType < Attribute
297
- TYPE = 21
298
- NAME = :"encap_type"
299
- # @private
300
- ORDER = 20
301
- # @private
302
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
303
- end
304
- class Encap < Attribute
305
- TYPE = 22
306
- NAME = :"encap"
307
- # @private
308
- ORDER = 21
309
- # @private
310
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
381
+ end
382
+ end
383
+ module AttributeSets
384
+ class RouteAttrs
385
+ module Definitions
386
+ # @private
387
+ BY_TYPE = ::Array.new(33).tap do |definitions|
388
+ definitions[1] = ::Nl::AttributeSet::Definition.new(id: 1, name: :"dst", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 0, selector_slot: nil)
389
+ definitions[2] = ::Nl::AttributeSet::Definition.new(id: 2, name: :"src", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 1, selector_slot: nil)
390
+ definitions[3] = ::Nl::AttributeSet::Definition.new(id: 3, name: :"iif", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 2, selector_slot: nil)
391
+ definitions[4] = ::Nl::AttributeSet::Definition.new(id: 4, name: :"oif", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 3, selector_slot: nil)
392
+ definitions[5] = ::Nl::AttributeSet::Definition.new(id: 5, name: :"gateway", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 4, selector_slot: nil)
393
+ definitions[6] = ::Nl::AttributeSet::Definition.new(id: 6, name: :"priority", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 5, selector_slot: nil)
394
+ definitions[7] = ::Nl::AttributeSet::Definition.new(id: 7, name: :"prefsrc", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 6, selector_slot: nil)
395
+ definitions[8] = ::Nl::AttributeSet::Definition.new(id: 8, name: :"metrics", datatype: ::Nl::DataTypes::NestedAttributes.new(AttributeSets::Metrics, selector_bindings: []), multi: false, order: 7, selector_slot: nil)
396
+ definitions[9] = ::Nl::AttributeSet::Definition.new(id: 9, name: :"multipath", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 8, selector_slot: nil)
397
+ definitions[10] = ::Nl::AttributeSet::Definition.new(id: 10, name: :"protoinfo", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 9, selector_slot: nil)
398
+ definitions[11] = ::Nl::AttributeSet::Definition.new(id: 11, name: :"flow", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 10, selector_slot: nil)
399
+ definitions[12] = ::Nl::AttributeSet::Definition.new(id: 12, name: :"cacheinfo", datatype: ::Nl::DataTypes::Struct.new(Structs::RtaCacheinfo, consume_remaining: true), multi: false, order: 11, selector_slot: nil)
400
+ definitions[13] = ::Nl::AttributeSet::Definition.new(id: 13, name: :"session", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 12, selector_slot: nil)
401
+ definitions[14] = ::Nl::AttributeSet::Definition.new(id: 14, name: :"mp_algo", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 13, selector_slot: nil)
402
+ definitions[15] = ::Nl::AttributeSet::Definition.new(id: 15, name: :"table", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 14, selector_slot: nil)
403
+ definitions[16] = ::Nl::AttributeSet::Definition.new(id: 16, name: :"mark", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 15, selector_slot: nil)
404
+ definitions[17] = ::Nl::AttributeSet::Definition.new(id: 17, name: :"mfc_stats", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 16, selector_slot: nil)
405
+ definitions[18] = ::Nl::AttributeSet::Definition.new(id: 18, name: :"via", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 17, selector_slot: nil)
406
+ definitions[19] = ::Nl::AttributeSet::Definition.new(id: 19, name: :"newdst", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 18, selector_slot: nil)
407
+ definitions[20] = ::Nl::AttributeSet::Definition.new(id: 20, name: :"pref", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, multi: false, order: 19, selector_slot: nil)
408
+ definitions[21] = ::Nl::AttributeSet::Definition.new(id: 21, name: :"encap_type", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U16].new, multi: false, order: 20, selector_slot: nil)
409
+ definitions[22] = ::Nl::AttributeSet::Definition.new(id: 22, name: :"encap", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 21, selector_slot: nil)
410
+ definitions[23] = ::Nl::AttributeSet::Definition.new(id: 23, name: :"expires", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 22, selector_slot: nil)
411
+ definitions[24] = ::Nl::AttributeSet::Definition.new(id: 24, name: :"pad", datatype: ::Nl::DataTypes::Binary.new, multi: false, order: 23, selector_slot: nil)
412
+ definitions[25] = ::Nl::AttributeSet::Definition.new(id: 25, name: :"uid", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 24, selector_slot: nil)
413
+ definitions[26] = ::Nl::AttributeSet::Definition.new(id: 26, name: :"ttl_propagate", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, multi: false, order: 25, selector_slot: nil)
414
+ definitions[27] = ::Nl::AttributeSet::Definition.new(id: 27, name: :"ip_proto", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U8].new, multi: false, order: 26, selector_slot: nil)
415
+ definitions[28] = ::Nl::AttributeSet::Definition.new(id: 28, name: :"sport", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U16].new, multi: false, order: 27, selector_slot: nil)
416
+ definitions[29] = ::Nl::AttributeSet::Definition.new(id: 29, name: :"dport", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U16].new, multi: false, order: 28, selector_slot: nil)
417
+ definitions[30] = ::Nl::AttributeSet::Definition.new(id: 30, name: :"nh_id", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 29, selector_slot: nil)
418
+ definitions[31] = ::Nl::AttributeSet::Definition.new(id: 31, name: :"flowlabel", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Big::U32].new, multi: false, order: 30, selector_slot: nil)
419
+ definitions[32] = ::Nl::AttributeSet::Definition.new(id: 32, name: :"del_reason", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 31, selector_slot: nil)
420
+ end.freeze #: Array[::Nl::AttributeSet::Definition?]
421
+ Ractor.make_shareable(BY_TYPE) if defined?(Ractor)
422
+ # @private
423
+ BY_NAME = BY_TYPE.compact.to_h { [it.name, it] }.freeze #: Hash[::Symbol, ::Nl::AttributeSet::Definition]
311
424
  end
312
- class Expires < Attribute
313
- TYPE = 23
314
- NAME = :"expires"
315
- # @private
316
- ORDER = 22
317
- # @private
318
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
425
+ end
426
+ class Metrics
427
+ module Definitions
428
+ # @private
429
+ BY_TYPE = ::Array.new(18).tap do |definitions|
430
+ definitions[1] = ::Nl::AttributeSet::Definition.new(id: 1, name: :"lock", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 0, selector_slot: nil)
431
+ definitions[2] = ::Nl::AttributeSet::Definition.new(id: 2, name: :"mtu", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 1, selector_slot: nil)
432
+ definitions[3] = ::Nl::AttributeSet::Definition.new(id: 3, name: :"window", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 2, selector_slot: nil)
433
+ definitions[4] = ::Nl::AttributeSet::Definition.new(id: 4, name: :"rtt", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 3, selector_slot: nil)
434
+ definitions[5] = ::Nl::AttributeSet::Definition.new(id: 5, name: :"rttvar", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 4, selector_slot: nil)
435
+ definitions[6] = ::Nl::AttributeSet::Definition.new(id: 6, name: :"ssthresh", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 5, selector_slot: nil)
436
+ definitions[7] = ::Nl::AttributeSet::Definition.new(id: 7, name: :"cwnd", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 6, selector_slot: nil)
437
+ definitions[8] = ::Nl::AttributeSet::Definition.new(id: 8, name: :"advmss", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 7, selector_slot: nil)
438
+ definitions[9] = ::Nl::AttributeSet::Definition.new(id: 9, name: :"reordering", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 8, selector_slot: nil)
439
+ definitions[10] = ::Nl::AttributeSet::Definition.new(id: 10, name: :"hoplimit", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 9, selector_slot: nil)
440
+ definitions[11] = ::Nl::AttributeSet::Definition.new(id: 11, name: :"initcwnd", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 10, selector_slot: nil)
441
+ definitions[12] = ::Nl::AttributeSet::Definition.new(id: 12, name: :"features", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 11, selector_slot: nil)
442
+ definitions[13] = ::Nl::AttributeSet::Definition.new(id: 13, name: :"rto_min", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 12, selector_slot: nil)
443
+ definitions[14] = ::Nl::AttributeSet::Definition.new(id: 14, name: :"initrwnd", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 13, selector_slot: nil)
444
+ definitions[15] = ::Nl::AttributeSet::Definition.new(id: 15, name: :"quickack", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 14, selector_slot: nil)
445
+ definitions[16] = ::Nl::AttributeSet::Definition.new(id: 16, name: :"cc_algo", datatype: ::Nl::DataTypes::String.new, multi: false, order: 15, selector_slot: nil)
446
+ definitions[17] = ::Nl::AttributeSet::Definition.new(id: 17, name: :"fastopen_no_cookie", datatype: ::Nl::DataTypes::Scalar[::Nl::Endian::Host::U32].new, multi: false, order: 16, selector_slot: nil)
447
+ end.freeze #: Array[::Nl::AttributeSet::Definition?]
448
+ Ractor.make_shareable(BY_TYPE) if defined?(Ractor)
449
+ # @private
450
+ BY_NAME = BY_TYPE.compact.to_h { [it.name, it] }.freeze #: Hash[::Symbol, ::Nl::AttributeSet::Definition]
319
451
  end
320
- class Pad < Attribute
321
- TYPE = 24
322
- NAME = :"pad"
323
- # @private
324
- ORDER = 23
325
- # @private
326
- DATATYPE = ::Nl::DataTypes::Binary.new(check: nil)
452
+ end
453
+ end
454
+ module Messages
455
+ # Dump route information.
456
+ class DoGetrouteRequest < ::Nl::Message
457
+ TYPE = 26
458
+ FIXED_HEADER = Structs::Rtmsg
459
+ ATTRIBUTE_SET = AttributeSets::RouteAttrs
460
+ ATTRIBUTES = %i[dst src iif oif mark uid ip_proto sport dport flowlabel].freeze
461
+ include ATTRIBUTE_SET::Definitions
462
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
463
+ @rtm_family = rtm_family
464
+ @rtm_dst_len = rtm_dst_len
465
+ @rtm_src_len = rtm_src_len
466
+ @rtm_tos = rtm_tos
467
+ @rtm_table = rtm_table
468
+ @rtm_protocol = rtm_protocol
469
+ @rtm_scope = rtm_scope
470
+ @rtm_type = rtm_type
471
+ @rtm_flags = rtm_flags
472
+ @attributes = attributes
327
473
  end
328
- class Uid < Attribute
329
- TYPE = 25
330
- NAME = :"uid"
331
- # @private
332
- ORDER = 24
333
- # @private
334
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
474
+ # @private
475
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
476
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
477
+ new(
478
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
479
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
480
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
481
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
482
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
483
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
484
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
485
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
486
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
487
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
488
+ )
335
489
  end
336
- class TtlPropagate < Attribute
337
- TYPE = 26
338
- NAME = :"ttl_propagate"
339
- # @private
340
- ORDER = 25
341
- # @private
342
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
490
+ # Decodes a message payload from the decoder into a new instance.
491
+ # @rbs (::Nl::Decoder decoder) -> instance
492
+ def self.decode(decoder)
493
+ word = decoder.get_u32
494
+ value_0 = ((word >> 0) & 0xff)
495
+ value_1 = ((word >> 8) & 0xff)
496
+ value_2 = ((word >> 16) & 0xff)
497
+ value_3 = ((word >> 24) & 0xff)
498
+ word = decoder.get_u32
499
+ value_4 = ((word >> 0) & 0xff)
500
+ value_5 = ((word >> 8) & 0xff)
501
+ value_6 = ((word >> 16) & 0xff)
502
+ value_7 = ((word >> 24) & 0xff)
503
+ value_8 = decoder.get_host_u32
504
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
343
505
  end
344
- class IpProto < Attribute
345
- TYPE = 27
346
- NAME = :"ip_proto"
347
- # @private
348
- ORDER = 26
349
- # @private
350
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
506
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
507
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
508
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
509
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
510
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
511
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
512
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
513
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
514
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
515
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
516
+ encode_attributes(encoder, external_selectors:)
351
517
  end
352
- class Sport < Attribute
353
- TYPE = 28
354
- NAME = :"sport"
355
- # @private
356
- ORDER = 27
357
- # @private
358
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
518
+ # @rbs return: ::Integer
519
+ # @return [Integer]
520
+ def rtm_family; @rtm_family; end
521
+ # @rbs return: ::Integer
522
+ # @return [Integer]
523
+ def rtm_dst_len; @rtm_dst_len; end
524
+ # @rbs return: ::Integer
525
+ # @return [Integer]
526
+ def rtm_src_len; @rtm_src_len; end
527
+ # @rbs return: ::Integer
528
+ # @return [Integer]
529
+ def rtm_tos; @rtm_tos; end
530
+ # @rbs return: ::Integer
531
+ # @return [Integer]
532
+ def rtm_table; @rtm_table; end
533
+ # @rbs return: ::Integer
534
+ # @return [Integer]
535
+ def rtm_protocol; @rtm_protocol; end
536
+ # @rbs return: ::Integer
537
+ # @return [Integer]
538
+ def rtm_scope; @rtm_scope; end
539
+ # @rbs return: ::Integer
540
+ # @return [Integer]
541
+ def rtm_type; @rtm_type; end
542
+ # @rbs return: ::Integer
543
+ # @return [Integer]
544
+ def rtm_flags; @rtm_flags; end
545
+ # @rbs return: ::String
546
+ # @return [String]
547
+ def dst; self[:"dst"]; end
548
+ # @rbs return: ::String
549
+ # @return [String]
550
+ def src; self[:"src"]; end
551
+ # @rbs return: ::Integer
552
+ # @return [Integer]
553
+ def iif; self[:"iif"]; end
554
+ # @rbs return: ::Integer
555
+ # @return [Integer]
556
+ def oif; self[:"oif"]; end
557
+ # @rbs return: ::Integer
558
+ # @return [Integer]
559
+ def mark; self[:"mark"]; end
560
+ # @rbs return: ::Integer
561
+ # @return [Integer]
562
+ def uid; self[:"uid"]; end
563
+ # @rbs return: ::Integer
564
+ # @return [Integer]
565
+ def ip_proto; self[:"ip_proto"]; end
566
+ # @rbs return: ::Integer
567
+ # @return [Integer]
568
+ def sport; self[:"sport"]; end
569
+ # @rbs return: ::Integer
570
+ # @return [Integer]
571
+ def dport; self[:"dport"]; end
572
+ # @rbs return: ::Integer
573
+ # @return [Integer]
574
+ def flowlabel; self[:"flowlabel"]; end
575
+ end
576
+ # Dump route information.
577
+ class DoGetrouteReply < ::Nl::Message
578
+ TYPE = 24
579
+ FIXED_HEADER = Structs::Rtmsg
580
+ ATTRIBUTE_SET = AttributeSets::RouteAttrs
581
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel del_reason].freeze
582
+ include ATTRIBUTE_SET::Definitions
583
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
584
+ @rtm_family = rtm_family
585
+ @rtm_dst_len = rtm_dst_len
586
+ @rtm_src_len = rtm_src_len
587
+ @rtm_tos = rtm_tos
588
+ @rtm_table = rtm_table
589
+ @rtm_protocol = rtm_protocol
590
+ @rtm_scope = rtm_scope
591
+ @rtm_type = rtm_type
592
+ @rtm_flags = rtm_flags
593
+ @attributes = attributes
359
594
  end
360
- class Dport < Attribute
361
- TYPE = 29
362
- NAME = :"dport"
363
- # @private
364
- ORDER = 28
365
- # @private
366
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
595
+ # @private
596
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
597
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
598
+ new(
599
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
600
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
601
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
602
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
603
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
604
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
605
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
606
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
607
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
608
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
609
+ )
367
610
  end
368
- class NhId < Attribute
369
- TYPE = 30
370
- NAME = :"nh_id"
371
- # @private
372
- ORDER = 29
373
- # @private
374
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
611
+ # Decodes a message payload from the decoder into a new instance.
612
+ # @rbs (::Nl::Decoder decoder) -> instance
613
+ def self.decode(decoder)
614
+ word = decoder.get_u32
615
+ value_0 = ((word >> 0) & 0xff)
616
+ value_1 = ((word >> 8) & 0xff)
617
+ value_2 = ((word >> 16) & 0xff)
618
+ value_3 = ((word >> 24) & 0xff)
619
+ word = decoder.get_u32
620
+ value_4 = ((word >> 0) & 0xff)
621
+ value_5 = ((word >> 8) & 0xff)
622
+ value_6 = ((word >> 16) & 0xff)
623
+ value_7 = ((word >> 24) & 0xff)
624
+ value_8 = decoder.get_host_u32
625
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
375
626
  end
376
- class Flowlabel < Attribute
377
- TYPE = 31
378
- NAME = :"flowlabel"
379
- # @private
380
- ORDER = 30
381
- # @private
382
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Big::U32, check: nil)
627
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
628
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
629
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
630
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
631
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
632
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
633
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
634
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
635
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
636
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
637
+ encode_attributes(encoder, external_selectors:)
383
638
  end
384
- # @private
385
- BY_NAME = Ractor.make_shareable({:"dst" => Dst, :"src" => Src, :"iif" => Iif, :"oif" => Oif, :"gateway" => Gateway, :"priority" => Priority, :"prefsrc" => Prefsrc, :"metrics" => Metrics, :"multipath" => Multipath, :"protoinfo" => Protoinfo, :"flow" => Flow, :"cacheinfo" => Cacheinfo, :"session" => Session, :"mp_algo" => MpAlgo, :"table" => Table, :"mark" => Mark, :"mfc_stats" => MfcStats, :"via" => Via, :"newdst" => Newdst, :"pref" => Pref, :"encap_type" => EncapType, :"encap" => Encap, :"expires" => Expires, :"pad" => Pad, :"uid" => Uid, :"ttl_propagate" => TtlPropagate, :"ip_proto" => IpProto, :"sport" => Sport, :"dport" => Dport, :"nh_id" => NhId, :"flowlabel" => Flowlabel}) #: Hash[::Symbol, Attribute]
386
- # @private
387
- BY_TYPE = Ractor.make_shareable({1 => Dst, 2 => Src, 3 => Iif, 4 => Oif, 5 => Gateway, 6 => Priority, 7 => Prefsrc, 8 => Metrics, 9 => Multipath, 10 => Protoinfo, 11 => Flow, 12 => Cacheinfo, 13 => Session, 14 => MpAlgo, 15 => Table, 16 => Mark, 17 => MfcStats, 18 => Via, 19 => Newdst, 20 => Pref, 21 => EncapType, 22 => Encap, 23 => Expires, 24 => Pad, 25 => Uid, 26 => TtlPropagate, 27 => IpProto, 28 => Sport, 29 => Dport, 30 => NhId, 31 => Flowlabel}) #: Hash[::Integer, Attribute]
639
+ # @rbs return: ::Integer
640
+ # @return [Integer]
641
+ def rtm_family; @rtm_family; end
642
+ # @rbs return: ::Integer
643
+ # @return [Integer]
644
+ def rtm_dst_len; @rtm_dst_len; end
645
+ # @rbs return: ::Integer
646
+ # @return [Integer]
647
+ def rtm_src_len; @rtm_src_len; end
648
+ # @rbs return: ::Integer
649
+ # @return [Integer]
650
+ def rtm_tos; @rtm_tos; end
651
+ # @rbs return: ::Integer
652
+ # @return [Integer]
653
+ def rtm_table; @rtm_table; end
654
+ # @rbs return: ::Integer
655
+ # @return [Integer]
656
+ def rtm_protocol; @rtm_protocol; end
657
+ # @rbs return: ::Integer
658
+ # @return [Integer]
659
+ def rtm_scope; @rtm_scope; end
660
+ # @rbs return: ::Integer
661
+ # @return [Integer]
662
+ def rtm_type; @rtm_type; end
663
+ # @rbs return: ::Integer
664
+ # @return [Integer]
665
+ def rtm_flags; @rtm_flags; end
388
666
  # @rbs return: ::String
389
667
  # @return [String]
390
- # @see Dst
391
- def dst; self[:"dst"]&.value; end
668
+ def dst; self[:"dst"]; end
392
669
  # @rbs return: ::String
393
670
  # @return [String]
394
- # @see Src
395
- def src; self[:"src"]&.value; end
671
+ def src; self[:"src"]; end
396
672
  # @rbs return: ::Integer
397
673
  # @return [Integer]
398
- # @see Iif
399
- def iif; self[:"iif"]&.value; end
674
+ def iif; self[:"iif"]; end
400
675
  # @rbs return: ::Integer
401
676
  # @return [Integer]
402
- # @see Oif
403
- def oif; self[:"oif"]&.value; end
677
+ def oif; self[:"oif"]; end
404
678
  # @rbs return: ::String
405
679
  # @return [String]
406
- # @see Gateway
407
- def gateway; self[:"gateway"]&.value; end
680
+ def gateway; self[:"gateway"]; end
408
681
  # @rbs return: ::Integer
409
682
  # @return [Integer]
410
- # @see Priority
411
- def priority; self[:"priority"]&.value; end
683
+ def priority; self[:"priority"]; end
412
684
  # @rbs return: ::String
413
685
  # @return [String]
414
- # @see Prefsrc
415
- def prefsrc; self[:"prefsrc"]&.value; end
686
+ def prefsrc; self[:"prefsrc"]; end
416
687
  # @rbs return: AttributeSets::Metrics
417
688
  # @return [AttributeSets::Metrics]
418
- # @see Metrics
419
- def metrics; self[:"metrics"]&.value; end
420
- # @rbs return: ::String
421
- # @return [String]
422
- # @see Multipath
423
- def multipath; self[:"multipath"]&.value; end
689
+ def metrics; self[:"metrics"]; end
424
690
  # @rbs return: ::String
425
691
  # @return [String]
426
- # @see Protoinfo
427
- def protoinfo; self[:"protoinfo"]&.value; end
692
+ def multipath; self[:"multipath"]; end
428
693
  # @rbs return: ::Integer
429
694
  # @return [Integer]
430
- # @see Flow
431
- def flow; self[:"flow"]&.value; end
695
+ def flow; self[:"flow"]; end
432
696
  # @rbs return: Structs::RtaCacheinfo
433
697
  # @return [Structs::RtaCacheinfo]
434
- # @see Cacheinfo
435
- def cacheinfo; self[:"cacheinfo"]&.value; end
436
- # @rbs return: ::String
437
- # @return [String]
438
- # @see Session
439
- def session; self[:"session"]&.value; end
440
- # @rbs return: ::String
441
- # @return [String]
442
- # @see MpAlgo
443
- def mp_algo; self[:"mp_algo"]&.value; end
698
+ def cacheinfo; self[:"cacheinfo"]; end
444
699
  # @rbs return: ::Integer
445
700
  # @return [Integer]
446
- # @see Table
447
- def table; self[:"table"]&.value; end
701
+ def table; self[:"table"]; end
448
702
  # @rbs return: ::Integer
449
703
  # @return [Integer]
450
- # @see Mark
451
- def mark; self[:"mark"]&.value; end
704
+ def mark; self[:"mark"]; end
452
705
  # @rbs return: ::String
453
706
  # @return [String]
454
- # @see MfcStats
455
- def mfc_stats; self[:"mfc_stats"]&.value; end
707
+ def mfc_stats; self[:"mfc_stats"]; end
456
708
  # @rbs return: ::String
457
709
  # @return [String]
458
- # @see Via
459
- def via; self[:"via"]&.value; end
710
+ def via; self[:"via"]; end
460
711
  # @rbs return: ::String
461
712
  # @return [String]
462
- # @see Newdst
463
- def newdst; self[:"newdst"]&.value; end
713
+ def newdst; self[:"newdst"]; end
464
714
  # @rbs return: ::Integer
465
715
  # @return [Integer]
466
- # @see Pref
467
- def pref; self[:"pref"]&.value; end
716
+ def pref; self[:"pref"]; end
468
717
  # @rbs return: ::Integer
469
718
  # @return [Integer]
470
- # @see EncapType
471
- def encap_type; self[:"encap_type"]&.value; end
719
+ def encap_type; self[:"encap_type"]; end
472
720
  # @rbs return: ::String
473
721
  # @return [String]
474
- # @see Encap
475
- def encap; self[:"encap"]&.value; end
722
+ def encap; self[:"encap"]; end
476
723
  # @rbs return: ::Integer
477
724
  # @return [Integer]
478
- # @see Expires
479
- def expires; self[:"expires"]&.value; end
725
+ def expires; self[:"expires"]; end
480
726
  # @rbs return: ::String
481
727
  # @return [String]
482
- # @see Pad
483
- def pad; self[:"pad"]&.value; end
728
+ def pad; self[:"pad"]; end
484
729
  # @rbs return: ::Integer
485
730
  # @return [Integer]
486
- # @see Uid
487
- def uid; self[:"uid"]&.value; end
731
+ def uid; self[:"uid"]; end
488
732
  # @rbs return: ::Integer
489
733
  # @return [Integer]
490
- # @see TtlPropagate
491
- def ttl_propagate; self[:"ttl_propagate"]&.value; end
734
+ def ttl_propagate; self[:"ttl_propagate"]; end
492
735
  # @rbs return: ::Integer
493
736
  # @return [Integer]
494
- # @see IpProto
495
- def ip_proto; self[:"ip_proto"]&.value; end
737
+ def ip_proto; self[:"ip_proto"]; end
496
738
  # @rbs return: ::Integer
497
739
  # @return [Integer]
498
- # @see Sport
499
- def sport; self[:"sport"]&.value; end
740
+ def sport; self[:"sport"]; end
500
741
  # @rbs return: ::Integer
501
742
  # @return [Integer]
502
- # @see Dport
503
- def dport; self[:"dport"]&.value; end
743
+ def dport; self[:"dport"]; end
504
744
  # @rbs return: ::Integer
505
745
  # @return [Integer]
506
- # @see NhId
507
- def nh_id; self[:"nh_id"]&.value; end
746
+ def nh_id; self[:"nh_id"]; end
508
747
  # @rbs return: ::Integer
509
748
  # @return [Integer]
510
- # @see Flowlabel
511
- def flowlabel; self[:"flowlabel"]&.value; end
512
- class << self
513
- # Looks up Attribute class by name.
514
- # @rbs name: Symbol
515
- # @rbs return: Attribute
516
- # @param [Symbol] name
517
- # @return [Attribute]
518
- def by_name(name); BY_NAME.fetch(name); end
519
- # Looks up Attribute class by type value.
520
- # @rbs type: Integer
521
- # @rbs return: Attribute
522
- # @param [Integer] type
523
- # @return [Attribute]
524
- def by_type(type); BY_TYPE.fetch(type); end
525
- end
749
+ def flowlabel; self[:"flowlabel"]; end
750
+ # Emitted only on RTM_DELROUTE notifications, and only when the
751
+ # deletion path records a cause. An absent attribute means
752
+ # either an older kernel or a deletion path that does not
753
+ # record its cause, consumers must treat absent and unspec
754
+ # identically. Currently only IPv6 deletion paths record a
755
+ # cause. The attribute is notification-only, the kernel rejects
756
+ # it in requests.
757
+ #
758
+ #
759
+ # Known enum values are defined in {Enums::DelReason}.
760
+ # @rbs return: ::Integer
761
+ # @return [Integer]
762
+ def del_reason; self[:"del_reason"]; end
526
763
  end
527
- class Metrics < ::Nl::AttributeSet
528
- # Abstract class
529
- class Attribute < ::Nl::AttributeSet::Attribute
530
- end
531
- class Lock < Attribute
532
- TYPE = 1
533
- NAME = :"lock"
534
- # @private
535
- ORDER = 0
536
- # @private
537
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
538
- end
539
- class Mtu < Attribute
540
- TYPE = 2
541
- NAME = :"mtu"
542
- # @private
543
- ORDER = 1
544
- # @private
545
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
546
- end
547
- class Window < Attribute
548
- TYPE = 3
549
- NAME = :"window"
550
- # @private
551
- ORDER = 2
552
- # @private
553
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
554
- end
555
- class Rtt < Attribute
556
- TYPE = 4
557
- NAME = :"rtt"
558
- # @private
559
- ORDER = 3
560
- # @private
561
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
562
- end
563
- class Rttvar < Attribute
564
- TYPE = 5
565
- NAME = :"rttvar"
566
- # @private
567
- ORDER = 4
568
- # @private
569
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
570
- end
571
- class Ssthresh < Attribute
572
- TYPE = 6
573
- NAME = :"ssthresh"
574
- # @private
575
- ORDER = 5
576
- # @private
577
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
578
- end
579
- class Cwnd < Attribute
580
- TYPE = 7
581
- NAME = :"cwnd"
582
- # @private
583
- ORDER = 6
584
- # @private
585
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
586
- end
587
- class Advmss < Attribute
588
- TYPE = 8
589
- NAME = :"advmss"
590
- # @private
591
- ORDER = 7
592
- # @private
593
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
594
- end
595
- class Reordering < Attribute
596
- TYPE = 9
597
- NAME = :"reordering"
598
- # @private
599
- ORDER = 8
600
- # @private
601
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
602
- end
603
- class Hoplimit < Attribute
604
- TYPE = 10
605
- NAME = :"hoplimit"
606
- # @private
607
- ORDER = 9
608
- # @private
609
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
610
- end
611
- class Initcwnd < Attribute
612
- TYPE = 11
613
- NAME = :"initcwnd"
614
- # @private
615
- ORDER = 10
616
- # @private
617
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
618
- end
619
- class Features < Attribute
620
- TYPE = 12
621
- NAME = :"features"
622
- # @private
623
- ORDER = 11
624
- # @private
625
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
626
- end
627
- class RtoMin < Attribute
628
- TYPE = 13
629
- NAME = :"rto_min"
630
- # @private
631
- ORDER = 12
632
- # @private
633
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
634
- end
635
- class Initrwnd < Attribute
636
- TYPE = 14
637
- NAME = :"initrwnd"
638
- # @private
639
- ORDER = 13
640
- # @private
641
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
764
+ # Dump route information.
765
+ class DumpGetrouteRequest < ::Nl::Message
766
+ TYPE = 26
767
+ FIXED_HEADER = Structs::Rtmsg
768
+ ATTRIBUTE_SET = AttributeSets::RouteAttrs
769
+ ATTRIBUTES = %i[].freeze
770
+ include ATTRIBUTE_SET::Definitions
771
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
772
+ @rtm_family = rtm_family
773
+ @rtm_dst_len = rtm_dst_len
774
+ @rtm_src_len = rtm_src_len
775
+ @rtm_tos = rtm_tos
776
+ @rtm_table = rtm_table
777
+ @rtm_protocol = rtm_protocol
778
+ @rtm_scope = rtm_scope
779
+ @rtm_type = rtm_type
780
+ @rtm_flags = rtm_flags
781
+ @attributes = attributes
642
782
  end
643
- class Quickack < Attribute
644
- TYPE = 15
645
- NAME = :"quickack"
646
- # @private
647
- ORDER = 14
648
- # @private
649
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
783
+ # @private
784
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
785
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
786
+ new(
787
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
788
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
789
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
790
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
791
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
792
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
793
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
794
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
795
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
796
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
797
+ )
650
798
  end
651
- class CcAlgo < Attribute
652
- TYPE = 16
653
- NAME = :"cc_algo"
654
- # @private
655
- ORDER = 15
656
- # @private
657
- DATATYPE = ::Nl::DataTypes::String.new(check: nil)
799
+ # Decodes a message payload from the decoder into a new instance.
800
+ # @rbs (::Nl::Decoder decoder) -> instance
801
+ def self.decode(decoder)
802
+ word = decoder.get_u32
803
+ value_0 = ((word >> 0) & 0xff)
804
+ value_1 = ((word >> 8) & 0xff)
805
+ value_2 = ((word >> 16) & 0xff)
806
+ value_3 = ((word >> 24) & 0xff)
807
+ word = decoder.get_u32
808
+ value_4 = ((word >> 0) & 0xff)
809
+ value_5 = ((word >> 8) & 0xff)
810
+ value_6 = ((word >> 16) & 0xff)
811
+ value_7 = ((word >> 24) & 0xff)
812
+ value_8 = decoder.get_host_u32
813
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
658
814
  end
659
- class FastopenNoCookie < Attribute
660
- TYPE = 17
661
- NAME = :"fastopen_no_cookie"
662
- # @private
663
- ORDER = 16
664
- # @private
665
- DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
815
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
816
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
817
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
818
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
819
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
820
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
821
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
822
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
823
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
824
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
825
+ encode_attributes(encoder, external_selectors:)
666
826
  end
667
- # @private
668
- BY_NAME = Ractor.make_shareable({:"lock" => Lock, :"mtu" => Mtu, :"window" => Window, :"rtt" => Rtt, :"rttvar" => Rttvar, :"ssthresh" => Ssthresh, :"cwnd" => Cwnd, :"advmss" => Advmss, :"reordering" => Reordering, :"hoplimit" => Hoplimit, :"initcwnd" => Initcwnd, :"features" => Features, :"rto_min" => RtoMin, :"initrwnd" => Initrwnd, :"quickack" => Quickack, :"cc_algo" => CcAlgo, :"fastopen_no_cookie" => FastopenNoCookie}) #: Hash[::Symbol, Attribute]
669
- # @private
670
- BY_TYPE = Ractor.make_shareable({1 => Lock, 2 => Mtu, 3 => Window, 4 => Rtt, 5 => Rttvar, 6 => Ssthresh, 7 => Cwnd, 8 => Advmss, 9 => Reordering, 10 => Hoplimit, 11 => Initcwnd, 12 => Features, 13 => RtoMin, 14 => Initrwnd, 15 => Quickack, 16 => CcAlgo, 17 => FastopenNoCookie}) #: Hash[::Integer, Attribute]
671
827
  # @rbs return: ::Integer
672
828
  # @return [Integer]
673
- # @see Lock
674
- def lock; self[:"lock"]&.value; end
829
+ def rtm_family; @rtm_family; end
675
830
  # @rbs return: ::Integer
676
831
  # @return [Integer]
677
- # @see Mtu
678
- def mtu; self[:"mtu"]&.value; end
832
+ def rtm_dst_len; @rtm_dst_len; end
679
833
  # @rbs return: ::Integer
680
834
  # @return [Integer]
681
- # @see Window
682
- def window; self[:"window"]&.value; end
835
+ def rtm_src_len; @rtm_src_len; end
683
836
  # @rbs return: ::Integer
684
837
  # @return [Integer]
685
- # @see Rtt
686
- def rtt; self[:"rtt"]&.value; end
838
+ def rtm_tos; @rtm_tos; end
687
839
  # @rbs return: ::Integer
688
840
  # @return [Integer]
689
- # @see Rttvar
690
- def rttvar; self[:"rttvar"]&.value; end
841
+ def rtm_table; @rtm_table; end
691
842
  # @rbs return: ::Integer
692
843
  # @return [Integer]
693
- # @see Ssthresh
694
- def ssthresh; self[:"ssthresh"]&.value; end
844
+ def rtm_protocol; @rtm_protocol; end
695
845
  # @rbs return: ::Integer
696
846
  # @return [Integer]
697
- # @see Cwnd
698
- def cwnd; self[:"cwnd"]&.value; end
847
+ def rtm_scope; @rtm_scope; end
699
848
  # @rbs return: ::Integer
700
849
  # @return [Integer]
701
- # @see Advmss
702
- def advmss; self[:"advmss"]&.value; end
850
+ def rtm_type; @rtm_type; end
703
851
  # @rbs return: ::Integer
704
852
  # @return [Integer]
705
- # @see Reordering
706
- def reordering; self[:"reordering"]&.value; end
853
+ def rtm_flags; @rtm_flags; end
854
+ end
855
+ # Dump route information.
856
+ class DumpGetrouteReply < ::Nl::Message
857
+ TYPE = 24
858
+ FIXED_HEADER = Structs::Rtmsg
859
+ ATTRIBUTE_SET = AttributeSets::RouteAttrs
860
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel del_reason].freeze
861
+ include ATTRIBUTE_SET::Definitions
862
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
863
+ @rtm_family = rtm_family
864
+ @rtm_dst_len = rtm_dst_len
865
+ @rtm_src_len = rtm_src_len
866
+ @rtm_tos = rtm_tos
867
+ @rtm_table = rtm_table
868
+ @rtm_protocol = rtm_protocol
869
+ @rtm_scope = rtm_scope
870
+ @rtm_type = rtm_type
871
+ @rtm_flags = rtm_flags
872
+ @attributes = attributes
873
+ end
874
+ # @private
875
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
876
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
877
+ new(
878
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
879
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
880
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
881
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
882
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
883
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
884
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
885
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
886
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
887
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
888
+ )
889
+ end
890
+ # Decodes a message payload from the decoder into a new instance.
891
+ # @rbs (::Nl::Decoder decoder) -> instance
892
+ def self.decode(decoder)
893
+ word = decoder.get_u32
894
+ value_0 = ((word >> 0) & 0xff)
895
+ value_1 = ((word >> 8) & 0xff)
896
+ value_2 = ((word >> 16) & 0xff)
897
+ value_3 = ((word >> 24) & 0xff)
898
+ word = decoder.get_u32
899
+ value_4 = ((word >> 0) & 0xff)
900
+ value_5 = ((word >> 8) & 0xff)
901
+ value_6 = ((word >> 16) & 0xff)
902
+ value_7 = ((word >> 24) & 0xff)
903
+ value_8 = decoder.get_host_u32
904
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
905
+ end
906
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
907
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
908
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
909
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
910
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
911
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
912
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
913
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
914
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
915
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
916
+ encode_attributes(encoder, external_selectors:)
917
+ end
707
918
  # @rbs return: ::Integer
708
919
  # @return [Integer]
709
- # @see Hoplimit
710
- def hoplimit; self[:"hoplimit"]&.value; end
920
+ def rtm_family; @rtm_family; end
711
921
  # @rbs return: ::Integer
712
922
  # @return [Integer]
713
- # @see Initcwnd
714
- def initcwnd; self[:"initcwnd"]&.value; end
923
+ def rtm_dst_len; @rtm_dst_len; end
715
924
  # @rbs return: ::Integer
716
925
  # @return [Integer]
717
- # @see Features
718
- def features; self[:"features"]&.value; end
926
+ def rtm_src_len; @rtm_src_len; end
719
927
  # @rbs return: ::Integer
720
928
  # @return [Integer]
721
- # @see RtoMin
722
- def rto_min; self[:"rto_min"]&.value; end
929
+ def rtm_tos; @rtm_tos; end
723
930
  # @rbs return: ::Integer
724
931
  # @return [Integer]
725
- # @see Initrwnd
726
- def initrwnd; self[:"initrwnd"]&.value; end
932
+ def rtm_table; @rtm_table; end
727
933
  # @rbs return: ::Integer
728
934
  # @return [Integer]
729
- # @see Quickack
730
- def quickack; self[:"quickack"]&.value; end
731
- # @rbs return: ::String
732
- # @return [String]
733
- # @see CcAlgo
734
- def cc_algo; self[:"cc_algo"]&.value; end
735
- # @rbs return: ::Integer
736
- # @return [Integer]
737
- # @see FastopenNoCookie
738
- def fastopen_no_cookie; self[:"fastopen_no_cookie"]&.value; end
739
- class << self
740
- # Looks up Attribute class by name.
741
- # @rbs name: Symbol
742
- # @rbs return: Attribute
743
- # @param [Symbol] name
744
- # @return [Attribute]
745
- def by_name(name); BY_NAME.fetch(name); end
746
- # Looks up Attribute class by type value.
747
- # @rbs type: Integer
748
- # @rbs return: Attribute
749
- # @param [Integer] type
750
- # @return [Attribute]
751
- def by_type(type); BY_TYPE.fetch(type); end
752
- end
753
- end
754
- # @private
755
- RouteAttrs::Metrics::DATATYPE = ::Nl::DataTypes::NestedAttributes.new(AttributeSets::Metrics, selector_bindings: Ractor.make_shareable([]))
756
- end
757
- module Messages
758
- # Dump route information.
759
- class DoGetrouteRequest < ::Nl::Raw::Message
760
- TYPE = 26
761
- FIXED_HEADER = Structs::Rtmsg
762
- ATTRIBUTE_SET = AttributeSets::RouteAttrs
763
- ATTRIBUTES = Ractor.make_shareable(%i[dst src iif oif mark uid ip_proto sport dport flowlabel])
935
+ def rtm_protocol; @rtm_protocol; end
764
936
  # @rbs return: ::Integer
765
937
  # @return [Integer]
766
- def rtm_family; fixed_header.rtm_family; end
938
+ def rtm_scope; @rtm_scope; end
767
939
  # @rbs return: ::Integer
768
940
  # @return [Integer]
769
- def rtm_dst_len; fixed_header.rtm_dst_len; end
941
+ def rtm_type; @rtm_type; end
770
942
  # @rbs return: ::Integer
771
943
  # @return [Integer]
772
- def rtm_src_len; fixed_header.rtm_src_len; end
944
+ def rtm_flags; @rtm_flags; end
945
+ # @rbs return: ::String
946
+ # @return [String]
947
+ def dst; self[:"dst"]; end
948
+ # @rbs return: ::String
949
+ # @return [String]
950
+ def src; self[:"src"]; end
773
951
  # @rbs return: ::Integer
774
952
  # @return [Integer]
775
- def rtm_tos; fixed_header.rtm_tos; end
953
+ def iif; self[:"iif"]; end
776
954
  # @rbs return: ::Integer
777
955
  # @return [Integer]
778
- def rtm_table; fixed_header.rtm_table; end
956
+ def oif; self[:"oif"]; end
957
+ # @rbs return: ::String
958
+ # @return [String]
959
+ def gateway; self[:"gateway"]; end
960
+ # @rbs return: ::Integer
961
+ # @return [Integer]
962
+ def priority; self[:"priority"]; end
963
+ # @rbs return: ::String
964
+ # @return [String]
965
+ def prefsrc; self[:"prefsrc"]; end
966
+ # @rbs return: AttributeSets::Metrics
967
+ # @return [AttributeSets::Metrics]
968
+ def metrics; self[:"metrics"]; end
969
+ # @rbs return: ::String
970
+ # @return [String]
971
+ def multipath; self[:"multipath"]; end
972
+ # @rbs return: ::Integer
973
+ # @return [Integer]
974
+ def flow; self[:"flow"]; end
975
+ # @rbs return: Structs::RtaCacheinfo
976
+ # @return [Structs::RtaCacheinfo]
977
+ def cacheinfo; self[:"cacheinfo"]; end
779
978
  # @rbs return: ::Integer
780
979
  # @return [Integer]
781
- def rtm_protocol; fixed_header.rtm_protocol; end
980
+ def table; self[:"table"]; end
782
981
  # @rbs return: ::Integer
783
982
  # @return [Integer]
784
- def rtm_scope; fixed_header.rtm_scope; end
983
+ def mark; self[:"mark"]; end
984
+ # @rbs return: ::String
985
+ # @return [String]
986
+ def mfc_stats; self[:"mfc_stats"]; end
987
+ # @rbs return: ::String
988
+ # @return [String]
989
+ def via; self[:"via"]; end
990
+ # @rbs return: ::String
991
+ # @return [String]
992
+ def newdst; self[:"newdst"]; end
785
993
  # @rbs return: ::Integer
786
994
  # @return [Integer]
787
- def rtm_type; fixed_header.rtm_type; end
995
+ def pref; self[:"pref"]; end
788
996
  # @rbs return: ::Integer
789
997
  # @return [Integer]
790
- def rtm_flags; fixed_header.rtm_flags; end
998
+ def encap_type; self[:"encap_type"]; end
791
999
  # @rbs return: ::String
792
1000
  # @return [String]
793
- # @see AttributeSets::RouteAttrs::Dst
794
- def dst; attributes[:"dst"]&.value; end
1001
+ def encap; self[:"encap"]; end
1002
+ # @rbs return: ::Integer
1003
+ # @return [Integer]
1004
+ def expires; self[:"expires"]; end
795
1005
  # @rbs return: ::String
796
1006
  # @return [String]
797
- # @see AttributeSets::RouteAttrs::Src
798
- def src; attributes[:"src"]&.value; end
1007
+ def pad; self[:"pad"]; end
799
1008
  # @rbs return: ::Integer
800
1009
  # @return [Integer]
801
- # @see AttributeSets::RouteAttrs::Iif
802
- def iif; attributes[:"iif"]&.value; end
1010
+ def uid; self[:"uid"]; end
803
1011
  # @rbs return: ::Integer
804
1012
  # @return [Integer]
805
- # @see AttributeSets::RouteAttrs::Oif
806
- def oif; attributes[:"oif"]&.value; end
1013
+ def ttl_propagate; self[:"ttl_propagate"]; end
807
1014
  # @rbs return: ::Integer
808
1015
  # @return [Integer]
809
- # @see AttributeSets::RouteAttrs::Mark
810
- def mark; attributes[:"mark"]&.value; end
1016
+ def ip_proto; self[:"ip_proto"]; end
811
1017
  # @rbs return: ::Integer
812
1018
  # @return [Integer]
813
- # @see AttributeSets::RouteAttrs::Uid
814
- def uid; attributes[:"uid"]&.value; end
1019
+ def sport; self[:"sport"]; end
815
1020
  # @rbs return: ::Integer
816
1021
  # @return [Integer]
817
- # @see AttributeSets::RouteAttrs::IpProto
818
- def ip_proto; attributes[:"ip_proto"]&.value; end
1022
+ def dport; self[:"dport"]; end
819
1023
  # @rbs return: ::Integer
820
1024
  # @return [Integer]
821
- # @see AttributeSets::RouteAttrs::Sport
822
- def sport; attributes[:"sport"]&.value; end
1025
+ def nh_id; self[:"nh_id"]; end
823
1026
  # @rbs return: ::Integer
824
1027
  # @return [Integer]
825
- # @see AttributeSets::RouteAttrs::Dport
826
- def dport; attributes[:"dport"]&.value; end
1028
+ def flowlabel; self[:"flowlabel"]; end
1029
+ # Emitted only on RTM_DELROUTE notifications, and only when the
1030
+ # deletion path records a cause. An absent attribute means
1031
+ # either an older kernel or a deletion path that does not
1032
+ # record its cause, consumers must treat absent and unspec
1033
+ # identically. Currently only IPv6 deletion paths record a
1034
+ # cause. The attribute is notification-only, the kernel rejects
1035
+ # it in requests.
1036
+ #
1037
+ #
1038
+ # Known enum values are defined in {Enums::DelReason}.
827
1039
  # @rbs return: ::Integer
828
1040
  # @return [Integer]
829
- # @see AttributeSets::RouteAttrs::Flowlabel
830
- def flowlabel; attributes[:"flowlabel"]&.value; end
1041
+ def del_reason; self[:"del_reason"]; end
831
1042
  end
832
- # Dump route information.
833
- class DoGetrouteReply < ::Nl::Raw::Message
1043
+ # Create a new route
1044
+ class DoNewrouteRequest < ::Nl::Message
834
1045
  TYPE = 24
835
1046
  FIXED_HEADER = Structs::Rtmsg
836
1047
  ATTRIBUTE_SET = AttributeSets::RouteAttrs
837
- ATTRIBUTES = Ractor.make_shareable(%i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel])
1048
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel].freeze
1049
+ include ATTRIBUTE_SET::Definitions
1050
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
1051
+ @rtm_family = rtm_family
1052
+ @rtm_dst_len = rtm_dst_len
1053
+ @rtm_src_len = rtm_src_len
1054
+ @rtm_tos = rtm_tos
1055
+ @rtm_table = rtm_table
1056
+ @rtm_protocol = rtm_protocol
1057
+ @rtm_scope = rtm_scope
1058
+ @rtm_type = rtm_type
1059
+ @rtm_flags = rtm_flags
1060
+ @attributes = attributes
1061
+ end
1062
+ # @private
1063
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1064
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
1065
+ new(
1066
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
1067
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
1068
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
1069
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
1070
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
1071
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
1072
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
1073
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
1074
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
1075
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
1076
+ )
1077
+ end
1078
+ # Decodes a message payload from the decoder into a new instance.
1079
+ # @rbs (::Nl::Decoder decoder) -> instance
1080
+ def self.decode(decoder)
1081
+ word = decoder.get_u32
1082
+ value_0 = ((word >> 0) & 0xff)
1083
+ value_1 = ((word >> 8) & 0xff)
1084
+ value_2 = ((word >> 16) & 0xff)
1085
+ value_3 = ((word >> 24) & 0xff)
1086
+ word = decoder.get_u32
1087
+ value_4 = ((word >> 0) & 0xff)
1088
+ value_5 = ((word >> 8) & 0xff)
1089
+ value_6 = ((word >> 16) & 0xff)
1090
+ value_7 = ((word >> 24) & 0xff)
1091
+ value_8 = decoder.get_host_u32
1092
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
1093
+ end
1094
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1095
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
1096
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
1097
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
1098
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
1099
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
1100
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
1101
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
1102
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
1103
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
1104
+ encode_attributes(encoder, external_selectors:)
1105
+ end
838
1106
  # @rbs return: ::Integer
839
1107
  # @return [Integer]
840
- def rtm_family; fixed_header.rtm_family; end
1108
+ def rtm_family; @rtm_family; end
841
1109
  # @rbs return: ::Integer
842
1110
  # @return [Integer]
843
- def rtm_dst_len; fixed_header.rtm_dst_len; end
1111
+ def rtm_dst_len; @rtm_dst_len; end
844
1112
  # @rbs return: ::Integer
845
1113
  # @return [Integer]
846
- def rtm_src_len; fixed_header.rtm_src_len; end
1114
+ def rtm_src_len; @rtm_src_len; end
847
1115
  # @rbs return: ::Integer
848
1116
  # @return [Integer]
849
- def rtm_tos; fixed_header.rtm_tos; end
1117
+ def rtm_tos; @rtm_tos; end
850
1118
  # @rbs return: ::Integer
851
1119
  # @return [Integer]
852
- def rtm_table; fixed_header.rtm_table; end
1120
+ def rtm_table; @rtm_table; end
853
1121
  # @rbs return: ::Integer
854
1122
  # @return [Integer]
855
- def rtm_protocol; fixed_header.rtm_protocol; end
1123
+ def rtm_protocol; @rtm_protocol; end
856
1124
  # @rbs return: ::Integer
857
1125
  # @return [Integer]
858
- def rtm_scope; fixed_header.rtm_scope; end
1126
+ def rtm_scope; @rtm_scope; end
859
1127
  # @rbs return: ::Integer
860
1128
  # @return [Integer]
861
- def rtm_type; fixed_header.rtm_type; end
1129
+ def rtm_type; @rtm_type; end
862
1130
  # @rbs return: ::Integer
863
1131
  # @return [Integer]
864
- def rtm_flags; fixed_header.rtm_flags; end
1132
+ def rtm_flags; @rtm_flags; end
865
1133
  # @rbs return: ::String
866
1134
  # @return [String]
867
- # @see AttributeSets::RouteAttrs::Dst
868
- def dst; attributes[:"dst"]&.value; end
1135
+ def dst; self[:"dst"]; end
869
1136
  # @rbs return: ::String
870
1137
  # @return [String]
871
- # @see AttributeSets::RouteAttrs::Src
872
- def src; attributes[:"src"]&.value; end
1138
+ def src; self[:"src"]; end
873
1139
  # @rbs return: ::Integer
874
1140
  # @return [Integer]
875
- # @see AttributeSets::RouteAttrs::Iif
876
- def iif; attributes[:"iif"]&.value; end
1141
+ def iif; self[:"iif"]; end
877
1142
  # @rbs return: ::Integer
878
1143
  # @return [Integer]
879
- # @see AttributeSets::RouteAttrs::Oif
880
- def oif; attributes[:"oif"]&.value; end
1144
+ def oif; self[:"oif"]; end
881
1145
  # @rbs return: ::String
882
1146
  # @return [String]
883
- # @see AttributeSets::RouteAttrs::Gateway
884
- def gateway; attributes[:"gateway"]&.value; end
1147
+ def gateway; self[:"gateway"]; end
885
1148
  # @rbs return: ::Integer
886
1149
  # @return [Integer]
887
- # @see AttributeSets::RouteAttrs::Priority
888
- def priority; attributes[:"priority"]&.value; end
1150
+ def priority; self[:"priority"]; end
889
1151
  # @rbs return: ::String
890
1152
  # @return [String]
891
- # @see AttributeSets::RouteAttrs::Prefsrc
892
- def prefsrc; attributes[:"prefsrc"]&.value; end
1153
+ def prefsrc; self[:"prefsrc"]; end
893
1154
  # @rbs return: AttributeSets::Metrics
894
1155
  # @return [AttributeSets::Metrics]
895
- # @see AttributeSets::RouteAttrs::Metrics
896
- def metrics; attributes[:"metrics"]&.value; end
1156
+ def metrics; self[:"metrics"]; end
897
1157
  # @rbs return: ::String
898
1158
  # @return [String]
899
- # @see AttributeSets::RouteAttrs::Multipath
900
- def multipath; attributes[:"multipath"]&.value; end
1159
+ def multipath; self[:"multipath"]; end
901
1160
  # @rbs return: ::Integer
902
1161
  # @return [Integer]
903
- # @see AttributeSets::RouteAttrs::Flow
904
- def flow; attributes[:"flow"]&.value; end
1162
+ def flow; self[:"flow"]; end
905
1163
  # @rbs return: Structs::RtaCacheinfo
906
1164
  # @return [Structs::RtaCacheinfo]
907
- # @see AttributeSets::RouteAttrs::Cacheinfo
908
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
1165
+ def cacheinfo; self[:"cacheinfo"]; end
909
1166
  # @rbs return: ::Integer
910
1167
  # @return [Integer]
911
- # @see AttributeSets::RouteAttrs::Table
912
- def table; attributes[:"table"]&.value; end
1168
+ def table; self[:"table"]; end
913
1169
  # @rbs return: ::Integer
914
1170
  # @return [Integer]
915
- # @see AttributeSets::RouteAttrs::Mark
916
- def mark; attributes[:"mark"]&.value; end
1171
+ def mark; self[:"mark"]; end
917
1172
  # @rbs return: ::String
918
1173
  # @return [String]
919
- # @see AttributeSets::RouteAttrs::MfcStats
920
- def mfc_stats; attributes[:"mfc_stats"]&.value; end
1174
+ def mfc_stats; self[:"mfc_stats"]; end
921
1175
  # @rbs return: ::String
922
1176
  # @return [String]
923
- # @see AttributeSets::RouteAttrs::Via
924
- def via; attributes[:"via"]&.value; end
1177
+ def via; self[:"via"]; end
925
1178
  # @rbs return: ::String
926
1179
  # @return [String]
927
- # @see AttributeSets::RouteAttrs::Newdst
928
- def newdst; attributes[:"newdst"]&.value; end
1180
+ def newdst; self[:"newdst"]; end
929
1181
  # @rbs return: ::Integer
930
1182
  # @return [Integer]
931
- # @see AttributeSets::RouteAttrs::Pref
932
- def pref; attributes[:"pref"]&.value; end
1183
+ def pref; self[:"pref"]; end
933
1184
  # @rbs return: ::Integer
934
1185
  # @return [Integer]
935
- # @see AttributeSets::RouteAttrs::EncapType
936
- def encap_type; attributes[:"encap_type"]&.value; end
1186
+ def encap_type; self[:"encap_type"]; end
937
1187
  # @rbs return: ::String
938
1188
  # @return [String]
939
- # @see AttributeSets::RouteAttrs::Encap
940
- def encap; attributes[:"encap"]&.value; end
1189
+ def encap; self[:"encap"]; end
941
1190
  # @rbs return: ::Integer
942
1191
  # @return [Integer]
943
- # @see AttributeSets::RouteAttrs::Expires
944
- def expires; attributes[:"expires"]&.value; end
1192
+ def expires; self[:"expires"]; end
945
1193
  # @rbs return: ::String
946
1194
  # @return [String]
947
- # @see AttributeSets::RouteAttrs::Pad
948
- def pad; attributes[:"pad"]&.value; end
1195
+ def pad; self[:"pad"]; end
949
1196
  # @rbs return: ::Integer
950
1197
  # @return [Integer]
951
- # @see AttributeSets::RouteAttrs::Uid
952
- def uid; attributes[:"uid"]&.value; end
1198
+ def uid; self[:"uid"]; end
953
1199
  # @rbs return: ::Integer
954
1200
  # @return [Integer]
955
- # @see AttributeSets::RouteAttrs::TtlPropagate
956
- def ttl_propagate; attributes[:"ttl_propagate"]&.value; end
1201
+ def ttl_propagate; self[:"ttl_propagate"]; end
957
1202
  # @rbs return: ::Integer
958
1203
  # @return [Integer]
959
- # @see AttributeSets::RouteAttrs::IpProto
960
- def ip_proto; attributes[:"ip_proto"]&.value; end
1204
+ def ip_proto; self[:"ip_proto"]; end
961
1205
  # @rbs return: ::Integer
962
1206
  # @return [Integer]
963
- # @see AttributeSets::RouteAttrs::Sport
964
- def sport; attributes[:"sport"]&.value; end
1207
+ def sport; self[:"sport"]; end
965
1208
  # @rbs return: ::Integer
966
1209
  # @return [Integer]
967
- # @see AttributeSets::RouteAttrs::Dport
968
- def dport; attributes[:"dport"]&.value; end
1210
+ def dport; self[:"dport"]; end
969
1211
  # @rbs return: ::Integer
970
1212
  # @return [Integer]
971
- # @see AttributeSets::RouteAttrs::NhId
972
- def nh_id; attributes[:"nh_id"]&.value; end
1213
+ def nh_id; self[:"nh_id"]; end
973
1214
  # @rbs return: ::Integer
974
1215
  # @return [Integer]
975
- # @see AttributeSets::RouteAttrs::Flowlabel
976
- def flowlabel; attributes[:"flowlabel"]&.value; end
1216
+ def flowlabel; self[:"flowlabel"]; end
977
1217
  end
978
- # Dump route information.
979
- class DumpGetrouteRequest < ::Nl::Raw::Message
980
- TYPE = 26
981
- FIXED_HEADER = Structs::Rtmsg
982
- ATTRIBUTE_SET = AttributeSets::RouteAttrs
983
- ATTRIBUTES = Ractor.make_shareable(%i[])
984
- # @rbs return: ::Integer
985
- # @return [Integer]
986
- def rtm_family; fixed_header.rtm_family; end
987
- # @rbs return: ::Integer
988
- # @return [Integer]
989
- def rtm_dst_len; fixed_header.rtm_dst_len; end
990
- # @rbs return: ::Integer
991
- # @return [Integer]
992
- def rtm_src_len; fixed_header.rtm_src_len; end
993
- # @rbs return: ::Integer
994
- # @return [Integer]
995
- def rtm_tos; fixed_header.rtm_tos; end
996
- # @rbs return: ::Integer
997
- # @return [Integer]
998
- def rtm_table; fixed_header.rtm_table; end
999
- # @rbs return: ::Integer
1000
- # @return [Integer]
1001
- def rtm_protocol; fixed_header.rtm_protocol; end
1002
- # @rbs return: ::Integer
1003
- # @return [Integer]
1004
- def rtm_scope; fixed_header.rtm_scope; end
1005
- # @rbs return: ::Integer
1006
- # @return [Integer]
1007
- def rtm_type; fixed_header.rtm_type; end
1008
- # @rbs return: ::Integer
1009
- # @return [Integer]
1010
- def rtm_flags; fixed_header.rtm_flags; end
1011
- end
1012
- # Dump route information.
1013
- class DumpGetrouteReply < ::Nl::Raw::Message
1014
- TYPE = 24
1218
+ # Delete an existing route
1219
+ class DoDelrouteRequest < ::Nl::Message
1220
+ TYPE = 25
1015
1221
  FIXED_HEADER = Structs::Rtmsg
1016
1222
  ATTRIBUTE_SET = AttributeSets::RouteAttrs
1017
- ATTRIBUTES = Ractor.make_shareable(%i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel])
1223
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel].freeze
1224
+ include ATTRIBUTE_SET::Definitions
1225
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
1226
+ @rtm_family = rtm_family
1227
+ @rtm_dst_len = rtm_dst_len
1228
+ @rtm_src_len = rtm_src_len
1229
+ @rtm_tos = rtm_tos
1230
+ @rtm_table = rtm_table
1231
+ @rtm_protocol = rtm_protocol
1232
+ @rtm_scope = rtm_scope
1233
+ @rtm_type = rtm_type
1234
+ @rtm_flags = rtm_flags
1235
+ @attributes = attributes
1236
+ end
1237
+ # @private
1238
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1239
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
1240
+ new(
1241
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
1242
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
1243
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
1244
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
1245
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
1246
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
1247
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
1248
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
1249
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
1250
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
1251
+ )
1252
+ end
1253
+ # Decodes a message payload from the decoder into a new instance.
1254
+ # @rbs (::Nl::Decoder decoder) -> instance
1255
+ def self.decode(decoder)
1256
+ word = decoder.get_u32
1257
+ value_0 = ((word >> 0) & 0xff)
1258
+ value_1 = ((word >> 8) & 0xff)
1259
+ value_2 = ((word >> 16) & 0xff)
1260
+ value_3 = ((word >> 24) & 0xff)
1261
+ word = decoder.get_u32
1262
+ value_4 = ((word >> 0) & 0xff)
1263
+ value_5 = ((word >> 8) & 0xff)
1264
+ value_6 = ((word >> 16) & 0xff)
1265
+ value_7 = ((word >> 24) & 0xff)
1266
+ value_8 = decoder.get_host_u32
1267
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
1268
+ end
1269
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1270
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
1271
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
1272
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
1273
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
1274
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
1275
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
1276
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
1277
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
1278
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
1279
+ encode_attributes(encoder, external_selectors:)
1280
+ end
1018
1281
  # @rbs return: ::Integer
1019
1282
  # @return [Integer]
1020
- def rtm_family; fixed_header.rtm_family; end
1283
+ def rtm_family; @rtm_family; end
1021
1284
  # @rbs return: ::Integer
1022
1285
  # @return [Integer]
1023
- def rtm_dst_len; fixed_header.rtm_dst_len; end
1286
+ def rtm_dst_len; @rtm_dst_len; end
1024
1287
  # @rbs return: ::Integer
1025
1288
  # @return [Integer]
1026
- def rtm_src_len; fixed_header.rtm_src_len; end
1289
+ def rtm_src_len; @rtm_src_len; end
1027
1290
  # @rbs return: ::Integer
1028
1291
  # @return [Integer]
1029
- def rtm_tos; fixed_header.rtm_tos; end
1292
+ def rtm_tos; @rtm_tos; end
1030
1293
  # @rbs return: ::Integer
1031
1294
  # @return [Integer]
1032
- def rtm_table; fixed_header.rtm_table; end
1295
+ def rtm_table; @rtm_table; end
1033
1296
  # @rbs return: ::Integer
1034
1297
  # @return [Integer]
1035
- def rtm_protocol; fixed_header.rtm_protocol; end
1298
+ def rtm_protocol; @rtm_protocol; end
1036
1299
  # @rbs return: ::Integer
1037
1300
  # @return [Integer]
1038
- def rtm_scope; fixed_header.rtm_scope; end
1301
+ def rtm_scope; @rtm_scope; end
1039
1302
  # @rbs return: ::Integer
1040
1303
  # @return [Integer]
1041
- def rtm_type; fixed_header.rtm_type; end
1304
+ def rtm_type; @rtm_type; end
1042
1305
  # @rbs return: ::Integer
1043
1306
  # @return [Integer]
1044
- def rtm_flags; fixed_header.rtm_flags; end
1307
+ def rtm_flags; @rtm_flags; end
1045
1308
  # @rbs return: ::String
1046
1309
  # @return [String]
1047
- # @see AttributeSets::RouteAttrs::Dst
1048
- def dst; attributes[:"dst"]&.value; end
1310
+ def dst; self[:"dst"]; end
1049
1311
  # @rbs return: ::String
1050
1312
  # @return [String]
1051
- # @see AttributeSets::RouteAttrs::Src
1052
- def src; attributes[:"src"]&.value; end
1313
+ def src; self[:"src"]; end
1053
1314
  # @rbs return: ::Integer
1054
1315
  # @return [Integer]
1055
- # @see AttributeSets::RouteAttrs::Iif
1056
- def iif; attributes[:"iif"]&.value; end
1316
+ def iif; self[:"iif"]; end
1057
1317
  # @rbs return: ::Integer
1058
1318
  # @return [Integer]
1059
- # @see AttributeSets::RouteAttrs::Oif
1060
- def oif; attributes[:"oif"]&.value; end
1319
+ def oif; self[:"oif"]; end
1061
1320
  # @rbs return: ::String
1062
1321
  # @return [String]
1063
- # @see AttributeSets::RouteAttrs::Gateway
1064
- def gateway; attributes[:"gateway"]&.value; end
1322
+ def gateway; self[:"gateway"]; end
1065
1323
  # @rbs return: ::Integer
1066
1324
  # @return [Integer]
1067
- # @see AttributeSets::RouteAttrs::Priority
1068
- def priority; attributes[:"priority"]&.value; end
1325
+ def priority; self[:"priority"]; end
1069
1326
  # @rbs return: ::String
1070
1327
  # @return [String]
1071
- # @see AttributeSets::RouteAttrs::Prefsrc
1072
- def prefsrc; attributes[:"prefsrc"]&.value; end
1328
+ def prefsrc; self[:"prefsrc"]; end
1073
1329
  # @rbs return: AttributeSets::Metrics
1074
1330
  # @return [AttributeSets::Metrics]
1075
- # @see AttributeSets::RouteAttrs::Metrics
1076
- def metrics; attributes[:"metrics"]&.value; end
1331
+ def metrics; self[:"metrics"]; end
1077
1332
  # @rbs return: ::String
1078
1333
  # @return [String]
1079
- # @see AttributeSets::RouteAttrs::Multipath
1080
- def multipath; attributes[:"multipath"]&.value; end
1334
+ def multipath; self[:"multipath"]; end
1081
1335
  # @rbs return: ::Integer
1082
1336
  # @return [Integer]
1083
- # @see AttributeSets::RouteAttrs::Flow
1084
- def flow; attributes[:"flow"]&.value; end
1337
+ def flow; self[:"flow"]; end
1085
1338
  # @rbs return: Structs::RtaCacheinfo
1086
1339
  # @return [Structs::RtaCacheinfo]
1087
- # @see AttributeSets::RouteAttrs::Cacheinfo
1088
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
1340
+ def cacheinfo; self[:"cacheinfo"]; end
1089
1341
  # @rbs return: ::Integer
1090
1342
  # @return [Integer]
1091
- # @see AttributeSets::RouteAttrs::Table
1092
- def table; attributes[:"table"]&.value; end
1343
+ def table; self[:"table"]; end
1093
1344
  # @rbs return: ::Integer
1094
1345
  # @return [Integer]
1095
- # @see AttributeSets::RouteAttrs::Mark
1096
- def mark; attributes[:"mark"]&.value; end
1346
+ def mark; self[:"mark"]; end
1097
1347
  # @rbs return: ::String
1098
1348
  # @return [String]
1099
- # @see AttributeSets::RouteAttrs::MfcStats
1100
- def mfc_stats; attributes[:"mfc_stats"]&.value; end
1349
+ def mfc_stats; self[:"mfc_stats"]; end
1101
1350
  # @rbs return: ::String
1102
1351
  # @return [String]
1103
- # @see AttributeSets::RouteAttrs::Via
1104
- def via; attributes[:"via"]&.value; end
1352
+ def via; self[:"via"]; end
1105
1353
  # @rbs return: ::String
1106
1354
  # @return [String]
1107
- # @see AttributeSets::RouteAttrs::Newdst
1108
- def newdst; attributes[:"newdst"]&.value; end
1355
+ def newdst; self[:"newdst"]; end
1109
1356
  # @rbs return: ::Integer
1110
1357
  # @return [Integer]
1111
- # @see AttributeSets::RouteAttrs::Pref
1112
- def pref; attributes[:"pref"]&.value; end
1358
+ def pref; self[:"pref"]; end
1113
1359
  # @rbs return: ::Integer
1114
1360
  # @return [Integer]
1115
- # @see AttributeSets::RouteAttrs::EncapType
1116
- def encap_type; attributes[:"encap_type"]&.value; end
1361
+ def encap_type; self[:"encap_type"]; end
1117
1362
  # @rbs return: ::String
1118
1363
  # @return [String]
1119
- # @see AttributeSets::RouteAttrs::Encap
1120
- def encap; attributes[:"encap"]&.value; end
1364
+ def encap; self[:"encap"]; end
1121
1365
  # @rbs return: ::Integer
1122
1366
  # @return [Integer]
1123
- # @see AttributeSets::RouteAttrs::Expires
1124
- def expires; attributes[:"expires"]&.value; end
1367
+ def expires; self[:"expires"]; end
1125
1368
  # @rbs return: ::String
1126
1369
  # @return [String]
1127
- # @see AttributeSets::RouteAttrs::Pad
1128
- def pad; attributes[:"pad"]&.value; end
1370
+ def pad; self[:"pad"]; end
1129
1371
  # @rbs return: ::Integer
1130
1372
  # @return [Integer]
1131
- # @see AttributeSets::RouteAttrs::Uid
1132
- def uid; attributes[:"uid"]&.value; end
1373
+ def uid; self[:"uid"]; end
1133
1374
  # @rbs return: ::Integer
1134
1375
  # @return [Integer]
1135
- # @see AttributeSets::RouteAttrs::TtlPropagate
1136
- def ttl_propagate; attributes[:"ttl_propagate"]&.value; end
1376
+ def ttl_propagate; self[:"ttl_propagate"]; end
1137
1377
  # @rbs return: ::Integer
1138
1378
  # @return [Integer]
1139
- # @see AttributeSets::RouteAttrs::IpProto
1140
- def ip_proto; attributes[:"ip_proto"]&.value; end
1379
+ def ip_proto; self[:"ip_proto"]; end
1141
1380
  # @rbs return: ::Integer
1142
1381
  # @return [Integer]
1143
- # @see AttributeSets::RouteAttrs::Sport
1144
- def sport; attributes[:"sport"]&.value; end
1382
+ def sport; self[:"sport"]; end
1145
1383
  # @rbs return: ::Integer
1146
1384
  # @return [Integer]
1147
- # @see AttributeSets::RouteAttrs::Dport
1148
- def dport; attributes[:"dport"]&.value; end
1385
+ def dport; self[:"dport"]; end
1149
1386
  # @rbs return: ::Integer
1150
1387
  # @return [Integer]
1151
- # @see AttributeSets::RouteAttrs::NhId
1152
- def nh_id; attributes[:"nh_id"]&.value; end
1388
+ def nh_id; self[:"nh_id"]; end
1153
1389
  # @rbs return: ::Integer
1154
1390
  # @return [Integer]
1155
- # @see AttributeSets::RouteAttrs::Flowlabel
1156
- def flowlabel; attributes[:"flowlabel"]&.value; end
1391
+ def flowlabel; self[:"flowlabel"]; end
1157
1392
  end
1158
- # Create a new route
1159
- class DoNewrouteRequest < ::Nl::Raw::Message
1393
+ end
1394
+ module Notifications
1395
+ # Notification about a created route.
1396
+ class NewrouteNtf < ::Nl::Message
1160
1397
  TYPE = 24
1161
1398
  FIXED_HEADER = Structs::Rtmsg
1162
1399
  ATTRIBUTE_SET = AttributeSets::RouteAttrs
1163
- ATTRIBUTES = Ractor.make_shareable(%i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel])
1400
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel del_reason].freeze
1401
+ include ATTRIBUTE_SET::Definitions
1402
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
1403
+ @rtm_family = rtm_family
1404
+ @rtm_dst_len = rtm_dst_len
1405
+ @rtm_src_len = rtm_src_len
1406
+ @rtm_tos = rtm_tos
1407
+ @rtm_table = rtm_table
1408
+ @rtm_protocol = rtm_protocol
1409
+ @rtm_scope = rtm_scope
1410
+ @rtm_type = rtm_type
1411
+ @rtm_flags = rtm_flags
1412
+ @attributes = attributes
1413
+ end
1414
+ # @private
1415
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1416
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
1417
+ new(
1418
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
1419
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
1420
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
1421
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
1422
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
1423
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
1424
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
1425
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
1426
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
1427
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
1428
+ )
1429
+ end
1430
+ # Decodes a message payload from the decoder into a new instance.
1431
+ # @rbs (::Nl::Decoder decoder) -> instance
1432
+ def self.decode(decoder)
1433
+ word = decoder.get_u32
1434
+ value_0 = ((word >> 0) & 0xff)
1435
+ value_1 = ((word >> 8) & 0xff)
1436
+ value_2 = ((word >> 16) & 0xff)
1437
+ value_3 = ((word >> 24) & 0xff)
1438
+ word = decoder.get_u32
1439
+ value_4 = ((word >> 0) & 0xff)
1440
+ value_5 = ((word >> 8) & 0xff)
1441
+ value_6 = ((word >> 16) & 0xff)
1442
+ value_7 = ((word >> 24) & 0xff)
1443
+ value_8 = decoder.get_host_u32
1444
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
1445
+ end
1446
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1447
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
1448
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
1449
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
1450
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
1451
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
1452
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
1453
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
1454
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
1455
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
1456
+ encode_attributes(encoder, external_selectors:)
1457
+ end
1164
1458
  # @rbs return: ::Integer
1165
1459
  # @return [Integer]
1166
- def rtm_family; fixed_header.rtm_family; end
1460
+ def rtm_family; @rtm_family; end
1167
1461
  # @rbs return: ::Integer
1168
1462
  # @return [Integer]
1169
- def rtm_dst_len; fixed_header.rtm_dst_len; end
1463
+ def rtm_dst_len; @rtm_dst_len; end
1170
1464
  # @rbs return: ::Integer
1171
1465
  # @return [Integer]
1172
- def rtm_src_len; fixed_header.rtm_src_len; end
1466
+ def rtm_src_len; @rtm_src_len; end
1173
1467
  # @rbs return: ::Integer
1174
1468
  # @return [Integer]
1175
- def rtm_tos; fixed_header.rtm_tos; end
1469
+ def rtm_tos; @rtm_tos; end
1176
1470
  # @rbs return: ::Integer
1177
1471
  # @return [Integer]
1178
- def rtm_table; fixed_header.rtm_table; end
1472
+ def rtm_table; @rtm_table; end
1179
1473
  # @rbs return: ::Integer
1180
1474
  # @return [Integer]
1181
- def rtm_protocol; fixed_header.rtm_protocol; end
1475
+ def rtm_protocol; @rtm_protocol; end
1182
1476
  # @rbs return: ::Integer
1183
1477
  # @return [Integer]
1184
- def rtm_scope; fixed_header.rtm_scope; end
1478
+ def rtm_scope; @rtm_scope; end
1185
1479
  # @rbs return: ::Integer
1186
1480
  # @return [Integer]
1187
- def rtm_type; fixed_header.rtm_type; end
1481
+ def rtm_type; @rtm_type; end
1188
1482
  # @rbs return: ::Integer
1189
1483
  # @return [Integer]
1190
- def rtm_flags; fixed_header.rtm_flags; end
1484
+ def rtm_flags; @rtm_flags; end
1191
1485
  # @rbs return: ::String
1192
1486
  # @return [String]
1193
- # @see AttributeSets::RouteAttrs::Dst
1194
- def dst; attributes[:"dst"]&.value; end
1487
+ def dst; self[:"dst"]; end
1195
1488
  # @rbs return: ::String
1196
1489
  # @return [String]
1197
- # @see AttributeSets::RouteAttrs::Src
1198
- def src; attributes[:"src"]&.value; end
1490
+ def src; self[:"src"]; end
1199
1491
  # @rbs return: ::Integer
1200
1492
  # @return [Integer]
1201
- # @see AttributeSets::RouteAttrs::Iif
1202
- def iif; attributes[:"iif"]&.value; end
1493
+ def iif; self[:"iif"]; end
1203
1494
  # @rbs return: ::Integer
1204
1495
  # @return [Integer]
1205
- # @see AttributeSets::RouteAttrs::Oif
1206
- def oif; attributes[:"oif"]&.value; end
1496
+ def oif; self[:"oif"]; end
1207
1497
  # @rbs return: ::String
1208
1498
  # @return [String]
1209
- # @see AttributeSets::RouteAttrs::Gateway
1210
- def gateway; attributes[:"gateway"]&.value; end
1499
+ def gateway; self[:"gateway"]; end
1211
1500
  # @rbs return: ::Integer
1212
1501
  # @return [Integer]
1213
- # @see AttributeSets::RouteAttrs::Priority
1214
- def priority; attributes[:"priority"]&.value; end
1502
+ def priority; self[:"priority"]; end
1215
1503
  # @rbs return: ::String
1216
1504
  # @return [String]
1217
- # @see AttributeSets::RouteAttrs::Prefsrc
1218
- def prefsrc; attributes[:"prefsrc"]&.value; end
1505
+ def prefsrc; self[:"prefsrc"]; end
1219
1506
  # @rbs return: AttributeSets::Metrics
1220
1507
  # @return [AttributeSets::Metrics]
1221
- # @see AttributeSets::RouteAttrs::Metrics
1222
- def metrics; attributes[:"metrics"]&.value; end
1508
+ def metrics; self[:"metrics"]; end
1223
1509
  # @rbs return: ::String
1224
1510
  # @return [String]
1225
- # @see AttributeSets::RouteAttrs::Multipath
1226
- def multipath; attributes[:"multipath"]&.value; end
1511
+ def multipath; self[:"multipath"]; end
1227
1512
  # @rbs return: ::Integer
1228
1513
  # @return [Integer]
1229
- # @see AttributeSets::RouteAttrs::Flow
1230
- def flow; attributes[:"flow"]&.value; end
1514
+ def flow; self[:"flow"]; end
1231
1515
  # @rbs return: Structs::RtaCacheinfo
1232
1516
  # @return [Structs::RtaCacheinfo]
1233
- # @see AttributeSets::RouteAttrs::Cacheinfo
1234
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
1517
+ def cacheinfo; self[:"cacheinfo"]; end
1235
1518
  # @rbs return: ::Integer
1236
1519
  # @return [Integer]
1237
- # @see AttributeSets::RouteAttrs::Table
1238
- def table; attributes[:"table"]&.value; end
1520
+ def table; self[:"table"]; end
1239
1521
  # @rbs return: ::Integer
1240
1522
  # @return [Integer]
1241
- # @see AttributeSets::RouteAttrs::Mark
1242
- def mark; attributes[:"mark"]&.value; end
1523
+ def mark; self[:"mark"]; end
1243
1524
  # @rbs return: ::String
1244
1525
  # @return [String]
1245
- # @see AttributeSets::RouteAttrs::MfcStats
1246
- def mfc_stats; attributes[:"mfc_stats"]&.value; end
1526
+ def mfc_stats; self[:"mfc_stats"]; end
1247
1527
  # @rbs return: ::String
1248
1528
  # @return [String]
1249
- # @see AttributeSets::RouteAttrs::Via
1250
- def via; attributes[:"via"]&.value; end
1529
+ def via; self[:"via"]; end
1251
1530
  # @rbs return: ::String
1252
1531
  # @return [String]
1253
- # @see AttributeSets::RouteAttrs::Newdst
1254
- def newdst; attributes[:"newdst"]&.value; end
1532
+ def newdst; self[:"newdst"]; end
1255
1533
  # @rbs return: ::Integer
1256
1534
  # @return [Integer]
1257
- # @see AttributeSets::RouteAttrs::Pref
1258
- def pref; attributes[:"pref"]&.value; end
1535
+ def pref; self[:"pref"]; end
1259
1536
  # @rbs return: ::Integer
1260
1537
  # @return [Integer]
1261
- # @see AttributeSets::RouteAttrs::EncapType
1262
- def encap_type; attributes[:"encap_type"]&.value; end
1538
+ def encap_type; self[:"encap_type"]; end
1263
1539
  # @rbs return: ::String
1264
1540
  # @return [String]
1265
- # @see AttributeSets::RouteAttrs::Encap
1266
- def encap; attributes[:"encap"]&.value; end
1541
+ def encap; self[:"encap"]; end
1267
1542
  # @rbs return: ::Integer
1268
1543
  # @return [Integer]
1269
- # @see AttributeSets::RouteAttrs::Expires
1270
- def expires; attributes[:"expires"]&.value; end
1544
+ def expires; self[:"expires"]; end
1271
1545
  # @rbs return: ::String
1272
1546
  # @return [String]
1273
- # @see AttributeSets::RouteAttrs::Pad
1274
- def pad; attributes[:"pad"]&.value; end
1547
+ def pad; self[:"pad"]; end
1275
1548
  # @rbs return: ::Integer
1276
1549
  # @return [Integer]
1277
- # @see AttributeSets::RouteAttrs::Uid
1278
- def uid; attributes[:"uid"]&.value; end
1550
+ def uid; self[:"uid"]; end
1279
1551
  # @rbs return: ::Integer
1280
1552
  # @return [Integer]
1281
- # @see AttributeSets::RouteAttrs::TtlPropagate
1282
- def ttl_propagate; attributes[:"ttl_propagate"]&.value; end
1553
+ def ttl_propagate; self[:"ttl_propagate"]; end
1283
1554
  # @rbs return: ::Integer
1284
1555
  # @return [Integer]
1285
- # @see AttributeSets::RouteAttrs::IpProto
1286
- def ip_proto; attributes[:"ip_proto"]&.value; end
1556
+ def ip_proto; self[:"ip_proto"]; end
1287
1557
  # @rbs return: ::Integer
1288
1558
  # @return [Integer]
1289
- # @see AttributeSets::RouteAttrs::Sport
1290
- def sport; attributes[:"sport"]&.value; end
1559
+ def sport; self[:"sport"]; end
1291
1560
  # @rbs return: ::Integer
1292
1561
  # @return [Integer]
1293
- # @see AttributeSets::RouteAttrs::Dport
1294
- def dport; attributes[:"dport"]&.value; end
1562
+ def dport; self[:"dport"]; end
1295
1563
  # @rbs return: ::Integer
1296
1564
  # @return [Integer]
1297
- # @see AttributeSets::RouteAttrs::NhId
1298
- def nh_id; attributes[:"nh_id"]&.value; end
1565
+ def nh_id; self[:"nh_id"]; end
1299
1566
  # @rbs return: ::Integer
1300
1567
  # @return [Integer]
1301
- # @see AttributeSets::RouteAttrs::Flowlabel
1302
- def flowlabel; attributes[:"flowlabel"]&.value; end
1568
+ def flowlabel; self[:"flowlabel"]; end
1569
+ # Emitted only on RTM_DELROUTE notifications, and only when the
1570
+ # deletion path records a cause. An absent attribute means
1571
+ # either an older kernel or a deletion path that does not
1572
+ # record its cause, consumers must treat absent and unspec
1573
+ # identically. Currently only IPv6 deletion paths record a
1574
+ # cause. The attribute is notification-only, the kernel rejects
1575
+ # it in requests.
1576
+ #
1577
+ #
1578
+ # Known enum values are defined in {Enums::DelReason}.
1579
+ # @rbs return: ::Integer
1580
+ # @return [Integer]
1581
+ def del_reason; self[:"del_reason"]; end
1303
1582
  end
1304
- # Delete an existing route
1305
- class DoDelrouteRequest < ::Nl::Raw::Message
1583
+ # Notification about a deleted route.
1584
+ class DelrouteNtf < ::Nl::Message
1306
1585
  TYPE = 25
1307
1586
  FIXED_HEADER = Structs::Rtmsg
1308
1587
  ATTRIBUTE_SET = AttributeSets::RouteAttrs
1309
- ATTRIBUTES = Ractor.make_shareable(%i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel])
1588
+ ATTRIBUTES = %i[dst src iif oif gateway priority prefsrc metrics multipath flow cacheinfo table mark mfc_stats via newdst pref encap_type encap expires pad uid ttl_propagate ip_proto sport dport nh_id flowlabel del_reason].freeze
1589
+ include ATTRIBUTE_SET::Definitions
1590
+ def initialize(rtm_family, rtm_dst_len, rtm_src_len, rtm_tos, rtm_table, rtm_protocol, rtm_scope, rtm_type, rtm_flags, attributes = [])
1591
+ @rtm_family = rtm_family
1592
+ @rtm_dst_len = rtm_dst_len
1593
+ @rtm_src_len = rtm_src_len
1594
+ @rtm_tos = rtm_tos
1595
+ @rtm_table = rtm_table
1596
+ @rtm_protocol = rtm_protocol
1597
+ @rtm_scope = rtm_scope
1598
+ @rtm_type = rtm_type
1599
+ @rtm_flags = rtm_flags
1600
+ @attributes = attributes
1601
+ end
1602
+ # @private
1603
+ def self.build_instance(params, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1604
+ validate_params(params, FIXED_HEADER.members, ATTRIBUTES)
1605
+ new(
1606
+ FIXED_HEADER::MEMBERS[:"rtm_family"].coerce(params.fetch(:"rtm_family", 0)),
1607
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].coerce(params.fetch(:"rtm_dst_len", 0)),
1608
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].coerce(params.fetch(:"rtm_src_len", 0)),
1609
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].coerce(params.fetch(:"rtm_tos", 0)),
1610
+ FIXED_HEADER::MEMBERS[:"rtm_table"].coerce(params.fetch(:"rtm_table", 0)),
1611
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].coerce(params.fetch(:"rtm_protocol", 0)),
1612
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].coerce(params.fetch(:"rtm_scope", 0)),
1613
+ FIXED_HEADER::MEMBERS[:"rtm_type"].coerce(params.fetch(:"rtm_type", 0)),
1614
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].coerce(params.fetch(:"rtm_flags", 0)),
1615
+ build_attributes(params.slice(*ATTRIBUTES), external_selectors:),
1616
+ )
1617
+ end
1618
+ # Decodes a message payload from the decoder into a new instance.
1619
+ # @rbs (::Nl::Decoder decoder) -> instance
1620
+ def self.decode(decoder)
1621
+ word = decoder.get_u32
1622
+ value_0 = ((word >> 0) & 0xff)
1623
+ value_1 = ((word >> 8) & 0xff)
1624
+ value_2 = ((word >> 16) & 0xff)
1625
+ value_3 = ((word >> 24) & 0xff)
1626
+ word = decoder.get_u32
1627
+ value_4 = ((word >> 0) & 0xff)
1628
+ value_5 = ((word >> 8) & 0xff)
1629
+ value_6 = ((word >> 16) & 0xff)
1630
+ value_7 = ((word >> 24) & 0xff)
1631
+ value_8 = decoder.get_host_u32
1632
+ new(value_0, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, decode_attributes(decoder, BY_TYPE, 0))
1633
+ end
1634
+ def encode(encoder, external_selectors: ::Nl::Selector::EMPTY_VALUES)
1635
+ FIXED_HEADER::MEMBERS[:"rtm_family"].encode(encoder, @rtm_family)
1636
+ FIXED_HEADER::MEMBERS[:"rtm_dst_len"].encode(encoder, @rtm_dst_len)
1637
+ FIXED_HEADER::MEMBERS[:"rtm_src_len"].encode(encoder, @rtm_src_len)
1638
+ FIXED_HEADER::MEMBERS[:"rtm_tos"].encode(encoder, @rtm_tos)
1639
+ FIXED_HEADER::MEMBERS[:"rtm_table"].encode(encoder, @rtm_table)
1640
+ FIXED_HEADER::MEMBERS[:"rtm_protocol"].encode(encoder, @rtm_protocol)
1641
+ FIXED_HEADER::MEMBERS[:"rtm_scope"].encode(encoder, @rtm_scope)
1642
+ FIXED_HEADER::MEMBERS[:"rtm_type"].encode(encoder, @rtm_type)
1643
+ FIXED_HEADER::MEMBERS[:"rtm_flags"].encode(encoder, @rtm_flags)
1644
+ encode_attributes(encoder, external_selectors:)
1645
+ end
1310
1646
  # @rbs return: ::Integer
1311
1647
  # @return [Integer]
1312
- def rtm_family; fixed_header.rtm_family; end
1648
+ def rtm_family; @rtm_family; end
1313
1649
  # @rbs return: ::Integer
1314
1650
  # @return [Integer]
1315
- def rtm_dst_len; fixed_header.rtm_dst_len; end
1651
+ def rtm_dst_len; @rtm_dst_len; end
1316
1652
  # @rbs return: ::Integer
1317
1653
  # @return [Integer]
1318
- def rtm_src_len; fixed_header.rtm_src_len; end
1654
+ def rtm_src_len; @rtm_src_len; end
1319
1655
  # @rbs return: ::Integer
1320
1656
  # @return [Integer]
1321
- def rtm_tos; fixed_header.rtm_tos; end
1657
+ def rtm_tos; @rtm_tos; end
1322
1658
  # @rbs return: ::Integer
1323
1659
  # @return [Integer]
1324
- def rtm_table; fixed_header.rtm_table; end
1660
+ def rtm_table; @rtm_table; end
1325
1661
  # @rbs return: ::Integer
1326
1662
  # @return [Integer]
1327
- def rtm_protocol; fixed_header.rtm_protocol; end
1663
+ def rtm_protocol; @rtm_protocol; end
1328
1664
  # @rbs return: ::Integer
1329
1665
  # @return [Integer]
1330
- def rtm_scope; fixed_header.rtm_scope; end
1666
+ def rtm_scope; @rtm_scope; end
1331
1667
  # @rbs return: ::Integer
1332
1668
  # @return [Integer]
1333
- def rtm_type; fixed_header.rtm_type; end
1669
+ def rtm_type; @rtm_type; end
1334
1670
  # @rbs return: ::Integer
1335
1671
  # @return [Integer]
1336
- def rtm_flags; fixed_header.rtm_flags; end
1672
+ def rtm_flags; @rtm_flags; end
1337
1673
  # @rbs return: ::String
1338
1674
  # @return [String]
1339
- # @see AttributeSets::RouteAttrs::Dst
1340
- def dst; attributes[:"dst"]&.value; end
1675
+ def dst; self[:"dst"]; end
1341
1676
  # @rbs return: ::String
1342
1677
  # @return [String]
1343
- # @see AttributeSets::RouteAttrs::Src
1344
- def src; attributes[:"src"]&.value; end
1678
+ def src; self[:"src"]; end
1345
1679
  # @rbs return: ::Integer
1346
1680
  # @return [Integer]
1347
- # @see AttributeSets::RouteAttrs::Iif
1348
- def iif; attributes[:"iif"]&.value; end
1681
+ def iif; self[:"iif"]; end
1349
1682
  # @rbs return: ::Integer
1350
1683
  # @return [Integer]
1351
- # @see AttributeSets::RouteAttrs::Oif
1352
- def oif; attributes[:"oif"]&.value; end
1684
+ def oif; self[:"oif"]; end
1353
1685
  # @rbs return: ::String
1354
1686
  # @return [String]
1355
- # @see AttributeSets::RouteAttrs::Gateway
1356
- def gateway; attributes[:"gateway"]&.value; end
1687
+ def gateway; self[:"gateway"]; end
1357
1688
  # @rbs return: ::Integer
1358
1689
  # @return [Integer]
1359
- # @see AttributeSets::RouteAttrs::Priority
1360
- def priority; attributes[:"priority"]&.value; end
1690
+ def priority; self[:"priority"]; end
1361
1691
  # @rbs return: ::String
1362
1692
  # @return [String]
1363
- # @see AttributeSets::RouteAttrs::Prefsrc
1364
- def prefsrc; attributes[:"prefsrc"]&.value; end
1693
+ def prefsrc; self[:"prefsrc"]; end
1365
1694
  # @rbs return: AttributeSets::Metrics
1366
1695
  # @return [AttributeSets::Metrics]
1367
- # @see AttributeSets::RouteAttrs::Metrics
1368
- def metrics; attributes[:"metrics"]&.value; end
1696
+ def metrics; self[:"metrics"]; end
1369
1697
  # @rbs return: ::String
1370
1698
  # @return [String]
1371
- # @see AttributeSets::RouteAttrs::Multipath
1372
- def multipath; attributes[:"multipath"]&.value; end
1699
+ def multipath; self[:"multipath"]; end
1373
1700
  # @rbs return: ::Integer
1374
1701
  # @return [Integer]
1375
- # @see AttributeSets::RouteAttrs::Flow
1376
- def flow; attributes[:"flow"]&.value; end
1702
+ def flow; self[:"flow"]; end
1377
1703
  # @rbs return: Structs::RtaCacheinfo
1378
1704
  # @return [Structs::RtaCacheinfo]
1379
- # @see AttributeSets::RouteAttrs::Cacheinfo
1380
- def cacheinfo; attributes[:"cacheinfo"]&.value; end
1705
+ def cacheinfo; self[:"cacheinfo"]; end
1381
1706
  # @rbs return: ::Integer
1382
1707
  # @return [Integer]
1383
- # @see AttributeSets::RouteAttrs::Table
1384
- def table; attributes[:"table"]&.value; end
1708
+ def table; self[:"table"]; end
1385
1709
  # @rbs return: ::Integer
1386
1710
  # @return [Integer]
1387
- # @see AttributeSets::RouteAttrs::Mark
1388
- def mark; attributes[:"mark"]&.value; end
1711
+ def mark; self[:"mark"]; end
1389
1712
  # @rbs return: ::String
1390
1713
  # @return [String]
1391
- # @see AttributeSets::RouteAttrs::MfcStats
1392
- def mfc_stats; attributes[:"mfc_stats"]&.value; end
1714
+ def mfc_stats; self[:"mfc_stats"]; end
1393
1715
  # @rbs return: ::String
1394
1716
  # @return [String]
1395
- # @see AttributeSets::RouteAttrs::Via
1396
- def via; attributes[:"via"]&.value; end
1717
+ def via; self[:"via"]; end
1397
1718
  # @rbs return: ::String
1398
1719
  # @return [String]
1399
- # @see AttributeSets::RouteAttrs::Newdst
1400
- def newdst; attributes[:"newdst"]&.value; end
1720
+ def newdst; self[:"newdst"]; end
1401
1721
  # @rbs return: ::Integer
1402
1722
  # @return [Integer]
1403
- # @see AttributeSets::RouteAttrs::Pref
1404
- def pref; attributes[:"pref"]&.value; end
1723
+ def pref; self[:"pref"]; end
1405
1724
  # @rbs return: ::Integer
1406
1725
  # @return [Integer]
1407
- # @see AttributeSets::RouteAttrs::EncapType
1408
- def encap_type; attributes[:"encap_type"]&.value; end
1726
+ def encap_type; self[:"encap_type"]; end
1409
1727
  # @rbs return: ::String
1410
1728
  # @return [String]
1411
- # @see AttributeSets::RouteAttrs::Encap
1412
- def encap; attributes[:"encap"]&.value; end
1729
+ def encap; self[:"encap"]; end
1413
1730
  # @rbs return: ::Integer
1414
1731
  # @return [Integer]
1415
- # @see AttributeSets::RouteAttrs::Expires
1416
- def expires; attributes[:"expires"]&.value; end
1732
+ def expires; self[:"expires"]; end
1417
1733
  # @rbs return: ::String
1418
1734
  # @return [String]
1419
- # @see AttributeSets::RouteAttrs::Pad
1420
- def pad; attributes[:"pad"]&.value; end
1735
+ def pad; self[:"pad"]; end
1736
+ # @rbs return: ::Integer
1737
+ # @return [Integer]
1738
+ def uid; self[:"uid"]; end
1421
1739
  # @rbs return: ::Integer
1422
1740
  # @return [Integer]
1423
- # @see AttributeSets::RouteAttrs::Uid
1424
- def uid; attributes[:"uid"]&.value; end
1741
+ def ttl_propagate; self[:"ttl_propagate"]; end
1425
1742
  # @rbs return: ::Integer
1426
1743
  # @return [Integer]
1427
- # @see AttributeSets::RouteAttrs::TtlPropagate
1428
- def ttl_propagate; attributes[:"ttl_propagate"]&.value; end
1744
+ def ip_proto; self[:"ip_proto"]; end
1429
1745
  # @rbs return: ::Integer
1430
1746
  # @return [Integer]
1431
- # @see AttributeSets::RouteAttrs::IpProto
1432
- def ip_proto; attributes[:"ip_proto"]&.value; end
1747
+ def sport; self[:"sport"]; end
1433
1748
  # @rbs return: ::Integer
1434
1749
  # @return [Integer]
1435
- # @see AttributeSets::RouteAttrs::Sport
1436
- def sport; attributes[:"sport"]&.value; end
1750
+ def dport; self[:"dport"]; end
1437
1751
  # @rbs return: ::Integer
1438
1752
  # @return [Integer]
1439
- # @see AttributeSets::RouteAttrs::Dport
1440
- def dport; attributes[:"dport"]&.value; end
1753
+ def nh_id; self[:"nh_id"]; end
1441
1754
  # @rbs return: ::Integer
1442
1755
  # @return [Integer]
1443
- # @see AttributeSets::RouteAttrs::NhId
1444
- def nh_id; attributes[:"nh_id"]&.value; end
1756
+ def flowlabel; self[:"flowlabel"]; end
1757
+ # Emitted only on RTM_DELROUTE notifications, and only when the
1758
+ # deletion path records a cause. An absent attribute means
1759
+ # either an older kernel or a deletion path that does not
1760
+ # record its cause, consumers must treat absent and unspec
1761
+ # identically. Currently only IPv6 deletion paths record a
1762
+ # cause. The attribute is notification-only, the kernel rejects
1763
+ # it in requests.
1764
+ #
1765
+ #
1766
+ # Known enum values are defined in {Enums::DelReason}.
1445
1767
  # @rbs return: ::Integer
1446
1768
  # @return [Integer]
1447
- # @see AttributeSets::RouteAttrs::Flowlabel
1448
- def flowlabel; attributes[:"flowlabel"]&.value; end
1769
+ def del_reason; self[:"del_reason"]; end
1449
1770
  end
1450
1771
  end
1451
- module Notifications
1452
- end
1453
1772
  # @private
1454
- NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
1773
+ NOTIFICATIONS = {24 => Notifications::NewrouteNtf, 25 => Notifications::DelrouteNtf}.freeze #: Hash[::Integer, ::Class]
1455
1774
  # Dump route information.
1456
1775
  # @rbs (?rtm_family: ::Integer, ?rtm_dst_len: ::Integer, ?rtm_src_len: ::Integer, ?rtm_tos: ::Integer, ?rtm_table: ::Integer, ?rtm_protocol: ::Integer, ?rtm_scope: ::Integer, ?rtm_type: ::Integer, ?rtm_flags: ::Integer, ?dst: ::String, ?src: ::String, ?iif: ::Integer, ?oif: ::Integer, ?mark: ::Integer, ?uid: ::Integer, ?ip_proto: ::Integer, ?sport: ::Integer, ?dport: ::Integer, ?flowlabel: ::Integer) -> Messages::DoGetrouteReply
1457
1776
  # @param [Hash] args
@@ -1751,5 +2070,13 @@ class RtRoute < ::Nl::Raw::Family
1751
2070
  return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
1752
2071
  build_async_facade(AsyncOperations, stream_capacity:)
1753
2072
  end
2073
+ # @rbs (*(:rtnlgrp_ipv4_route | :rtnlgrp_ipv6_route) groups) -> self
2074
+ # @param [Array<:rtnlgrp_ipv4_route, :rtnlgrp_ipv6_route>] groups
2075
+ # @return [self]
2076
+ def subscribe(*groups) = super
2077
+ # @rbs (*(:rtnlgrp_ipv4_route | :rtnlgrp_ipv6_route) groups) -> self
2078
+ # @param [Array<:rtnlgrp_ipv4_route, :rtnlgrp_ipv6_route>] groups
2079
+ # @return [self]
2080
+ def unsubscribe(*groups) = super
1754
2081
  end
1755
2082
  end; end