]>
git.ipfire.org Git - thirdparty/iw.git/blob - iw.h
4 #include <netlink/netlink.h>
5 #include <netlink/genl/genl.h>
6 #include <netlink/genl/family.h>
7 #include <netlink/genl/ctrl.h>
13 #ifndef CONFIG_LIBNL20
14 # define nl_sock nl_handle
17 struct nl80211_state
{
18 struct nl_sock
*nl_sock
;
19 struct nl_cache
*nl_cache
;
20 struct genl_family
*nl80211
;
23 enum command_identify_by
{
41 const enum nl80211_commands cmd
;
44 const enum command_identify_by idby
;
46 * The handler should return a negative error code,
47 * zero on success, 1 if the arguments were wrong
48 * and the usage message should and 2 otherwise.
50 int (*handler
)(struct nl80211_state
*state
,
53 int argc
, char **argv
);
56 #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
58 #define __COMMAND(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help)\
59 static const struct cmd \
60 __cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden\
61 __attribute__((used)) __attribute__((section("__cmd"))) = { \
62 .section = (_section), \
66 .nl_msg_flags = (_flags), \
67 .hidden = (_hidden), \
69 .handler = (_handler), \
72 #define COMMAND(section, name, args, cmd, flags, idby, handler, help) \
73 __COMMAND(#section, name, #name, args, cmd, flags, 0, idby, handler, help)
74 #define HIDDEN(section, name, args, cmd, flags, idby, handler) \
75 __COMMAND(#section, name, #name, args, cmd, flags, 1, idby, handler, NULL)
76 #define TOPLEVEL(name, args, cmd, flags, idby, handler, help) \
77 __COMMAND(NULL, name, #name, args, cmd, flags, 0, idby, handler, help)
78 extern struct cmd __start___cmd
;
79 extern struct cmd __stop___cmd
;
81 extern const char iw_version
[];
85 int handle_cmd(struct nl80211_state
*state
, enum id_input idby
,
86 int argc
, char **argv
);
87 __u32
listen_events(struct nl80211_state
*state
,
88 const int n_waits
, const __u32
*waits
);
91 int mac_addr_a2n(unsigned char *mac_addr
, char *arg
);
92 int mac_addr_n2a(char *mac_addr
, unsigned char *arg
);
94 const char *iftype_name(enum nl80211_iftype iftype
);
95 int ieee80211_channel_to_frequency(int chan
);
96 int ieee80211_frequency_to_channel(int freq
);
98 void print_ssid_escaped(const uint8_t len
, const uint8_t *data
);
100 int nl_get_multicast_id(struct nl_sock
*sock
, const char *family
, const char *group
);
102 char *reg_initiator_to_string(__u8 initiator
);
104 const char *get_reason_str(uint16_t reason
);
105 const char *get_status_str(uint16_t status
);