You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines

  1. #ifndef OWL_CORE_H
  2. #define OWL_CORE_H
  3. #include <stdbool.h>
  4. #include <ev.h>
  5. #include "state.h"
  6. #include "circular_buffer.h"
  7. #include "io.h"
  8. struct ev_state {
  9. struct ev_loop *loop;
  10. ev_timer mif_timer, psf_timer, tx_timer, tx_mcast_timer, chan_timer, peer_timer;
  11. ev_io read_wlan, read_host;
  12. ev_signal stats;
  13. };
  14. struct daemon_state {
  15. struct io_state io;
  16. struct awdl_state awdl_state;
  17. struct ieee80211_state ieee80211_state;
  18. struct ev_state ev_state;
  19. struct buf *next;
  20. cbuf_handle_t tx_queue_multicast;
  21. const char *dump;
  22. };
  23. int awdl_init(struct daemon_state *state, const char *wlan, const char *host, struct awdl_chan chan, const char *dump);
  24. void awdl_free(struct daemon_state *state);
  25. void awdl_schedule(struct ev_loop *loop, struct daemon_state *state);
  26. void wlan_device_ready(struct ev_loop *loop, ev_io *handle, int revents);
  27. void host_device_ready(struct ev_loop *loop, ev_io *handle, int revents);
  28. void awdl_receive_frame(uint8_t *user, const struct pcap_pkthdr *hdr, const uint8_t *buf);
  29. void awdl_send_action(struct daemon_state *state, enum awdl_action_type type);
  30. void awdl_send_psf(struct ev_loop *loop, ev_timer *handle, int revents);
  31. void awdl_send_mif(struct ev_loop *loop, ev_timer *handle, int revents);
  32. void awdl_send_unicast(struct ev_loop *loop, ev_timer *timer, int revents);
  33. void awdl_send_multicast(struct ev_loop *loop, ev_timer *timer, int revents);
  34. int awdl_send_data(const struct buf *buf, const struct io_state *io_state,
  35. struct awdl_state *awdl_state, struct ieee80211_state *ieee80211_state);
  36. void awdl_switch_channel(struct ev_loop *loop, ev_timer *handle, int revents);
  37. void awdl_clean_peers(struct ev_loop *loop, ev_timer *timer, int revents);
  38. void awdl_print_stats(struct ev_loop *loop, ev_signal *handle, int revents);
  39. #endif /* OWL_CORE_H */