62 #ifndef _BSPROXYMODIF_H 63 #define _BSPROXYMODIF_H 65 #include "rnr/rnrconfig.h" 66 #include "rnr/netmsgs.h" 80 #define BSMOD_SYM_INIT bsModInit 81 #define BSMOD_SYM_EXIT bsModExit
82 #define BSMOD_SYM_OPEN bsModOpen
83 #define BSMOD_SYM_CLOSE bsModClose
84 #define BSMOD_SYM_REQUEST bsModRequest
85 #define BSMOD_SYM_TRACE bsModTrace
86 #define BSMOD_SYM_INFO bsModInfo
92 #define _S_EXP(x) _S_LIT(x) 103 #define BSMOD_SYM_INIT_S _S_EXP(BSMOD_SYM_INIT) 104 #define BSMOD_SYM_EXIT_S _S_EXP(BSMOD_SYM_EXIT)
105 #define BSMOD_SYM_OPEN_S _S_EXP(BSMOD_SYM_OPEN)
106 #define BSMOD_SYM_CLOSE_S _S_EXP(BSMOD_SYM_CLOSE)
107 #define BSMOD_SYM_REQUEST_S _S_EXP(BSMOD_SYM_REQUEST)
108 #define BSMOD_SYM_TRACE_S _S_EXP(BSMOD_SYM_TRACE)
109 #define BSMOD_SYM_INFO_S _S_EXP(BSMOD_SYM_INFO)
149 #define BSMOD_IS_VCONN_HANDLE(hndVConn) \ 150 (((int)(hndVConn) >= BSPROXY_VCONN_MOD_MIN) && \ 151 ((int)(hndVConn) <= BSPROXY_VCONN_MOD_MAX)) 159 #define BSMOD_RSRC_IS_FREE(pRsrcTbl, hndVConn) \ 160 (BSMOD_IS_VCONN_HANDLE(hndVConn) && \ 161 (pRsrcTbl)->m_vecIndex[hndVConn] == (byte_t)BSPROXY_VCONN_UNDEF) 169 #define BSMOD_RSRC_IS_INUSE(pRsrcTbl, hndVConn) \ 170 (BSMOD_IS_VCONN_HANDLE(hndVConn) && \ 171 (pRsrcTbl)->m_vecIndex[hndVConn] != (byte_t)BSPROXY_VCONN_UNDEF) 181 #define BSMOD_RSRC_INDEX(pRsrcTbl, hndVConn) \ 182 ( BSMOD_IS_VCONN_HANDLE(hndVConn)? \ 183 ((pRsrcTbl)->m_vecIndex[hndVConn] != (byte_t)BSPROXY_VCONN_UNDEF? \ 184 (int)((pRsrcTbl)->m_vecIndex[hndVConn]): -1): \ 196 #define BSMOD_RSRC(pRsrcTbl, hndVConn) \ 197 ( BSMOD_IS_VCONN_HANDLE(hndVConn)? \ 198 ((pRsrcTbl)->m_vecIndex[hndVConn] != (byte_t)BSPROXY_VCONN_UNDEF? \ 199 ((pRsrcTbl)->m_vecRsrc[(pRsrcTbl)->m_vecIndex[hndVConn]]): NULL): \ 208 #define BSMOD_RSRC_INUSE_COUNT(pRsrcTbl) ((pRsrcTbl)->m_uInUseCount) 331 const char *(*m_fnGetDevUri)(
BsVConnHnd_T hndVConn,
char dest[],
size_t n);
391 #define BSMOD_LOG_WARN(hndVConn, ecode, wfmt, ...) \ 392 LOGDIAG3("Warning: VConn=%d: %s(): %s(ecode=%d): " wfmt, \ 393 hndVConn, LOGFUNCNAME, \ 394 bsStrError(ecode), ((ecode)>=0? (ecode): -(ecode)), \ 405 #define BSMOD_LOG_ERROR(hndVConn, ecode, efmt, ...) \ 406 LOGERROR("VConn=%d: %s(): %s(ecode=%d): " efmt, \ 407 hndVConn, LOGFUNCNAME, \ 408 bsStrError(ecode), (ecode>=0? ecode: -ecode), \ 419 #define BSMOD_LOG_NMERROR(hndVConn, nmecode, efmt, ...) \ 420 BSMOD_LOG_ERROR(hndVConn, BS_ECODE_BAD_MSG, "%s(nmecode=%d): " efmt, \ 421 nmStrError(nmecode), (nmecode>=0? nmecode: -nmecode), \ 431 #define BSMOD_LOG_SYSERROR(hndVConn, efmt, ...) \ 432 LOGERROR("VConn=%d: %s(): %s(ecode=%d): %s(errno=%d): " efmt, \ 433 hndVConn, LOGFUNCNAME, \ 434 bsStrError(BS_ECODE_SYS), BS_ECODE_SYS, \ 435 strerror(errno), errno, ##__VA_ARGS__) 447 #define BSMOD_SEND_ERROR_RSP(pCb, hndVConn, uTid, ecode, efmt, ...) \ 450 BSMOD_LOG_ERROR(hndVConn, ecode, efmt, ##__VA_ARGS__); \ 451 (pCb)->m_cbSendErrorRsp(hndVConn, uTid, ecode, efmt, ##__VA_ARGS__); \ 464 #define BSMOD_SEND_NMERROR_RSP(pCb, hndVConn, uTid, nmecode, efmt, ...) \ 467 BSMOD_LOG_NMERROR(hndVConn, nmecode, efmt, ##__VA_ARGS__); \ 468 (pCb)->m_cbSendErrorRsp(hndVConn, uTid, BS_ECODE_BAD_MSG, efmt, \ 481 #define BSMOD_SEND_SYSERROR_RSP(pCb, hndVConn, uTid, efmt, ...) \ 484 BSMOD_LOG_SYSERROR(hndVConn, efmt, ##__VA_ARGS__); \ 485 (pCb)->m_cbSendErrorRsp(hndVConn, uTid, BS_ECODE_SYS, \ 486 "%s(errno=%d): " efmt, \ 487 strerror(errno), errno, ##__VA_ARGS__); \ 499 #define BSMOD_TRY_VCONN_HND_RANGE(hndVConn) \ 502 if( !BSMOD_IS_VCONN_HANDLE(hndVConn) ) \ 504 BSMOD_LOG_ERROR(hndVConn, BS_ECODE_BAD_VCONN_HND, \ 505 "Module vconn handle out-of-range."); \ 506 return -BS_ECODE_BAD_VCONN_HND; \ 639 #endif // _BSPROXYMODIF_H uint_t BsMsgId_T
client message id type [0-64k].
iterator over virtual connections (no pattern)
#define BSMOD_SYM_TRACE
enable/disable tracing function
BsModTraceFunc_T * BsModTraceFunc_P
pointer to msg trace func.
Useful indirect indexing of handle to resource instance structure.
BsModRequestFunc_T * BsModRequestFunc_P
pointer to request func.
BsModCloseFunc_T * BsModCloseFunc_P
pointer to close function
const char * maintainer
maintainer/owner
uint_t BsTid_T
client transaction id type [0-255].
uint_t m_uInUseCount
resources in-use count
BsModInfoFunc_T * BsModInfoFunc_P
pointer to mod info function
#define BSMOD_SYM_INIT
Required Module Symbols. See below for function prototypes.
const char * brief
brief one-line description
BsModExitFunc_T * BsModExitFunc_P
pointer to exit function
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.
const BsModInfo_T *( BsModInfoFunc_T)()
Query for the static module information.
const char * mod_name
module load name sans OS dependent substrings
int( BsModCloseFunc_T)(BsVConnHnd_T hndVConn)
Close device controlled by module and disassociate handle.
#define BSMOD_SYM_OPEN
open device function
Interface Module callbacks to bsProxy services type.
int( BsModTraceFunc_T)(BsVConnHnd_T hndVConn, bool_t bTrace)
Enable/disable message tracing on handle.
#define BSMOD_SYM_REQUEST
process client request function
int( BsModInitFunc_T)(const char *sModUri, const BsModProxyCb_T *pCallbacks)
Initialize module.
BsModOpenFunc_T * BsModOpenFunc_P
pointer to open function
char * m_sDevUri
device URI
uint_t m_uMaxResources
maximum resource count
int m_rd
module's resource descriptor
#define BSMOD_SYM_CLOSE
close device function
const char * date
version date
Standard bsProxy static interface module information structure type.
#define BSMOD_SYM_INFO
get module static info function
BsVConnHnd_T m_hndVConn
virtual connection handle
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.
const char * version
dotted version x.y.z[-app[-a.b.c]]
#define BSPROXY_VCONN_MOD_NUMOF
number of module-specific handles
#define BSMOD_SYM_EXIT
module deinit exit function
char * m_sModUri
module URI
void ** m_vecRsrc
vecRsrc[index] -> rsrc
BsModInitFunc_T * BsModInitFunc_P
pointer to init function
BsModIterOver_T
What to iterate over.
BsModIterOver_T m_eOver
iterator over enum
void( BsModExitFunc_T)()
Exit module.
<b><i>BotSense</i></b> package top-level, unifying header declarations.
int BsVConnHnd_T
virtual connection handle type
const char * license
short license/copyright statement