TuyaOS
wifi_netcfg_frame_sniffer.h
1#ifndef __WIFI_NETCFG_FRAME_SNIFFER_H__
2#define __WIFI_NETCFG_FRAME_SNIFFER_H__
3
4#include <stdint.h>
5#include <stdbool.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/*
12 wifi netcfg frame sniffer用于wifi sniffer共享管理,
13 需要通过wifi sniffer获取802.11数据包的组件都可以注册
14 回调接口到该组件,获取wifi空中数据包;
15 是原有ez配网中的wf_nw_sniffer.c中的功能
16*/
17
18
19/*
20 角色定义:
21 Sniffer:是提供嗅探服务的组件
22 SnifferUser:使用Sniffer组件的嗅探服务的用户组件
23
24*/
25typedef int (*fnSnifferUserCallback_t)(void *ptrArgs, uint8_t *buf, uint16_t len, const int8_t rssi);
27 fnSnifferUserCallback_t cb;
28 void* ptrArgs;
30
31/*Sniffer组件内部的生命周期:
32 全局: Init-> stop -> uninit
33 SnifferUser: register -> start ->unregister
34*/
35typedef int (*fnSnifferUserRegister)(int netcfg_type, ptrSnifferUserParameters_t pParam);
36typedef int (*fnSnifferUserUnregister)(int netcfg_type);
37
38typedef int (*fnSnifferUserStart)(int netcfg_type);
39
40typedef int (*fnSnifferUserStop)(bool isInternalCall);
41/*
42 关闭除netcfg_type之外,其他配网的sniffer收包
43 在共存配网时,当探测到netcfg_type的配网意图时,关闭其他配网的收包
44*/
45typedef int (*fnSnifferUserStopAllOtherNetcfg)(int netcfg_type, bool isInternalCall);
46/*
47 打开除netcfg_type之外,其他配网的sniffer收包
48 在共存配网时,当netcfg_type超时退出时,重新打开其他配网的收包,继续执行共存配网
49*/
50typedef int (*fnSnifferUserStartAllOtherNetcfg)(int netcfg_type, bool isInternalCall);
51
52
54 bool isSnifferStart;
55 fnSnifferUserRegister registerSnifferUserFn;
56 fnSnifferUserStart startSnifferUserFn;
57 fnSnifferUserStop stopSnifferUserFn;
58 fnSnifferUserUnregister unregisterSnifferUserFn;
59 fnSnifferUserStartAllOtherNetcfg startAllOtherUserFn;
60 fnSnifferUserStopAllOtherNetcfg stopAllOtherUserFn;
62
63/*共存配网启动时,执行sniffer callback设置*/
64int WifiNetcfgFrameSnifferCallbackSet(void);
65/*ez only配网时,使能sniffer*/
66int WifiNetcfgFrameSnifferEnable(void);
67
68
69/*获取wifi_netcfg_frame_sniffer的实例*/
70ptrWifiNetcfgFrameSniffer_t getWifiNetcfgFrameSniffer(void);
71
72/*销毁wifi_netcfg_frame_sniffer实例*/
73void destroyWifiNetcfgFrameSniffer(void);
74
75int WifiNetcfgFrameSnifferSessionInit(void);
76int WifiNetcfgFrameSnifferSessionUnInit(void);
77
78
79#ifdef __cplusplus
80}
81#endif
82#endif
Definition: wifi_netcfg_frame_sniffer.h:26
Definition: wifi_netcfg_frame_sniffer.h:53