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;
29 const char *device_path;
30 struct ramdisk_device *ramdisk;
37 struct list boot_options;
41 struct discover_boot_option {
42 struct parser *source;
43 struct discover_device *device;
44 struct boot_option *option;
45 struct list_item list;
47 struct resource *boot_image;
48 struct resource *initrd;
50 struct resource *icon;
54 struct discover_context {
55 struct parser *parser;
57 struct discover_device *device;
58 struct list boot_options;
59 struct pb_url *conf_url;
60 struct network *network;
64 struct ramdisk_device {
72 struct device_handler *device_handler_init(struct discover_server *server,
73 struct waitset *waitset, int dry_run);
75 void device_handler_destroy(struct device_handler *devices);
77 int device_handler_get_device_count(const struct device_handler *handler);
78 const struct discover_device *device_handler_get_device(
79 const struct device_handler *handler, unsigned int index);
81 struct discover_device *discover_device_create(struct device_handler *handler,
83 void device_handler_add_device(struct device_handler *handler,
84 struct discover_device *device);
85 void device_handler_add_ramdisk(struct device_handler *handler,
87 struct ramdisk_device *device_handler_get_ramdisk(
88 struct device_handler *handler);
89 void device_handler_release_ramdisk(struct discover_device *device);
90 int device_handler_discover(struct device_handler *handler,
91 struct discover_device *dev);
92 int device_handler_dhcp(struct device_handler *handler,
93 struct discover_device *dev, struct event *event);
94 int device_handler_conf(struct device_handler *handler,
95 struct discover_device *dev, struct pb_url *url);
96 void device_handler_remove(struct device_handler *handler,
97 struct discover_device *device);
99 struct discover_context *device_handler_discover_context_create(
100 struct device_handler *handler,
101 struct discover_device *device);
102 void device_handler_discover_context_commit(struct device_handler *handler,
103 struct discover_context *ctx);
105 struct discover_boot_option *discover_boot_option_create(
106 struct discover_context *ctx,
107 struct discover_device *dev);
108 void discover_context_add_boot_option(struct discover_context *ctx,
109 struct discover_boot_option *opt);
111 int device_handler_user_event(struct device_handler *handler,
112 struct event *event);
114 struct discover_device *device_lookup_by_name(struct device_handler *handler,
116 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
118 struct discover_device *device_lookup_by_label(struct device_handler *handler,
120 struct discover_device *device_lookup_by_id(struct device_handler *handler,
122 struct discover_device *device_lookup_by_serial(
123 struct device_handler *device_handler,
126 void discover_device_set_param(struct discover_device *device,
127 const char *name, const char *value);
128 const char *discover_device_get_param(struct discover_device *device,
131 void device_handler_boot(struct device_handler *handler,
132 struct boot_command *cmd);
133 void device_handler_cancel_default(struct device_handler *handler);
134 void device_handler_update_config(struct device_handler *handler,
135 struct config *config);
136 void device_handler_process_url(struct device_handler *handler,
137 const char *url, const char *mac, const char *ip);
138 void device_handler_reinit(struct device_handler *handler);
140 int device_request_write(struct discover_device *dev, bool *release);
141 void device_release_write(struct discover_device *dev, bool release);
143 #endif /* _DEVICE_HANDLER_H */