409 lines
12 KiB
C
409 lines
12 KiB
C
/*--------------------------------------------------------------------------------------------------------------------
|
|
* -------------------------------------------------------------------------------------------------------------------
|
|
*
|
|
* Filename: cmux_api.h
|
|
*
|
|
* Description: API interface prototypes for cmux
|
|
*
|
|
* History:
|
|
* Sep 4, 2017 - Rong Jin Creation of file
|
|
*
|
|
* Notes:
|
|
*
|
|
******************************************************************************/
|
|
|
|
|
|
#ifndef __CMUX_API_H__
|
|
#define __CMUX_API_H__
|
|
|
|
#include "osa.h"
|
|
#include "teldef.h"
|
|
#include "mi_api.h"
|
|
#include "uart.h"
|
|
#include "dialer_task.h"
|
|
|
|
#ifdef CRANE_MCU_DONGLE
|
|
#define CMUX_EXTEND_AT
|
|
#else
|
|
#undef CMUX_EXTEND_AT
|
|
#endif
|
|
|
|
//#define ATNET_SSL
|
|
|
|
|
|
#define MAKE_MI_REQ_HANDLE( atHandle, reqId ) MAKE_CI_REQ_HANDLE( atHandle, reqId )
|
|
#ifndef LTEONLY_THIN_SINGLE_SIM_2MFLASH
|
|
#define MAX_CMUX_CHANNEL 6
|
|
#else
|
|
#define MAX_CMUX_CHANNEL 2
|
|
#endif
|
|
#define MAX_CHANNEL_SEND_BUF utlAT_MAX_LINE_LENGTH
|
|
#define AT_COMMAND_MODE 0
|
|
#define NON_TRANSPARENT_MDOE 1
|
|
#define TRANSPARENT_MDOE 2
|
|
#define TYPE_USERPWD "USERPWD"
|
|
#define TYPE_APN "APN"
|
|
#define TYPE_CFGT "CFGT"
|
|
#define TYPE_CFGP "CFGP"
|
|
#define TYPE_AUTH "AUTH"
|
|
|
|
#define FTP_CFG_ACCOUNT "account"
|
|
#define FTP_CFG_FILETYPE "filetype"
|
|
#define FTP_CFG_TRANSMODE "transmode"
|
|
#define FTP_CFG_CONTEXTID "contextid"
|
|
#define FTP_CFG_RSPTIMEOUT "rsptimeout"
|
|
#define FTP_CFG_SSLTYPE "ssltype"
|
|
#define FTP_CFG_SSLCTXID "sslctxid"
|
|
|
|
#define CMUXDBG(fmt,args...) CPUartLogPrintf(fmt, ##args)
|
|
|
|
enum acceptAction
|
|
{
|
|
ACCEPT_ALLOW,
|
|
ACCEPT_DENY
|
|
};
|
|
|
|
enum transportMode
|
|
{
|
|
NON_TRANSPARENT,
|
|
TRANSPARENT
|
|
};
|
|
|
|
enum netType
|
|
{
|
|
TCP_CLIENT,
|
|
TCP_SERVER,
|
|
UDP_CLIENT
|
|
};
|
|
|
|
enum viewMode
|
|
{
|
|
HEX_MODE,
|
|
TEXT_MODE
|
|
};
|
|
|
|
enum serviceID
|
|
{
|
|
SVCID_DIALER,
|
|
SVCID_NET0,
|
|
SVCID_NET1,
|
|
SVCID_NET2,
|
|
SVCID_NET3,
|
|
SVCID_NET4,
|
|
SVCID_NET5,
|
|
SVCID_FOTA,
|
|
SVCID_FTP,
|
|
SVCID_FTPA,
|
|
SVCID_NBIOT,
|
|
SVCID_MAX
|
|
};
|
|
|
|
enum miRequestMsg
|
|
{
|
|
MI_REQUEST_MSG,
|
|
MI_RESPONSE_MSG,
|
|
MI_FOTA_REQUEST_MSG,
|
|
MI_FOTA_RESPONSE_MSG,
|
|
MI_FTPA_REQUEST_MSG,
|
|
MI_FTPA_RESPONSE_MSG,
|
|
MI_TRANSPORT_REQUEST_MSG,
|
|
};
|
|
|
|
enum channelType
|
|
{
|
|
CHANNEL_INIT,
|
|
CHANNEL_NET,
|
|
CHANNEL_FTP,
|
|
CHANNEL_FOTA,
|
|
};
|
|
|
|
enum pdpActiveStatus
|
|
{
|
|
PDP_STATUS_DEACTIVED,
|
|
PDP_STATUS_ACTIVED
|
|
};
|
|
|
|
enum apnHandleStatus
|
|
{
|
|
APN_ACTIVE_NOT_ALLOWED = 1, /*APN has been actived by this channel*/
|
|
APN_HAS_ACTIVED, /*APN has been actived by other channel */
|
|
APN_NOT_ACTIVED, /*No channel actived the APN*/
|
|
APN_DEACTIV_NOT_ALLOWED,
|
|
APN_DEACTIV_ONLY_CLEAR_INFO,
|
|
APN_DEACTIVE
|
|
};
|
|
|
|
|
|
enum AsrOpenServiceType
|
|
{
|
|
ASR_SERVICE_TCP,
|
|
ASR_SERVICE_UDP,
|
|
ASR_SERVICE_TCP_LISTENER,
|
|
ASR_SERVICE_UDP_SERVICE,
|
|
ASR_SERVICE_MAX
|
|
};
|
|
|
|
|
|
enum SSLCfgParameType
|
|
{
|
|
SSL_CFG_VERSION,
|
|
SSL_CFG_CIPHERSUITE,
|
|
SSL_CFG_CACERT,
|
|
SSL_CFG_CLIENTCERT,
|
|
SSL_CFG_CLIENTKEY,
|
|
SSL_CFG_SECLEVEL,
|
|
SSL_CFG_IGNORELOCALTIME,
|
|
SSL_CFG_NEGOTIATETIME
|
|
};
|
|
|
|
|
|
struct pdpParam
|
|
{
|
|
struct pdpUserPswd userPswd;
|
|
CHAR apn[MAX_STRING_LEN];
|
|
CHAR ip_type[MAX_STRING_LEN];
|
|
INT32 auth;
|
|
INT32 cfgp;
|
|
INT32 cfgt;
|
|
INT32 conNum;
|
|
UINT32 atHandle;
|
|
BOOL isDefault;
|
|
};
|
|
|
|
struct pdpIpInfo
|
|
{
|
|
INT32 status;
|
|
CHAR ipStr[MAX_STRING_LEN];
|
|
CHAR gateStr[MAX_STRING_LEN];
|
|
CHAR DNS1[MAX_STRING_LEN];
|
|
CHAR DNS2[MAX_STRING_LEN];
|
|
};
|
|
|
|
struct netSvcParam
|
|
{
|
|
UINT8 socketID;/*accept socket*/
|
|
UINT8 mode;
|
|
UINT8 type;
|
|
UINT8 action;/*if type: tcp/udp server, check action*/
|
|
UINT8 transMode;
|
|
struct pdpParam pdpCfg;
|
|
struct pdpIpInfo ipInfo;
|
|
};
|
|
|
|
struct createDataCtrl
|
|
{
|
|
UINT8 socketID;/*socket*/
|
|
UINT8 type; /*0:TCP client, 1:TCP server, 2:UCP client*/
|
|
};
|
|
|
|
struct writeDataCtrl
|
|
{
|
|
UINT32 totalWriteLen;
|
|
UINT32 writeLen;
|
|
UINT32 transferLen;
|
|
UINT8 waitForWrite;
|
|
UINT8 ftpPutMode;
|
|
UINT8 socketID;
|
|
UINT8 ftpPutA;
|
|
UINT32 atHandle;
|
|
UINT32 lastDataTick;
|
|
UINT32 startPos;
|
|
CHAR fileName[FTP_MAX_STRING_LEN];
|
|
CHAR localName[FTP_MAX_STRING_LEN];
|
|
INT32 cnf;
|
|
};
|
|
|
|
struct channelAtp
|
|
{
|
|
UINT32 atp;
|
|
struct netSvcParam svc;
|
|
struct writeDataCtrl dataCtrl;
|
|
struct createDataCtrl createCtrl;
|
|
char writeBuf[ MAX_CHANNEL_SEND_BUF];
|
|
OSAMsgQRef msgQ;
|
|
OSAMutexRef lock;
|
|
UINT8 transMode;
|
|
UINT8 SocketId;
|
|
enum channelType type;
|
|
};
|
|
|
|
struct cmuxChannelController
|
|
{
|
|
struct channelAtp channel[MAX_CMUX_CHANNEL];
|
|
CHAR defaultApn[MAX_STRING_LEN];
|
|
UINT8 urc;
|
|
UINT8 configured;
|
|
};
|
|
|
|
struct serviceGrp
|
|
{
|
|
enum serviceID svcID;
|
|
OSAMsgQRef msgQRef;
|
|
UINT32 sAtp;
|
|
};
|
|
|
|
struct miApiMsg
|
|
{
|
|
UINT32 msgID;
|
|
void *pArgs;
|
|
UINT32 len;
|
|
};
|
|
|
|
struct miRequestArgs
|
|
{
|
|
UINT32 primID;
|
|
UINT32 requestHandle;
|
|
void *param;
|
|
};
|
|
|
|
struct TIGX_INFO
|
|
{
|
|
CHAR version[MAX_STRING_LEN];
|
|
CHAR module_info[MAX_STRING_LEN];
|
|
CHAR manufacture_id[MAX_STRING_LEN];
|
|
CHAR model[MAX_STRING_LEN];
|
|
CHAR firmwareVer[MAX_STRING_LEN];
|
|
CHAR firmwareDate[MAX_STRING_LEN];
|
|
CHAR hardwareVer[MAX_STRING_LEN];
|
|
CHAR hardwareDate[MAX_STRING_LEN];
|
|
};
|
|
|
|
struct miSSLCfgReq
|
|
{
|
|
UINT8 ssl_ctx_id;
|
|
UINT8 ssl_ctg_type;
|
|
INT32 value;
|
|
UINT8 path[MAX_STRING_LEN];
|
|
};
|
|
|
|
|
|
|
|
|
|
MiReturnCode setPdpUserReq(UINT32 atHandle, struct pdpSetParam *reqParas);
|
|
MiReturnCode setPdpApnReq(UINT32 atHandle, struct pdpSetParam *reqParas);
|
|
MiReturnCode setPdpAuthReq(UINT32 atHandle, struct pdpSetParam *reqParas);
|
|
MiReturnCode setPdpCfgtReq(UINT32 atHandle, struct pdpSetParam *reqParas);
|
|
MiReturnCode setPdpCfgpReq(UINT32 atHandle, struct pdpSetParam *reqParas);
|
|
MiReturnCode setPdpActReq(UINT32 atHandle, struct pdpActiveStateReq *reqParas);
|
|
MiReturnCode setNetIpfilterReq(UINT32 atHandle, struct netSetIpfilterReq *reqParas);
|
|
MiReturnCode setNetServiceReq(UINT32 atHandle, struct netSetServiceReq *reqParas);
|
|
MiReturnCode setNetOpenReq(UINT32 atHandle, struct netSetSocketOpenReq *reqParas);
|
|
MiReturnCode setNetDataReadReq(UINT32 atHandle, struct netSocketReadReq *reqParas);
|
|
MiReturnCode setNetWriteReq(UINT32 atHandle, struct netSocketWriteReq *reqParas);
|
|
MiReturnCode setNetCloseReq(UINT32 atHandle, struct netSocketCloseReq *reqParas);
|
|
MiReturnCode setNetAckReq(UINT32 atHandle, struct netSocketAckReq *reqParas);
|
|
MiReturnCode setNetAcceptReq(UINT32 atHandle, struct netSocketAcceptReq *reqParas);
|
|
MiReturnCode setNetCreateReq(UINT32 atHandle, struct netCreateReq *reqParas);
|
|
MiReturnCode setFtpOpenReq(UINT32 atHandle, struct ftpSetOpenReq *reqParas);
|
|
MiReturnCode setFtpCloseReq(UINT32 atHandle, void *reqParas);
|
|
MiReturnCode setFtpSizeReq(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpGetFileReq(UINT32 atHandle, struct ftpSetFileGetReq *reqParas);
|
|
MiReturnCode setFtpPutFileReq(UINT32 atHandle, struct ftpSetFilePutReq *reqParas);
|
|
#if 0
|
|
MiReturnCode setFtpPutFileDataReq(UINT32 atHandle, struct ftpSetFilePutDataReq *reqParas);
|
|
#endif
|
|
MiReturnCode getDialerNoParamReq(UINT32 atHandle, UINT32 primID);
|
|
MiReturnCode getNetNoParamReq(UINT32 atHandle, UINT32 primID);
|
|
MiReturnCode getFtpNoParamReq(UINT32 atHandle, UINT32 primID);
|
|
MiReturnCode setSysResetNoParamReq(UINT32 atHandle, UINT32 primID);
|
|
MiReturnCode getNetIpfilterReq(UINT32 atHandle, UINT32 primID);
|
|
MiReturnCode setAsrOpenReq(UINT32 atHandle, struct asrOpenReq *reqParas);
|
|
MiReturnCode setAsrCloseReq(UINT32 atHandle, struct netSocketCloseReq *reqParas);
|
|
MiReturnCode setAsrStateReq(UINT32 atHandle, struct asrStateReq *reqParas);
|
|
MiReturnCode setAsrSendReq(UINT32 atHandle, struct asrSocketSendReq *reqParas);
|
|
MiReturnCode setAsrQueryReadReq(UINT32 atHandle, struct netSocketReadReq *reqParas);
|
|
MiReturnCode setAsrDataReadReq(UINT32 atHandle, struct netSocketReadReq *reqParas);
|
|
MiReturnCode setAsrSendHexReq(UINT32 atHandle, struct asrSendHexReq *reqParas);
|
|
MiReturnCode setAsrSwTmdReq(UINT32 atHandle, struct asrSwTmdReq *reqParas);
|
|
MiReturnCode setSSLCfgReq(UINT32 atHandle, struct miSSLCfgReq *reqParas);
|
|
MiReturnCode getSSLCfgReq(UINT32 atHandle, struct miSSLCfgReq *reqParas);
|
|
void init_e20_config(void);
|
|
struct asrSetCfg * getAsrCfgReq(void);
|
|
MiReturnCode setAsrCfgReq(UINT8 type, int cfg_value,int retrans_value);
|
|
int setAsrEchoSendData(int echo_mode);
|
|
int getAsrEchoSendData(void);
|
|
|
|
|
|
UINT32 cmuxGetChannelIndex(UINT32 sAtpIndex);
|
|
UINT32 cmuxIsTransportAtpIndex(UINT32 sAtpIndex);
|
|
INT32 cmuxSetAtpIndex(UINT32 chanIndex, UINT32 sAtpIndex);
|
|
INT32 cmuxSetFtpAtpIndex(UINT32 chanIndex, UINT32 sAtpIndex);
|
|
INT32 cmuxSetFotaAtpIndex(UINT32 chanIndex, UINT32 sAtpIndex);
|
|
INT32 cmuxSetNetSvcParam(UINT32 chanIndex, struct netSetServiceReq *paras);
|
|
BOOL cmuxIsSocketBindChannel(UINT32 chanIndex, UINT8 socket);
|
|
INT32 cmuxSetDataCtrl(UINT32 chanIndex, UINT32 atHandle, UINT8 socketID, UINT32 totalLen, UINT8 ftpPutMode, struct ftpSetFilePutReq *putData);
|
|
INT32 cmuxSetNetAcceptCtrl(UINT32 chanIndex, struct netSocketAcceptCnf *paras);
|
|
INT32 processCmuxChannelData(UINT32 chanIndex, char *buf, INT32 len);
|
|
void initMsgQRef(UINT32 svcID,OSAMsgQRef msgQ);
|
|
void init_cmux_channelCtrl(void);
|
|
struct cmuxChannelController * get_cmux_channelCtrl(void);
|
|
INT32 cmuxSetMode(UINT32 chanIndex, UINT8 mode);
|
|
INT32 cmuxSetModeWithSocketID(UINT32 chanIndex, UINT8 mode,UINT8 socketId);
|
|
int get_ipsec_test_enable(void);
|
|
void set_ipsec_test_enable(int enable);
|
|
|
|
void *get_tigx_info(void);
|
|
void init_tigx_info(void);
|
|
void set_tigx_info(char type);
|
|
void get_order_key(char *dst);
|
|
char *get_tigx_key(void);
|
|
void set_my_sys_info_urc_sAtp(UINT32 urcValue , UINT32 sAtpIndex);
|
|
UINT32 get_my_sys_info_urc_sAtp(UINT32 sAtpIndex);
|
|
void sysinfourc_ind_reg_status(UINT8 status,UINT8 act,UINT16 NetworkCode);
|
|
void sysinfourc_ind_saved_reg_status(void);
|
|
void atcfun_reset_led(void);
|
|
void atcfun_reset_device(void);
|
|
|
|
void set_E20_error_num(int err);
|
|
int is_E20_module_type(void);
|
|
int get_E20_error_num(void);
|
|
|
|
//void cmux_set_data_to_control_mode(UINT32 xid);
|
|
void cmux_set_ftp_resp_timeout(UINT32 atHandle, UINT32 timeout);
|
|
|
|
BOOL cmuxIsNetDataTransMode(UINT32 sAtpIndex,char *buf, int len);
|
|
BOOL cmuxSwitchToCommandMode(CHAR *data, INT32 dataLen);
|
|
BOOL cmuxSetCommandMode(UINT32 chanIndex);
|
|
MiReturnCode setNetTransWriteDataReq(UINT32 chanIndex, struct netSocketWriteDataReq *reqParas);
|
|
MiReturnCode setNetTransWriteDataReq_directly2net(UINT8 SocketId, char *buf, int len);
|
|
MiReturnCode DetachCloseSocketReq(UINT32 reqHandle);
|
|
INT32 dialerReportNokToCmux(INT32 conNum);
|
|
INT32 dialerResponseToCmux(DialerResponseData *rsp);
|
|
MiReturnCode setNetWriteDataReq(UINT32 atHandle, struct netSocketWriteDataReq *reqParas);
|
|
void sendCmuxData(UINT32 sAtpIndex, char *data, UINT32 dataLen);
|
|
MiReturnCode setFotaReq(UINT32 atHandle, struct fotaSetOpenReq *reqParas);
|
|
#ifdef QUECTEL_MINIFOTA_SUPPORT
|
|
MiReturnCode quec_minisys_fota_req(UINT32 atHandle, struct fotaGetProCnf *reqParas, UINT32 msgId);
|
|
#endif
|
|
MiReturnCode setSocketLEDReq(UINT32 atHandle, struct setSocketLEDReq *reqParas);
|
|
UINT8 cmuxGetUrc(void);
|
|
MiReturnCode setNetUrcReq(UINT32 atHandle, struct netSetUrcReq *reqParas);
|
|
INT32 cmuxGetPdpStatus(UINT32 chanIndex, UINT8 *status);
|
|
#ifndef NO_EXTEND_MY_Q_AT
|
|
MiReturnCode getCtxConfigReq(UINT32 atHandle, UINT32 contextID);
|
|
MiReturnCode setCtxConfigReq(UINT32 atHandle, struct asrCtxConfigReq *reqParas);
|
|
#endif
|
|
MiReturnCode getFtpCfgReqA(UINT32 atHandle, UINT8 type);
|
|
MiReturnCode setFtpCfgReqA(UINT32 atHandle, struct ftpSetOpenReq *reqParas);
|
|
MiReturnCode setFtpOpenReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpCloseReqA(UINT32 atHandle);
|
|
MiReturnCode setFtpCwdReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpPwdReqA(UINT32 atHandle);
|
|
MiReturnCode setFtpGetFileReqA(UINT32 atHandle, struct ftpSetFileGetReq *reqParas);
|
|
MiReturnCode setFtpSizeReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpMkdirReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpDelReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpRmdirReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpMdtmReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpRenameReqA(UINT32 atHandle, struct ftpSetGenericReq *reqParas);
|
|
MiReturnCode setFtpListReqA(UINT32 atHandle, struct ftpSetListReq *reqParas);
|
|
MiReturnCode setFtpStatReqA(UINT32 atHandle);
|
|
MiReturnCode setFtpPutFileReqA(UINT32 atHandle, struct ftpSetGetPutReq *reqParas);
|
|
MiReturnCode setFtpLenReqA(UINT32 atHandle);
|
|
void HexStrToByte(const char *src, char *dst,int src_len);
|
|
INT32 cmuxClearDataCtrl(UINT32 chanIndex);
|
|
struct pdpIpInfo * cmuxGetPdpInfo(UINT32 chanIndex);
|
|
INT32 cmuxGetPdpIpStr(UINT32 chanIndex, CHAR *ip);
|
|
|
|
#endif
|