]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add a helper command to print command IDs
authorJohannes Berg <johannes.berg@intel.com>
Thu, 15 Nov 2012 14:15:10 +0000 (15:15 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 15 Nov 2012 14:15:10 +0000 (15:15 +0100)
sometimes knowing the command ID for a given
nl80211 command or knowing the command for a
given number is needed, add a helper for that

info.c

diff --git a/info.c b/info.c
index 5d99bf82b599766b7ee0505fe24cf70beeb4b706..08dbfc081521ed1cf92234b962d1423a906e04d2 100644 (file)
--- a/info.c
+++ b/info.c
@@ -472,3 +472,16 @@ __COMMAND(NULL, info, "info", NULL, NL80211_CMD_GET_WIPHY, 0, 0, CIB_PHY, handle
 TOPLEVEL(list, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info,
         "List all wireless devices and their capabilities.");
 TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
+
+static int handle_commands(struct nl80211_state *state,
+                          struct nl_cb *cb, struct nl_msg *msg,
+                          int argc, char **argv, enum id_input id)
+{
+       int i;
+       for (i = 1; i < NL80211_CMD_MAX; i++)
+               printf("%d (0x%x): %s\n", i, i, command_name(i));
+       /* don't send netlink messages */
+       return 2;
+}
+TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
+        "list all known commands and their decimal & hex value");