]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add P2P Device handling primitives
authorJohannes Berg <johannes.berg@intel.com>
Tue, 6 Nov 2012 10:31:55 +0000 (11:31 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 6 Nov 2012 10:31:55 +0000 (11:31 +0100)
For testing, it can be useful to be able to use the
P2P Device manually, add the ability to do that.

Makefile
interface.c
p2p.c [new file with mode: 0644]

index 9cf8a8e92392c79a2a898c90c9dee0df636f14bc..ed62ffe7f863f0c08f30a498d25c574c98eaec2a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ OBJS = iw.o genl.o event.o info.o phy.o \
        interface.o ibss.o station.o survey.o util.o \
        mesh.o mpath.o scan.o reg.o version.o \
        reason.o status.o connect.o link.o offch.o ps.o cqm.o \
-       bitrate.o wowlan.o roc.o
+       bitrate.o wowlan.o roc.o p2p.o
 OBJS += sections.o
 
 OBJS-$(HWSIM) += hwsim.o
index 945362f90ab4d86ec0bf4af17edd9d1568c147e6..810c2b96d25e56c6ce0c09602d33880b5c3f51b0 100644 (file)
@@ -133,6 +133,9 @@ static int get_if_type(int *argc, char ***argv, enum nl80211_iftype *type,
        } else if (strcmp(tpstr, "__p2pcl") == 0) {
                *type = NL80211_IFTYPE_P2P_CLIENT;
                return 0;
+       } else if (strcmp(tpstr, "__p2pdev") == 0) {
+               *type = NL80211_IFTYPE_P2P_DEVICE;
+               return 0;
        } else if (strcmp(tpstr, "__p2pgo") == 0) {
                *type = NL80211_IFTYPE_P2P_GO;
                return 0;
diff --git a/p2p.c b/p2p.c
new file mode 100644 (file)
index 0000000..addb740
--- /dev/null
+++ b/p2p.c
@@ -0,0 +1,30 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(p2p);
+
+static int handle_p2p_start(struct nl80211_state *state, struct nl_cb *cb,
+                           struct nl_msg *msg, int argc, char **argv,
+                           enum id_input id)
+{
+       return 0;
+}
+COMMAND(p2p, start, "", NL80211_CMD_START_P2P_DEVICE, 0, CIB_WDEV, handle_p2p_start, "");
+
+static int handle_p2p_stop(struct nl80211_state *state, struct nl_cb *cb,
+                          struct nl_msg *msg, int argc, char **argv,
+                          enum id_input id)
+{
+       return 0;
+}
+COMMAND(p2p, stop, "", NL80211_CMD_STOP_P2P_DEVICE, 0, CIB_WDEV, handle_p2p_stop, "");