1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
7 struct discover_device;
8 struct discover_server;
15 CONF_METHOD_LOCAL_FILE, /* discover by looking at local files on this
18 CONF_METHOD_DHCP, /* configuration from a DHCP response */
20 CONF_METHOD_UNKNOWN = -1,
23 struct discover_device {
24 struct device *device;
35 struct list boot_options;
38 struct discover_boot_option {
39 struct parser *source;
40 struct discover_device *device;
41 struct boot_option *option;
42 struct list_item list;
44 struct resource *boot_image;
45 struct resource *initrd;
46 struct resource *icon;
50 struct discover_context {
51 struct parser *parser;
53 struct discover_device *device;
54 struct list boot_options;
55 struct pb_url *conf_url;
56 enum conf_method method;
59 struct device_handler *device_handler_init(struct discover_server *server,
62 void device_handler_destroy(struct device_handler *devices);
64 int device_handler_get_device_count(const struct device_handler *handler);
65 const struct discover_device *device_handler_get_device(
66 const struct device_handler *handler, unsigned int index);
68 struct device *discover_context_device(struct discover_context *ctx);
69 struct discover_boot_option *discover_boot_option_create(
70 struct discover_context *ctx,
71 struct discover_device *dev);
72 void discover_context_add_boot_option(struct discover_context *ctx,
73 struct discover_boot_option *opt);
75 int device_handler_event(struct device_handler *handler, struct event *event);
77 struct discover_device *device_lookup_by_name(struct device_handler *handler,
79 struct discover_device *device_lookup_by_path(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);
91 #endif /* _DEVICE_HANDLER_H */