]> git.ozlabs.org Git - petitboot/blob - ui/common/discover-client.h
bc2294aa20b84d557558a25335bca1a9abaf9eb7
[petitboot] / ui / common / discover-client.h
1 #ifndef _DISCOVER_CLIENT_H
2 #define _DISCOVER_CLIENT_H
3
4 #include <pb-protocol/pb-protocol.h>
5
6 struct discover_client;
7
8 /**
9  * struct discover_client_ops - Application supplied client info.
10  * @add_device: PB_PROTOCOL_ACTION_ADD event callback.
11  * @remove_device: PB_PROTOCOL_ACTION_REMOVE event callback.
12  * @cb_arg: Client managed convenience variable passed to callbacks.
13  */
14
15 struct discover_client_ops {
16         int (*add_device)(struct device *device, void *arg);
17         void (*remove_device)(char *dev_id, void *arg);
18         void *cb_arg;
19 };
20
21 struct discover_client *discover_client_init(struct discover_client_ops *ops);
22
23 int discover_client_get_fd(struct discover_client *client);
24
25 void discover_client_destroy(struct discover_client *client);
26
27 /**
28  * Process data from the server.
29  *
30  * Will read from the client socket, and call add_device on any discovered
31  * devices.
32  * 
33  */
34 int discover_client_process(struct discover_client *client);
35
36 #endif