![]() |
botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
|
Client base functions. More...
#include <stdio.h>#include <stdlib.h>#include <libgen.h>#include <string.h>#include <errno.h>#include <pthread.h>#include <limits.h>#include <sys/select.h>#include <sys/time.h>#include "rnr/rnrconfig.h"#include "rnr/new.h"#include "rnr/log.h"#include "rnr/netmsgs.h"#include "botsense/BotSense.h"#include "botsense/libBotSense.h"#include "botsense/bsProxyMsgs.h"#include "bsLibInternal.h"Go to the source code of this file.
Functions | |
| static void | fdset_nowarn (int fd, fd_set *pset) |
| FD_SET() wrapper with no annoying warnings. More... | |
| static void | bsTransLock (BsClient_T *pClient) |
| Lock client's transaction mutual exclusion. More... | |
| static void | bsTransUnlock (BsClient_T *pClient) |
| Unlock client's transaction mutual exclusion. More... | |
| static bool_t | bsTransTryLock (BsClient_T *pClient) |
| Try to lock client's transaction mutual exclusion. More... | |
| static void | bsTransMark (BsClient_T *pClient, BsTid_T uTid) |
| Mark the start of a client's server transaction in the transaction cache. More... | |
| static void | bsTransForget (BsClient_T *pClient, BsTid_T uTid) |
| Delete any cached transaction state from the cache. More... | |
| static void | bsTransCacheRsp (BsClient_T *pClient, BsTid_T uTid, BsProxyMsgHdr_T *pMsgHdr, byte_t bufRsp[]) |
| Cache a transaction response. More... | |
| static int | bsTransLoadCached (BsClient_T *pClient, BsTid_T uTid, BsProxyMsgHdr_T *pMsgHdr, byte_t bufRsp[], size_t sizeRsp) |
| Load cached response from transaction cache. More... | |
| static BsTid_T | bsNextTid (BsClient_T *pClient) |
| Atomically get the next available transaction id. More... | |
| static void | timer_mark (struct timeval *pTvMark) |
| Mark the current time. Resolution is microseconds. More... | |
| static uint_t | timer_elapsed (struct timeval *pTvMark) |
| Calculate the elapsed time between the given time mark and this call. More... | |
| static int | bsClientPackMsgHdr (BsClient_T *pClient, BsProxyMsgHdr_T *pMsgHdr, byte_t buf[], size_t bufSize) |
| Pack BotSense client message header. More... | |
| static int | bsClientUnpackMsgHdr (BsClient_T *pClient, byte_t buf[], size_t bufSize, BsProxyMsgHdr_T *pMsgHdr) |
| Unpack BotSense client message header. More... | |
| static int | bsClientRead (BsClient_T *pClient, int sd, byte_t buf[], size_t count, uint_t usec) |
| Read bytes from socket. More... | |
| static int | bsClientWrite (BsClient_T *pClient, int sd, byte_t buf[], size_t count, uint_t usec) |
| Write bytes to socket. More... | |
| static void | bsFlushInput (BsClient_T *pClient, size_t count) |
| Flush input of count bytes. More... | |
| static void | bsResync (BsClient_T *pClient) |
| Resync client with server. More... | |
| static int | bsClientSendReq (BsClient_T *pClient, BsProxyMsgHdr_T *pMsgHdr, byte_t bufReq[], size_t bufSize) |
| Send a request message to the server. More... | |
| static int | bsClientRecvRsp (BsClient_T *pClient, BsProxyMsgHdr_T *pMsgHdr, byte_t bufRsp[], size_t bufSize) |
| Read response message from server. More... | |
| const char * | bsClientAttrGetName (BsClient_P pClient) |
| Get client name. More... | |
| void | bsClientAttrGetTimeouts (BsClient_P pClient, uint_t *pReqTimeout, uint_t *pRspTimeout) |
| Get client request (write) and response (read) timeouts. More... | |
| void | bsClientAttrSetTimeouts (BsClient_P pClient, uint_t uReqTimeout, uint_t uRspTimeout) |
| Set client request (write) and response (read) timeouts. More... | |
| bool_t | bsClientAttrGetTraceState (BsClient_P pClient, BsVConnHnd_T hndVConn) |
| Get client virtual connection trace state. More... | |
| int | bsClientAttrGetVConnCount (BsClient_P pClient) |
| Get the number of active virtual connections for this client. More... | |
| bool_t | bsClientAttrHasVConn (BsClient_P pClient, BsVConnHnd_T hndVConn) |
| Test if client has a virtual connection identified by the handle. More... | |
| const char * | bsClientAttrGetDevName (BsClient_P pClient, BsVConnHnd_T hndVConn) |
| Get client virtual connection device name. More... | |
| const char * | bsClientAttrGetModName (BsClient_P pClient, BsVConnHnd_T hndVConn) |
| Get client virtual connection interface module name. More... | |
| void | bsClientAttrSetLogging (BsClient_P pClient, int nLevel) |
| Set client's diagnostics logging threshold. More... | |
| void | bsClientAttrGetConnState (BsClient_P pClient, BsClientConnState_T *pConnState) |
| Get client's connection state. More... | |
| void | bsClientFillMsgHdr (BsClient_P pClient, int hndVConn, uint_t uMsgId, size_t uBodyLen, BsProxyMsgHdr_T *pMsgHdr) |
| Fill in message header. More... | |
| const char * | bsClientGetMsgName (BsClient_P pClient, BsVConnHnd_T hndVConn, uint_t uMsgId) |
| Get the message name. More... | |
| void | bsClientLogMsgHdr (BsClient_P pClient, const char *sPreface, BsProxyMsgHdr_T *pMsgHdr) |
| Log [pre/un]packed message header. More... | |
| int | bsClientTrans (BsClient_P pClient, int hndVConn, uint_t uReqMsgId, byte_t bufReq[], size_t uReqBodyLen, uint_t uRspMsgId, byte_t bufRsp[], size_t sizeRspBuf) |
| Execute a request - response transaction with the server. More... | |
| BsClient_T * | bsClientNew (const char *sClientName) |
| Create a new unconnected proxied client. More... | |
| void | bsClientDelete (BsClient_P pClient) |
| Delete a proxied client. More... | |
| void | bsVConnClearAll (BsClient_T *pClient) |
| Remove and delete all of a client's vConnections. More... | |
| int | bsVConnAdd (BsClient_T *pClient, BsVConnHnd_T hndVConn, int index) |
| Add a created vConnection to the client's tblHndIndex table. More... | |
| int | bsVConnRemove (BsClient_T *pClient, BsVConnHnd_T hndVConn) |
| Remove a vConnection from the client's tblHndIndex table. More... | |
| int | bsVConnNew (BsClient_T *pClient, const char *sDevName, const char *sModName, const BsClientAppInfo_T *pAppInfo, bool_t bTrace) |
| Reserve a new client vConnection (and proxied device) in the client's tblVConn table. More... | |
| int | bsVConnDelete (BsClient_T *pClient, int index) |
| Delete a vConnection (and proxied device) from the client's tblVConn table. More... | |
Client base functions.
Definition in file bsLibClient.c.
| void bsClientAttrGetConnState | ( | BsClient_P | pClient, |
| BsClientConnState_T * | pConnState | ||
| ) |
Get client's connection state.
| pClient |
Definition at line 1120 of file bsLibClient.c.
References BsClientConnState_T::m_bIsConnected, _bsClientStruct::m_pSocket, and BsClientConnState_T::m_sServerHostName.
| const char* bsClientAttrGetDevName | ( | BsClient_P | pClient, |
| BsVConnHnd_T | hndVConn | ||
| ) |
Get client virtual connection device name.
| pClient |
Definition at line 1054 of file bsLibClient.c.
References bsClientAttrHasVConn(), BSPROXY_VCONN_SERVER, BsVConn_T::m_sDevName, and _bsClientStruct::m_tblVConn.
| const char* bsClientAttrGetModName | ( | BsClient_P | pClient, |
| BsVConnHnd_T | hndVConn | ||
| ) |
Get client virtual connection interface module name.
| pClient |
Definition at line 1083 of file bsLibClient.c.
References bsClientAttrHasVConn(), BSPROXY_VCONN_SERVER, BsVConn_T::m_sModName, and _bsClientStruct::m_tblVConn.
| const char* bsClientAttrGetName | ( | BsClient_P | pClient | ) |
Get client name.
| pClient |
Definition at line 918 of file bsLibClient.c.
References _bsClientStruct::m_sClientName.
Referenced by bsTransCacheRsp(), and bsTransLoadCached().
| void bsClientAttrGetTimeouts | ( | BsClient_P | pClient, |
| uint_t * | pReqTimeout, | ||
| uint_t * | pRspTimeout | ||
| ) |
Get client request (write) and response (read) timeouts.
| pClient |
Definition at line 930 of file bsLibClient.c.
References _bsClientStruct::m_uReqTimeout, and _bsClientStruct::m_uRspTimeout.
| bool_t bsClientAttrGetTraceState | ( | BsClient_P | pClient, |
| BsVConnHnd_T | hndVConn | ||
| ) |
Get client virtual connection trace state.
| pClient |
Definition at line 970 of file bsLibClient.c.
References bsClientAttrHasVConn(), bsGetVConn(), BSPROXY_VCONN_SERVER, BsVConn_T::m_bTrace, and _bsClientStruct::m_bTraceServer.
| int bsClientAttrGetVConnCount | ( | BsClient_P | pClient | ) |
Get the number of active virtual connections for this client.
| pClient |
Definition at line 998 of file bsLibClient.c.
References _bsClientStruct::m_nVConnCount.
Referenced by bsVConnNew().
| bool_t bsClientAttrHasVConn | ( | BsClient_P | pClient, |
| BsVConnHnd_T | hndVConn | ||
| ) |
Test if client has a virtual connection identified by the handle.
| pClient |
Definition at line 1019 of file bsLibClient.c.
References BSCLIENT_IS_VCONN_HANDLE, BSPROXY_VCONN_UNDEF, _bsClientStruct::m_tblHndIndex, and _bsClientStruct::m_tblVConn.
Referenced by bsClientAttrGetDevName(), bsClientAttrGetModName(), bsClientAttrGetTraceState(), and bsClientGetMsgName().
| void bsClientAttrSetLogging | ( | BsClient_P | pClient, |
| int | nLevel | ||
| ) |
Set client's diagnostics logging threshold.
| pClient |
Definition at line 1109 of file bsLibClient.c.
| void bsClientAttrSetTimeouts | ( | BsClient_P | pClient, |
| uint_t | uReqTimeout, | ||
| uint_t | uRspTimeout | ||
| ) |
Set client request (write) and response (read) timeouts.
A timeout value of 0 means block forever until i/o operation is complete.
| pClient |
Definition at line 950 of file bsLibClient.c.
References _bsClientStruct::m_uReqTimeout, and _bsClientStruct::m_uRspTimeout.
| void bsClientDelete | ( | BsClient_P | pClient | ) |
Delete a proxied client.
| pClient |
Definition at line 1438 of file bsLibClient.c.
References BS_ECODE_GEN, BSCLIENT_LOG_WARN, bsTransForget(), bsVConnClearAll(), _bsClientStruct::m_mutexTrans, _bsClientStruct::m_pSocket, _bsClientStruct::m_sClientName, and _bsClientStruct::m_tblTransCache.
| void bsClientFillMsgHdr | ( | BsClient_P | pClient, |
| int | hndVConn, | ||
| uint_t | uMsgId, | ||
| size_t | uBodyLen, | ||
| BsProxyMsgHdr_T * | pMsgHdr | ||
| ) |
Fill in message header.
| pClient |
Definition at line 1148 of file bsLibClient.c.
References bsNextTid(), BSPROXY_MSG_MAGIC, BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMagic, BsProxyMsgHdr_T::m_hdrMsgId, BsProxyMsgHdr_T::m_hdrTid, and BsProxyMsgHdr_T::m_hdrVConn.
Referenced by bsClientTrans().
| const char* bsClientGetMsgName | ( | BsClient_P | pClient, |
| BsVConnHnd_T | hndVConn, | ||
| uint_t | uMsgId | ||
| ) |
Get the message name.
For each (virtual connection, message id) 2-tuple, there can be a known name string (provided the id is valid and an application provides the information).
| pClient |
Definition at line 1175 of file bsLibClient.c.
References bsClientAttrHasVConn(), bsGetVConn(), BSPROXY_VCONN_SERVER, BsProxyLookupMsgDef(), BsClientAppInfo_T::fnGetMsgName, and BsVConn_T::m_pAppInfo.
Referenced by bsClientLogMsgHdr().
| void bsClientLogMsgHdr | ( | BsClient_P | pClient, |
| const char * | sPreface, | ||
| BsProxyMsgHdr_T * | pMsgHdr | ||
| ) |
Log [pre/un]packed message header.
| pClient |
Definition at line 1219 of file bsLibClient.c.
References bsClientGetMsgName(), BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMagic, BsProxyMsgHdr_T::m_hdrMsgId, BsProxyMsgHdr_T::m_hdrTid, and BsProxyMsgHdr_T::m_hdrVConn.
| BsClient_T* bsClientNew | ( | const char * | sClientName | ) |
Create a new unconnected proxied client.
| sClientName | Proxied client (robot)'s name. |
Definition at line 1396 of file bsLibClient.c.
References BSCLIENT_T_READ, BSCLIENT_T_WRITE, BSPROXY_VCONN_UNDEF, _bsClientStruct::m_bTraceServer, _bsClientStruct::m_mutexTrans, _bsClientStruct::m_nVConnCount, _bsClientStruct::m_pSocket, _bsClientStruct::m_sClientName, _bsClientStruct::m_tblHndIndex, _bsClientStruct::m_tblTransCache, _bsClientStruct::m_tblVConn, _bsClientStruct::m_uReqTimeout, _bsClientStruct::m_uRspTimeout, and _bsClientStruct::m_uTidCounter.
|
inlinestatic |
Pack BotSense client message header.
| pClient |
Definition at line 397 of file bsLibClient.c.
References BS_ECODE_BUF_TOO_SMALL, BSCLIENT_TRY_EXPR, and BSPROXY_MSG_HDR_LEN.
Referenced by bsClientSendReq().
|
static |
Read bytes from socket.
Read up to count bytes into buf from the socket. This call is non-blocking if the timeout value usec is greater than zero. Otherwise the read can block indefinitely.
Note that on return the bytes read can be less than count.
| pClient |
Definition at line 457 of file bsLibClient.c.
References BS_ECODE_BAD_RECV, BSCLIENT_LOG_SYSERROR, fdset_nowarn(), timer_elapsed(), and timer_mark().
Referenced by bsClientRecvRsp(), and bsFlushInput().
|
static |
Read response message from server.
| pClient |
Definition at line 829 of file bsLibClient.c.
References _BS_LOG_MSGHDR, BS_ECODE_BAD_RECV, BS_ECODE_MSG_BAD_HDR, BS_ECODE_MSG_TOO_BIG, BSCLIENT_LOG_ERROR, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_EXPR, bsClientRead(), bsClientUnpackMsgHdr(), bsFlushInput(), BSPROXY_MSG_HDR_LEN, BSPROXY_MSG_MAGIC, bsResync(), bsTransLock(), bsTransUnlock(), BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMagic, BsProxyMsgHdr_T::m_hdrMsgId, _bsClientStruct::m_pSocket, and _bsClientStruct::m_uRspTimeout.
Referenced by bsClientTrans().
|
static |
Send a request message to the server.
| pClient |
Definition at line 771 of file bsLibClient.c.
References _BS_LOG_MSGHDR, BS_ECODE_BAD_SEND, BS_ECODE_BUF_TOO_SMALL, BS_ECODE_MSG_TOO_BIG, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_EXPR, bsClientPackMsgHdr(), bsClientWrite(), BSPROXY_MSG_BODY_MAX, BSPROXY_MSG_HDR_LEN, bsTransLock(), bsTransUnlock(), BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMsgId, _bsClientStruct::m_pSocket, and _bsClientStruct::m_uReqTimeout.
Referenced by bsClientTrans().
| int bsClientTrans | ( | BsClient_P | pClient, |
| int | hndVConn, | ||
| uint_t | uReqMsgId, | ||
| byte_t | bufReq[], | ||
| size_t | uReqBodyLen, | ||
| uint_t | uRspMsgId, | ||
| byte_t | bufRsp[], | ||
| size_t | sizeRspBuf | ||
| ) |
Execute a request - response transaction with the server.
| pClient |
Definition at line 1279 of file bsLibClient.c.
References _BS_LOG_REQ, _BS_LOG_RSP, BS_ECODE_MSG_BAD_HDR, BSCLIENT_LOG_ERROR, BSCLIENT_TRY_ECODE, BSCLIENT_TRY_EXPR, bsClientFillMsgHdr(), bsClientRecvRsp(), bsClientSendReq(), BSPROXY_MSG_HDR_LEN, BSPROXY_VCONN_SERVER, BsProxyMsgIdRspErr, BsProxyUnpackRspErr(), bsTransCacheRsp(), bsTransForget(), bsTransLoadCached(), bsTransMark(), BsProxyRspErr_T::m_ecode, BsProxyRspErr_T::m_emsg, BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMsgId, BsProxyMsgHdr_T::m_hdrTid, and BsProxyMsgHdr_T::m_hdrVConn.
|
inlinestatic |
Unpack BotSense client message header.
| pClient |
Definition at line 421 of file bsLibClient.c.
References BS_ECODE_BUF_TOO_SMALL, BSCLIENT_TRY_EXPR, and BSPROXY_MSG_HDR_LEN.
Referenced by bsClientRecvRsp().
|
static |
Write bytes to socket.
Write up to count bytes from buf to the socket. This call is non-blocking if the timeout value usec is greater than zero. Otherwise the read can block indefinitely.
Note that the number of bytes written can be less than the count.
| pClient |
Definition at line 594 of file bsLibClient.c.
References BS_ECODE_BAD_RECV, BS_ECODE_BAD_SEND, BSCLIENT_LOG_SYSERROR, fdset_nowarn(), timer_elapsed(), and timer_mark().
Referenced by bsClientSendReq().
|
static |
Flush input of count bytes.
| pClient |
Definition at line 713 of file bsLibClient.c.
References BSCLIENT_T_FLUSH, bsClientRead(), and _bsClientStruct::m_pSocket.
Referenced by bsClientRecvRsp(), and bsResync().
|
static |
Atomically get the next available transaction id.
| pClient |
Definition at line 315 of file bsLibClient.c.
References BSPROXY_TID_MASK, bsTransLock(), bsTransUnlock(), and _bsClientStruct::m_uTidCounter.
Referenced by bsClientFillMsgHdr().
|
static |
Resync client with server.
Lost message alignment with the server (if this is possible). Perfomr a series of flush-request cycles to try to get back in sync.
| pClient |
Definition at line 742 of file bsLibClient.c.
References BS_ECODE_BAD_RESYNC, BS_OK, BSCLIENT_LOG_ERROR, bsFlushInput(), and BSPROXY_MSG_MAX_LEN.
Referenced by bsClientRecvRsp().
|
static |
Cache a transaction response.
Cashing a response occurs when this client thread receives a response fo another client thread.
| pClient |
Definition at line 214 of file bsLibClient.c.
References bsClientAttrGetName(), BSPROXY_TID_MASK, bsTransLock(), bsTransUnlock(), BsTransInfo_T::m_bCached, BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMsgId, BsTransInfo_T::m_pBuf, BsTransInfo_T::m_pMsgHdr, and _bsClientStruct::m_tblTransCache.
Referenced by bsClientTrans().
|
static |
Delete any cached transaction state from the cache.
| pClient |
Definition at line 184 of file bsLibClient.c.
References BSPROXY_TID_MASK, bsTransLock(), bsTransUnlock(), BsTransInfo_T::m_pBuf, BsTransInfo_T::m_pMsgHdr, and _bsClientStruct::m_tblTransCache.
Referenced by bsClientDelete(), and bsClientTrans().
|
static |
Load cached response from transaction cache.
Cashing a response occurs when this client thread receives a response fo another client thread.
| pClient |
Definition at line 258 of file bsLibClient.c.
References BS_ECODE_MSG_TOO_BIG, BSCLIENT_LOG_ERROR, bsClientAttrGetName(), BSPROXY_TID_MASK, bsTransLock(), bsTransUnlock(), BsTransInfo_T::m_bCached, BsProxyMsgHdr_T::m_hdrBodyLen, BsProxyMsgHdr_T::m_hdrMsgId, BsTransInfo_T::m_pBuf, BsTransInfo_T::m_pMsgHdr, and _bsClientStruct::m_tblTransCache.
Referenced by bsClientTrans().
|
inlinestatic |
Lock client's transaction mutual exclusion.
| pClient |
Definition at line 97 of file bsLibClient.c.
References BS_ECODE_SYS, and BSCLIENT_LOG_SYSERROR.
Referenced by bsClientRecvRsp(), bsClientSendReq(), bsNextTid(), bsTransCacheRsp(), bsTransForget(), bsTransLoadCached(), bsTransMark(), bsVConnAdd(), bsVConnDelete(), bsVConnNew(), and bsVConnRemove().
|
static |
Mark the start of a client's server transaction in the transaction cache.
A client can be multi-threaded, and so the responses from the server may come out of order with respect to the client thread.
| pClient |
Definition at line 152 of file bsLibClient.c.
References BSPROXY_TID_MASK, bsTransLock(), bsTransUnlock(), BsTransInfo_T::m_bCached, BsTransInfo_T::m_pBuf, BsTransInfo_T::m_pMsgHdr, and _bsClientStruct::m_tblTransCache.
Referenced by bsClientTrans().
|
inlinestatic |
Try to lock client's transaction mutual exclusion.
| pClient |
Definition at line 132 of file bsLibClient.c.
References _bsClientStruct::m_mutexTrans.
|
inlinestatic |
Unlock client's transaction mutual exclusion.
| pClient |
Definition at line 113 of file bsLibClient.c.
References BS_ECODE_SYS, BSCLIENT_LOG_SYSERROR, and _bsClientStruct::m_mutexTrans.
Referenced by bsClientRecvRsp(), bsClientSendReq(), bsNextTid(), bsTransCacheRsp(), bsTransForget(), bsTransLoadCached(), bsTransMark(), bsVConnAdd(), bsVConnDelete(), bsVConnNew(), and bsVConnRemove().
| int bsVConnAdd | ( | BsClient_T * | pClient, |
| BsVConnHnd_T | hndVConn, | ||
| int | index | ||
| ) |
Add a created vConnection to the client's tblHndIndex table.
| pClient |
Definition at line 1506 of file bsLibClient.c.
References BS_ECODE_INTERNAL, BS_OK, BSCLIENT_IS_VCONN_HANDLE, BSCLIENT_LOG_ERROR, BSCLIENT_TRY_EXPR, BSPROXY_VCONN_CLIENT_MAX, BSPROXY_VCONN_UNDEF, bsTransLock(), bsTransUnlock(), BsVConn_T::m_hndVConn, _bsClientStruct::m_nVConnCount, _bsClientStruct::m_tblHndIndex, and _bsClientStruct::m_tblVConn.
Referenced by bsGetVConn(), and bsServerReqOpenDev().
| void bsVConnClearAll | ( | BsClient_T * | pClient | ) |
Remove and delete all of a client's vConnections.
| pClient |
Definition at line 1478 of file bsLibClient.c.
References BSPROXY_VCONN_UNDEF, bsVConnDelete(), bsVConnRemove(), and _bsClientStruct::m_tblHndIndex.
Referenced by bsClientDelete(), bsGetVConn(), and bsServerDisconnect().
| int bsVConnDelete | ( | BsClient_T * | pClient, |
| int | index | ||
| ) |
Delete a vConnection (and proxied device) from the client's tblVConn table.
| pClient |
Definition at line 1684 of file bsLibClient.c.
References BS_ECODE_INTERNAL, BS_OK, BSCLIENT_LOG_ERROR, BSCLIENT_TRY_EXPR, BSPROXY_VCONN_CLIENT_MAX, bsTransLock(), bsTransUnlock(), BsVConn_T::m_sDevName, BsVConn_T::m_sModName, and _bsClientStruct::m_tblVConn.
Referenced by bsGetVConn(), bsServerReqCloseDev(), bsServerReqOpenDev(), and bsVConnClearAll().
| int bsVConnNew | ( | BsClient_T * | pClient, |
| const char * | sDevName, | ||
| const char * | sModName, | ||
| const BsClientAppInfo_T * | pAppInfo, | ||
| bool_t | bTrace | ||
| ) |
Reserve a new client vConnection (and proxied device) in the client's tblVConn table.
| pClient |
Definition at line 1614 of file bsLibClient.c.
References BS_ECODE_INTERNAL, BS_ECODE_NO_RSRC, BS_OK, BSCLIENT_LOG_ERROR, bsClientAttrGetVConnCount(), BSPROXY_VCONN_CLIENT_MAX, BSPROXY_VCONN_UNDEF, bsTransLock(), bsTransUnlock(), BsVConn_T::m_bTrace, BsVConn_T::m_hndVConn, BsVConn_T::m_pAppInfo, BsVConn_T::m_sDevName, BsVConn_T::m_sModName, and _bsClientStruct::m_tblVConn.
Referenced by bsGetVConn(), and bsServerReqOpenDev().
| int bsVConnRemove | ( | BsClient_T * | pClient, |
| BsVConnHnd_T | hndVConn | ||
| ) |
Remove a vConnection from the client's tblHndIndex table.
| pClient |
Definition at line 1565 of file bsLibClient.c.
References BS_ECODE_INTERNAL, BSCLIENT_IS_VCONN_HANDLE, BSCLIENT_LOG_ERROR, BSCLIENT_TRY_EXPR, BSPROXY_VCONN_UNDEF, bsTransLock(), bsTransUnlock(), BsVConn_T::m_hndVConn, _bsClientStruct::m_nVConnCount, _bsClientStruct::m_tblHndIndex, and _bsClientStruct::m_tblVConn.
Referenced by bsGetVConn(), bsServerReqCloseDev(), and bsVConnClearAll().
|
inlinestatic |
FD_SET() wrapper with no annoying warnings.
| fd | File descriptor to add to set. |
| pset | Pointer to fd set. |
Definition at line 81 of file bsLibClient.c.
Referenced by bsClientRead(), and bsClientWrite().
|
static |
Calculate the elapsed time between the given time mark and this call.
| pTvMark | Pointer to timeval holding time mark. |
Definition at line 358 of file bsLibClient.c.
References timer_mark().
Referenced by bsClientRead(), bsClientWrite(), ClientRead(), and ClientWrite().
|
inlinestatic |
Mark the current time. Resolution is microseconds.
| pTvMark | Pointer to timeval structure to be populated with the current system time in seconds and useconds. |
Definition at line 340 of file bsLibClient.c.
Referenced by bsClientRead(), bsClientWrite(), ClientRead(), ClientWrite(), and timer_elapsed().