2
0

wireless.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * netifd - network interface daemon
  3. * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef __NETIFD_WIRELESS_H
  15. #define __NETIFD_WIRELESS_H
  16. #include <libubox/utils.h>
  17. #include "interface.h"
  18. extern struct vlist_tree wireless_devices;
  19. extern struct avl_tree wireless_drivers;
  20. struct wireless_driver {
  21. struct avl_node node;
  22. const char *name;
  23. const char *script;
  24. struct {
  25. char *buf;
  26. struct uci_blob_param_list *config;
  27. } device, interface;
  28. };
  29. struct wireless_device {
  30. struct vlist_node node;
  31. struct wireless_driver *drv;
  32. struct vlist_tree interfaces;
  33. char *name;
  34. struct netifd_process script_task;
  35. struct uloop_timeout timeout;
  36. struct uloop_timeout poll;
  37. struct list_head script_proc;
  38. struct uloop_fd script_proc_fd;
  39. struct uloop_timeout script_check;
  40. struct ubus_request_data *kill_request;
  41. struct blob_attr *prev_config;
  42. struct blob_attr *config;
  43. struct blob_attr *data;
  44. bool autostart;
  45. bool disabled;
  46. bool retry_setup_failed;
  47. enum interface_state state;
  48. enum interface_config_state config_state;
  49. bool cancel;
  50. int retry;
  51. int vif_idx;
  52. };
  53. struct wireless_interface {
  54. struct vlist_node node;
  55. const char *section;
  56. char *name;
  57. struct wireless_device *wdev;
  58. struct blob_attr *config;
  59. struct blob_attr *data;
  60. const char *ifname;
  61. struct blob_attr *network;
  62. bool isolate;
  63. bool ap_mode;
  64. };
  65. struct wireless_process {
  66. struct list_head list;
  67. const char *exe;
  68. int pid;
  69. bool required;
  70. };
  71. void wireless_device_create(struct wireless_driver *drv, const char *name, struct blob_attr *data);
  72. void wireless_device_set_up(struct wireless_device *wdev);
  73. void wireless_device_set_down(struct wireless_device *wdev);
  74. void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b);
  75. void wireless_device_get_validate(struct wireless_device *wdev, struct blob_buf *b);
  76. void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section);
  77. int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
  78. struct ubus_request_data *req);
  79. void wireless_start_pending(void);
  80. void wireless_init(void);
  81. #endif