]>
git.ipfire.org Git - thirdparty/iw.git/blob - iw.h
315a145728a3cdd781f70a74bbaad4ab27fbb206
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(sect, name, args, nlcmd, flags, hidden, idby, handler)\
59 static const struct cmd \
60 __cmd_ ## handler ## _ ## nlcmd ## _ ## idby ## _ ## hidden \
61 __attribute__((used)) __attribute__((section("__cmd"))) \
62 = { sect, name, args, nlcmd, flags, hidden, idby, handler }
63 #define COMMAND(section, name, args, cmd, flags, idby, handler) \
64 __COMMAND(#section, #name, args, cmd, flags, 0, idby, handler)
65 #define HIDDEN(section, name, args, cmd, flags, idby, handler) \
66 __COMMAND(#section, #name, args, cmd, flags, 1, idby, handler)
67 #define TOPLEVEL(name, args, cmd, flags, idby, handler) \
68 __COMMAND(NULL, #name, args, cmd, flags, 0, idby, handler)
69 extern struct cmd __start___cmd
;
70 extern struct cmd __stop___cmd
;
73 int handle_cmd(struct nl80211_state
*state
, enum id_input idby
,
74 int argc
, char **argv
);
77 int mac_addr_a2n(unsigned char *mac_addr
, char *arg
);
78 int mac_addr_n2a(char *mac_addr
, unsigned char *arg
);
80 const char *iftype_name(enum nl80211_iftype iftype
);
81 int ieee80211_channel_to_frequency(int chan
);
82 int ieee80211_frequency_to_channel(int freq
);
84 int nl_get_multicast_id(struct nl_sock
*sock
, const char *family
, const char *group
);
86 char *reg_initiator_to_string(__u8 initiator
);