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.

48 lines
1.1KB

  1. #ifndef OWL_NETUTILS_H_
  2. #define OWL_NETUTILS_H_
  3. #include <netinet/in.h>
  4. #ifdef __APPLE__
  5. #include <net/ethernet.h>
  6. #else
  7. #include <netinet/ether.h>
  8. #endif
  9. /**
  10. * Needs to be run once before netutils can be used (platform-dependent).
  11. *
  12. * For example, on Linux, sets up nl80211 socket and state.
  13. *
  14. * @return 0 on success, a negative value on failure
  15. */
  16. int netutils_init();
  17. /**
  18. * Clean up methods if netutils are no longer needed (platform-dependent)
  19. */
  20. void netutils_cleanup();
  21. int set_monitor_mode(int ifindex);
  22. int set_channel(int ifindex, int channel);
  23. int link_up(int ifindex);
  24. int link_down(int ifindex);
  25. int link_ether_addr_get(const char *ifname, struct ether_addr *addr);
  26. int get_hostname(char *name, size_t len);
  27. int neighbor_add(int ifindex, const struct ether_addr *, const struct in6_addr *);
  28. int neighbor_remove(int ifindex, const struct in6_addr *);
  29. int neighbor_add_rfc4291(int ifindex, const struct ether_addr *);
  30. int neighbor_remove_rfc4291(int ifindex, const struct ether_addr *);
  31. void rfc4291_addr(const struct ether_addr *eth, struct in6_addr *in6);
  32. #endif /* OWL_NETUTILS_H_ */