a639d9cfa85b03dc87d749770a757f143aef2f48
[petitboot] / discover / event.h
1 #ifndef _PB_EVENT_H
2 #define _PB_EVENT_H
3
4 enum event_type {
5         EVENT_TYPE_UDEV = 10,
6         EVENT_TYPE_USER,
7         EVENT_TYPE_MAX,
8 };
9
10 enum event_action {
11         EVENT_ACTION_ADD = 20,
12         EVENT_ACTION_REMOVE,
13         EVENT_ACTION_URL,
14         EVENT_ACTION_DHCP,
15         EVENT_ACTION_BOOT,
16         EVENT_ACTION_SYNC,
17         EVENT_ACTION_MAX,
18 };
19
20 struct event {
21         enum event_type type;
22         enum event_action action;
23         const char *device;
24
25         struct param {
26                 char *name;
27                 char *value;
28         } *params;
29         int n_params;
30 };
31
32 int event_parse_ad_message(struct event *event, char *buf, int len);
33 const char *event_get_param(const struct event *event, const char *name);
34 void event_set_param(struct event *event, const char *name, const char *value);
35
36 #endif /* _PB_EVENT_H */