7 * CDUMP_SAVED - prefix for a structure or enum to be parsed by cdump_parse.
9 * A structure or enum tagged with this will be parsed by cdump_parse;
10 * others are ignored. Note that the parser is very primitive, so
11 * your definitions should be formatted simply.
14 * CDUMP_SAVED struct foo {
21 * CDUMP_LEN - annotation for a pointer parsed by cdump_parse.
22 * @member: the structure memeber which defines the length.
24 * This marks a pointer as having a known length, either a constant or
25 * another structure member.
28 * CDUMP_SAVED struct bar {
30 * char *p CDUMP_LEN(len);
36 * CDUMP_ZEROTERM - annotation for a pointer parsed by cdump_parse.
38 * This marks a pointer as being an array terminated by a zero entry, such
42 * CDUMP_SAVED struct baz {
43 * char *p CDUMP_ZEROTERM;
46 #define CDUMP_ZEROTERM
49 * CDUMP_IGNORE - annotation for telling cdump_parse to ignore a member.
51 * This means it won't be bundled (and thus doesn't need to be understood) so
52 * on unbundling it will be all zero.
55 * CDUMP_SAVED struct baz {
56 * char *p CDUMP_IGNORE;
60 #endif /* CDUMP_PARSING */
65 * cdump_bundle - linearize a given datastructure
66 * @ctx: the context to tallocate the returned string off.
67 * @info: a cdump_desc definition created by cdump_parse()
68 * @data: a pointer to the struct described by @info.
70 * This tallocates a string which is a description of the talloc
71 * pointer @data and everything it references.
73 char *cdump_bundle(const void *ctx,
74 const struct cdump_desc *info, const void *data);
77 * cdump_unbundle - extract a datastructure from a linearized description
78 * @ctx: the context to tallocate the returned datastructure off.
79 * @info: a cdump_desc definition created by cdump_parse()
80 * @data: a pointer to the structute to unbundle.
81 * @str: the string created by cdump_bundle().
83 * Returns false on failure. Fields not mentioned in @str are zero-filled.
85 bool cdump_unbundle(const void *ctx,
86 const struct cdump_desc *info,
87 void *data, const char *str);
89 #endif /* CCAN_CDUMP_H */