2025-04-11 09:40:32 +08:00

139 lines
3.9 KiB
C

/******************************************************************************
*(C) Copyright 2018 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename: wifiCli.h
*
* Description:
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __SFDT_SWITCH_WIFI_H__
#define __SFDT_SWITCH_WIFI_H__
#include "lwip/opt.h"
#include "lwip/ip_addr.h"
#include "networkmgr.h"
#ifdef FEATURE_WIFI_SWITCH_ENABLE
#define SWITCH_DEFAULT_ROUTE_CID 2
typedef enum NmWanNetType_Tag{
NM_WAN_NET_INVALID = 0,
NM_WAN_NET_PS_CAT1 = 1,
NM_WAN_NET_WIFI_CLI = 2,
}NmWanNetType;
/******************************************************************************
* wifi client netif configuration info
* Use to link up one netif
******************************************************************************/
typedef struct NmWifiCliConfiguration_Tag
{
uint16_t dnsNum : 3;
uint16_t mtuPresent : 1; //if mtu is invalid ,this value will be zero
uint16_t ipv4NetMaskPresent : 1;
uint16_t ipType : 3; //NmNetIpType
uint16_t bDefault : 1; //whether default netif
uint16_t rsvd0 : 6;
uint16_t mtu; //default 1500
ip4_addr_t ipv4Addr;
ip4_addr_t ipv4NetMask;
ip6_addr_t ipv6LinkLocalAddr; //ipv6 link local address
ip6_addr_t ipv6GlobalAddr; //ipv6 global address
ip_addr_t dns[NM_MAX_DNS_NUM];// v4 max nume is 2; v6 max num is 2
}NmWifiCliConfiguration; //124 bytes
/******************************************************************************
* wifi client netif configuration info
* Use to link up one netif
******************************************************************************/
typedef struct NmWanNetDefaultChangeInfoTag
{
uint8_t type; //NmWanNetType
uint8_t cid;
uint16_t rsvd;
}NmWanNetDefaultChangeInfo; //124 bytes
typedef enum _AtWanSwitchErr_e{
WSAT_OK = 0,
WSAT_ERR_SWITCH_FAIL = 1,
WSAT_ERR_MAX = 0xff
}AtWanSwitchErr_e;
typedef enum _applSwitchWifiPrimId_Enum{
APPL_SW_PRIM_ID_BAISC = 0,
APPL_SW_WAN_SWITCH_CNF,
APPL_SW_CURR_WAN_SWITCH_IND,
APPL_SW_PRIM_ID_END = 0xff
}applSwitchWifiPrimId_Enum;
typedef struct _wanSwitchCnfCmdMsg_t
{
uint8_t ret;
uint8_t chanId;
char rspbuf[60];
} wanSwitchCnfCmdMsg_t;
typedef struct _queueSwitchWifiT
{
uint8_t switchType; //<< refer to <NmWanNetType>
uint32_t reqHandler;
union{
int32_t cid;
void *wifiCfg; //<< switch config info, refer to <NmWifiCliConfiguration>
}config;
uint8_t resv[4]; //<< reserve for cust
}queueSwitchWifiT;
int32_t sfdt_switchWifiInit(void);
/******************************************************************************
* NetMgrWifiWanLinkUp
* Description: active wifi client as wan netif
* input: NmWifiCliConfiguration *pIfCfg
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkUp(NmWifiCliConfiguration *pIfCfg);
/******************************************************************************
* NetMgrWifiWanLinkDown
* Description: deactive wifi client as wan netif
* input:
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkDown(void);
/******************************************************************************
* NetMgrWanDefaultRouteChange
* Description: deactive wifi client as wan netif
* input:UINT8 type(NmWanNetType),
* UINT8 cid(if the type is NM_WAN_NET_PS_CAT1, need input this parameter)
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWanDefaultRouteChange(UINT8 type, UINT8 cid);
#endif
#endif/*__SFDT_SWITCH_WIFI_H__*/