From 8d5d7ba796bf89c1efd3be3fbed5d1c7bd40dec7 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 6 Nov 2012 11:31:55 +0100 Subject: [PATCH] add P2P Device handling primitives For testing, it can be useful to be able to use the P2P Device manually, add the ability to do that. --- Makefile | 2 +- interface.c | 3 +++ p2p.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 p2p.c diff --git a/Makefile b/Makefile index 9cf8a8e..ed62ffe 100644 --- 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 diff --git a/interface.c b/interface.c index 945362f..810c2b9 100644 --- a/interface.c +++ b/interface.c @@ -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 index 0000000..addb740 --- /dev/null +++ b/p2p.c @@ -0,0 +1,30 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#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, ""); -- 2.39.2