Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
码肥人壮
rt-thread
提交
986b64cb
R
rt-thread
项目概览
码肥人壮
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
986b64cb
编写于
2月 29, 2020
作者:
Lawlieta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[driver][wlan] add raw frame send interface and Management frame filter interface
Signed-off-by:
chenyong
<
1521761801@qq.com
>
上级
02722864
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
87 addition
and
1 deletion
+87
-1
components/drivers/wlan/wlan_dev.c
components/drivers/wlan/wlan_dev.c
+80
-0
components/drivers/wlan/wlan_dev.h
components/drivers/wlan/wlan_dev.h
+7
-1
未找到文件。
components/drivers/wlan/wlan_dev.c
浏览文件 @
986b64cb
...
...
@@ -574,6 +574,77 @@ rt_err_t rt_wlan_dev_report_data(struct rt_wlan_device *device, void *buff, int
#endif
}
rt_err_t
rt_wlan_dev_enter_mgnt_filter
(
struct
rt_wlan_device
*
device
)
{
rt_err_t
result
=
RT_EOK
;
int
enable
=
1
;
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
}
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_CFG_MGNT_FILTER
,
&
enable
);
return
result
;
}
rt_err_t
rt_wlan_dev_exit_mgnt_filter
(
struct
rt_wlan_device
*
device
)
{
rt_err_t
result
=
RT_EOK
;
int
enable
=
0
;
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
}
result
=
rt_device_control
(
RT_DEVICE
(
device
),
RT_WLAN_CMD_CFG_MGNT_FILTER
,
&
enable
);
return
result
;
}
rt_err_t
rt_wlan_dev_set_mgnt_filter_callback
(
struct
rt_wlan_device
*
device
,
rt_wlan_mgnt_filter_callback_t
callback
)
{
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
}
device
->
mgnt_filter_callback
=
callback
;
return
RT_EOK
;
}
void
rt_wlan_dev_mgnt_filter_handler
(
struct
rt_wlan_device
*
device
,
void
*
data
,
int
len
)
{
rt_wlan_mgnt_filter_callback_t
callback
;
if
(
device
==
RT_NULL
)
{
return
;
}
callback
=
device
->
mgnt_filter_callback
;
if
(
callback
!=
RT_NULL
)
{
callback
(
device
,
data
,
len
);
}
}
int
rt_wlan_dev_send_raw_frame
(
struct
rt_wlan_device
*
device
,
void
*
buff
,
int
len
)
{
if
(
device
==
RT_NULL
)
{
return
-
RT_EIO
;
}
if
(
device
->
ops
->
wlan_send_raw_frame
)
{
return
device
->
ops
->
wlan_send_raw_frame
(
device
,
buff
,
len
);
}
return
-
RT_ERROR
;
}
static
rt_err_t
_rt_wlan_dev_init
(
rt_device_t
dev
)
{
struct
rt_wlan_device
*
wlan
=
(
struct
rt_wlan_device
*
)
dev
;
...
...
@@ -716,6 +787,15 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
err
=
wlan
->
ops
->
wlan_cfg_filter
(
wlan
,
filter
);
break
;
}
case
RT_WLAN_CMD_CFG_MGNT_FILTER
:
{
rt_bool_t
start
=
*
((
rt_bool_t
*
)
args
);
LOG_D
(
"%s %d cmd[%d]:%s run......"
,
__FUNCTION__
,
__LINE__
,
RT_WLAN_CMD_CFG_MGNT_FILTER
,
"RT_WLAN_CMD_CFG_MGNT_FILTER"
);
if
(
wlan
->
ops
->
wlan_cfg_mgnt_filter
)
err
=
wlan
->
ops
->
wlan_cfg_mgnt_filter
(
wlan
,
start
);
break
;
}
case
RT_WLAN_CMD_SET_CHANNEL
:
{
int
channel
=
*
(
int
*
)
args
;
...
...
components/drivers/wlan/wlan_dev.h
浏览文件 @
986b64cb
...
...
@@ -37,7 +37,8 @@ typedef enum
RT_WLAN_CMD_SET_POWERSAVE
,
RT_WLAN_CMD_GET_POWERSAVE
,
RT_WLAN_CMD_CFG_PROMISC
,
/* start/stop minitor */
RT_WLAN_CMD_CFG_FILTER
,
RT_WLAN_CMD_CFG_FILTER
,
/* start/stop frame filter */
RT_WLAN_CMD_CFG_MGNT_FILTER
,
/* start/stop management frame filter */
RT_WLAN_CMD_SET_CHANNEL
,
RT_WLAN_CMD_GET_CHANNEL
,
RT_WLAN_CMD_SET_COUNTRY
,
...
...
@@ -360,6 +361,8 @@ typedef void (*rt_wlan_dev_event_handler)(struct rt_wlan_device *device, rt_wlan
typedef
void
(
*
rt_wlan_pormisc_callback_t
)(
struct
rt_wlan_device
*
device
,
void
*
data
,
int
len
);
typedef
void
(
*
rt_wlan_mgnt_filter_callback_t
)(
struct
rt_wlan_device
*
device
,
void
*
data
,
int
len
);
struct
rt_wlan_ssid
{
rt_uint8_t
len
;
...
...
@@ -445,6 +448,7 @@ struct rt_wlan_device
struct
rt_mutex
lock
;
struct
rt_wlan_dev_event_desc
handler_table
[
RT_WLAN_DEV_EVT_MAX
][
RT_WLAN_DEV_EVENT_NUM
];
rt_wlan_pormisc_callback_t
pormisc_callback
;
rt_wlan_mgnt_filter_callback_t
mgnt_filter_callback
;
const
struct
rt_wlan_dev_ops
*
ops
;
rt_uint32_t
flags
;
struct
netdev
*
netdev
;
...
...
@@ -495,6 +499,7 @@ struct rt_wlan_dev_ops
int
(
*
wlan_get_powersave
)(
struct
rt_wlan_device
*
wlan
);
rt_err_t
(
*
wlan_cfg_promisc
)(
struct
rt_wlan_device
*
wlan
,
rt_bool_t
start
);
rt_err_t
(
*
wlan_cfg_filter
)(
struct
rt_wlan_device
*
wlan
,
struct
rt_wlan_filter
*
filter
);
rt_err_t
(
*
wlan_cfg_mgnt_filter
)(
struct
rt_wlan_device
*
wlan
,
rt_bool_t
start
);
rt_err_t
(
*
wlan_set_channel
)(
struct
rt_wlan_device
*
wlan
,
int
channel
);
int
(
*
wlan_get_channel
)(
struct
rt_wlan_device
*
wlan
);
rt_err_t
(
*
wlan_set_country
)(
struct
rt_wlan_device
*
wlan
,
rt_country_code_t
country_code
);
...
...
@@ -503,6 +508,7 @@ struct rt_wlan_dev_ops
rt_err_t
(
*
wlan_get_mac
)(
struct
rt_wlan_device
*
wlan
,
rt_uint8_t
mac
[]);
int
(
*
wlan_recv
)(
struct
rt_wlan_device
*
wlan
,
void
*
buff
,
int
len
);
int
(
*
wlan_send
)(
struct
rt_wlan_device
*
wlan
,
void
*
buff
,
int
len
);
int
(
*
wlan_send_raw_frame
)(
struct
rt_wlan_device
*
wlan
,
void
*
buff
,
int
len
);
};
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录