6 #include "device-handler.h"
8 struct discover_context;
15 * Each parser is responsible for creating discover_boot_options from config
16 * files found on new devices. The boot items discovered during parse will have
17 * 'resources' attached (see @discover_boot_option), which may already be
18 * resolved (in the case of a device-local filename, or a URL), or unresolved
19 * (in the case of a filename on another device).
21 * If the boot option contains references to unresolved resources, the
22 * device handler will not inform clients about the boot options, as
23 * they're not properly "available" at this stage. The handler will attempt to
24 * resolve them whenever new devices are discovered, by calling the parser's
25 * resolve_resource function. Once a boot option's resources are full resolved,
26 * the option can be sent to clients.
30 enum conf_method method;
31 const char * const *filenames;
32 int (*parse)(struct discover_context *ctx,
34 bool (*resolve_resource)(
35 struct device_handler *handler,
36 struct resource *res);
39 enum generic_icon_type {
47 #define streq(a,b) (!strcasecmp((a),(b)))
49 void parser_init(void);
51 void iterate_parsers(struct discover_context *ctx, enum conf_method method);
52 int parse_user_event(struct discover_context *ctx, struct event *event);
54 /* File IO functions for parsers; these should be the only interface that
55 * parsers use to access a device's filesystem.
57 * These are intended for small amounts of data, typically text configuration
60 int parser_request_file(struct discover_context *ctx,
61 struct discover_device *dev, const char *filename,
62 char **buf, int *len);
63 int parser_replace_file(struct discover_context *ctx,
64 struct discover_device *dev, const char *filename,
67 #endif /* _PARSER_H */