aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorAyala Beker <ayala.beker@intel.com>2016-09-20 10:31:15 -0400
committerJohannes Berg <johannes.berg@intel.com>2016-09-30 07:21:23 -0400
commita442b761b24b6886f9a4e2ff5f8cb4824c96526b (patch)
tree85886140e3f340c7716e8bb58caf9ed9ec5be8db /include/uapi/linux
parent708d50edb149fe488c7c96f59ba9a89a64985cf2 (diff)
cfg80211: add add_nan_func / del_nan_func
A NAN function can be either publish, subscribe or follow up. Make all the necessary verifications and just pass the request to the driver. Allow the user space application that starts NAN to forbid any other socket to add or remove functions. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Ayala Beker <ayala.beker@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/nl80211.h150
1 files changed, 150 insertions, 0 deletions
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 98fd3ec8598d..e4935d963061 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -847,6 +847,21 @@
847 * After this command NAN functions can be added. 847 * After this command NAN functions can be added.
848 * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by 848 * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
849 * its %NL80211_ATTR_WDEV interface. 849 * its %NL80211_ATTR_WDEV interface.
850 * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined
851 * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this
852 * operation returns the strictly positive and unique instance id
853 * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE)
854 * of the function upon success.
855 * Since instance ID's can be re-used, this cookie is the right
856 * way to identify the function. This will avoid races when a termination
857 * event is handled by the user space after it has already added a new
858 * function that got the same instance id from the kernel as the one
859 * which just terminated.
860 * This cookie may be used in NAN events even before the command
861 * returns, so userspace shouldn't process NAN events until it processes
862 * the response to this command.
863 * Look at %NL80211_ATTR_SOCKET_OWNER as well.
864 * @NL80211_CMD_DEL_NAN_FUNCTION: Delete a NAN function by cookie.
850 * 865 *
851 * @NL80211_CMD_MAX: highest used command number 866 * @NL80211_CMD_MAX: highest used command number
852 * @__NL80211_CMD_AFTER_LAST: internal use 867 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1038,6 +1053,8 @@ enum nl80211_commands {
1038 1053
1039 NL80211_CMD_START_NAN, 1054 NL80211_CMD_START_NAN,
1040 NL80211_CMD_STOP_NAN, 1055 NL80211_CMD_STOP_NAN,
1056 NL80211_CMD_ADD_NAN_FUNCTION,
1057 NL80211_CMD_DEL_NAN_FUNCTION,
1041 1058
1042 /* add new commands above here */ 1059 /* add new commands above here */
1043 1060
@@ -1899,6 +1916,9 @@ enum nl80211_commands {
1899 * @NL80211_ATTR_NAN_DUAL: NAN dual band operation config (see 1916 * @NL80211_ATTR_NAN_DUAL: NAN dual band operation config (see
1900 * &enum nl80211_nan_dual_band_conf). This attribute is used with 1917 * &enum nl80211_nan_dual_band_conf). This attribute is used with
1901 * %NL80211_CMD_START_NAN. 1918 * %NL80211_CMD_START_NAN.
1919 * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
1920 * &enum nl80211_nan_func_attributes for description of this nested
1921 * attribute.
1902 * 1922 *
1903 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 1923 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1904 * @NL80211_ATTR_MAX: highest attribute number currently defined 1924 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2296,6 +2316,7 @@ enum nl80211_attrs {
2296 2316
2297 NL80211_ATTR_NAN_MASTER_PREF, 2317 NL80211_ATTR_NAN_MASTER_PREF,
2298 NL80211_ATTR_NAN_DUAL, 2318 NL80211_ATTR_NAN_DUAL,
2319 NL80211_ATTR_NAN_FUNC,
2299 2320
2300 /* add attributes here, update the policy in nl80211.c */ 2321 /* add attributes here, update the policy in nl80211.c */
2301 2322
@@ -4917,4 +4938,133 @@ enum nl80211_nan_dual_band_conf {
4917 NL80211_NAN_BAND_5GHZ = 1 << 2, 4938 NL80211_NAN_BAND_5GHZ = 1 << 2,
4918}; 4939};
4919 4940
4941/**
4942 * enum nl80211_nan_function_type - NAN function type
4943 *
4944 * Defines the function type of a NAN function
4945 *
4946 * @NL80211_NAN_FUNC_PUBLISH: function is publish
4947 * @NL80211_NAN_FUNC_SUBSCRIBE: function is subscribe
4948 * @NL80211_NAN_FUNC_FOLLOW_UP: function is follow-up
4949 */
4950enum nl80211_nan_function_type {
4951 NL80211_NAN_FUNC_PUBLISH,
4952 NL80211_NAN_FUNC_SUBSCRIBE,
4953 NL80211_NAN_FUNC_FOLLOW_UP,
4954
4955 /* keep last */
4956 __NL80211_NAN_FUNC_TYPE_AFTER_LAST,
4957 NL80211_NAN_FUNC_MAX_TYPE = __NL80211_NAN_FUNC_TYPE_AFTER_LAST - 1,
4958};
4959
4960/**
4961 * enum nl80211_nan_publish_type - NAN publish tx type
4962 *
4963 * Defines how to send publish Service Discovery Frames
4964 *
4965 * @NL80211_NAN_SOLICITED_PUBLISH: publish function is solicited
4966 * @NL80211_NAN_UNSOLICITED_PUBLISH: publish function is unsolicited
4967 */
4968enum nl80211_nan_publish_type {
4969 NL80211_NAN_SOLICITED_PUBLISH = 1 << 0,
4970 NL80211_NAN_UNSOLICITED_PUBLISH = 1 << 1,
4971};
4972
4973#define NL80211_NAN_FUNC_SERVICE_ID_LEN 6
4974#define NL80211_NAN_FUNC_SERVICE_SPEC_INFO_MAX_LEN 0xff
4975#define NL80211_NAN_FUNC_SRF_MAX_LEN 0xff
4976
4977/**
4978 * enum nl80211_nan_func_attributes - NAN function attributes
4979 * @__NL80211_NAN_FUNC_INVALID: invalid
4980 * @NL80211_NAN_FUNC_TYPE: &enum nl80211_nan_function_type (u8).
4981 * @NL80211_NAN_FUNC_SERVICE_ID: 6 bytes of the service ID hash as
4982 * specified in NAN spec. This is a binary attribute.
4983 * @NL80211_NAN_FUNC_PUBLISH_TYPE: relevant if the function's type is
4984 * publish. Defines the transmission type for the publish Service Discovery
4985 * Frame, see &enum nl80211_nan_publish_type. Its type is u8.
4986 * @NL80211_NAN_FUNC_PUBLISH_BCAST: relevant if the function is a solicited
4987 * publish. Should the solicited publish Service Discovery Frame be sent to
4988 * the NAN Broadcast address. This is a flag.
4989 * @NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE: relevant if the function's type is
4990 * subscribe. Is the subscribe active. This is a flag.
4991 * @NL80211_NAN_FUNC_FOLLOW_UP_ID: relevant if the function's type is follow up.
4992 * The instance ID for the follow up Service Discovery Frame. This is u8.
4993 * @NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID: relevant if the function's type
4994 * is follow up. This is a u8.
4995 * The requestor instance ID for the follow up Service Discovery Frame.
4996 * @NL80211_NAN_FUNC_FOLLOW_UP_DEST: the MAC address of the recipient of the
4997 * follow up Service Discovery Frame. This is a binary attribute.
4998 * @NL80211_NAN_FUNC_CLOSE_RANGE: is this function limited for devices in a
4999 * close range. The range itself (RSSI) is defined by the device.
5000 * This is a flag.
5001 * @NL80211_NAN_FUNC_TTL: strictly positive number of DWs this function should
5002 * stay active. If not present infinite TTL is assumed. This is a u32.
5003 * @NL80211_NAN_FUNC_SERVICE_INFO: array of bytes describing the service
5004 * specific info. This is a binary attribute.
5005 * @NL80211_NAN_FUNC_SRF: Service Receive Filter. This is a nested attribute.
5006 * See &enum nl80211_nan_srf_attributes.
5007 * @NL80211_NAN_FUNC_RX_MATCH_FILTER: Receive Matching filter. This is a nested
5008 * attribute. It is a list of binary values.
5009 * @NL80211_NAN_FUNC_TX_MATCH_FILTER: Transmit Matching filter. This is a
5010 * nested attribute. It is a list of binary values.
5011 * @NL80211_NAN_FUNC_INSTANCE_ID: The instance ID of the function.
5012 * Its type is u8 and it cannot be 0.
5013 * @NL80211_NAN_FUNC_TERM_REASON: NAN function termination reason.
5014 * See &enum nl80211_nan_func_term_reason.
5015 *
5016 * @NUM_NL80211_NAN_FUNC_ATTR: internal
5017 * @NL80211_NAN_FUNC_ATTR_MAX: highest NAN function attribute
5018 */
5019enum nl80211_nan_func_attributes {
5020 __NL80211_NAN_FUNC_INVALID,
5021 NL80211_NAN_FUNC_TYPE,
5022 NL80211_NAN_FUNC_SERVICE_ID,
5023 NL80211_NAN_FUNC_PUBLISH_TYPE,
5024 NL80211_NAN_FUNC_PUBLISH_BCAST,
5025 NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE,
5026 NL80211_NAN_FUNC_FOLLOW_UP_ID,
5027 NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID,
5028 NL80211_NAN_FUNC_FOLLOW_UP_DEST,
5029 NL80211_NAN_FUNC_CLOSE_RANGE,
5030 NL80211_NAN_FUNC_TTL,
5031 NL80211_NAN_FUNC_SERVICE_INFO,
5032 NL80211_NAN_FUNC_SRF,
5033 NL80211_NAN_FUNC_RX_MATCH_FILTER,
5034 NL80211_NAN_FUNC_TX_MATCH_FILTER,
5035 NL80211_NAN_FUNC_INSTANCE_ID,
5036 NL80211_NAN_FUNC_TERM_REASON,
5037
5038 /* keep last */
5039 NUM_NL80211_NAN_FUNC_ATTR,
5040 NL80211_NAN_FUNC_ATTR_MAX = NUM_NL80211_NAN_FUNC_ATTR - 1
5041};
5042
5043/**
5044 * enum nl80211_nan_srf_attributes - NAN Service Response filter attributes
5045 * @__NL80211_NAN_SRF_INVALID: invalid
5046 * @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set.
5047 * This is a flag.
5048 * @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if
5049 * &NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary.
5050 * @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if
5051 * &NL80211_NAN_SRF_BF is present. This is a u8.
5052 * @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if
5053 * and only if &NL80211_NAN_SRF_BF isn't present. This is a nested
5054 * attribute. Each nested attribute is a MAC address.
5055 * @NUM_NL80211_NAN_SRF_ATTR: internal
5056 * @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute
5057 */
5058enum nl80211_nan_srf_attributes {
5059 __NL80211_NAN_SRF_INVALID,
5060 NL80211_NAN_SRF_INCLUDE,
5061 NL80211_NAN_SRF_BF,
5062 NL80211_NAN_SRF_BF_IDX,
5063 NL80211_NAN_SRF_MAC_ADDRS,
5064
5065 /* keep last */
5066 NUM_NL80211_NAN_SRF_ATTR,
5067 NL80211_NAN_SRF_ATTR_MAX = NUM_NL80211_NAN_SRF_ATTR - 1,
5068};
5069
4920#endif /* __LINUX_NL80211_H */ 5070#endif /* __LINUX_NL80211_H */