You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2024/09/12 04:43:58 UTC

(nuttx-apps) 01/03: [wireless][wapi] add extend api for private needs

This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c5541bfb5646ce112ba623895bc46e6a5ead52b9
Author: meijian <me...@xiaomi.com>
AuthorDate: Wed Nov 1 21:13:13 2023 +0800

    [wireless][wapi] add extend api for private needs
    
    Signed-off-by: meijian <me...@xiaomi.com>
---
 include/wireless/wapi.h      | 10 ++++++++++
 wireless/wapi/src/wireless.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/include/wireless/wapi.h b/include/wireless/wapi.h
index d4cf69036..aa481fe42 100644
--- a/include/wireless/wapi.h
+++ b/include/wireless/wapi.h
@@ -963,6 +963,16 @@ int wapi_set_pta_prio(int sock, FAR const char *ifname,
 int wapi_get_pta_prio(int sock, FAR const char *ifname,
                       enum wapi_pta_prio_e *pta_prio);
 
+/****************************************************************************
+ * Name: wapi_extend_params
+ *
+ * Description:
+ *   wapi extension interface for privatization method.
+ *
+ ****************************************************************************/
+
+int wapi_extend_params(int sock, int cmd, FAR struct iwreq *wrq);
+
 #undef EXTERN
 #ifdef __cplusplus
 }
diff --git a/wireless/wapi/src/wireless.c b/wireless/wapi/src/wireless.c
index 92eba66a1..36a3b0544 100644
--- a/wireless/wapi/src/wireless.c
+++ b/wireless/wapi/src/wireless.c
@@ -1628,3 +1628,34 @@ int wapi_get_pta_prio(int sock, FAR const char *ifname,
   return ret;
 }
 
+/****************************************************************************
+ * Name: wapi_extend_params
+ *
+ * Description:
+ *   wapi extension interface for privatization method.
+ *
+ ****************************************************************************/
+
+int wapi_extend_params(int sock, int cmd, FAR struct iwreq *wrq)
+{
+  int ret;
+
+  WAPI_VALIDATE_PTR(wrq);
+
+  if (cmd < SIOCIWFIRSTPRIV || cmd > SIOCIWLASTPRIV)
+    {
+      wlerr("extend ioctl cmd invalid");
+      return -EINVAL;
+    }
+
+  ret = ioctl(sock, cmd, (unsigned long)((uintptr_t)wrq));
+  if (ret < 0)
+    {
+      int errcode = errno;
+      wlerr("extend ioctl(%d): %d", cmd, errcode);
+      ret = -errcode;
+    }
+
+  return ret;
+}
+