![]() |
botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
|
BotSense bsProxy Dynamically Linked Library module interface. More...
Go to the source code of this file.
Classes | |
struct | BsModInfo_T |
Standard bsProxy static interface module information structure type. More... | |
struct | BsModRsrcTbl_T |
Useful indirect indexing of handle to resource instance structure. More... | |
struct | BsModIter_T |
Module Iterator Type. More... | |
struct | BsModProxyCb_T |
Interface Module callbacks to bsProxy services type. More... | |
Macros | |
#define | BSMOD_SYM_INIT bsModInit |
Required Module Symbols. See below for function prototypes. More... | |
#define | BSMOD_SYM_EXIT bsModExit |
module deinit exit function | |
#define | BSMOD_SYM_OPEN bsModOpen |
open device function | |
#define | BSMOD_SYM_CLOSE bsModClose |
close device function | |
#define | BSMOD_SYM_REQUEST bsModRequest |
process client request function | |
#define | BSMOD_SYM_TRACE bsModTrace |
enable/disable tracing function | |
#define | BSMOD_SYM_INFO bsModInfo |
get module static info function | |
#define | _S_EXP(x) _S_LIT(x) |
Convert expanded macro parameter to string literal. More... | |
#define | _S_LIT(x) #x |
Convert macro parameter to string literal. More... | |
#define | BSMOD_SYM_INIT_S _S_EXP(BSMOD_SYM_INIT) |
Required Module Symbols Strings. More... | |
#define | BSMOD_SYM_EXIT_S _S_EXP(BSMOD_SYM_EXIT) |
exit function string | |
#define | BSMOD_SYM_OPEN_S _S_EXP(BSMOD_SYM_OPEN) |
open function string | |
#define | BSMOD_SYM_CLOSE_S _S_EXP(BSMOD_SYM_CLOSE) |
close function string | |
#define | BSMOD_SYM_REQUEST_S _S_EXP(BSMOD_SYM_REQUEST) |
request func string | |
#define | BSMOD_SYM_TRACE_S _S_EXP(BSMOD_SYM_TRACE) |
tracing func string | |
#define | BSMOD_SYM_INFO_S _S_EXP(BSMOD_SYM_INFO) |
info function string | |
#define | BSMOD_IS_VCONN_HANDLE(hndVConn) |
Test if the handle is in the valid module virtual connection range. More... | |
#define | BSMOD_RSRC_IS_FREE(pRsrcTbl, hndVConn) |
Test if the resource table resource handle slot is free. More... | |
#define | BSMOD_RSRC_IS_INUSE(pRsrcTbl, hndVConn) |
Test if the resource table resource handle slot is in-use. More... | |
#define | BSMOD_RSRC_INDEX(pRsrcTbl, hndVConn) |
Get the resource index given the handle. More... | |
#define | BSMOD_RSRC(pRsrcTbl, hndVConn) |
Get the resource given the handle. More... | |
#define | BSMOD_RSRC_INUSE_COUNT(pRsrcTbl) ((pRsrcTbl)->m_uInUseCount) |
Get the resouce table current in-use count. More... | |
#define | BSMOD_LOG_WARN(hndVConn, ecode, wfmt, ...) |
Log Interface Module Warning. More... | |
#define | BSMOD_LOG_ERROR(hndVConn, ecode, efmt, ...) |
Log Interface Module Error. More... | |
#define | BSMOD_LOG_NMERROR(hndVConn, nmecode, efmt, ...) |
Log Interface Module NetMsgs (Un)Packing Error. More... | |
#define | BSMOD_LOG_SYSERROR(hndVConn, efmt, ...) |
Log Interface Module System Error. More... | |
#define | BSMOD_SEND_ERROR_RSP(pCb, hndVConn, uTid, ecode, efmt, ...) |
Log BotSense Error and Send Error Response. More... | |
#define | BSMOD_SEND_NMERROR_RSP(pCb, hndVConn, uTid, nmecode, efmt, ...) |
Log NetMsgs (Un)Packing Error and Send Error Response. More... | |
#define | BSMOD_SEND_SYSERROR_RSP(pCb, hndVConn, uTid, efmt, ...) |
Log System Error and Send Error Response. More... | |
#define | BSMOD_TRY_VCONN_HND_RANGE(hndVConn) |
Check if handle is within the range of module handles. More... | |
Typedefs | |
typedef int( | BsModInitFunc_T) (const char *sModUri, const BsModProxyCb_T *pCallbacks) |
Initialize module. More... | |
typedef BsModInitFunc_T * | BsModInitFunc_P |
pointer to init function | |
typedef void( | BsModExitFunc_T) () |
Exit module. More... | |
typedef BsModExitFunc_T * | BsModExitFunc_P |
pointer to exit function | |
typedef int( | BsModOpenFunc_T) (BsVConnHnd_T hndVConn, bool_t bTrace, const char *sDevUri, byte_t argbuf[], size_t uArgLen) |
Open device controlled by module and associate with handle. More... | |
typedef BsModOpenFunc_T * | BsModOpenFunc_P |
pointer to open function | |
typedef int( | BsModCloseFunc_T) (BsVConnHnd_T hndVConn) |
Close device controlled by module and disassociate handle. More... | |
typedef BsModCloseFunc_T * | BsModCloseFunc_P |
pointer to close function | |
typedef int( | BsModRequestFunc_T) (BsVConnHnd_T hndVConn, BsTid_T uTid, BsMsgId_T uMsgIdReq, byte_t bufReq[], size_t uReqLen) |
Service client-specific request directed to this interface module. More... | |
typedef BsModRequestFunc_T * | BsModRequestFunc_P |
pointer to request func. | |
typedef int( | BsModTraceFunc_T) (BsVConnHnd_T hndVConn, bool_t bTrace) |
Enable/disable message tracing on handle. More... | |
typedef BsModTraceFunc_T * | BsModTraceFunc_P |
pointer to msg trace func. | |
typedef const BsModInfo_T *( | BsModInfoFunc_T) () |
Query for the static module information. More... | |
typedef BsModInfoFunc_T * | BsModInfoFunc_P |
pointer to mod info function | |
Enumerations | |
enum | BsModIterOver_T { BsModIterOverDevUri, BsModIterOverModUri, BsModIterOverVConn } |
What to iterate over. More... | |
Variables | |
BsModInitFunc_T | bsModInit |
init prototype | |
BsModExitFunc_T | bsModExit |
exit prototype | |
BsModOpenFunc_T | bsModOpen |
open prototype | |
BsModCloseFunc_T | bsModClose |
close prototype | |
BsModRequestFunc_T | bsModRequest |
request prototype | |
BsModTraceFunc_T | bsModTrace |
trace prototype | |
BsModInfoFunc_T | bsModInfo |
mod info prototype | |
BotSense bsProxy Dynamically Linked Library module interface.
The client side assumes responsibility for "doing the right thing". So, bsProxy does minimal consistency checking.
A bsProxy module must be thread safe. The bsProxy device thread provides context control and sequencing.
The bsProxy provides a unique handle to identify a specific device-module instance (virtual connection).
A bsProxy interface module:
Definition in file bsProxyModIF.h.
#define _S_EXP | ( | x | ) | _S_LIT(x) |
Convert expanded macro parameter to string literal.
x | Parameter. |
Definition at line 92 of file bsProxyModIF.h.
#define _S_LIT | ( | x | ) | #x |
Convert macro parameter to string literal.
x | Parameter. |
Definition at line 98 of file bsProxyModIF.h.
#define BSMOD_IS_VCONN_HANDLE | ( | hndVConn | ) |
Test if the handle is in the valid module virtual connection range.
hndVConn | Virtual connection handle. |
Definition at line 149 of file bsProxyModIF.h.
Referenced by bsModI2CReqRead(), bsModI2CReqScan(), bsModI2CReqTrans(), bsModI2CReqWrite(), bsModNullReqWrite(), bsModRequest(), bsModSerialReqRead(), bsModSerialReqTrans(), bsModSerialReqWrite(), bsModTrace(), ModCbRsrcAdd(), and ModCbRsrcRemove().
#define BSMOD_LOG_ERROR | ( | hndVConn, | |
ecode, | |||
efmt, | |||
... | |||
) |
Log Interface Module Error.
hndVConn | Virtual connection handle. |
ecode |
Definition at line 405 of file bsProxyModIF.h.
Referenced by bsModClose(), bsModOpen(), and bsModTrace().
#define BSMOD_LOG_NMERROR | ( | hndVConn, | |
nmecode, | |||
efmt, | |||
... | |||
) |
Log Interface Module NetMsgs (Un)Packing Error.
hndVConn | Virtual connection handle. |
nmecode | NetMsgs error code. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 419 of file bsProxyModIF.h.
Referenced by bsModOpen().
#define BSMOD_LOG_SYSERROR | ( | hndVConn, | |
efmt, | |||
... | |||
) |
Log Interface Module System Error.
hndVConn | Virtual connection handle. |
efmt | Error output format string litteral. |
... | Error variable arguments. |
Definition at line 431 of file bsProxyModIF.h.
Referenced by bsModOpen().
#define BSMOD_LOG_WARN | ( | hndVConn, | |
ecode, | |||
wfmt, | |||
... | |||
) |
Log Interface Module Warning.
hndVConn | Virtual connection handle. |
ecode |
Definition at line 391 of file bsProxyModIF.h.
#define BSMOD_RSRC | ( | pRsrcTbl, | |
hndVConn | |||
) |
Get the resource given the handle.
pRsrcTbl | Pointer to resource table. |
hndVConn | Virtual connection handle. |
Definition at line 196 of file bsProxyModIF.h.
Referenced by bsModI2CReqRead(), bsModI2CReqScan(), bsModI2CReqTrans(), bsModI2CReqWrite(), bsModNullReqWrite(), bsModRequest(), bsModSerialReqRead(), bsModSerialReqTrans(), bsModSerialReqWrite(), and bsModTrace().
#define BSMOD_RSRC_INDEX | ( | pRsrcTbl, | |
hndVConn | |||
) |
Get the resource index given the handle.
pRsrcTbl | Pointer to resource table. |
hndVConn | Virtual connection handle. |
Definition at line 181 of file bsProxyModIF.h.
Referenced by ModCbRsrcRemove().
#define BSMOD_RSRC_INUSE_COUNT | ( | pRsrcTbl | ) | ((pRsrcTbl)->m_uInUseCount) |
Get the resouce table current in-use count.
pRsrcTbl | Pointer to resource table. |
Definition at line 208 of file bsProxyModIF.h.
Referenced by bsModOpen().
#define BSMOD_RSRC_IS_FREE | ( | pRsrcTbl, | |
hndVConn | |||
) |
Test if the resource table resource handle slot is free.
pRsrcTbl | Pointer to resource table. |
hndVConn | Virtual connection handle. |
Definition at line 159 of file bsProxyModIF.h.
#define BSMOD_RSRC_IS_INUSE | ( | pRsrcTbl, | |
hndVConn | |||
) |
Test if the resource table resource handle slot is in-use.
pRsrcTbl | Pointer to resource table. |
hndVConn | Virtual connection handle. |
Definition at line 169 of file bsProxyModIF.h.
Referenced by bsModClose(), and bsModOpen().
#define BSMOD_SEND_ERROR_RSP | ( | pCb, | |
hndVConn, | |||
uTid, | |||
ecode, | |||
efmt, | |||
... | |||
) |
Log BotSense Error and Send Error Response.
pCb | Pointer to server callbacks. |
hndVConn | Virtual connection handle. |
uTid | Request-Response transaction id. |
ecode |
Definition at line 447 of file bsProxyModIF.h.
Referenced by bsModI2CReqRead(), bsModI2CReqScan(), bsModI2CReqTrans(), bsModI2CReqWrite(), bsModNullReqWrite(), bsModRequest(), bsModSerialReqRead(), bsModSerialReqTrans(), and bsModSerialReqWrite().
#define BSMOD_SEND_NMERROR_RSP | ( | pCb, | |
hndVConn, | |||
uTid, | |||
nmecode, | |||
efmt, | |||
... | |||
) |
Log NetMsgs (Un)Packing Error and Send Error Response.
pCb | Pointer to server callbacks. |
hndVConn | Virtual connection handle. |
uTid | Request-Response transaction id. |
nmecode | NetMsgs error code. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 464 of file bsProxyModIF.h.
Referenced by bsModI2CReqRead(), bsModI2CReqScan(), bsModI2CReqTrans(), bsModI2CReqWrite(), bsModNullReqWrite(), bsModSerialReqRead(), bsModSerialReqTrans(), and bsModSerialReqWrite().
#define BSMOD_SEND_SYSERROR_RSP | ( | pCb, | |
hndVConn, | |||
uTid, | |||
efmt, | |||
... | |||
) |
Log System Error and Send Error Response.
pCb | Pointer to server callbacks. |
hndVConn | Virtual connection handle. |
uTid | Request-Response transaction id. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 481 of file bsProxyModIF.h.
Referenced by bsModI2CReqRead(), bsModI2CReqScan(), bsModI2CReqTrans(), bsModI2CReqWrite(), bsModNullReqWrite(), bsModSerialReqRead(), bsModSerialReqTrans(), and bsModSerialReqWrite().
#define BSMOD_SYM_INIT bsModInit |
Required Module Symbols. See below for function prototypes.
module initialization function
Definition at line 80 of file bsProxyModIF.h.
#define BSMOD_SYM_INIT_S _S_EXP(BSMOD_SYM_INIT) |
Required Module Symbols Strings.
init function string
Definition at line 103 of file bsProxyModIF.h.
Referenced by ModDllNewIF().
#define BSMOD_TRY_VCONN_HND_RANGE | ( | hndVConn | ) |
Check if handle is within the range of module handles.
If the check is false, an appropriate error is logged and the calling function is immediately exited by invoking a return with the appropriate < 0 error code.
hndVConn | Virtual connection handle. |
Definition at line 499 of file bsProxyModIF.h.
Referenced by bsModClose(), and bsModOpen().
typedef int( BsModCloseFunc_T) (BsVConnHnd_T hndVConn) |
Close device controlled by module and disassociate handle.
The handle instance specific resources should be freed.
hndVConn | Virtual connection handle. |
Definition at line 580 of file bsProxyModIF.h.
typedef void( BsModExitFunc_T) () |
Exit module.
Called once prior to module being unloaded.
Any module owned resources should be freed here. Any active handles associated opened devices should be closed.
Definition at line 540 of file bsProxyModIF.h.
typedef const BsModInfo_T*( BsModInfoFunc_T) () |
Query for the static module information.
Definition at line 620 of file bsProxyModIF.h.
typedef int( BsModInitFunc_T) (const char *sModUri, const BsModProxyCb_T *pCallbacks) |
Initialize module.
Called once after module is loaded.
Global module initialization and resource allocation should be done here.
sModUri | Expanded, canonical module path name. |
pCallbacks | Pointer to a set of module -> bsProxy core callback functions. |
Definition at line 528 of file bsProxyModIF.h.
typedef int( BsModOpenFunc_T) (BsVConnHnd_T hndVConn, bool_t bTrace, const char *sDevUri, byte_t argbuf[], size_t uArgLen) |
Open device controlled by module and associate with handle.
Subsequent calls to the module use the given handle to associate the specific module-device instance.
The argument buffer contains packed message arguements specific to the device and module.
hndVConn | Virtual connection handle. |
bTrace | Do [not] enable message tracing on this handle. |
sDevUri | Expanded, canonical device path name. |
argbuf | Packed specific open configuration arguments submessage. |
uArgLen | Length of packed argumets in buffer (number of bytes). |
On error, the appropriate < 0 negated BotSense Error Code is returned.
Definition at line 563 of file bsProxyModIF.h.
typedef int( BsModRequestFunc_T) (BsVConnHnd_T hndVConn, BsTid_T uTid, BsMsgId_T uMsgIdReq, byte_t bufReq[], size_t uReqLen) |
Service client-specific request directed to this interface module.
hndVConn | Virtual connection handle. |
uTid | Request-Response transaction id. |
uMsgIdReq | Request message id. |
bufReq | Packed request message buffer. |
uReqLen | Length of request in buffer (number of bytes). |
Definition at line 596 of file bsProxyModIF.h.
typedef int( BsModTraceFunc_T) (BsVConnHnd_T hndVConn, bool_t bTrace) |
Enable/disable message tracing on handle.
hndVConn | Virtual connection handle. |
bTrace | Do [not] enable message tracing on this handle. |
Definition at line 611 of file bsProxyModIF.h.
enum BsModIterOver_T |
What to iterate over.
Enumerator | |
---|---|
BsModIterOverDevUri |
iterator over device URI |
BsModIterOverModUri |
iterator over module URI |
BsModIterOverVConn |
iterator over virtual connections (no pattern) |
Definition at line 213 of file bsProxyModIF.h.