m2mb API docs  37.00.004.1
m2mb API sets documentation
m2mb_pdp.h File Reference

Header file for m2mb_pdp APIs. More...

Go to the source code of this file.

Data Structures

struct  M2MB_PDP_STATS_T
 

Typedefs

typedef HANDLE M2MB_PDP_HANDLE
 
typedef void(* m2mb_pdp_ind_callback) (M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
 

Enumerations

enum  M2MB_PDP_IP_TYPE_E { M2MB_PDP_IPV4, M2MB_PDP_IPV6, M2MB_PDP_IPV4V6 }
 
enum  M2MB_PDP_TYPE_E { M2MB_PDP_TYPE_IPV4, M2MB_PDP_TYPE_PPP, M2MB_PDP_TYPE_IPV6, M2MB_PDP_TYPE_IPV4V6 }
 
enum  M2MB_PDP_AUTHTYPE_E { M2MB_PDP_AUTHTYPE_NOAUTH, M2MB_PDP_AUTHTYPE_PAP, M2MB_PDP_AUTHTYPE_CHAP }
 
enum  M2MB_PDP_IND_E { M2MB_PDP_UP, M2MB_PDP_DOWN }
 
enum  M2MB_PDP_DATAVOL_ACTION_E { M2MB_PDP_DATAVOL_RESET = 0, M2MB_PDP_DATAVOL_GET_SESSION = 1, M2MB_PDP_DATAVOL_GET_LIFE = 2 }
 
enum  M2MB_PDP_STATS_ACTION_E { M2MB_PDP_STATS_RESET, M2MB_PDP_STATS_GET_SESSION, M2MB_PDP_STATS_GET_LIFE }
 

Functions

M2MB_RESULT_E m2mb_pdp_init (M2MB_PDP_HANDLE *h, m2mb_pdp_ind_callback callback, void *userdata)
 m2mb_pdp_init initializes PDP service for current client. More...
 
M2MB_RESULT_E m2mb_pdp_deinit (M2MB_PDP_HANDLE h)
 m2mb_pdp_deinit deinitializes PDP service for current client. More...
 
M2MB_RESULT_E m2mb_pdp_activate (M2MB_PDP_HANDLE h, UINT8 cid, CHAR *APN, CHAR *user, CHAR *password, M2MB_PDP_IP_TYPE_E pdpIPver)
 m2mb_pdp_activate activates PDP context(or PDN connection) More...
 
M2MB_RESULT_E m2mb_pdp_deactivate (M2MB_PDP_HANDLE h, UINT8 cid)
 m2mb_pdp_deactivate deactivates PDP context(or PDN connection) More...
 
M2MB_RESULT_E m2mb_pdp_get_my_ip (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_IP_TYPE_E pdpIPver, void *addr)
 m2mb_pdp_get_my_ip permits to get IP address More...
 
M2MB_RESULT_E m2mb_pdp_get_DNS (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_IP_TYPE_E pdpIPver, void *pDNS, void *sDNS)
 permits to get address of the DNS More...
 
M2MB_RESULT_E m2mb_pdp_get_status (M2MB_PDP_HANDLE h, UINT8 cid, UINT8 *p_status)
 permits to get PDP context(or PDN connection) status More...
 
M2MB_RESULT_E m2mb_pdp_APN_set (M2MB_PDP_HANDLE h, UINT8 cid, CHAR *APN)
 permits to set APN More...
 
M2MB_RESULT_E m2mb_pdp_APN_get (M2MB_PDP_HANDLE h, UINT8 cid, CHAR *APN, UINT8 len)
 permits to get APN More...
 
M2MB_RESULT_E m2mb_pdp_apnclass2cid (M2MB_PDP_HANDLE h, UINT8 apnclass, UINT8 *p_cid)
 permits to get cid related to specific APN class More...
 
M2MB_RESULT_E m2mb_pdp_type_get (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_TYPE_E *pdp_type)
 permits to get PDP Type More...
 
M2MB_RESULT_E m2mb_pdp_type_set (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_TYPE_E pdp_type)
 permits to set PDP Type More...
 
M2MB_RESULT_E m2mb_pdp_profile_name_get (M2MB_PDP_HANDLE h, UINT8 cid, CHAR *profname, UINT8 len)
 permits to get Profile Name More...
 
M2MB_RESULT_E m2mb_pdp_profile_name_set (M2MB_PDP_HANDLE h, UINT8 cid, CHAR *profname)
 permits to set Profile Name More...
 
M2MB_RESULT_E m2mb_pdp_authtype_get (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_AUTHTYPE_E *pdp_authtype)
 permits to get AUTH Type More...
 
M2MB_RESULT_E m2mb_pdp_authtype_set (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_AUTHTYPE_E pdp_authtype)
 permits to set AUTH Type More...
 
M2MB_RESULT_E m2mb_pdp_datavol_get (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_DATAVOL_ACTION_E datavol_action, UINT32 *tx, UINT32 *rx)
 allows to get data traffic statistics (in bytes) on a given PDP More...
 
M2MB_RESULT_E m2mb_pdp_stats (M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_STATS_ACTION_E stats_action, M2MB_PDP_STATS_T *stats)
 allows to get bytes and packets statistics (in bytes) on a given PDP More...
 
M2MB_RESULT_E m2mb_pdp_default_cid_get (M2MB_PDP_HANDLE h, UINT8 *cid)
 function used to get the dfefault PDP context number More...
 

Detailed Description

Header file for m2mb_pdp APIs.

m2m/m2m_common/m2mb_inc/m2mb_pdp.h

m2m_pdp API actions and related parameters

@notes Dependencies:

Author
Andrea Pirnetti
Date
01/03/2017

Enumeration Type Documentation

◆ M2MB_PDP_STATS_ACTION_E

Enumerator
M2MB_PDP_STATS_RESET 

Reset stats counter

M2MB_PDP_STATS_GET_SESSION 

Get session stats

M2MB_PDP_STATS_GET_LIFE 

Get life stats

Function Documentation

◆ m2mb_pdp_activate()

M2MB_RESULT_E m2mb_pdp_activate ( M2MB_PDP_HANDLE  h,
UINT8  cid,
CHAR *  APN,
CHAR *  user,
CHAR *  password,
M2MB_PDP_IP_TYPE_E  pdpIPver 
)

m2mb_pdp_activate activates PDP context(or PDN connection)

m2mb_pdp_activate permits to activate PDP context(or PDN connection) for a specific cid

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]APNaccess point name
[in]userusername if required by the APN
[in]passwordpassword if required by the APN
[in]pdpIPverpdp IP version(M2MB_PDP_IPV4V6 or M2MB_PDP_IPV6 or M2MB_PDP_IPV4)
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_activate will not work

m2mb_pdp_activate(h,cid,apn,user,password,pdpIPver);

void mycallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
{
//............
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_PDP_HANDLE hndl;
struct myStruct myUserdata;
retVal = m2mb_pdp_init(&hndl, myCallback, (void*)myUserdata);
retVal = m2mb_pdp_activate(hndl,3,"testAPN","","",M2MB_PDP_IPV4); //activates cid 3 with APN "testAPN" and IP type IPV4
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_pdp_activate succeeded");
}

◆ m2mb_pdp_APN_get()

M2MB_RESULT_E m2mb_pdp_APN_get ( M2MB_PDP_HANDLE  h,
UINT8  cid,
CHAR *  APN,
UINT8  len 
)

permits to get APN

permits to get APN for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]APNbuffer to retrieve APN
[in]lenAPN buffer length
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_APN_get will not work

m2mb_pdp_APN_get(h,cid,apn,len);

◆ m2mb_pdp_APN_set()

M2MB_RESULT_E m2mb_pdp_APN_set ( M2MB_PDP_HANDLE  h,
UINT8  cid,
CHAR *  APN 
)

permits to set APN

permits to set APN for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]APNaccess point name
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_APN_set will not work

m2mb_pdp_APN_set(h,cid,apn);

◆ m2mb_pdp_apnclass2cid()

M2MB_RESULT_E m2mb_pdp_apnclass2cid ( M2MB_PDP_HANDLE  h,
UINT8  apnclass,
UINT8 *  p_cid 
)

permits to get cid related to specific APN class

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]apnclassapnclass to be given to get corresponding cid
[out]p_cidpointer to cid to be retrieved
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_apnclass2cid(h,apnclass,&cid);

◆ m2mb_pdp_authtype_get()

M2MB_RESULT_E m2mb_pdp_authtype_get ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_AUTHTYPE_E *  pdp_authtype 
)

permits to get AUTH Type

permits to get AUTH Type for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdp_authtypeto retrieve AUTH Type
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_authtype_get will not work

m2mb_pdp_authtype_get(h,cid,pdp_authtype);

◆ m2mb_pdp_authtype_set()

M2MB_RESULT_E m2mb_pdp_authtype_set ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_AUTHTYPE_E  pdp_authtype 
)

permits to set AUTH Type

permits to set AUTH Type for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdp_authtypeto set AUTH Type
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_authtype_set will not work

m2mb_pdp_authtype_set(h,cid,pdp_authtype);

◆ m2mb_pdp_datavol_get()

M2MB_RESULT_E m2mb_pdp_datavol_get ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_DATAVOL_ACTION_E  datavol_action,
UINT32 *  tx,
UINT32 *  rx 
)

allows to get data traffic statistics (in bytes) on a given PDP

allows to get data traffic statistics (in bytes) on a given PDP

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidPDP context identifier (value of 0 with action RESET, resets all counters).
[in]datavol_actionto set the action (RESET / GET current session counters / GET life counters).
[out]txpointer to retreive sent bytes statistics
[out]rxpointer to retreive received bytes statistics
Returns
returns M2MB_RESULT_SUCCESS on success, M2MB_RESULT_FAIL on error.
Note
if not supported by the platform it returns M2MB_RESULT_FAIL

m2mb_pdp_datavol_get(h,cid,datavol_action,tx,rx);

◆ m2mb_pdp_deactivate()

M2MB_RESULT_E m2mb_pdp_deactivate ( M2MB_PDP_HANDLE  h,
UINT8  cid 
)

m2mb_pdp_deactivate deactivates PDP context(or PDN connection)

m2mb_pdp_deactivate permits to deactivate PDP context(or PDN connection) for a specific cid

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_deactivate(h,cid);

◆ m2mb_pdp_default_cid_get()

M2MB_RESULT_E m2mb_pdp_default_cid_get ( M2MB_PDP_HANDLE  h,
UINT8 *  cid 
)

function used to get the dfefault PDP context number

the functions allows to get the default PDP context number based on the customization variant of the module

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[out]cidpointer to PDP context identifier.
Returns
returns M2MB_RESULT_SUCCESS on success, M2MB_RESULT_FAIL on error.
Note

m2mb_pdp_default_cid_get(h,cid);

◆ m2mb_pdp_deinit()

M2MB_RESULT_E m2mb_pdp_deinit ( M2MB_PDP_HANDLE  h)

m2mb_pdp_deinit deinitializes PDP service for current client.

m2mb_pdp_deinit deinitialize PDP service for current client freeing the handle passed as first parameter. Calling the m2mb_pdp_deinit is useful after using the PDP service in order to free memory space.

Parameters
[in]hparameter is the handle to the PDP service, that will be deinitialized by the function.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_deinit(h);

M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_PDP_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_pdp_init(&h, myCallback, (void*)myUserdata);
//... use PDP APIs ...
retVal = m2mb_pdp_deinit(h);
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_pdp_deinit succeeded");

◆ m2mb_pdp_get_DNS()

M2MB_RESULT_E m2mb_pdp_get_DNS ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_IP_TYPE_E  pdpIPver,
void *  pDNS,
void *  sDNS 
)

permits to get address of the DNS

permits to get IPV4 primary and secondary DNS or IPv6 primary and secondary DNS, for a specific cid

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdpIPverIP version(M2MB_PDP_IPV4 or M2MB_PDP_IPV6)
[out]pDNSpointer to IP address struct of the primary DNS to be filled in: in case of IPV4 address struct has to be M2MB_SOCKET_BSD_IN_ADDR, in case of IPv6 address struct has to be M2MB_SOCKET_BSD_IPV6_ADDR
[out]sDNSpointer to IP address struct of the secondary DNS to be filled in: in case of IPV4 address struct has to be M2MB_SOCKET_BSD_IN_ADDR, in case of IPv6 address struct has to be M2MB_SOCKET_BSD_IPV6_ADDR
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_get_DNS(h,cid,pDNS,sDNS);

◆ m2mb_pdp_get_my_ip()

M2MB_RESULT_E m2mb_pdp_get_my_ip ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_IP_TYPE_E  pdpIPver,
void *  addr 
)

m2mb_pdp_get_my_ip permits to get IP address

m2mb_pdp_get_my_ip permits to get IP address obtained at PDP(or PDN) context activation for a specific cid

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdpIPverIP version(M2MB_PDP_IPV4 or M2MB_PDP_IPV6)
[out]addrpointer to IP address struct to be filled in: in case of IPV4 address struct has to be M2MB_SOCKET_BSD_IN_ADDR, in case of IPv6 address struct has to be M2MB_SOCKET_BSD_IPV6_ADDR
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: cannot be called directly inside callback loaded with m2mb_pdp_init

m2mb_pdp_get_my_ip(h,cid,pdpIPver,addr);

ret = m2mb_pdp_get_my_ip(hndl,cid,M2MB_PDP_IPV4,&addrv4);
// ..........
ret = m2mb_pdp_get_my_ip(hndl,cid,M2MB_PDP_IPV6,&addrv6);
// ..........

◆ m2mb_pdp_get_status()

M2MB_RESULT_E m2mb_pdp_get_status ( M2MB_PDP_HANDLE  h,
UINT8  cid,
UINT8 *  p_status 
)

permits to get PDP context(or PDN connection) status

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[out]pointerto PDP(or PDN) connection status for specific cid status 0: PDP inactive status 1: PDP active
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_get_status(h,cid,&status);

◆ m2mb_pdp_init()

M2MB_RESULT_E m2mb_pdp_init ( M2MB_PDP_HANDLE *  h,
m2mb_pdp_ind_callback  callback,
void *  userdata 
)

m2mb_pdp_init initializes PDP service for current client.

m2mb_pdp_init initialize PDP service for current client returning the handle that must be passed as first parameter for all PDP actions. Calling the m2mb_pdp_init is mandatory before using the PDP service.

Parameters
[in]*hhandle to the PDP service, that will be initialized by the function.
[in]callbackcallback that will be called if an event or a response happens.
[in]userdatapointer to generic user data that will be returned as it is in the callback.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_pdp_init(&h, myCallback, myUserdata);

void mycallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
{
//my code
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_PDP_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_pdp_init(&h, myCallback, (void*)myUserdata);
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_pdp_init succeeded");
}

◆ m2mb_pdp_profile_name_get()

M2MB_RESULT_E m2mb_pdp_profile_name_get ( M2MB_PDP_HANDLE  h,
UINT8  cid,
CHAR *  profname,
UINT8  len 
)

permits to get Profile Name

permits to get Profile Name for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]profnamebuffer to retrieve Profile Name
[in]lenProfile Name buffer length
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
if profile with the same cid is deleted with +CGDCONT m2mb_pdp_profile_name_get will not work
if not supported by the platform it returns M2MB_RESULT_FAIL

m2mb_pdp_profile_name_get(h, cid, profname, len);

◆ m2mb_pdp_profile_name_set()

M2MB_RESULT_E m2mb_pdp_profile_name_set ( M2MB_PDP_HANDLE  h,
UINT8  cid,
CHAR *  profname 
)

permits to set Profile Name

permits to set Profile Name for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]profnamebuffer to set Profile Name
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
if profile with the same cid is deleted with +CGDCONT m2mb_pdp_profile_name_set will not work
if not supported by the platform it returns M2MB_RESULT_FAIL

m2mb_pdp_profile_name_set(h, cid, profname);

◆ m2mb_pdp_stats()

M2MB_RESULT_E m2mb_pdp_stats ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_STATS_ACTION_E  stats_action,
M2MB_PDP_STATS_T stats 
)

allows to get bytes and packets statistics (in bytes) on a given PDP

allows to get bytes and packets statistics (in bytes) on a given PDP

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidPDP context identifier.
[in]stats_actionto set the action.
[out]statspointer to retrieve bytes and packets statistics.
Returns
returns M2MB_RESULT_SUCCESS on success, M2MB_RESULT_FAIL on error.
Note

m2mb_pdp_stats(h,cid,datavol_action,stats);

◆ m2mb_pdp_type_get()

M2MB_RESULT_E m2mb_pdp_type_get ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_TYPE_E *  pdp_type 
)

permits to get PDP Type

permits to get PDP Type for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdp_typeto retrieve pdp IP Type
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_type_get will not work

m2mb_pdp_type_get(h,cid,&pdp_type);

◆ m2mb_pdp_type_set()

M2MB_RESULT_E m2mb_pdp_type_set ( M2MB_PDP_HANDLE  h,
UINT8  cid,
M2MB_PDP_TYPE_E  pdp_type 
)

permits to set PDP Type

permits to set PDP Type for specific context identifier

Parameters
[in]hhandle to the PDP service, previously initialized by the m2mb_pdp_init function.
[in]cidcontext identifier
[in]pdp_typeto set pdp IP Type
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
: if profile with the same cid is deleted with +CGDCONT m2mb_pdp_type_set will not work

m2mb_pdp_type_set(h,cid,pdp_type);

m2mb_pdp_deinit
M2MB_RESULT_E m2mb_pdp_deinit(M2MB_PDP_HANDLE h)
m2mb_pdp_deinit deinitializes PDP service for current client.
M2MB_SOCKET_BSD_IPV6_ADDR
Definition: m2mb_socket.h:225
M2MB_SOCKET_BSD_IN_ADDR
Definition: m2mb_socket.h:205
m2mb_pdp_get_my_ip
M2MB_RESULT_E m2mb_pdp_get_my_ip(M2MB_PDP_HANDLE h, UINT8 cid, M2MB_PDP_IP_TYPE_E pdpIPver, void *addr)
m2mb_pdp_get_my_ip permits to get IP address
m2mb_pdp_init
M2MB_RESULT_E m2mb_pdp_init(M2MB_PDP_HANDLE *h, m2mb_pdp_ind_callback callback, void *userdata)
m2mb_pdp_init initializes PDP service for current client.
m2mb_pdp_activate
M2MB_RESULT_E m2mb_pdp_activate(M2MB_PDP_HANDLE h, UINT8 cid, CHAR *APN, CHAR *user, CHAR *password, M2MB_PDP_IP_TYPE_E pdpIPver)
m2mb_pdp_activate activates PDP context(or PDN connection)