1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
6 #define DEFAULT_BOOT_TIMEOUT_SEC 10
9 struct discover_device;
10 struct discover_server;
18 CONF_METHOD_LOCAL_FILE, /* discover by looking at local files on this
21 CONF_METHOD_DHCP, /* configuration from a DHCP response */
23 CONF_METHOD_UNKNOWN = -1,
26 struct discover_device {
27 struct device *device;
38 struct list boot_options;
41 struct discover_boot_option {
42 struct parser *source;
43 struct discover_device *device;
44 struct boot_option *option;
45 struct list_item list;
47 struct resource *boot_image;
48 struct resource *initrd;
50 struct resource *icon;
54 struct discover_context {
55 struct parser *parser;
57 struct discover_device *device;
58 struct list boot_options;
59 struct pb_url *conf_url;
60 enum conf_method method;
63 struct device_handler *device_handler_init(struct discover_server *server,
64 struct waitset *waitset, int dry_run);
66 void device_handler_destroy(struct device_handler *devices);
68 int device_handler_get_device_count(const struct device_handler *handler);
69 const struct discover_device *device_handler_get_device(
70 const struct device_handler *handler, unsigned int index);
72 struct device *discover_context_device(struct discover_context *ctx);
73 struct discover_boot_option *discover_boot_option_create(
74 struct discover_context *ctx,
75 struct discover_device *dev);
76 void discover_context_add_boot_option(struct discover_context *ctx,
77 struct discover_boot_option *opt);
79 int device_handler_event(struct device_handler *handler, struct event *event);
81 struct discover_device *device_lookup_by_name(struct device_handler *handler,
83 struct discover_device *device_lookup_by_path(struct device_handler *handler,
85 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
87 struct discover_device *device_lookup_by_label(struct device_handler *handler,
89 struct discover_device *device_lookup_by_id(struct device_handler *handler,
92 void device_handler_boot(struct device_handler *handler,
93 struct boot_command *cmd);
94 void device_handler_cancel_default(struct device_handler *handler);
96 #endif /* _DEVICE_HANDLER_H */