From c5541bfb5646ce112ba623895bc46e6a5ead52b9 Mon Sep 17 00:00:00 2001 From: meijian Date: Wed, 1 Nov 2023 21:13:13 +0800 Subject: [PATCH] [wireless][wapi] add extend api for private needs Signed-off-by: meijian --- 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; +} +