diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-21 20:15:31 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-11-29 14:52:01 +0100 |
commit | fbb4a83633fd935748dd3c26d4fc28821db71cdd (patch) | |
tree | 16e1630b408dac7214bf8ec871720a68f06d977c /wireless.h | |
parent | 2eaffc0ed137595784d19edf17e517c320cbf264 (diff) |
add initial support for handling wireless devices via scripts
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'wireless.h')
-rw-r--r-- | wireless.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/wireless.h b/wireless.h new file mode 100644 index 0000000..c6609e7 --- /dev/null +++ b/wireless.h @@ -0,0 +1,98 @@ +/* + * netifd - network interface daemon + * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef __NETIFD_WIRELESS_H +#define __NETIFD_WIRELESS_H + +#include <libubox/utils.h> +#include "interface.h" + +struct vlist_tree wireless_devices; +struct avl_tree wireless_drivers; + +struct wireless_driver { + struct avl_node node; + + const char *name; + const char *script; + + struct { + char *buf; + struct uci_blob_param_list *config; + } device, interface; +}; + +struct wireless_device { + struct vlist_node node; + + struct wireless_driver *drv; + struct vlist_tree interfaces; + char *name; + + struct netifd_process script_task; + struct uloop_timeout timeout; + struct uloop_timeout poll; + + struct list_head script_proc; + struct uloop_fd script_proc_fd; + struct uloop_timeout script_check; + + struct ubus_request_data *kill_request; + + struct blob_attr *config; + struct blob_attr *data; + + bool config_autostart; + bool autostart; + + enum interface_state state; + enum interface_config_state config_state; + bool cancel; + int retry; + + int vif_idx; +}; + +struct wireless_interface { + struct vlist_node node; + char *name; + + struct wireless_device *wdev; + + struct blob_attr *config; + struct blob_attr *data; + + const char *ifname; + const char *network; +}; + +struct wireless_process { + struct list_head list; + + const char *exe; + int pid; + + bool required; +}; + +void wireless_device_create(struct wireless_driver *drv, const char *name, struct blob_attr *data); +void wireless_device_set_up(struct wireless_device *wdev); +void wireless_device_set_down(struct wireless_device *wdev); +void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b); +void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data); +int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data, + struct ubus_request_data *req); + +void wireless_start_pending(void); + +#endif |