![]() |
botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
|
Server-Client connection, control, and information functions. More...
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
#include <string.h>
#include "rnr/rnrconfig.h"
#include "rnr/sock.h"
#include "rnr/new.h"
#include "rnr/log.h"
#include "botsense/BotSense.h"
#include "botsense/libBotSense.h"
#include "botsense/bsProxyMsgs.h"
#include "bsLibInternal.h"
Go to the source code of this file.
Macros | |
#define | _BS_LOG_VCONN_OPEN(pClient, index) |
Log virtual connection open event. More... | |
Functions | |
static void | bsLogVConnOpenEvent (BsClient_T *pClient, int index) |
Log virtual connection open event. More... | |
int | bsServerConnect (BsClient_P pClient, const char *sServerHostName, int ipServerPort) |
Connect to the bsProxy server. More... | |
int | bsServerDisconnect (BsClient_P pClient) |
Disconnect from the bsProxy server. More... | |
int | bsServerReqLoopback (BsClient_P pClient, char sLoopbackMsg[]) |
Request server to loopback the requested message data. More... | |
int | bsServerReqSetLogging (BsClient_P pClient, int nLogLevel) |
Request server to set the server's logging level. More... | |
int | bsServerReqGetVersion (BsClient_P pClient, char bufVer[], size_t bufSize) |
Request server to return the server's version string. More... | |
int | bsServerReqMsgTrace (BsClient_P pClient, BsVConnHnd_T hndVConn, bool_t bNewTrace) |
Request server to enable/disable message tracing on a virtual connection. More... | |
int | bsServerReqOpenDev (BsClient_P pClient, const char *sDevName, const char *sModName, byte_t argbuf[], size_t arglen, const BsClientAppInfo_T *pAppInfo, bool_t bInitTrace) |
Request server to establish a virtual connection to the device end point. More... | |
int | bsServerReqCloseDev (BsClient_P pClient, BsVConnHnd_T hndVConn) |
Request server to close a client's vitual connection. More... | |
int | bsServerReqGetVConnList (BsClient_P pClient, BsVecHandles_T *pVecHandles) |
Request server to retrieve the server's list of virtual connection handles for this client. More... | |
int | bsServerReqGetVConnInfo (BsClient_P pClient, BsVConnHnd_T hndVConn, BsVConnInfo_T *pVConnInfo) |
Request server to retrieve the server's information for a given virtual connection. More... | |
Server-Client connection, control, and information functions.
Definition in file bsLibServer.c.
#define _BS_LOG_VCONN_OPEN | ( | pClient, | |
index | |||
) |
Log virtual connection open event.
pClient |
Definition at line 76 of file bsLibServer.c.
Referenced by bsServerReqOpenDev().
|
static |
Log virtual connection open event.
pClient |
Definition at line 91 of file bsLibServer.c.
References BsClientAppInfo_T::app_name, BsClientAppInfo_T::brief, BsClientAppInfo_T::date, BsVConn_T::m_hndVConn, BsVConn_T::m_pAppInfo, _bsClientStruct::m_sClientName, BsVConn_T::m_sDevName, BsVConn_T::m_sModName, _bsClientStruct::m_tblVConn, BsClientAppInfo_T::maintainer, and BsClientAppInfo_T::version.
int bsServerConnect | ( | BsClient_P | pClient, |
const char * | sServerHostName, | ||
int | ipServerPort | ||
) |
Connect to the bsProxy server.
pClient |
Definition at line 167 of file bsLibServer.c.
References BS_ECODE_SERVER_CONN_FAIL, BS_OK, BSCLIENT_LOG_SYSERROR, bsServerDisconnect(), _bsClientStruct::m_pSocket, and _bsClientStruct::m_sClientName.
int bsServerDisconnect | ( | BsClient_P | pClient | ) |
Disconnect from the bsProxy server.
pClient |
Definition at line 207 of file bsLibServer.c.
References BS_OK, bsVConnClearAll(), _bsClientStruct::m_pSocket, and _bsClientStruct::m_sClientName.
Referenced by bsServerConnect().
int bsServerReqCloseDev | ( | BsClient_P | pClient, |
BsVConnHnd_T | hndVConn | ||
) |
Request server to close a client's vitual connection.
pClient |
Definition at line 597 of file bsLibServer.c.
References BS_ECODE_BAD_VAL, BS_OK, BSCLIENT_HAS_VCONN, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_EXPR, BSCLIENT_TRY_NM_ECODE, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqDevClose, BsProxyMsgIdRspOk, BsProxyPackReqDevClose(), bsVConnDelete(), bsVConnRemove(), _bsClientStruct::m_sClientName, and BsProxyReqDevClose_T::m_vconn.
int bsServerReqGetVConnInfo | ( | BsClient_P | pClient, |
BsVConnHnd_T | hndVConn, | ||
BsVConnInfo_T * | pVConnInfo | ||
) |
Request server to retrieve the server's information for a given virtual connection.
pClient |
Definition at line 735 of file bsLibServer.c.
References BS_ECODE_BAD_VAL, BS_OK, BSCLIENT_HAS_VCONN, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_EXPR, BSCLIENT_TRY_NM_ECODE, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqGetVConnInfo, BsProxyMsgIdRspGetVConnInfo, BsProxyPackReqGetVConnInfo(), BsProxyUnpackRspGetVConnInfo(), BsVConnInfo_T::m_client, BsProxyRspGetVConnInfo_T::m_client, BsVConnInfo_T::m_devuri, BsProxyRspGetVConnInfo_T::m_devuri, BsVConnInfo_T::m_moddate, BsProxyRspGetVConnInfo_T::m_moddate, BsVConnInfo_T::m_moduri, BsProxyRspGetVConnInfo_T::m_moduri, BsVConnInfo_T::m_modver, BsProxyRspGetVConnInfo_T::m_modver, BsVConnInfo_T::m_rd, BsProxyRspGetVConnInfo_T::m_rd, BsVConnInfo_T::m_vconn, BsProxyReqGetVConnInfo_T::m_vconn, and BsProxyRspGetVConnInfo_T::m_vconn.
int bsServerReqGetVConnList | ( | BsClient_P | pClient, |
BsVecHandles_T * | pVecHandles | ||
) |
Request server to retrieve the server's list of virtual connection handles for this client.
pClient |
Definition at line 672 of file bsLibServer.c.
References BS_OK, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_NM_ECODE, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_CLIENT_MAX, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqGetVConnList, BsProxyMsgIdRspGetVConnList, BsProxyUnpackRspGetVConnList(), BsProxyRspGetVConnList_T::m_count, BsVecHandles_T::m_uCount, BsProxyRspGetVConnList_T::m_vconn, BsVecHandles_T::m_vecHnd, and BsProxyRspGetVConnList_T::u.
int bsServerReqGetVersion | ( | BsClient_P | pClient, |
char | bufVer[], | ||
size_t | bufSize | ||
) |
Request server to return the server's version string.
pClient |
Definition at line 354 of file bsLibServer.c.
References BS_OK, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_NM_ECODE, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqGetVersion, BsProxyMsgIdRspGetVersion, BsProxyUnpackRspGetVersion(), and BsProxyRspGetVersion_T::m_version.
int bsServerReqLoopback | ( | BsClient_P | pClient, |
char | sLoopbackMsg[] | ||
) |
Request server to loopback the requested message data.
pClient |
Definition at line 230 of file bsLibServer.c.
References BS_OK, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_NM_ECODE, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqLoopback, BsProxyMsgIdRspLoopback, BsProxyPackReqLoopback(), BsProxyUnpackRspLoopback(), BsProxyReqLoopback_T::m_cdata, and BsProxyRspLoopback_T::m_cdata.
int bsServerReqMsgTrace | ( | BsClient_P | pClient, |
BsVConnHnd_T | hndVConn, | ||
bool_t | bNewTrace | ||
) |
Request server to enable/disable message tracing on a virtual connection.
pClient |
Definition at line 411 of file bsLibServer.c.
References BS_OK, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_NM_ECODE, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqMsgTrace, BsProxyMsgIdRspOk, BsProxyPackReqMsgTrace(), BsProxyReqMsgTrace_T::m_trace, and BsProxyReqMsgTrace_T::m_vconn.
int bsServerReqOpenDev | ( | BsClient_P | pClient, |
const char * | sDevName, | ||
const char * | sModName, | ||
byte_t | argbuf[], | ||
size_t | arglen, | ||
const BsClientAppInfo_T * | pAppInfo, | ||
bool_t | bInitTrace | ||
) |
Request server to establish a virtual connection to the device end point.
The device is open if not already opened by another virtual connection. Otherwise it is attached to this vconn.
The interface module is dynamically loaded into the server and provides the set of services for the client application communicating with the device.
pClient |
Definition at line 485 of file bsLibServer.c.
References _BS_LOG_VCONN_OPEN, BS_ECODE_BAD_MSG, BS_ECODE_BAD_VAL, BSCLIENT_LOG_ERROR, BSCLIENT_LOG_NM_ERROR, BSCLIENT_TRY_EXPR, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_REQDEVOPEN_ARGBUF_LEN, BSPROXY_REQDEVOPEN_DEVNAME_LEN, BSPROXY_REQDEVOPEN_MODNAME_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqDevOpen, BsProxyMsgIdRspDevOpen, BsProxyPackReqDevOpen(), BsProxyUnpackRspDevOpen(), bsVConnAdd(), bsVConnDelete(), bsVConnNew(), BsProxyReqDevOpen_T::m_argbuf, BsProxyReqDevOpen_T::m_count, BsProxyReqDevOpen_T::m_devname, BsProxyReqDevOpen_T::m_modname, BsProxyReqDevOpen_T::m_trace, BsProxyRspDevOpen_T::m_vconn, and BsProxyReqDevOpen_T::u.
int bsServerReqSetLogging | ( | BsClient_P | pClient, |
int | nLogLevel | ||
) |
Request server to set the server's logging level.
pClient |
Definition at line 298 of file bsLibServer.c.
References BS_OK, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_NM_ECODE, BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdReqSetLogging, BsProxyMsgIdRspOk, BsProxyPackReqSetLogging(), and BsProxyReqSetLogging_T::m_level.