1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
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,
27 struct discover_device {
28 struct device *device;
37 const char *device_path;
43 struct list boot_options;
47 struct discover_boot_option {
48 struct parser *source;
49 struct discover_device *device;
50 struct boot_option *option;
51 struct list_item list;
53 struct resource *boot_image;
54 struct resource *initrd;
56 struct resource *icon;
60 struct discover_context {
61 struct parser *parser;
63 struct discover_device *device;
64 struct list boot_options;
65 struct pb_url *conf_url;
66 enum conf_method method;
70 struct device_handler *device_handler_init(struct discover_server *server,
71 struct waitset *waitset, int dry_run);
73 void device_handler_destroy(struct device_handler *devices);
75 int device_handler_get_device_count(const struct device_handler *handler);
76 const struct discover_device *device_handler_get_device(
77 const struct device_handler *handler, unsigned int index);
79 struct discover_device *discover_device_create(struct device_handler *handler,
81 void device_handler_add_device(struct device_handler *handler,
82 struct discover_device *device);
83 int device_handler_discover(struct device_handler *handler,
84 struct discover_device *dev, enum conf_method method);
85 int device_handler_conf(struct device_handler *handler,
86 struct discover_device *dev, struct pb_url *url,
87 enum conf_method method);
88 void device_handler_remove(struct device_handler *handler,
89 struct discover_device *device);
91 struct discover_context *device_handler_discover_context_create(
92 struct device_handler *handler,
93 struct discover_device *device);
94 void device_handler_discover_context_commit(struct device_handler *handler,
95 struct discover_context *ctx);
97 struct discover_boot_option *discover_boot_option_create(
98 struct discover_context *ctx,
99 struct discover_device *dev);
100 void discover_context_add_boot_option(struct discover_context *ctx,
101 struct discover_boot_option *opt);
103 int device_handler_user_event(struct device_handler *handler,
104 struct event *event);
106 struct discover_device *device_lookup_by_name(struct device_handler *handler,
108 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
110 struct discover_device *device_lookup_by_label(struct device_handler *handler,
112 struct discover_device *device_lookup_by_id(struct device_handler *handler,
114 struct discover_device *device_lookup_by_serial(
115 struct device_handler *device_handler,
118 void discover_device_set_param(struct discover_device *device,
119 const char *name, const char *value);
120 const char *discover_device_get_param(struct discover_device *device,
123 void device_handler_boot(struct device_handler *handler,
124 struct boot_command *cmd);
125 void device_handler_cancel_default(struct device_handler *handler);
127 #endif /* _DEVICE_HANDLER_H */