blob: 344903521fe3588ae5de75cff41e0310772412d1 [file] [log] [blame]
#include <stdint.h>
//gsw include
#define GSW_HAL_SUCCESS 0
#define GSW_HAL_FAIL -1
#define GSW_HAL_MEM_INVAILD -2
#define GSW_NW_OPERATION_NAME_LEN 128
#define GSW_NW_PLMN_LEN 6
#define GSW_NW_MCC_LEN 3
#define GSW_NW_MNC_LEN 3
#define GSW_NW_PARA_MAX_LEN 128
#define GSW_MCC_MAX_LEN 16
#define GSW_MNC_MAX_LEN 16
#define GSW_APN_CHANNEL_MAX 10
#define GSW_POXY_ADDR_MAX_LEN 64
#define GSW_PDP_TYPE_MAX_LEN 16
#define GSW_APN_MAX_LEN 65
#define GSW_APN_ID_MAX_LEN 32
#define GSW_APN_TYPE_MAX_LEN 50
#define GSW_USR_MAX_LEN 16
#define GSW_PWD_MAX_LEN 16
#define GSW_AUTH_TYPE_MAX_LEN 50
#define GSW_PROTOCO_MAX_LEN 64
#define GSW_CARRIER_ID_MAX_LEN 64
#define GSW_IFACE_NAME_MAX_LEN 50
#define GSW_PDP_ADDR_MAX_LEN 64
#define GSW_DNS_ADDR_MAX_LEN 64
#define GSW_GETWAYS_ADDR_MAX_LEN 64
#define GSW_RSP_MAX_LEN 256
typedef struct {
int handle; /**< data connection handle*/
int cid; /**< data connection cid*/
int state; /**< data connection state*/
int fail_cause; /**< data connection fail cause*/
char *type; /**< data connection type*/
char *ifname; /**< ifname*/
char *v4_ip; /**< ipv4 address*/
char *v4_pdns; /**< ipv4 pdns address*/
char *v4_sdns; /**< ipv4 sdns address*/
char *v4_gw; /**< ipv4 gateway address*/
char *v6_ip; /**< ipv6 address*/
char *v6_pdns; /**< ipv6 gateway address*/
char *v6_sdns; /**< ipv6 gateway address*/
}Wan_State_ind_s;
typedef struct {
char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address */
char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
char gw[GSW_GETWAYS_ADDR_MAX_LEN]; /**< gate way address*/
}V4_Addr_s;
typedef struct {
char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address*/
char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
}V6_Addr_s;
typedef struct {
int handle; /**< data connection handle*/
/* req info */
char mcc[GSW_MCC_MAX_LEN]; /**< apn mcc value*/
char mnc[GSW_MNC_MAX_LEN]; /**< apn mnc value*/
char apnid[GSW_APN_ID_MAX_LEN]; /**< apn id*/
char apn[GSW_APN_MAX_LEN]; /**< apn name*/
char apnType[GSW_APN_TYPE_MAX_LEN]; /**< apn type ipv4 ipv4v6 ipv6*/
char usr[GSW_USR_MAX_LEN]; /**< apn usr name*/
char pwd[GSW_PWD_MAX_LEN]; /**< apn password*/
char authType[GSW_AUTH_TYPE_MAX_LEN]; /**< apn auth type*/
char normalProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco*/
char roamingProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco roaming*/
char carrier[GSW_CARRIER_ID_MAX_LEN]; /**< carrier id*/
/* rsp */
int cid; /**< data connection cid for mdm sdk*/
int active; /**< pdn context active state: 2,actived; other,not active */
char ifname[GSW_IFACE_NAME_MAX_LEN]; /**< if name of current datalink */
int type; /**< data connection type*/
V4_Addr_s v4; /**< ipv4 addr*/
V6_Addr_s v6; /**< ipv6 addr*/
int mtu; /**< mtu value*/
char out[GSW_RSP_MAX_LEN]; /**< sdk return value*/
}Link_Info_s;
typedef struct
{
uint64_t tx_pkts; /* the number of packet sent*/
uint64_t tx_bytes; /* the number of packet sent bytes */
uint64_t tx_dropped_pkts; /* the number of packet dropped by sent*/
uint64_t rx_pkts; /* the number of packet received*/
uint64_t rx_bytes; /* the number of packet receivedbytes */
uint64_t rx_dropped_pkts; /* the number of packet dropped by received*/
}gsw_data_pkt_stats;
typedef void (*gsw_data_call_evt_cb_t)(Wan_State_ind_s *linkState);
/**
* @brief datacall sdk init
* @param [in] evt_cb callback function for data connection state change event
* call back;
* @retval 0: success
* @retval other: fail
*/
int gsw_data_call_init(gsw_data_call_evt_cb_t evt_cb);
/**
* @brief data_call sdk deinit
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_data_call_deinit(void);
/**
* @brief set apn parameters for data call
* @param [in/out] LinkInf apn info for pub or private datacall
* inlcude apn name mcc mnc, passwork apnid type cid etc
* @retval 0: success
* @retval other: fail
*/
int gsw_data_call_set_apn(Link_Info_s *LinkInf);
/**
* @brief set apn parameters for data call
* @param [in] linkid data connetion link number
* @param [in/out] LinkInf link info req: apn info for pub or private datacall
* inlcude apn name mcc mnc, passwork apnid etc
* resp: data call link state ipaddress type etc
* @retval 0: success
* @retval other: fail
*/
int gsw_data_call_connect(int linkid, Link_Info_s *LinkInf);
/**
* @brief set apn parameters for data call
* @param [in] linkid
* @param [in/out] LinkInf link info req: apn info for pub or private datacall
* inlcude apn name mcc mnc, passwork apnid etc
* resp: data call link state ipaddress type etc
* @retval 0: success
* @retval other: fail
*/
int gsw_data_call_disconnect(int linkid, Link_Info_s *LinkInf);
/*
* @brief get mobile operator name
@param [in] linkid apn id
@param [out] data_pkt obtian actual data call network card data traffic
@retval 0: success
@retval 0: other: fail
*/
int gsw_get_data_call_pkt_stats(int linkid, gsw_data_pkt_stats *data_pkt);