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)?$
17 # literal int or limit based on fixed-width type e.g. u8-min, u16-max, etc.
18 type: [ string, integer ]
19 pattern: ^[su](8|16|32|64)-(min|max)$
24 description: Specification of a genetlink protocol
26 required: [ name, doc, attribute-sets, operations ]
27 additionalProperties: False
30 description: Name of the genetlink family.
35 description: Schema compatibility level. Default is "genetlink".
36 enum: [ genetlink, genetlink-c, genetlink-legacy ] # Trim
38 description: Path to the uAPI header, default is linux/${family-name}.h
42 description: Name of the define for the family name.
45 description: Name of the define for the version of the family.
48 description: Makes the number of attributes and commands be specified by a define, not an enum value.
51 description: Name of the define for the last operation in the list.
54 description: The explicit name for constant holding the count of operations (last operation + 1).
57 # Start genetlink-legacy
60 Defines if the input policy in the kernel is global, per-operation, or split per operation type.
62 enum: [ split, per-op, global ]
64 description: Generic Netlink family version. Default is 1.
67 # End genetlink-legacy
70 description: List of type and constant definitions (enums, flags, defines).
74 required: [ type, name ]
75 additionalProperties: False
80 description: For C-compatible languages, header which already defines this value.
83 enum: [ const, enum, flags, struct ] # Trim
88 description: For const - the value.
89 type: [ string, integer ]
92 description: For enum or flags the literal initializer for the first value.
93 type: [ string, integer ]
95 description: For enum or flags array of values.
102 additionalProperties: False
111 description: Render the max members for this enum.
115 description: Name for enum, if empty no name will be used.
116 type: [ string, "null" ]
118 description: For enum the prefix of the values, optional.
121 # Start genetlink-legacy
123 description: List of struct members. Only scalars and strings members allowed.
127 required: [ name, type ]
128 additionalProperties: False
133 description: The netlink attribute type
134 enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary ]
136 $ref: '#/$defs/len-or-define'
138 enum: [ little-endian, big-endian ]
140 description: Documentation for the struct member attribute.
143 description: Name of the enum type used for the attribute.
145 display-hint: &display-hint
147 Optional format indicator that is intended only for choosing
148 the right formatting mechanism when displaying values of this
150 enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]
151 # End genetlink-legacy
154 description: Definition of attribute spaces for this family.
157 description: Definition of a single attribute space.
159 required: [ name, attributes ]
160 additionalProperties: False
164 Name used when referring to this space in other definitions, not used outside of the spec.
168 Prefix for the C enum name of the attributes. Default family[name]-set[name]-a-
171 description: Name for the enum type of the attribute.
174 description: Documentation of the space.
178 Name of another space which this is a logical part of. Sub-spaces can be used to define
179 a limited group of attributes which are used in a nest.
183 description: The explicit name for constant holding the count of attributes (last attr + 1).
186 description: The explicit name for last member of attribute enum.
190 description: List of attributes in the space.
195 additionalProperties: False
200 description: The netlink attribute type
201 enum: [ unused, pad, flag, binary, bitfield32,
202 uint, sint, u8, u16, u32, u64, s32, s64,
203 string, nest, array-nest, nest-type-value ]
205 description: Documentation of the attribute.
208 description: Value for the enum item representing this attribute in the uAPI.
211 description: Name of the value extracted from the type of a nest-type-value attribute.
216 enum: [ little-endian, big-endian ]
220 description: Name of the space (sub-space) used inside the attribute.
223 description: Name of the enum type used for the attribute.
227 Treat the enum as flags. In most cases enum is either used as flags or as values.
228 Sometimes, however, both forms are necessary, in which case header contains the enum
229 form while specific attributes may request to convert the values into a bitfield.
232 description: Kernel input validation.
234 additionalProperties: False
237 description: Name of the flags constant on which to base mask (unsigned scalar types only).
240 description: Min value for an integer attribute.
241 $ref: '#/$defs/len-or-limit'
243 description: Max value for an integer attribute.
244 $ref: '#/$defs/len-or-limit'
246 description: Min length for a binary attribute.
247 $ref: '#/$defs/len-or-define'
249 description: Max length for a string or a binary attribute.
250 $ref: '#/$defs/len-or-define'
252 description: Exact length for a string or a binary attribute.
253 $ref: '#/$defs/len-or-define'
255 display-hint: *display-hint
260 # Start genetlink-legacy
262 description: Name of the struct type used for the attribute.
264 # End genetlink-legacy
266 # Make sure name-prefix does not appear in subsets (subsets inherit naming)
270 required: [ subset-of ]
273 required: [ name-prefix ]
275 # type property is only required if not in subset definition
288 description: Operations supported by the protocol.
291 additionalProperties: False
295 The model of assigning values to the operations.
296 "unified" is the recommended model where all message types belong
298 "directional" has the messages sent to the kernel and from the kernel
299 enumerated separately.
300 enum: [ unified, directional ] # Trim
303 Prefix for the C enum name of the command. The name is formed by concatenating
304 the prefix with the upper case name of the command, with dashes replaced by underscores.
307 description: Name for the enum type with commands.
310 description: Same as name-prefix but used to render notifications and events to separate enum.
313 description: Name for the enum type with notifications/events.
315 # Start genetlink-legacy
316 fixed-header: &fixed-header
318 Name of the structure defining the optional fixed-length protocol
319 header. This header is placed in a message after the netlink and
320 genetlink headers and before any attributes.
322 # End genetlink-legacy
324 description: List of commands
328 additionalProperties: False
329 required: [ name, doc ]
332 description: Name of the operation, also defining its C enum value in uAPI.
335 description: Documentation for the command.
338 description: Value for the enum in the uAPI.
342 Attribute space from which attributes directly in the requests and replies
343 to this command are defined.
346 description: Command flags.
349 enum: [ admin-perm, uns-admin-perm ]
351 description: Kernel attribute validation flags.
354 enum: [ strict, dump, dump-strict ]
357 Name of the kernel config option gating the presence of
358 the operation, without the 'CONFIG_' prefix.
360 # Start genetlink-legacy
361 fixed-header: *fixed-header
362 # End genetlink-legacy
364 description: Main command handler.
366 additionalProperties: False
368 request: &subop-attr-list
369 description: Definition of the request message for a given command.
371 additionalProperties: False
375 Names of attributes from the attribute-set (not full attribute
376 definitions, just names).
380 # Start genetlink-legacy
383 ID of this message if value for request and response differ,
384 i.e. requests and responses have different message enums.
386 # End genetlink-legacy
387 reply: *subop-attr-list
389 description: Hook for a function to run before the main callback (pre_doit or start).
392 description: Hook for a function to run after the main callback (post_doit or done).
396 description: Name of the command sharing the reply type with this notification.
400 additionalProperties: False
403 description: Explicit list of the attributes for the notification.
408 description: Name of the multicast group generating given notification.
411 description: List of multicast groups.
414 additionalProperties: False
417 description: List of groups.
422 additionalProperties: False
426 The name for the group, used to form the define and the value of the define.
430 description: Override for the name of the define in C uAPI.