protocol: Separate device add from boot-option add messages
[petitboot] / discover / device-handler.h
1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
3
4 #include <list/list.h>
5
6 struct device_handler;
7 struct discover_server;
8 struct boot_command;
9 struct event;
10 struct device;
11
12 struct discover_context {
13         char *id;
14         char *device_path;
15         char *mount_path;
16         struct event *event;
17         struct device *device;
18         char **links;
19         int n_links;
20
21         struct list_item list;
22 };
23
24 struct device_handler *device_handler_init(struct discover_server *server,
25                 int dry_run);
26
27 void device_handler_destroy(struct device_handler *devices);
28
29 int device_handler_get_device_count(const struct device_handler *handler);
30 const struct device *device_handler_get_device(
31         const struct device_handler *handler, unsigned int index);
32
33 int device_handler_event(struct device_handler *handler, struct event *event);
34
35 void device_handler_boot(struct device_handler *handler,
36                 struct boot_command *cmd);
37
38 #endif /* _DEVICE_HANDLER_H */