netlink.h 580 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef _KRATOS_NETLINK_H_
  2. #define _KRATOS_NETLINK_H_
  3. #include <linux/nl80211.h>
  4. #include <netlink/attr.h>
  5. typedef int nl_callback(struct nl_msg *msg, void *arg);
  6. typedef struct {
  7. int id;
  8. struct nl_sock *socket;
  9. struct nl_cb *cb1;
  10. int result;
  11. } Netlink;
  12. typedef struct {
  13. char ifname[30];
  14. int ifindex;
  15. int signal;
  16. int txrate;
  17. } Wifi;
  18. static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = {
  19. [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 },
  20. };
  21. int finish_handler(struct nl_msg*, void*);
  22. int initNl80211(Netlink* nl, Wifi* w, nl_callback*);
  23. #endif