1 # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
4 $id: http://kernel.org/schemas/netlink/genetlink-legacy.yaml#
5 $schema: https://json-schema.org/draft-07/schema
13 type: [ string, integer ]
14 pattern: ^[0-9A-Za-z_]+( - 1)?$
19 description: Specification of a genetlink protocol
21 required: [ name, doc, attribute-sets, operations ]
22 additionalProperties: False
25 description: Name of the genetlink family.
30 description: Generic Netlink family version. Default is 1.
34 description: Schema compatibility level. Default is "genetlink".
35 enum: [ genetlink, genetlink-c, genetlink-legacy ] # Trim
37 description: Path to the uAPI header, default is linux/${family-name}.h
41 description: Name of the define for the family name.
44 description: Name of the define for the verion of the family.
47 description: Makes the number of attributes and commands be specified by a define, not an enum value.
50 # Start genetlink-legacy
53 Defines if the input policy in the kernel is global, per-operation, or split per operation type.
55 enum: [ split, per-op, global ]
56 # End genetlink-legacy
59 description: List of type and constant definitions (enums, flags, defines).
63 required: [ type, name ]
64 additionalProperties: False
69 description: For C-compatible languages, header which already defines this value.
72 enum: [ const, enum, flags, struct ] # Trim
77 description: For const - the value.
78 type: [ string, integer ]
81 description: For enum or flags the literal initializer for the first value.
82 type: [ string, integer ]
84 description: For enum or flags array of values.
91 additionalProperties: False
100 description: Render the max members for this enum.
104 description: Name for enum, if empty no name will be used.
105 type: [ string, "null" ]
107 description: For enum the prefix of the values, optional.
110 # Start genetlink-legacy
112 description: List of struct members. Only scalars and strings members allowed.
116 required: [ name, type ]
117 additionalProperties: False
122 enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string ]
124 $ref: '#/$defs/len-or-define'
125 # End genetlink-legacy
128 description: Definition of attribute spaces for this family.
131 description: Definition of a single attribute space.
133 required: [ name, attributes ]
134 additionalProperties: False
138 Name used when referring to this space in other definitions, not used outside of the spec.
142 Prefix for the C enum name of the attributes. Default family[name]-set[name]-a-
145 description: Name for the enum type of the attribute.
148 description: Documentation of the space.
152 Name of another space which this is a logical part of. Sub-spaces can be used to define
153 a limited group of attributes which are used in a nest.
157 description: The explicit name for constant holding the count of attributes (last attr + 1).
160 description: The explicit name for last member of attribute enum.
164 description: List of attributes in the space.
168 required: [ name, type ]
169 additionalProperties: False
174 enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64,
175 string, nest, array-nest, nest-type-value ]
177 description: Documentation of the attribute.
180 description: Value for the enum item representing this attribute in the uAPI.
183 description: Name of the value extracted from the type of a nest-type-value attribute.
188 enum: [ little-endian, big-endian ]
192 description: Name of the space (sub-space) used inside the attribute.
195 description: Name of the enum type used for the attribute.
199 Treat the enum as flags. In most cases enum is either used as flags or as values.
200 Sometimes, however, both forms are necessary, in which case header contains the enum
201 form while specific attributes may request to convert the values into a bitfield.
204 description: Kernel input validation.
206 additionalProperties: False
209 description: Name of the flags constant on which to base mask (unsigned scalar types only).
212 description: Min value for an integer attribute.
215 description: Min length for a binary attribute.
216 $ref: '#/$defs/len-or-define'
218 description: Max length for a string or a binary attribute.
219 $ref: '#/$defs/len-or-define'
221 # Start genetlink-legacy
223 description: Name of the struct type used for the attribute.
225 # End genetlink-legacy
227 # Make sure name-prefix does not appear in subsets (subsets inherit naming)
231 required: [ subset-of ]
234 required: [ name-prefix ]
237 description: Operations supported by the protocol.
240 additionalProperties: False
244 The model of assigning values to the operations.
245 "unified" is the recommended model where all message types belong
247 "directional" has the messages sent to the kernel and from the kernel
248 enumerated separately.
249 enum: [ unified, directional ] # Trim
252 Prefix for the C enum name of the command. The name is formed by concatenating
253 the prefix with the upper case name of the command, with dashes replaced by underscores.
256 description: Name for the enum type with commands.
259 description: Same as name-prefix but used to render notifications and events to separate enum.
262 description: Name for the enum type with notifications/events.
264 # Start genetlink-legacy
265 fixed-header: &fixed-header
267 Name of the structure defining the optional fixed-length protocol
268 header. This header is placed in a message after the netlink and
269 genetlink headers and before any attributes.
271 # End genetlink-legacy
273 description: List of commands
277 additionalProperties: False
278 required: [ name, doc ]
281 description: Name of the operation, also defining its C enum value in uAPI.
284 description: Documentation for the command.
287 description: Value for the enum in the uAPI.
291 Attribute space from which attributes directly in the requests and replies
292 to this command are defined.
295 description: Command flags.
300 description: Kernel attribute validation flags.
303 enum: [ strict, dump ]
304 # Start genetlink-legacy
305 fixed-header: *fixed-header
306 # End genetlink-legacy
308 description: Main command handler.
310 additionalProperties: False
312 request: &subop-attr-list
313 description: Definition of the request message for a given command.
315 additionalProperties: False
319 Names of attributes from the attribute-set (not full attribute
320 definitions, just names).
324 # Start genetlink-legacy
327 ID of this message if value for request and response differ,
328 i.e. requests and responses have different message enums.
330 # End genetlink-legacy
331 reply: *subop-attr-list
333 description: Hook for a function to run before the main callback (pre_doit or start).
336 description: Hook for a function to run after the main callback (post_doit or done).
340 description: Name of the command sharing the reply type with this notification.
344 additionalProperties: False
347 description: Explicit list of the attributes for the notification.
352 description: Name of the multicast group generating given notification.
355 description: List of multicast groups.
358 additionalProperties: False
361 description: List of groups.
366 additionalProperties: False
370 The name for the group, used to form the define and the value of the define.
374 description: Override for the name of the define in C uAPI.