1 # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
4 $id: http://kernel.org/schemas/netlink/genetlink-c.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 ]
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).
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 ]
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.
112 description: Definition of attribute spaces for this family.
115 description: Definition of a single attribute space.
117 required: [ name, attributes ]
118 additionalProperties: False
122 Name used when referring to this space in other definitions, not used outside of the spec.
126 Prefix for the C enum name of the attributes. Default family[name]-set[name]-a-
130 Name for the enum type of the attribute, if empty no name will be used.
131 type: [ string, "null" ]
133 description: Documentation of the space.
137 Name of another space which this is a logical part of. Sub-spaces can be used to define
138 a limited group of attributes which are used in a nest.
142 description: The explicit name for constant holding the count of attributes (last attr + 1).
145 description: The explicit name for last member of attribute enum.
149 description: List of attributes in the space.
154 additionalProperties: False
159 enum: [ unused, pad, flag, binary,
160 uint, sint, u8, u16, u32, u64, s32, s64,
161 string, nest, indexed-array, nest-type-value ]
163 description: Documentation of the attribute.
166 description: Value for the enum item representing this attribute in the uAPI.
169 description: Name of the value extracted from the type of a nest-type-value attribute.
174 enum: [ little-endian, big-endian ]
178 description: Name of the space (sub-space) used inside the attribute.
181 description: Name of the enum type used for the attribute.
185 Treat the enum as flags. In most cases enum is either used as flags or as values.
186 Sometimes, however, both forms are necessary, in which case header contains the enum
187 form while specific attributes may request to convert the values into a bitfield.
190 description: Kernel input validation.
192 additionalProperties: False
195 description: Name of the flags constant on which to base mask (unsigned scalar types only).
198 description: Min value for an integer attribute.
199 $ref: '#/$defs/len-or-limit'
201 description: Max value for an integer attribute.
202 $ref: '#/$defs/len-or-limit'
204 description: Min length for a binary attribute.
205 $ref: '#/$defs/len-or-define'
207 description: Max length for a string or a binary attribute.
208 $ref: '#/$defs/len-or-define'
210 description: Exact length for a string or a binary attribute.
211 $ref: '#/$defs/len-or-define'
214 For string attributes, do not check whether attribute
215 contains the terminating null character.
218 display-hint: &display-hint
220 Optional format indicator that is intended only for choosing
221 the right formatting mechanism when displaying values of this
223 enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]
229 # Make sure name-prefix does not appear in subsets (subsets inherit naming)
233 required: [ subset-of ]
236 required: [ name-prefix ]
238 # type property is only required if not in subset definition
251 description: Operations supported by the protocol.
254 additionalProperties: False
258 The model of assigning values to the operations.
259 "unified" is the recommended model where all message types belong
261 "directional" has the messages sent to the kernel and from the kernel
262 enumerated separately.
266 Prefix for the C enum name of the command. The name is formed by concatenating
267 the prefix with the upper case name of the command, with dashes replaced by underscores.
271 Name for the enum type with commands, if empty no name will be used.
272 type: [ string, "null" ]
274 description: Same as name-prefix but used to render notifications and events to separate enum.
278 Name for the enum type with commands, if empty no name will be used.
279 type: [ string, "null" ]
281 description: List of commands
285 additionalProperties: False
286 required: [ name, doc ]
289 description: Name of the operation, also defining its C enum value in uAPI.
292 description: Documentation for the command.
295 description: Value for the enum in the uAPI.
299 Attribute space from which attributes directly in the requests and replies
300 to this command are defined.
303 description: Command flags.
308 description: Kernel attribute validation flags.
311 enum: [ strict, dump, dump-strict ]
314 Name of the kernel config option gating the presence of
315 the operation, without the 'CONFIG_' prefix.
318 description: Main command handler.
320 additionalProperties: False
322 request: &subop-attr-list
323 description: Definition of the request message for a given command.
325 additionalProperties: False
329 Names of attributes from the attribute-set (not full attribute
330 definitions, just names).
334 reply: *subop-attr-list
336 description: Hook for a function to run before the main callback (pre_doit or start).
339 description: Hook for a function to run after the main callback (post_doit or done).
343 description: Name of the command sharing the reply type with this notification.
347 additionalProperties: False
350 description: Explicit list of the attributes for the notification.
355 description: Name of the multicast group generating given notification.
358 description: List of multicast groups.
361 additionalProperties: False
364 description: List of groups.
369 additionalProperties: False
373 The name for the group, used to form the define and the value of the define.
377 description: Override for the name of the define in C uAPI.
383 description: Additional global attributes used for kernel C code generation.
385 additionalProperties: False
389 List of extra headers which should be included in the source
390 of the generated code.
396 Literal name of the type which is used within the kernel
397 to store the socket state. The type / structure is internal
398 to the kernel, and is not defined in the spec.