1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
7 struct discover_device;
8 struct discover_server;
16 CONF_METHOD_LOCAL_FILE, /* discover by looking at local files on this
19 CONF_METHOD_DHCP, /* configuration from a DHCP response */
21 CONF_METHOD_UNKNOWN = -1,
24 struct discover_device {
25 struct device *device;
36 struct list boot_options;
39 struct discover_boot_option {
40 struct parser *source;
41 struct discover_device *device;
42 struct boot_option *option;
43 struct list_item list;
45 struct resource *boot_image;
46 struct resource *initrd;
48 struct resource *icon;
52 struct discover_context {
53 struct parser *parser;
55 struct discover_device *device;
56 struct list boot_options;
57 struct pb_url *conf_url;
58 enum conf_method method;
61 struct device_handler *device_handler_init(struct discover_server *server,
62 struct waitset *waitset, int dry_run);
64 void device_handler_destroy(struct device_handler *devices);
66 int device_handler_get_device_count(const struct device_handler *handler);
67 const struct discover_device *device_handler_get_device(
68 const struct device_handler *handler, unsigned int index);
70 struct device *discover_context_device(struct discover_context *ctx);
71 struct discover_boot_option *discover_boot_option_create(
72 struct discover_context *ctx,
73 struct discover_device *dev);
74 void discover_context_add_boot_option(struct discover_context *ctx,
75 struct discover_boot_option *opt);
77 int device_handler_event(struct device_handler *handler, struct event *event);
79 struct discover_device *device_lookup_by_name(struct device_handler *handler,
81 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
83 struct discover_device *device_lookup_by_label(struct device_handler *handler,
85 struct discover_device *device_lookup_by_id(struct device_handler *handler,
88 void device_handler_boot(struct device_handler *handler,
89 struct boot_command *cmd);
90 void device_handler_cancel_default(struct device_handler *handler);
92 #endif /* _DEVICE_HANDLER_H */