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;
49 struct resource *icon;
53 struct discover_context {
54 struct parser *parser;
56 struct discover_device *device;
57 struct list boot_options;
58 struct pb_url *conf_url;
59 enum conf_method method;
62 struct device_handler *device_handler_init(struct discover_server *server,
63 struct waitset *waitset, int dry_run);
65 void device_handler_destroy(struct device_handler *devices);
67 int device_handler_get_device_count(const struct device_handler *handler);
68 const struct discover_device *device_handler_get_device(
69 const struct device_handler *handler, unsigned int index);
71 struct device *discover_context_device(struct discover_context *ctx);
72 struct discover_boot_option *discover_boot_option_create(
73 struct discover_context *ctx,
74 struct discover_device *dev);
75 void discover_context_add_boot_option(struct discover_context *ctx,
76 struct discover_boot_option *opt);
78 int device_handler_event(struct device_handler *handler, struct event *event);
80 struct discover_device *device_lookup_by_name(struct device_handler *handler,
82 struct discover_device *device_lookup_by_path(struct device_handler *handler,
84 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
86 struct discover_device *device_lookup_by_label(struct device_handler *handler,
88 struct discover_device *device_lookup_by_id(struct device_handler *handler,
91 void device_handler_boot(struct device_handler *handler,
92 struct boot_command *cmd);
93 void device_handler_cancel_default(struct device_handler *handler);
95 #endif /* _DEVICE_HANDLER_H */