1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
9 struct discover_device;
10 struct discover_server;
18 struct discover_device {
19 struct device *device;
28 const char *device_path;
35 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 struct network *network;
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 discover_device *discover_device_create(struct device_handler *handler,
73 void device_handler_add_device(struct device_handler *handler,
74 struct discover_device *device);
75 int device_handler_discover(struct device_handler *handler,
76 struct discover_device *dev);
77 int device_handler_dhcp(struct device_handler *handler,
78 struct discover_device *dev, struct event *event);
79 int device_handler_conf(struct device_handler *handler,
80 struct discover_device *dev, struct pb_url *url);
81 void device_handler_remove(struct device_handler *handler,
82 struct discover_device *device);
84 struct discover_context *device_handler_discover_context_create(
85 struct device_handler *handler,
86 struct discover_device *device);
87 void device_handler_discover_context_commit(struct device_handler *handler,
88 struct discover_context *ctx);
90 struct discover_boot_option *discover_boot_option_create(
91 struct discover_context *ctx,
92 struct discover_device *dev);
93 void discover_context_add_boot_option(struct discover_context *ctx,
94 struct discover_boot_option *opt);
96 int device_handler_user_event(struct device_handler *handler,
99 struct discover_device *device_lookup_by_name(struct device_handler *handler,
101 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
103 struct discover_device *device_lookup_by_label(struct device_handler *handler,
105 struct discover_device *device_lookup_by_id(struct device_handler *handler,
107 struct discover_device *device_lookup_by_serial(
108 struct device_handler *device_handler,
111 void discover_device_set_param(struct discover_device *device,
112 const char *name, const char *value);
113 const char *discover_device_get_param(struct discover_device *device,
116 void device_handler_boot(struct device_handler *handler,
117 struct boot_command *cmd);
118 void device_handler_cancel_default(struct device_handler *handler);
119 void device_handler_update_config(struct device_handler *handler,
120 struct config *config);
121 void device_handler_process_url(struct device_handler *handler,
123 void device_handler_reinit(struct device_handler *handler);
125 int device_request_write(struct discover_device *dev, bool *release);
126 void device_release_write(struct discover_device *dev, bool release);
128 #endif /* _DEVICE_HANDLER_H */