PGClient
Payment Gateway Client Library
PgcClient.h File Reference

Go to the source code of this file.

Macros

MacrosSec

Macros section

#define PGC_HAS_ERR(nErr)   ((nErr) < PGC_ERR_NONE_MARKER)
 
#define PGC_IS_ASYNC(nErr)   ((nErr) == PGC_ERR_NONE_ASYNC)
 
#define PGC_ISVALID_CONN(nConn)   ((nConn) > 0)
 
#define PGC_ISVALID_SESS(nSess)   ((nSess) > 0)
 
FuncDecoSec

Function decorators section

#define PGC_DECL_EXPORT   __attribute__ ((visibility("default")))
 Export function decorator.
 
#define PGC_DECL_IMPORT
 Import function decorator.
 
#define PGC_API_EXPORT   PGC_DECL_IMPORT
 API export function decorator.
 
#define PGC_API_ENTRY
 API entry function decorator.
 

Functions

FuncInitSec

Init functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcInit (const char *sMduName)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcUninit (const char *sMduName)
 
FuncInfoSec

Info functions section

PGC_API_EXPORT const char *PGC_API_ENTRY PgcGetVer ()
 
PGC_API_EXPORT void PGC_API_ENTRY PgcGetErrTag (int nErrCode, char *sErrTag)
 
PGC_API_EXPORT void PGC_API_ENTRY PgcLogInfo (const char *sFmt, const char *sArg1, const char *sArg2, const char *sArg3)
 
PGC_API_EXPORT void PGC_API_ENTRY PgcLogErr (const char *sFmt, const char *sArg1, const char *sArg2, const char *sArg3)
 
FuncConnSec

Connection functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcNewConn (const char *sUrl, const char *sUName, const char *sPwd, int nTimeout, const char *sMduName, const char *sCfgPath)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcFreeConn (int nConn)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsSyncMode (int nConn)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetConnOpt (int nConn, const char *sKey, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetConnSts (int nConn, const char *sKey, char *sVal, int nSize)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetConnProp (int nConn, const char *sSec, const char *sKey, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetConnProp (int nConn, const char *sSec, const char *sKey, const char *sDefVal, char *sVal, int nSize)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcConnect (int nConn)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcDisconnect (int nConn)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsConnected (int nConn)
 
FuncSessSec

Session functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcNewSess (int nConn, int nMsgCnt)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcFreeSess (int nSess)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsRecvEnd (int nSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetSessOpt (int nSess, const char *sKey, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetSessSts (int nSess, const char *sKey, char *sVal, int nSize)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetConn (int nSess, int nConn)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetConn (int nSess)
 
FuncMsgBlockSec

Message block functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgCnt (int nSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetMsgData (int nSess, bool bIsRaw, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgData (int nSess, bool bIsRaw, char *sVal, int nSize)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsRawMsg (int nSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetMsgPrm (int nSess, const char *sKey, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgPrm (int nSess, const char *sKey, char *sVal, int nSize)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcNewMsg (int nSess)
 
FuncMsgSec

Message functions section

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsSet (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcUnset (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsEmpty (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetType (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetStr (int nSess, int nMsg, const char *sKey, const char *sVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetStr (int nSess, int nMsg, const char *sKey, char *sVal, int nSize)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetAmt (int nSess, int nMsg, const char *sKey, long nVal)
 
PGC_API_EXPORT long PGC_API_ENTRY PgcGetAmt (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetInt (int nSess, int nMsg, const char *sKey, int nVal)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetInt (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetNum (int nSess, int nMsg, const char *sKey, double nVal)
 
PGC_API_EXPORT double PGC_API_ENTRY PgcGetNum (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetBool (int nSess, int nMsg, const char *sKey, bool bVal)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcGetBool (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetDate (int nSess, int nMsg, const char *sKey, double dVal)
 
PGC_API_EXPORT double PGC_API_ENTRY PgcGetDate (int nSess, int nMsg, const char *sKey)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetChildMsg (int nSess, int nMsg, const char *sKey, int nChildMsgSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcGetChildMsg (int nSess, int nMsg, const char *sKey)
 
FuncReqSec

Request functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcRequest (int nSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSend (int nSess)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcPerform (int nSess)
 
FuncHeedSec

Heed functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcHeed (int nConn)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcUnheed (int nConn)
 
PGC_API_EXPORT bool PGC_API_ENTRY PgcIsHeeding (int nConn)
 
PGC_API_EXPORT int PGC_API_ENTRY PgcPoll (int nConn, int nTimeout)
 
FuncCfmSec

Confirm functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcConfirm (int nSess)
 
FuncTxnSec

Transaction functions section

PGC_API_EXPORT int PGC_API_ENTRY PgcDoTxn (const char *sUrl, const char *sReq, char *sRsp, int nRspSize)
 

ConstsSec

Constants section

#define PGC_API_VERSION   "1.66.170810"
 Version.
 
enum  PgcErrs {
  PGC_ERR_NONE = 0, PGC_ERR_NONE_ASYNC = -1, PGC_ERR_NONE_FIRST = -11, PGC_ERR_NONE_LAST = -12,
  PGC_ERR_NONE_MARKER = -100, PGC_ERR_NOTSUPPORTED = -101, PGC_ERR_PARAM_INVALID = -111, PGC_ERR_SVC_NOTFOUND = -121,
  PGC_ERR_SVC_REGISTERFAILED = -122, PGC_ERR_CONN_NOTFOUND = -201, PGC_ERR_CONN_INITFAILED = -202, PGC_ERR_CONN_OPTNOTFOUND = -203,
  PGC_ERR_CONN_ALREADYCONNECTED = -211, PGC_ERR_CONN_ALREADYDISCONNECTED = -212, PGC_ERR_CONN_NOTCONNECTED = -213, PGC_ERR_CONN_CBKNOTREGISTERED = -221,
  PGC_ERR_CONN_ALREADYLISTENING = -231, PGC_ERR_CONN_NOTLISTENING = -232, PGC_ERR_SESS_NOTFOUND = -301, PGC_ERR_SESS_INITFAILED = -302,
  PGC_ERR_SESS_MSGCNTINVALID = -311, PGC_ERR_SESS_MSGCNTALREADYSET = -312, PGC_ERR_SESS_NOTSOURCE = -321, PGC_ERR_MSG_NOTFOUND = -401,
  PGC_ERR_MSG_IDXOUTOFBOUND = -402, PGC_ERR_MSG_FIELDNOTFOUND = -403, PGC_ERR_MSG_OBJINVALID = -404, PGC_ERR_MSG_SIZEINVALID = -405,
  PGC_ERR_MSG_KEYINVALID = -406, PGC_ERR_MSG_WRITEFAILED = -411, PGC_ERR_NET_URLINVALID = -501, PGC_ERR_NET_REFINVALID = -502,
  PGC_ERR_NET_INITFAILED = -503, PGC_ERR_NET_INFONOTFOUND = -504, PGC_ERR_NET_STSNOTFOUND = -505, PGC_ERR_NET_CONNECTFAILED = -511,
  PGC_ERR_NET_HANDSHAKEFAILED = -512, PGC_ERR_NET_DISCONNECTFAILED = -513, PGC_ERR_NET_SENDFAILED = -521, PGC_ERR_NET_RECVFAILED = -522,
  PGC_ERR_NET_FLUSHFAILED = -523, PGC_ERR_NET_PERFORMFAILED = -524, PGC_ERR_NET_TIMEDOUT = -531, PGC_ERR_NET_LISTENFAILED = -541,
  PGC_ERR_NET_UNLISTENFAILED = -542, PGC_ERR_NET_CLOSED = -551, PGC_ERR_EXT_IDINVALID = -10101, PGC_ERR_EXT_KEYINVALID = -10102,
  PGC_ERR_EXT_PWDINVALID = -10103, PGC_ERR_EXT_IDNOTFOUND = -10201, PGC_ERR_EXT_KEYNOTFOUND = -10202, PGC_ERR_EXT_IDXOUTOFBOUND = -10304,
  PGC_ERR_EXT_PWDNOTMATCHED = -10403
}
 Error codes. More...
 
enum  PgcTypes {
  PGC_TYPE_NULL = 0, PGC_TYPE_STR = 101, PGC_TYPE_NUM = 102, PGC_TYPE_BOOL = 103,
  PGC_TYPE_DATE = 111, PGC_TYPE_INT = 121, PGC_TYPE_AMT = 122, PGC_TYPE_OBJ = 201,
  PGC_TYPE_ARR = 202
}
 Data types. More...
 
enum  PgcTimeoInds {
  PGC_TIMEO_DEF = 0, PGC_TIMEO_API = -101, PGC_TIMEO_API_LL = -102, PGC_TIMEO_TXN = -111,
  PGC_TIMEO_TXN_UI = -113, PGC_TIMEO_BATCH = -121, PGC_TIMEO_MSG = -131, PGC_TIMEO_MSG_LL = -132,
  PGC_TIMEO_FILE = -141
}
 Timeout Indicators (used in the nTimeout field in NewConn function) More...
 
enum  PgcMsgOpTgts { PGC_MSGOP_REGULAR = 1, PGC_MSGOP_SESSDEF = -101 }
 Message operation targets (used in the nMsgCnt field in NewSess function) More...
 

FuncCbkSec

Callback functions section

typedef int nConn
 
typedef int int nSess
 
typedef int (PGC_API_ENTRY PGC_EVTCBK_FUNC)(void *pRef
 Event callback function. More...
 
PGC_API_EXPORT int PGC_API_ENTRY PgcSetCbk (int nConn, PGC_EVTCBK_FUNC *pfnEvtCbk, void *pEvtCbkRef)
 Set callback. More...
 

Detailed Description

Payment Gateway Client Header
Strings are all in UTF-8 encoding
Schemes and supported actions
WSS (Async): Request, Confirm, Send
WSS (Sync): Request
HTTPS (Sync): Request

Macro Definition Documentation

§ PGC_HAS_ERR

#define PGC_HAS_ERR (   nErr)    ((nErr) < PGC_ERR_NONE_MARKER)

Check if the error code contains an error

Parameters
[in]nErrError code
Returns
True if it contains an error

§ PGC_IS_ASYNC

#define PGC_IS_ASYNC (   nErr)    ((nErr) == PGC_ERR_NONE_ASYNC)

Check if the error code is async

Parameters
[in]nErrError code
Returns
True if it is async code

§ PGC_ISVALID_CONN

#define PGC_ISVALID_CONN (   nConn)    ((nConn) > 0)

Check if the connection value is valid

Parameters
[in]nConnConnection
Returns
True if the connection is valid

§ PGC_ISVALID_SESS

#define PGC_ISVALID_SESS (   nSess)    ((nSess) > 0)

Check if the session value is valid

Parameters
[in]nSessSession
Returns
True if the session is valid

Enumeration Type Documentation

§ PgcErrs

enum PgcErrs

Error codes.

Enumerator
PGC_ERR_NONE 

No error.

PGC_ERR_NONE_ASYNC 

No error, async.

PGC_ERR_NONE_FIRST 

No error, first.

PGC_ERR_NONE_LAST 

No error, last.

PGC_ERR_NONE_MARKER 

No error, marker.

PGC_ERR_NOTSUPPORTED 

Not supported.

PGC_ERR_PARAM_INVALID 

Parameter invalid.

PGC_ERR_SVC_NOTFOUND 

Service not found.

PGC_ERR_SVC_REGISTERFAILED 

Register-service failed.

PGC_ERR_CONN_NOTFOUND 

Connection not found.

PGC_ERR_CONN_INITFAILED 

Connection-initialize failed.

PGC_ERR_CONN_OPTNOTFOUND 

Connection option not found.

PGC_ERR_CONN_ALREADYCONNECTED 

Connection already connected.

PGC_ERR_CONN_ALREADYDISCONNECTED 

Connection already disconnected.

PGC_ERR_CONN_NOTCONNECTED 

Connection not connected.

PGC_ERR_CONN_CBKNOTREGISTERED 

Connection callback not registered.

PGC_ERR_CONN_ALREADYLISTENING 

Connection already listening.

PGC_ERR_CONN_NOTLISTENING 

Connection not listening.

PGC_ERR_SESS_NOTFOUND 

Session not found.

PGC_ERR_SESS_INITFAILED 

Session-initialize failed.

PGC_ERR_SESS_MSGCNTINVALID 

Session message count invalid.

PGC_ERR_SESS_MSGCNTALREADYSET 

Session message count already set.

PGC_ERR_SESS_NOTSOURCE 

Session not in source state.

PGC_ERR_MSG_NOTFOUND 

Message not found.

PGC_ERR_MSG_IDXOUTOFBOUND 

Message index out of bound.

PGC_ERR_MSG_FIELDNOTFOUND 

Message field not found.

PGC_ERR_MSG_OBJINVALID 

Message object invalid.

PGC_ERR_MSG_SIZEINVALID 

Message size invalid.

PGC_ERR_MSG_KEYINVALID 

Message key invalid.

PGC_ERR_MSG_WRITEFAILED 

Write-message failed.

PGC_ERR_NET_URLINVALID 

Network URL invalid.

PGC_ERR_NET_REFINVALID 

Network reference invalid.

PGC_ERR_NET_INITFAILED 

Initialize-network failed.

PGC_ERR_NET_INFONOTFOUND 

Network info not found.

PGC_ERR_NET_STSNOTFOUND 

Network status/statistics not found.

PGC_ERR_NET_CONNECTFAILED 

Network-connect failed.

PGC_ERR_NET_HANDSHAKEFAILED 

Network-handshake failed.

PGC_ERR_NET_DISCONNECTFAILED 

Network-disconnect failed.

PGC_ERR_NET_SENDFAILED 

Network-send failed.

PGC_ERR_NET_RECVFAILED 

Network-receive failed.

PGC_ERR_NET_FLUSHFAILED 

Network-flush failed.

PGC_ERR_NET_PERFORMFAILED 

Network-perform failed.

PGC_ERR_NET_TIMEDOUT 

Network timed out.

PGC_ERR_NET_LISTENFAILED 

Network-listen failed.

PGC_ERR_NET_UNLISTENFAILED 

Network-unlisten failed.

PGC_ERR_NET_CLOSED 

Network-closed.

PGC_ERR_EXT_IDINVALID 

Ext: ID invalid.

PGC_ERR_EXT_KEYINVALID 

Ext: Key invalid.

PGC_ERR_EXT_PWDINVALID 

Ext: password invalid.

PGC_ERR_EXT_IDNOTFOUND 

Ext: ID not found.

PGC_ERR_EXT_KEYNOTFOUND 

Ext: Key not found.

PGC_ERR_EXT_IDXOUTOFBOUND 

Ext: index out of bound.

PGC_ERR_EXT_PWDNOTMATCHED 

Ext: password not matched.

§ PgcTypes

enum PgcTypes

Data types.

Enumerator
PGC_TYPE_NULL 

Null; Unknown.

PGC_TYPE_STR 

String.

PGC_TYPE_NUM 

Number.

PGC_TYPE_BOOL 

Boolean.

PGC_TYPE_DATE 

Date/time.

PGC_TYPE_INT 

Integer.

PGC_TYPE_AMT 

Amount.

PGC_TYPE_OBJ 

Object.

PGC_TYPE_ARR 

Array.

§ PgcTimeoInds

Timeout Indicators (used in the nTimeout field in NewConn function)

Enumerator
PGC_TIMEO_DEF 

Default.

PGC_TIMEO_API 

API: 5 secs.

PGC_TIMEO_API_LL 

API with low latency: 2 secs.

PGC_TIMEO_TXN 

Transaction: 10 secs.

PGC_TIMEO_TXN_UI 

Transaction with UI: 2 mins.

PGC_TIMEO_BATCH 

Batch: 5 mins.

PGC_TIMEO_MSG 

Message: 15 secs.

PGC_TIMEO_MSG_LL 

Message with low latency: 5 secs.

PGC_TIMEO_FILE 

File: 2 hrs.

§ PgcMsgOpTgts

Message operation targets (used in the nMsgCnt field in NewSess function)

Enumerator
PGC_MSGOP_REGULAR 

Regular message.

PGC_MSGOP_SESSDEF 

Session default message.

Function Documentation

§ PgcInit()

PGC_API_EXPORT int PGC_API_ENTRY PgcInit ( const char *  sMduName)

Initialize It has to be called in the main thread

Parameters
[in]sMduNameModule name
Returns
Error code

§ PgcUninit()

PGC_API_EXPORT int PGC_API_ENTRY PgcUninit ( const char *  sMduName)

Uninitialize

Parameters
[in]sMduNameModule name
Returns
Error code

§ PgcGetVer()

PGC_API_EXPORT const char* PGC_API_ENTRY PgcGetVer ( )

Get version

Returns
Version string

§ PgcGetErrTag()

PGC_API_EXPORT void PGC_API_ENTRY PgcGetErrTag ( int  nErrCode,
char *  sErrTag 
)

Get error tag

Parameters
[in]nErrCodeError code
[out]sErrTagError tag; The size must be equal to or greater than 256

§ PgcLogInfo()

PGC_API_EXPORT void PGC_API_ENTRY PgcLogInfo ( const char *  sFmt,
const char *  sArg1,
const char *  sArg2,
const char *  sArg3 
)

Write to log at info level

Parameters
[in]sFmtFormat
[in]sArg1Argument 1 to be logged
[in]sArg2Argument 2 to be logged
[in]sArg3Argument 3 to be logged

§ PgcLogErr()

PGC_API_EXPORT void PGC_API_ENTRY PgcLogErr ( const char *  sFmt,
const char *  sArg1,
const char *  sArg2,
const char *  sArg3 
)

Write to log at error level

Parameters
[in]sFmtFormat
[in]sArg1Argument 1 to be logged
[in]sArg2Argument 2 to be logged
[in]sArg3Argument 3 to be logged

§ PgcNewConn()

PGC_API_EXPORT int PGC_API_ENTRY PgcNewConn ( const char *  sUrl,
const char *  sUName,
const char *  sPwd,
int  nTimeout,
const char *  sMduName,
const char *  sCfgPath 
)

Create new connection

Parameters
[in]sUrlURL to connect to; Accepted forms: "wss://host:port/path", "https://host:port/path", or "$Service"; if empty, get from: cfg file in curr dir, cfg file in def dir
[in]sUNameName that can uniquely identify the client; if empty, get from: env var, cfg file in curr dir, cfg file in def dir, random name
[in]sPwdPassword to connect to the server; if empty, get from: cfg file in curr dir, cfg file in def dir
[in]nTimeoutTimeout indicator or actual timeout in milliseconds; if zero, get from: cfg file in curr dir, cfg file in def dir
[in]sMduNameModule name; if empty, get from: random name
[in]sCfgPathConfiguration directory or file; if file path, use it; if dir path, locate cfg file; if empty, use curr dir; if not in curr dir, use def dir; any file matching prefix and extension in the cfg dir; if file name has matching UName, choose this
Returns
Connection or Error code

§ PgcFreeConn()

PGC_API_EXPORT int PGC_API_ENTRY PgcFreeConn ( int  nConn)

Close connection

Parameters
[in]nConnConnection
Returns
Error code

§ PgcIsSyncMode()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsSyncMode ( int  nConn)

Is connection synchronous mode (non-async mode)

Parameters
[in]nConnConnection
Returns
True if it is synchronous mode

§ PgcSetConnOpt()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetConnOpt ( int  nConn,
const char *  sKey,
const char *  sVal 
)

Set connection option

Parameters
[in]nConnConnection
[in]sKeyKey for the option
[in]sValValue for the option
Returns
Error code

§ PgcGetConnSts()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetConnSts ( int  nConn,
const char *  sKey,
char *  sVal,
int  nSize 
)

Get connection status / stat

Parameters
[in]nConnConnection
[in]sKeyKey of the status / stat
[out]sValValue buffer for the status / stat
[in]nSizeSize of the value buffer
Returns
Error code, or if Val is NULL, then size is returned

§ PgcSetConnProp()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetConnProp ( int  nConn,
const char *  sSec,
const char *  sKey,
const char *  sVal 
)

Set connection property

Parameters
[in]nConnConnection
[in]sSecSection of the property
[in]sKeyKey of the property
[in]sValValue buffer for the property
Returns
Error code, or if Val is NULL, then size is returned

§ PgcGetConnProp()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetConnProp ( int  nConn,
const char *  sSec,
const char *  sKey,
const char *  sDefVal,
char *  sVal,
int  nSize 
)

Get connection property

Parameters
[in]nConnConnection
[in]sSecSection of the property
[in]sKeyKey of the property
[in]sDefValDefault value of the property
[out]sValValue buffer for the property
[in]nSizeSize of the value buffer
Returns
Error code, or if Val is NULL, then size is returned

§ PgcConnect()

PGC_API_EXPORT int PGC_API_ENTRY PgcConnect ( int  nConn)

Connect

Parameters
[in]nConnConnection
Returns
Error code

§ PgcDisconnect()

PGC_API_EXPORT int PGC_API_ENTRY PgcDisconnect ( int  nConn)

Disconnect

Parameters
[in]nConnConnection
Returns
Error code

§ PgcIsConnected()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsConnected ( int  nConn)

Is connected

Parameters
[in]nConnConnection
Returns
True if it is connected

§ PgcNewSess()

PGC_API_EXPORT int PGC_API_ENTRY PgcNewSess ( int  nConn,
int  nMsgCnt 
)

Create new session

Parameters
[in]nConnConnection
[in]nMsgCntMessage operation target or the actual message count
Returns
Session or Error code

§ PgcFreeSess()

PGC_API_EXPORT int PGC_API_ENTRY PgcFreeSess ( int  nSess)

Close session

Parameters
[in]nSessSession
Returns
Error code

§ PgcIsRecvEnd()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsRecvEnd ( int  nSess)

Is session a receiving party

Parameters
[in]nSessSession
Returns
True if it is received

§ PgcSetSessOpt()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetSessOpt ( int  nSess,
const char *  sKey,
const char *  sVal 
)

Set session option

Parameters
[in]nSessSession
[in]sKeyKey for the option
[in]sValValue for the option
Returns
Error code

§ PgcGetSessSts()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetSessSts ( int  nSess,
const char *  sKey,
char *  sVal,
int  nSize 
)

Get session status / stat

Parameters
[in]nSessSession
[in]sKeyKey of the status / stat
[out]sValValue buffer for the status / stat
[in]nSizeSize of the value buffer
Returns
Error code, or if Val is NULL, then size is returned

§ PgcSetConn()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetConn ( int  nSess,
int  nConn 
)

Set connection to session

Parameters
[in]nSessSession
[in]nConnConnection
Returns
Connection or Error code

§ PgcGetConn()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetConn ( int  nSess)

Get connection from session

Parameters
[in]nSessSession
Returns
Connection or Error code

§ PgcGetMsgCnt()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgCnt ( int  nSess)

Get message count

Parameters
[in]nSessSession
Returns
Message count

§ PgcSetMsgData()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetMsgData ( int  nSess,
bool  bIsRaw,
const char *  sVal 
)
Parameters
[in]nSessSession
[in]bIsRawif the data is raw data (not JSON)
[in]sValValue of the data
Returns
Error code

§ PgcGetMsgData()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgData ( int  nSess,
bool  bIsRaw,
char *  sVal,
int  nSize 
)
Parameters
[in]nSessSession
[in]bIsRawif the data is raw data (not JSON)
[out]sValValue of the data
[in]nSizeSize of the sVal buffer
Returns
Error code; or if sVal is NULL or nSize is 0, then size is returned

§ PgcIsRawMsg()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsRawMsg ( int  nSess)
Parameters
[in]nSessSession
Returns
True if the message is a raw message (not JSON)

§ PgcSetMsgPrm()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetMsgPrm ( int  nSess,
const char *  sKey,
const char *  sVal 
)

Set message parameter

Parameters
[in]nSessSession
[in]sKeyKey of the data
[in]sValValue of the data
Returns
Error code

§ PgcGetMsgPrm()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetMsgPrm ( int  nSess,
const char *  sKey,
char *  sVal,
int  nSize 
)

Get message parameter

Parameters
[in]nSessSession
[in]sKeyKey of the data
[out]sValValue of the data
[in]nSizeSize of the sVal buffer
Returns
Error code; or if sVal is NULL or nSize is 0, then size is returned

§ PgcNewMsg()

PGC_API_EXPORT int PGC_API_ENTRY PgcNewMsg ( int  nSess)

Create new message for confirm or reply The old message is backed up and can be accessed using negative message indexes

Parameters
[in]nSessSession
Returns
Error code

§ PgcIsSet()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsSet ( int  nSess,
int  nMsg,
const char *  sKey 
)

Is key set in message

Parameters
[in]nSessSession
[in]nMsgMessage index: starts with 0 for current messages; use negative numbers for the messages that were just backed up
[in]sKeyKey of the data; Accepted forms: Pointer style keys: /RootObj/SubObj/ArrIdx/Key
Returns
True if the data with the key is set in the message

§ PgcUnset()

PGC_API_EXPORT int PGC_API_ENTRY PgcUnset ( int  nSess,
int  nMsg,
const char *  sKey 
)

Unset key in message

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Error code

§ PgcIsEmpty()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsEmpty ( int  nSess,
int  nMsg,
const char *  sKey 
)

Is value empty in message

Parameters
[in]nSessSession
[in]nMsgMessage index: starts with 0 for current messages; use negative numbers for the messages that were just backed up
[in]sKeyKey of the data; Accepted forms: Pointer style keys: /RootObj/SubObj/ArrIdx/Key
Returns
True if the data with the key is empty or not set in the message

§ PgcGetType()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetType ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get type of value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Data type

§ PgcSetStr()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetStr ( int  nSess,
int  nMsg,
const char *  sKey,
const char *  sVal 
)

Set string value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]sValValue of the data
Returns
Error code

§ PgcGetStr()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetStr ( int  nSess,
int  nMsg,
const char *  sKey,
char *  sVal,
int  nSize 
)

Get string value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[out]sValValue of the data
[in]nSizeSize of the sVal buffer
Returns
Error code; or if sVal is NULL or nSize is 0, then size is returned

§ PgcSetAmt()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetAmt ( int  nSess,
int  nMsg,
const char *  sKey,
long  nVal 
)

Set amount value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]nValValue of the data; 2 decimal places assumed
Returns
Error code

§ PgcGetAmt()

PGC_API_EXPORT long PGC_API_ENTRY PgcGetAmt ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get amount value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Amount value

§ PgcSetInt()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetInt ( int  nSess,
int  nMsg,
const char *  sKey,
int  nVal 
)

Set integer value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]nValValue of the data
Returns
Error code

§ PgcGetInt()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetInt ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get integer value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Integer value

§ PgcSetNum()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetNum ( int  nSess,
int  nMsg,
const char *  sKey,
double  nVal 
)

Set number value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]nValValue of the data
Returns
Error code

§ PgcGetNum()

PGC_API_EXPORT double PGC_API_ENTRY PgcGetNum ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get number value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Number value

§ PgcSetBool()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetBool ( int  nSess,
int  nMsg,
const char *  sKey,
bool  bVal 
)

Set boolean value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]bValValue of the data
Returns
Error code

§ PgcGetBool()

PGC_API_EXPORT bool PGC_API_ENTRY PgcGetBool ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get boolean value

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Boolean value

§ PgcSetDate()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetDate ( int  nSess,
int  nMsg,
const char *  sKey,
double  dVal 
)

Set date/time value defined as seconds since 00:00, Jan 1, 1970 UTC

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]dValValue of the data; floating-point time_t
Returns
Error code

§ PgcGetDate()

PGC_API_EXPORT double PGC_API_ENTRY PgcGetDate ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get date/time value defined as seconds since 00:00, Jan 1, 1970 UTC

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Date value

§ PgcSetChildMsg()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetChildMsg ( int  nSess,
int  nMsg,
const char *  sKey,
int  nChildMsgSess 
)

Set child message in a session; a message (encoded) within the message

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
[in]nChildMsgSessSession that contains the child message
Returns
Error code

§ PgcGetChildMsg()

PGC_API_EXPORT int PGC_API_ENTRY PgcGetChildMsg ( int  nSess,
int  nMsg,
const char *  sKey 
)

Get child message in a session; a message (encoded) within the message

Parameters
[in]nSessSession
[in]nMsgMessage index
[in]sKeyKey of the data
Returns
Integer value of the session that contains the child message

§ PgcRequest()

PGC_API_EXPORT int PGC_API_ENTRY PgcRequest ( int  nSess)

Request

Parameters
[in]nSessSession
Returns
Error code

§ PgcSend()

PGC_API_EXPORT int PGC_API_ENTRY PgcSend ( int  nSess)

Send message (from client, either initiate or respond)

Parameters
[in]nSessSession
Returns
Error code

§ PgcPerform()

PGC_API_EXPORT int PGC_API_ENTRY PgcPerform ( int  nSess)

Perform task (from client)

Parameters
[in]nSessSession
Returns
Error code

§ int()

typedef int ( PGC_API_ENTRY  PGC_EVTCBK_FUNC)

Event callback function.

Example: int PGC_API_ENTRY PgcCallback(void * pRef, int nConn, int nSess);

Parameters
PGC_EVTCBK_FUNCEvent callback function
Returns
Error code

§ PgcSetCbk()

PGC_API_EXPORT int PGC_API_ENTRY PgcSetCbk ( int  nConn,
PGC_EVTCBK_FUNC *  pfnEvtCbk,
void *  pEvtCbkRef 
)

Set callback.

To manually check the messages, make pfnEvtCbk and pEvtCbkRef NULL

Parameters
[in]nConnConnection
[in]pfnEvtCbkEvent callback function
[in]pEvtCbkRefReference pointer when calling back
Returns
Error code

§ PgcHeed()

PGC_API_EXPORT int PGC_API_ENTRY PgcHeed ( int  nConn)

Heed (only valid for WSS)

Parameters
[in]nConnConnection
Returns
Error code

§ PgcUnheed()

PGC_API_EXPORT int PGC_API_ENTRY PgcUnheed ( int  nConn)

Unheed

Parameters
[in]nConnConnection
Returns
Error code

§ PgcIsHeeding()

PGC_API_EXPORT bool PGC_API_ENTRY PgcIsHeeding ( int  nConn)

Is heeding

Parameters
[in]nConnConnection
Returns
True if it is heeding

§ PgcPoll()

PGC_API_EXPORT int PGC_API_ENTRY PgcPoll ( int  nConn,
int  nTimeout 
)

Poll

Parameters
[in]nConnConnection
[in]nTimeoutTimeout waiting for the message; 0 means no wait.
Returns
Session if available, otherwise 0 or error code

§ PgcConfirm()

PGC_API_EXPORT int PGC_API_ENTRY PgcConfirm ( int  nSess)

Confirm

Parameters
[in]nSessSession
Returns
Error code

§ PgcDoTxn()

PGC_API_EXPORT int PGC_API_ENTRY PgcDoTxn ( const char *  sUrl,
const char *  sReq,
char *  sRsp,
int  nRspSize 
)

Do transaction

Parameters
[in]sUrlURL to connect to; Accepted forms: "wss://host:port/", "https://host:port/", or "$Service"
[in]sReqRequest string in JSON format
[out]sRspResponse string in JSON format
[in]nRspSizeResponse buffer size
Returns
Error code