nl 0.2.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/Rakefile +7 -0
  4. data/lib/nl/async/dispatcher.rb +199 -0
  5. data/lib/nl/async/driver.rb +37 -0
  6. data/lib/nl/async/mailbox.rb +81 -0
  7. data/lib/nl/async/operation.rb +277 -0
  8. data/lib/nl/async.rb +13 -0
  9. data/lib/nl/attribute_set.rb +173 -0
  10. data/lib/nl/bitfield32.rb +86 -0
  11. data/lib/nl/blocking_transport.rb +131 -0
  12. data/lib/nl/connection.rb +61 -0
  13. data/lib/nl/datagram.rb +22 -0
  14. data/lib/nl/datatypes.rb +454 -0
  15. data/lib/nl/decoder.rb +13 -1
  16. data/lib/nl/endian.rb +10 -0
  17. data/lib/nl/error.rb +10 -0
  18. data/lib/nl/exchange.rb +124 -0
  19. data/lib/nl/family.rb +117 -23
  20. data/lib/nl/genl/client.rb +104 -0
  21. data/lib/nl/genl/protocol.rb +59 -0
  22. data/lib/nl/genl/wire.rb +94 -0
  23. data/lib/nl/genl.rb +60 -73
  24. data/lib/nl/notification.rb +112 -0
  25. data/lib/nl/notification_router.rb +92 -0
  26. data/lib/nl/raw/client.rb +83 -0
  27. data/lib/nl/raw/protocol.rb +112 -0
  28. data/lib/nl/raw/wire.rb +146 -0
  29. data/lib/nl/raw.rb +104 -0
  30. data/lib/nl/sequence_allocator.rb +34 -0
  31. data/lib/nl/socket.rb +15 -12
  32. data/lib/nl/structured_payload.rb +61 -0
  33. data/lib/nl/sub_message.rb +94 -0
  34. data/lib/nl/version.rb +1 -1
  35. data/lib/nl.rb +10 -12
  36. data/sig/generated/nl/async/dispatcher.rbs +53 -0
  37. data/sig/generated/nl/async/driver.rbs +21 -0
  38. data/sig/generated/nl/async/mailbox.rbs +32 -0
  39. data/sig/generated/nl/async/operation.rbs +123 -0
  40. data/sig/generated/nl/async.rbs +9 -0
  41. data/sig/generated/nl/attribute_set.rbs +50 -0
  42. data/sig/generated/nl/bitfield32.rbs +41 -0
  43. data/sig/generated/nl/blocking_transport.rbs +33 -0
  44. data/sig/generated/nl/connection.rbs +26 -0
  45. data/sig/generated/nl/datagram.rbs +11 -0
  46. data/sig/generated/nl/datatypes.rbs +181 -0
  47. data/sig/generated/nl/decoder.rbs +38 -0
  48. data/sig/generated/nl/encoder.rbs +29 -0
  49. data/sig/generated/nl/endian.rbs +28 -0
  50. data/sig/generated/nl/error.rbs +27 -0
  51. data/sig/generated/nl/exchange.rbs +75 -0
  52. data/sig/generated/nl/family.rbs +71 -0
  53. data/sig/generated/nl/genl/client.rbs +74 -0
  54. data/sig/generated/nl/genl/protocol.rbs +37 -0
  55. data/sig/generated/nl/genl/wire.rbs +113 -0
  56. data/sig/generated/nl/genl.rbs +50 -0
  57. data/sig/generated/nl/notification.rbs +53 -0
  58. data/sig/generated/nl/notification_router.rbs +30 -0
  59. data/sig/generated/nl/raw/client.rbs +50 -0
  60. data/sig/generated/nl/raw/protocol.rbs +122 -0
  61. data/sig/generated/nl/raw/wire.rbs +151 -0
  62. data/sig/generated/nl/raw.rbs +70 -0
  63. data/sig/generated/nl/sequence_allocator.rbs +15 -0
  64. data/sig/generated/nl/socket.rbs +40 -0
  65. data/sig/generated/nl/structured_payload.rbs +25 -0
  66. data/sig/generated/nl/sub_message.rbs +74 -0
  67. data/sig/generated/nl/version.rbs +5 -0
  68. data/sig/generated/nl.rbs +2 -0
  69. metadata +65 -9
  70. data/lib/nl/core.rb +0 -94
  71. data/lib/nl/protocols/genl.rb +0 -55
  72. data/lib/nl/protocols/raw.rb +0 -395
@@ -0,0 +1,181 @@
1
+ # Generated from lib/nl/datatypes.rb with RBS::Inline
2
+
3
+ module Nl
4
+ interface _DataType
5
+ def encode: (Encoder, untyped, ?context: untyped) -> void
6
+
7
+ def decode: (Decoder, ?context: untyped, ?nlattr_type_flags: Integer) -> untyped
8
+
9
+ def nlattr_type_flags: (?untyped, ?context: untyped) -> Integer
10
+
11
+ def coerce: (untyped, ?context: untyped) -> untyped
12
+ end
13
+
14
+ module DataTypes
15
+ class Base
16
+ def initialize: (?check: untyped) -> untyped
17
+
18
+ def nlattr_type_flags: (?untyped _value, ?context: untyped) -> untyped
19
+
20
+ def coerce: (untyped value, ?context: untyped) -> untyped
21
+
22
+ private def checked: (untyped value) -> untyped
23
+ end
24
+
25
+ class Scalar < Base
26
+ def initialize: (untyped type, check: untyped) -> untyped
27
+
28
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
29
+
30
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
31
+ end
32
+
33
+ class VariableInteger < Base
34
+ UINT32_RANGE: untyped
35
+
36
+ UINT64_RANGE: untyped
37
+
38
+ SINT32_RANGE: untyped
39
+
40
+ SINT64_RANGE: untyped
41
+
42
+ def initialize: (untyped byte_order, signed: untyped, check: untyped) -> untyped
43
+
44
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
45
+
46
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
47
+ end
48
+
49
+ class String < Base
50
+ def initialize: (check: untyped) -> untyped
51
+
52
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
53
+
54
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
55
+ end
56
+
57
+ class Binary < Base
58
+ def initialize: (check: untyped, ?length: untyped) -> untyped
59
+
60
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
61
+
62
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
63
+ end
64
+
65
+ # An array whose elements are packed consecutively without per-element
66
+ # headers or alignment padding.
67
+ class PackedArray < Base
68
+ def initialize: (untyped sub_type, ?check: untyped) -> untyped
69
+
70
+ def encode: (untyped encoder, untyped values, ?context: untyped) -> untyped
71
+
72
+ def coerce: (untyped values, ?context: untyped) -> untyped
73
+
74
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
75
+ end
76
+
77
+ class Struct < Base
78
+ def initialize: (untyped type, ?check: untyped, ?consume_remaining: untyped) -> untyped
79
+
80
+ def coerce: (untyped value, ?context: untyped) -> untyped
81
+
82
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
83
+
84
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
85
+ end
86
+
87
+ class Flag < Base
88
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
89
+
90
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
91
+ end
92
+
93
+ class Bitfield32 < Base
94
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
95
+
96
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
97
+ end
98
+
99
+ class Pad < Base
100
+ def initialize: (?untyped length) -> untyped
101
+
102
+ def encode: (untyped encoder, untyped _value, ?context: untyped) -> untyped
103
+
104
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
105
+ end
106
+
107
+ class NestedAttributes < Base
108
+ def initialize: (untyped attribute_set, ?selector_bindings: untyped) -> untyped
109
+
110
+ def nlattr_type_flags: (?untyped _value, ?context: untyped) -> untyped
111
+
112
+ def coerce: (untyped value, ?context: untyped) -> untyped
113
+
114
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
115
+
116
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
117
+
118
+ private def selectors: (untyped context) -> untyped
119
+ end
120
+
121
+ class SubMessage < Base
122
+ class Format < Data
123
+ attr_reader type(): untyped
124
+
125
+ attr_reader selector_bindings(): untyped
126
+
127
+ attr_reader nested(): untyped
128
+
129
+ def self.new: (untyped type, untyped selector_bindings, untyped nested) -> instance
130
+ | (type: untyped, selector_bindings: untyped, nested: untyped) -> instance
131
+
132
+ def self.members: () -> [ :type, :selector_bindings, :nested ]
133
+
134
+ def members: () -> [ :type, :selector_bindings, :nested ]
135
+ end
136
+
137
+ def initialize: (untyped selector, untyped formats) -> untyped
138
+
139
+ def nlattr_type_flags: (?untyped value, context: untyped) -> untyped
140
+
141
+ def coerce: (untyped value, context: untyped) -> untyped
142
+
143
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
144
+
145
+ def decode: (untyped decoder, context: untyped, ?nlattr_type_flags: untyped) -> untyped
146
+
147
+ private def selectors: (untyped format, untyped context) -> untyped
148
+ end
149
+
150
+ # Nested attributes whose type numbers are keys rather than members of
151
+ # an attribute set. Each level is returned as an Integer-keyed Hash;
152
+ # values at the innermost level are decoded as @attribute_set.
153
+ class NestTypeValue < Base
154
+ def initialize: (untyped attribute_set, untyped levels, ?selector_bindings: untyped) -> untyped
155
+
156
+ def encode: (untyped encoder, untyped value, ?context: untyped) -> untyped
157
+
158
+ def coerce: (?untyped value, ?context: untyped, **untyped keywords) -> untyped
159
+
160
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
161
+
162
+ private def encode_level: (untyped encoder, untyped values, untyped levels, untyped external_selectors) -> untyped
163
+
164
+ private def coerce_level: (untyped values, untyped levels, untyped external_selectors) -> untyped
165
+
166
+ private def decode_level: (untyped decoder, untyped levels, untyped external_selectors) -> untyped
167
+
168
+ private def selectors: (untyped context) -> untyped
169
+ end
170
+
171
+ class IndexedArray < Base
172
+ def initialize: (untyped sub_type) -> untyped
173
+
174
+ def encode: (untyped encoder, untyped values, ?context: untyped) -> untyped
175
+
176
+ def coerce: (untyped values, ?context: untyped) -> untyped
177
+
178
+ def decode: (untyped decoder, ?context: untyped, ?nlattr_type_flags: untyped) -> untyped
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,38 @@
1
+ # Generated from lib/nl/decoder.rb with RBS::Inline
2
+
3
+ module Nl
4
+ class Decoder
5
+ class Error < StandardError
6
+ end
7
+
8
+ class OutOfBounds < Error
9
+ def initialize: (?untyped message) -> untyped
10
+ end
11
+
12
+ class Unterminated < Error
13
+ def initialize: (?untyped message) -> untyped
14
+ end
15
+
16
+ def initialize: (untyped buffer, ?untyped offset, ?untyped length) -> untyped
17
+
18
+ def available?: (?untyped size) -> untyped
19
+
20
+ def remaining: () -> untyped
21
+
22
+ def limit: (untyped size) -> untyped
23
+
24
+ def skip: (?untyped length) -> untyped
25
+
26
+ def get_string: (?untyped length) -> untyped
27
+
28
+ def get_buffer: (?untyped length) -> untyped
29
+
30
+ def get_zstring: (?unterminated_ok: untyped) -> untyped
31
+
32
+ def get_value: (untyped type) -> untyped
33
+
34
+ def get_values: (untyped types) -> untyped
35
+
36
+ def align_to: (untyped alignment) -> untyped
37
+ end
38
+ end
@@ -0,0 +1,29 @@
1
+ # Generated from lib/nl/encoder.rb with RBS::Inline
2
+
3
+ module Nl
4
+ class Encoder
5
+ attr_reader position: untyped
6
+
7
+ def initialize: (?untyped capacity) -> untyped
8
+
9
+ def reserve: (untyped size) -> untyped
10
+
11
+ def put_string: (untyped value) -> untyped
12
+
13
+ def put_zstring: (untyped value) -> untyped
14
+
15
+ def put_value: (untyped type, untyped value) -> untyped
16
+
17
+ def put_values: (untyped types, untyped values) -> untyped
18
+
19
+ def align_to: (untyped alignment) -> untyped
20
+
21
+ def put_value_at: (untyped offset, untyped type, untyped value) -> untyped
22
+
23
+ def put_values_at: (untyped offset, untyped types, untyped values) -> untyped
24
+
25
+ def buffer: () -> untyped
26
+
27
+ def measure: (untyped type, ?untyped offset) -> untyped
28
+ end
29
+ end
@@ -0,0 +1,28 @@
1
+ # Generated from lib/nl/endian.rb with RBS::Inline
2
+
3
+ module Nl
4
+ module Endian
5
+ # sizeof(int)
6
+ SIZEOF_INT: untyped
7
+
8
+ # sizeof(long)
9
+ SIZEOF_LONG: untyped
10
+
11
+ # sizeof(long long)
12
+ SIZEOF_LLONG: untyped
13
+
14
+ # Little-endian scalar types.
15
+ module Little
16
+ end
17
+
18
+ # Big-endian scalar types.
19
+ module Big
20
+ end
21
+
22
+ # Host-endian scalar types.
23
+ #
24
+ # This module includes either {Little} or {Big} depending on the host's native byte order.
25
+ module Host
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/nl/error.rb with RBS::Inline
2
+
3
+ module Nl
4
+ class Error < StandardError
5
+ end
6
+
7
+ class ProtocolViolation < Error
8
+ end
9
+
10
+ class ExhaustedSequenceNumber < Error
11
+ end
12
+
13
+ class TimeoutError < Error
14
+ end
15
+
16
+ class ClosedError < Error
17
+ end
18
+
19
+ class NotificationLossError < Error
20
+ end
21
+
22
+ class UnknownMulticastGroupError < Error
23
+ end
24
+
25
+ class UnresolvedMulticastGroupError < Error
26
+ end
27
+ end
@@ -0,0 +1,75 @@
1
+ # Generated from lib/nl/exchange.rb with RBS::Inline
2
+
3
+ module Nl
4
+ # State machine for one Netlink request/reply exchange.
5
+ #
6
+ # Dump exchanges are known to be multipart from the request and remain open
7
+ # through NLMSG_DONE. Some Linux Generic Netlink dump handlers construct
8
+ # replies with genlmsg_iput(), which leaves NLM_F_MULTI unset despite that
9
+ # multipart lifetime. Dump mode therefore accepts data with or without the
10
+ # flag; reply mode still uses it to detect a multipart do response.
11
+ #
12
+ # Some operations also return multipart data for a do request, although YNL
13
+ # cannot declare such a reply. Reply mode handles this kernel behavior by
14
+ # retaining the first data message, draining the remainder, and completing
15
+ # on NLMSG_DONE instead of ACK.
16
+ class Exchange
17
+ class Item < Data
18
+ attr_reader value(): untyped
19
+
20
+ def self.new: (untyped value) -> instance
21
+ | (value: untyped) -> instance
22
+
23
+ def self.members: () -> [ :value ]
24
+
25
+ def members: () -> [ :value ]
26
+ end
27
+
28
+ class Complete < Data
29
+ def self.new: () -> instance
30
+ | () -> instance
31
+
32
+ def self.members: () -> [ ]
33
+
34
+ def members: () -> [ ]
35
+ end
36
+
37
+ COMPLETE: untyped
38
+
39
+ class Failure < Data
40
+ attr_reader exception(): untyped
41
+
42
+ def self.new: (untyped exception) -> instance
43
+ | (exception: untyped) -> instance
44
+
45
+ def self.members: () -> [ :exception ]
46
+
47
+ def members: () -> [ :exception ]
48
+ end
49
+
50
+ MODES: untyped
51
+
52
+ attr_reader mode: untyped
53
+
54
+ # @rbs (mode: :dump | :no_reply | :reply) -> void
55
+ def initialize: (mode: :dump | :no_reply | :reply) -> void
56
+
57
+ def accept: (untyped frame) -> untyped
58
+
59
+ def cancel: () -> untyped
60
+
61
+ def cancelled?: () -> untyped
62
+
63
+ def complete?: () -> untyped
64
+
65
+ def result: () -> untyped
66
+
67
+ private def accept_ack: () -> untyped
68
+
69
+ private def accept_reply: (untyped frame) -> untyped
70
+
71
+ private def complete: (untyped value) -> untyped
72
+
73
+ private def fail_with: (untyped exception) -> untyped
74
+ end
75
+ end
@@ -0,0 +1,71 @@
1
+ # Generated from lib/nl/family.rb with RBS::Inline
2
+
3
+ module Nl
4
+ type executor = :thread | :fiber
5
+
6
+ interface _Connection
7
+ def exchange: (Raw::Endpoint endpoint, Symbol kind, Class request_class, Class reply_class, Hash[Symbol, untyped] args) ?{ (untyped) -> void } -> untyped
8
+
9
+ def exchange_async: (Raw::Endpoint endpoint, Symbol kind, Class request_class, Class reply_class, Hash[Symbol, untyped] args, ?stream_capacity: Integer?) -> (Async::Future[untyped] | Async::Stream[untyped])
10
+
11
+ def async_capable?: () -> bool
12
+
13
+ def register_notifications: (Raw::Endpoint, Hash[Integer, Class]) -> NotificationChannel
14
+
15
+ def add_memberships: (Array[Integer]) -> nil
16
+
17
+ def drop_memberships: (Array[Integer]) -> nil
18
+
19
+ def receive_notification: (Raw::Endpoint, ?timeout: Numeric?) -> untyped
20
+
21
+ def close: () -> nil
22
+ end
23
+
24
+ interface _FamilyClass[out F]
25
+ def new: (_Connection, endpoint: Raw::Endpoint) -> F
26
+ end
27
+
28
+ class Family
29
+ DEFAULT_NOTIFICATION_CAPACITY: untyped
30
+
31
+ module Session
32
+ def close: () -> nil
33
+ end
34
+
35
+ # --
36
+ # @rbs connection: _Connection
37
+ # @rbs endpoint: Raw::Endpoint
38
+ # @rbs return: instance
39
+ def initialize: (_Connection connection, endpoint: Raw::Endpoint) -> instance
40
+
41
+ private def exchange_message: (untyped kind, untyped request_class, untyped reply_class, untyped args) ?{ (?) -> untyped } -> untyped
42
+
43
+ def async_capable?: () -> bool
44
+
45
+ # Adds multicast memberships to the existing family socket. Membership is
46
+ # additive and remains active until explicitly removed or the owner closes.
47
+ def subscribe: (*untyped groups) -> untyped
48
+
49
+ def unsubscribe: (*untyped groups) -> untyped
50
+
51
+ def receive_notification: (?timeout: untyped) -> untyped
52
+
53
+ def each_notification: () ?{ (?) -> untyped } -> untyped
54
+
55
+ # Builds a generated asynchronous-operation facade with a narrowly scoped
56
+ # callback, so the facade does not need access to Family's private API.
57
+ # --
58
+ # @rbs operations_class: Class
59
+ # @rbs stream_capacity: Integer?
60
+ # @rbs return: untyped
61
+ private def build_async_facade: (Class operations_class, ?stream_capacity: Integer?) -> untyped
62
+
63
+ private def exchange_message_async: (untyped kind, untyped request_class, untyped reply_class, untyped args, ?stream_capacity: untyped) -> untyped
64
+
65
+ private def notification_classes: () -> untyped
66
+
67
+ private def multicast_groups: () -> untyped
68
+
69
+ private def multicast_group_ids: (untyped names) -> untyped
70
+ end
71
+ end
@@ -0,0 +1,74 @@
1
+ # Generated from lib/nl/genl/client.rb with RBS::Inline
2
+
3
+ module Nl
4
+ module Genl
5
+ # Dynamically resolved information for a generic Netlink family.
6
+ #
7
+ # @!attribute [r] id
8
+ # @return [Integer] the assigned family ID
9
+ # @!attribute [r] multicast_groups
10
+ # @return [Hash<String, Integer>] multicast group names mapped to their IDs
11
+ class FamilyInfo < Data
12
+ attr_reader id(): Integer
13
+
14
+ attr_reader multicast_groups(): Hash[String, Integer]
15
+
16
+ def self.new: (Integer id, Hash[String, Integer] multicast_groups) -> instance
17
+ | (id: Integer, multicast_groups: Hash[String, Integer]) -> instance
18
+
19
+ def self.members: () -> [ :id, :multicast_groups ]
20
+
21
+ def members: () -> [ :id, :multicast_groups ]
22
+ end
23
+
24
+ # Owns one generic Netlink connection shared by compatible families.
25
+ class Client
26
+ # Opens a generic Netlink client.
27
+ #
28
+ # @overload open(resolver:, executor: nil, notification_capacity: Nl::Connection::DEFAULT_NOTIFICATION_CAPACITY)
29
+ # The caller is responsible for closing the client.
30
+ # @param [#call] resolver a callable that resolves a family name to {FamilyInfo}
31
+ # @param [:thread, :fiber, nil] executor the asynchronous executor, or `nil` for blocking operation
32
+ # @param [Integer] notification_capacity the maximum number of queued notifications
33
+ # @return [Client] the opened client
34
+ # @overload open(resolver:, executor: nil, notification_capacity: Nl::Connection::DEFAULT_NOTIFICATION_CAPACITY, &block)
35
+ # The client is automatically closed after the block returns.
36
+ # @param [#call] resolver a callable that resolves a family name to {FamilyInfo}
37
+ # @param [:thread, :fiber, nil] executor the asynchronous executor, or `nil` for blocking operation
38
+ # @param [Integer] notification_capacity the maximum number of queued notifications
39
+ # @yieldparam [Client] client the opened client
40
+ # @return [Object] the value returned from the block
41
+ # @rbs (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) -> instance
42
+ # | [R] (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) { (instance) -> R } -> R
43
+ def self.open: (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) -> instance
44
+ | [R] (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) { (instance) -> R } -> R
45
+
46
+ # @param [#call] resolver a callable that resolves a family name to {FamilyInfo}
47
+ # @param [:thread, :fiber, nil] executor the asynchronous executor, or `nil` for blocking operation
48
+ # @param [Integer] notification_capacity the maximum number of queued notifications
49
+ # @rbs (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) -> void
50
+ def initialize: (resolver: ^(instance, ::String) -> FamilyInfo, ?executor: executor?, ?notification_capacity: Integer?) -> void
51
+
52
+ # Builds a family backed by this client's connection.
53
+ #
54
+ # @param [Class<Family>] family_class a generic Netlink family class
55
+ # @return [Family] an instance of `family_class`
56
+ # @raise [TypeError] if +family_class+ does not inherit from {Family}
57
+ # @rbs [F < Family] (_FamilyClass[F] family_class) -> F
58
+ def family: [F < Family] (_FamilyClass[F] family_class) -> F
59
+
60
+ # Closes the underlying Netlink connection.
61
+ #
62
+ # @return [void]
63
+ # @rbs () -> void
64
+ def close: () -> void
65
+
66
+ # Resolves and caches information for a family by name.
67
+ #
68
+ # @param [String] name the generic Netlink family name
69
+ # @return [FamilyInfo] the resolved family information
70
+ # @rbs (String name) -> FamilyInfo
71
+ private def family_info: (String name) -> FamilyInfo
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,37 @@
1
+ # Generated from lib/nl/genl/protocol.rb with RBS::Inline
2
+
3
+ module Nl
4
+ module Genl
5
+ # A generated Generic Netlink family bound to nlctrl-provided information.
6
+ class Endpoint < Raw::Endpoint
7
+ attr_reader info: untyped
8
+
9
+ def initialize: (untyped definition, untyped info) -> untyped
10
+
11
+ def family_id: () -> untyped
12
+
13
+ def version: () -> untyped
14
+
15
+ def frame_type: (untyped _message_class) -> untyped
16
+
17
+ def multicast_group_id: (untyped name, untyped _value) -> untyped
18
+ end
19
+
20
+ # Socket-wide Generic Netlink wire behavior.
21
+ class Protocol < Raw::Protocol
22
+ def initialize: () -> untyped
23
+
24
+ def encode_message: (untyped encoder, untyped endpoint, untyped request, seq: untyped, pid: untyped) -> untyped
25
+
26
+ def notification_channel_key: (untyped endpoint) -> untyped
27
+
28
+ def notification_route_keys: (untyped endpoint, untyped _classes) -> untyped
29
+
30
+ def notification_frame_key: (untyped header) -> untyped
31
+
32
+ def notification_frame?: (untyped endpoint, untyped header, untyped _payload) -> untyped
33
+
34
+ def notification_class: (untyped endpoint, untyped header, untyped payload, untyped classes) -> untyped
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,113 @@
1
+ # Generated from lib/nl/genl/wire.rb with RBS::Inline
2
+
3
+ module Nl
4
+ module Genl
5
+ # Constants from <linux/genetlink.h>
6
+ module Constants
7
+ GENL_NAMSIZ: ::Integer
8
+
9
+ GENL_MIN_ID: untyped
10
+
11
+ GENL_MAX_ID: ::Integer
12
+
13
+ GENL_HDRLEN: ::Integer
14
+
15
+ GENL_ID_GENERATE: ::Integer
16
+
17
+ GENL_ID_CTRL: untyped
18
+
19
+ GENL_ID_VFS_DQUOT: untyped
20
+
21
+ GENL_ID_PMCRAID: untyped
22
+
23
+ CTRL_CMD_UNSPEC: ::Integer
24
+
25
+ CTRL_CMD_NEWFAMILY: ::Integer
26
+
27
+ CTRL_CMD_DELFAMILY: ::Integer
28
+
29
+ CTRL_CMD_GETFAMILY: ::Integer
30
+
31
+ CTRL_CMD_NEWOPS: ::Integer
32
+
33
+ CTRL_CMD_DELOPS: ::Integer
34
+
35
+ CTRL_CMD_GETOPS: ::Integer
36
+
37
+ CTRL_CMD_NEWMCAST_GRP: ::Integer
38
+
39
+ CTRL_CMD_DELMCAST_GRP: ::Integer
40
+
41
+ CTRL_CMD_GETMCAST_GRP: ::Integer
42
+
43
+ CTRL_ATTR_UNSPEC: ::Integer
44
+
45
+ CTRL_ATTR_FAMILY_ID: ::Integer
46
+
47
+ CTRL_ATTR_FAMILY_NAME: ::Integer
48
+
49
+ CTRL_ATTR_VERSION: ::Integer
50
+
51
+ CTRL_ATTR_HDRSIZE: ::Integer
52
+
53
+ CTRL_ATTR_MAXATTR: ::Integer
54
+
55
+ CTRL_ATTR_OPS: ::Integer
56
+
57
+ CTRL_ATTR_MCAST_GROUPS: ::Integer
58
+
59
+ CTRL_ATTR_OP_UNSPEC: ::Integer
60
+
61
+ CTRL_ATTR_OP_ID: ::Integer
62
+
63
+ CTRL_ATTR_OP_FLAGS: ::Integer
64
+
65
+ CTRL_ATTR_MCAST_GRP_UNSPEC: ::Integer
66
+
67
+ CTRL_ATTR_MCAST_GRP_NAME: ::Integer
68
+
69
+ CTRL_ATTR_MCAST_GRP_ID: ::Integer
70
+ end
71
+
72
+ include Constants
73
+
74
+ # Header prepended to a Generic Netlink payload after the Netlink header.
75
+ #
76
+ # This corresponds to Linux's +struct genlmsghdr+.
77
+ #
78
+ # @!attribute [rw] cmd
79
+ # @return [Integer] family-specific command identifier
80
+ # @!attribute [rw] version
81
+ # @return [Integer] family-specific protocol version
82
+ # @!attribute [rw] reserved
83
+ # @return [Integer] reserved field, which must be zero
84
+ class GenlMsgHdr < Struct[Integer]
85
+ attr_accessor cmd(): Integer
86
+
87
+ attr_accessor version(): Integer
88
+
89
+ attr_accessor reserved(): Integer
90
+
91
+ def self.new: (?Integer cmd, ?Integer version, ?Integer reserved) -> instance
92
+ | (?cmd: Integer, ?version: Integer, ?reserved: Integer) -> instance
93
+ end
94
+
95
+ class GenlMsgHdr
96
+ FORMAT: untyped
97
+
98
+ # Decodes a header from the decoder's current position.
99
+ #
100
+ # @param [Decoder] decoder the source decoder
101
+ # @return [GenlMsgHdr] the decoded header
102
+ # @rbs (Decoder decoder) -> instance
103
+ def self.decode: (Decoder decoder) -> instance
104
+
105
+ # Encodes this header at the encoder's current position.
106
+ #
107
+ # @param [Encoder] encoder the destination encoder
108
+ # @return [void]
109
+ # @rbs (Encoder encoder) -> void
110
+ def encode: (Encoder encoder) -> void
111
+ end
112
+ end
113
+ end