wireless.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 <libubox/list.h>
  18. #include "interface.h"
  19. extern struct vlist_tree wireless_devices;
  20. extern struct avl_tree wireless_drivers;
  21. struct wireless_driver {
  22. struct avl_node node;
  23. const char *name;
  24. const char *script;
  25. struct {
  26. char *buf;
  27. struct uci_blob_param_list *config;
  28. } device, interface, vlan, station;
  29. };
  30. struct wireless_device {
  31. struct vlist_node node;
  32. struct list_head handler;
  33. bool handler_action;
  34. bool handler_pending;
  35. bool serialize;
  36. struct wireless_driver *drv;
  37. struct vlist_tree interfaces;
  38. struct vlist_tree vlans;
  39. struct vlist_tree stations;
  40. char *name;
  41. struct netifd_process script_task;
  42. struct uloop_timeout timeout;
  43. struct uloop_timeout poll;
  44. struct list_head script_proc;
  45. struct uloop_fd script_proc_fd;
  46. struct uloop_timeout script_check;
  47. struct ubus_request_data *kill_request;
  48. struct blob_attr *prev_config;
  49. struct blob_attr *config;
  50. struct blob_attr *data;
  51. bool autostart;
  52. bool disabled;
  53. bool retry_setup_failed;
  54. enum interface_state state;
  55. enum interface_config_state config_state;
  56. bool reconf;
  57. bool cancel;
  58. int retry;
  59. int vif_idx;
  60. int vlan_idx;
  61. int sta_idx;
  62. };
  63. struct wireless_interface {
  64. struct vlist_node node;
  65. const char *section;
  66. char *name;
  67. struct wireless_device *wdev;
  68. struct blob_attr *config;
  69. struct blob_attr *data;
  70. const char *ifname;
  71. struct blob_attr *network;
  72. bool isolate;
  73. bool ap_mode;
  74. };
  75. struct wireless_vlan {
  76. struct vlist_node node;
  77. const char *section;
  78. char *name;
  79. struct wireless_device *wdev;
  80. char *vif;
  81. struct blob_attr *config;
  82. struct blob_attr *data;
  83. const char *ifname;
  84. struct blob_attr *network;
  85. bool isolate;
  86. };
  87. struct wireless_station {
  88. struct vlist_node node;
  89. const char *section;
  90. char *name;
  91. struct wireless_device *wdev;
  92. char *vif;
  93. struct blob_attr *config;
  94. struct blob_attr *data;
  95. };
  96. struct wireless_process {
  97. struct list_head list;
  98. const char *exe;
  99. int pid;
  100. bool required;
  101. bool keep;
  102. };
  103. void wireless_device_create(struct wireless_driver *drv, const char *name, struct blob_attr *data);
  104. void wireless_device_set_up(struct wireless_device *wdev);
  105. void wireless_device_set_down(struct wireless_device *wdev);
  106. void wireless_device_reconf(struct wireless_device *wdev);
  107. void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b);
  108. void wireless_device_get_validate(struct wireless_device *wdev, struct blob_buf *b);
  109. struct wireless_interface* wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section);
  110. void wireless_vlan_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section);
  111. void wireless_station_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section);
  112. int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
  113. struct ubus_request_data *req);
  114. void wireless_start_pending(void);
  115. void wireless_init(void);
  116. #endif