Lines Matching defs:type
55 A netgraph node type may provide a list of types that correspond to
124 Here is how one would define a parse type for the above structure,
125 subclassing the pre-defined types below. We construct the type in
126 a 'bottom up' fashion, defining each field's type first, then the
127 type for the whole structure ('//' comments used to avoid breakage).
129 // Super-type info for 'label' field
132 // Parse type for 'label' field
134 &ng_parse_fixedstring_type // super-type
135 &foo_label_info // super-type info
144 foo_ary_getLength(const struct ng_parse_type *type,
153 // Super-type info for 'ary' field
155 &ng_parse_int16_type, // element type
159 // Parse type for 'ary' field
161 &ng_parse_array_type, // super-type
162 &foo_ary_info // super-type info
165 // Super-type info for struct foo
175 // Parse type for struct foo
177 &ng_parse_struct_type, // super-type
178 &foo_fields // super-type info
181 To define a type, you can define it as a sub-type of a predefined
182 type as shown above, possibly overriding some of the predefined
183 type's methods, or define an entirely new syntax, with the restriction
184 that the ASCII representation of your type's value must not contain
197 * Three methods are required for a type. These may be given explicitly
198 * or, if NULL, inherited from the super-type. The 'getDefault' method
199 * is always optional; the others are required if there is no super-type.
205 * Convert ASCII to binary according to the supplied type.
226 typedef int ng_parse_t(const struct ng_parse_type *type, const char *string,
231 * Convert binary to ASCII according to the supplied type.
241 typedef int ng_unparse_t(const struct ng_parse_type *type,
245 * Compute the default value according to the supplied type.
253 * EOPNOTSUPP Default value is not specified for this type
255 typedef int ng_getDefault_t(const struct ng_parse_type *type,
259 * Return the alignment requirement of this type. Zero is same as one.
261 typedef int ng_getAlign_t(const struct ng_parse_type *type);
268 * This structure describes a type, which may be a sub-type of another
269 * type by pointing to it with 'supertype' and possibly omitting methods.
270 * Typically the super-type requires some type-specific info, which is
277 * super-type), which means the value for any item of this type must
281 const struct ng_parse_type *supertype; /* super-type, if any */
282 const void *info; /* type-specific info */
297 * This type supports arbitrary C structures. The normal field alignment
306 /* Each field has a name, type, and optional alignment override. If the
307 override is non-zero, the alignment is determined from the field type.
312 const struct ng_parse_type *type; /* field type */
319 * This type supports fixed length arrays, having any element type.
329 * element type. Otherwise, it should fill in the default value at *buf
333 typedef int ng_parse_array_getDefault_t(const struct ng_parse_type *type,
360 typedef int ng_parse_array_getLength_t(const struct ng_parse_type *type,
468 * This is the parse type for a struct ng_mesg.
495 extern int ng_parse(const struct ng_parse_type *type, const char *string,
501 extern int ng_unparse(const struct ng_parse_type *type,
507 extern int ng_parse_getDefault(const struct ng_parse_type *type,