![]() |
botsense
3.2.0
RoadNarrows Client-Server Proxied Services Framework
|
BotSense bsProxy server plug-in DLL /dev/null device module. More...
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <string.h>#include <errno.h>#include "rnr/rnrconfig.h"#include "rnr/log.h"#include "rnr/new.h"#include "rnr/netmsgs.h"#include "botsense/BotSense.h"#include "botsense/libBotSense.h"#include "botsense/bsProxyModIF.h"#include "botsense/bsNull.h"#include "botsense/bsNullMsgs.h"Go to the source code of this file.
Classes | |
| struct | BsModCtlBlk_T |
| Module resource control block structure type. More... | |
Macros | |
| #define | BSMOD_MAX_HANDLES BSPROXY_VCONN_MOD_NUMOF |
| Maximum number of module supported simultaneous virtual connections. | |
Functions | |
| static BsModCtlBlk_T * | bsModCtlBlkNew (int fd, bool_t bTrace) |
| Allocate a new resource control block. More... | |
| static void | bsModCtlBlkDelete (BsModCtlBlk_T *pCtlBlk) |
| Delete an allocated resource control block. More... | |
| static int | bsModNullReqWrite (BsVConnHnd_T hndVConn, BsTid_T uTid, BsMsgId_T uMsgIdReq, byte_t bufReq[], size_t uReqLen) |
| Service a /dev/null write request. More... | |
| int | bsModInit (const char *sModUri, const BsModProxyCb_T *pCallbacks) |
| Initialize /dev/null module. More... | |
| void | bsModExit () |
| Exit /dev/null module. More... | |
| int | bsModOpen (BsVConnHnd_T hndVConn, bool_t bTrace, const char *sDevUri, byte_t argbuf[], size_t uArgSize) |
| Open an /dev/null device and associate with the given handle. More... | |
| int | bsModClose (BsVConnHnd_T hndVConn) |
| Close the /dev/null device and disassociate virtual connection handle. More... | |
| int | bsModRequest (BsVConnHnd_T hndVConn, BsTid_T uTid, BsMsgId_T uMsgIdReq, byte_t bufReq[], size_t uReqLen) |
| Service an /dev/null request. More... | |
| int | bsModTrace (BsVConnHnd_T hndVConn, bool_t bTrace) |
| Enable/disable message tracing on handle. More... | |
| const BsModInfo_T * | bsModInfo () |
| Query for the static module information. More... | |
Variables | |
| static BsModInfo_T | BsModInfo |
| Module static information. More... | |
| static const char * | BsModUri |
| module canonical name | |
| static const BsModProxyCb_T * | BsModCallbacks |
| module to bsProxy callbacks | |
| static BsModRsrcTbl_T * | BsModRsrcTbl |
| module resource table | |
BotSense bsProxy server plug-in DLL /dev/null device module.
Definition in file bsNullServer.c.
| int bsModClose | ( | BsVConnHnd_T | hndVConn | ) |
Close the /dev/null device and disassociate virtual connection handle.
The actual device and resources are only cleared if this is the last virtual connection reference to this device.
| hndVConn | Virtual connection handle. |
Definition at line 397 of file bsNullServer.c.
References BS_ECODE_INTERNAL, BS_ECODE_NO_VCONN, BS_OK, BSMOD_LOG_ERROR, BSMOD_RSRC_IS_INUSE, BSMOD_TRY_VCONN_HND_RANGE, bsModCtlBlkDelete(), BsModProxyCb_T::m_cbModRsrcRemove, and BsModCtlBlk_T::m_fd.
|
static |
Delete an allocated resource control block.
| pCtlBlk | Pointer to allocated control block. |
Definition at line 142 of file bsNullServer.c.
Referenced by bsModClose(), and bsModExit().
|
static |
Allocate a new resource control block.
| fd | File descriptor. |
| bTrace | Do [not] trace messages. |
Definition at line 125 of file bsNullServer.c.
References BsModCtlBlk_T::m_bTrace, and BsModCtlBlk_T::m_fd.
Referenced by bsModOpen().
| void bsModExit | ( | ) |
Exit /dev/null module.
Called once prior to module being unloaded.
All open /dev/null devices will be closed.
Definition at line 288 of file bsNullServer.c.
References BSMOD_MAX_HANDLES, bsModCtlBlkDelete(), BsModUri, BsModProxyCb_T::m_cbModRsrcTblDelete, BsModCtlBlk_T::m_fd, and BsModRsrcTbl_T::m_vecRsrc.
| const BsModInfo_T* bsModInfo | ( | ) |
Query for the static module information.
Definition at line 526 of file bsNullServer.c.
References BsModInfo.
| int bsModInit | ( | const char * | sModUri, |
| const BsModProxyCb_T * | pCallbacks | ||
| ) |
Initialize /dev/null module.
Called once after module is loaded.
| sModUri | Expanded, canonical module path name. |
| pCallbacks | Pointer to a set of module -> bsProxy core callback functions. |
Definition at line 268 of file bsNullServer.c.
References BS_OK, BSMOD_MAX_HANDLES, BsModUri, and BsModProxyCb_T::m_cbModRsrcTblNew.
|
static |
Service a /dev/null write request.
| hndVConn | Virtual connection handle. |
| uTid | Request-Response transaction id. |
| uMsgIdReq | Request message id. |
| bufReq | Packed request message buffer. |
| uReqLen | Size of request in buffer (number of bytes). |
Definition at line 163 of file bsNullServer.c.
References BS_ECODE_BAD_MSG, BS_ECODE_BAD_VCONN_HND, BS_ECODE_NO_VCONN, BS_ECODE_SYS, BS_OK, BSMOD_IS_VCONN_HANDLE, BSMOD_RSRC, BSMOD_SEND_ERROR_RSP, BSMOD_SEND_NMERROR_RSP, BSMOD_SEND_SYSERROR_RSP, BsNullMsgIdRspWrite, BsNullPackRspWrite(), BsNullUnpackReqWrite(), BSPROXY_BUF_BODY, BSPROXY_MSG_MAX_LEN, BsModCtlBlk_T::m_bTrace, BsNullRspWrite_T::m_byteswritten, BsModProxyCb_T::m_cbSendRsp, BsNullReqWrite_T::m_count, BsModCtlBlk_T::m_fd, BsNullReqWrite_T::m_writebuf, and BsNullReqWrite_T::u.
Referenced by bsModRequest().
| int bsModOpen | ( | BsVConnHnd_T | hndVConn, |
| bool_t | bTrace, | ||
| const char * | sDevUri, | ||
| byte_t | argbuf[], | ||
| size_t | uArgSize | ||
| ) |
Open an /dev/null device and associate with the given 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. For this /dev/null module, there are now additional arguments.
| hndVConn | Virtual connection handle. |
| bTrace | Do [not] enable message tracing on this handle. |
| sDevUri | Device URI. |
| argbuf | Packed specific open configuration arguments submessage. |
| uArgSize | Size of packed argumets in buffer (number of bytes). |
Definition at line 337 of file bsNullServer.c.
References BS_ECODE_BUSY, BS_ECODE_NO_RSRC, BS_ECODE_SYS, BSMOD_LOG_ERROR, BSMOD_LOG_SYSERROR, BSMOD_MAX_HANDLES, BSMOD_RSRC_INUSE_COUNT, BSMOD_RSRC_IS_INUSE, BSMOD_TRY_VCONN_HND_RANGE, bsModCtlBlkNew(), and BsModProxyCb_T::m_cbModRsrcAdd.
| int bsModRequest | ( | BsVConnHnd_T | hndVConn, |
| BsTid_T | uTid, | ||
| BsMsgId_T | uMsgIdReq, | ||
| byte_t | bufReq[], | ||
| size_t | uReqLen | ||
| ) |
Service an /dev/null request.
| hndVConn | Virtual connection handle. |
| uTid | Request-Response transaction id. |
| uMsgIdReq | Request message id. |
| bufReq | Packed request message buffer. |
| uReqLen | Size of request in buffer (number of bytes). |
Definition at line 446 of file bsNullServer.c.
References BS_ECODE_BAD_VCONN_HND, BS_ECODE_NO_VCONN, BS_ECODE_UNKNOWN_REQ, BSMOD_IS_VCONN_HANDLE, BSMOD_RSRC, BSMOD_SEND_ERROR_RSP, bsModNullReqWrite(), and BsNullMsgIdReqWrite.
| int bsModTrace | ( | 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 492 of file bsNullServer.c.
References BS_ECODE_BAD_VCONN_HND, BS_ECODE_NO_VCONN, BS_OK, BSMOD_IS_VCONN_HANDLE, BSMOD_LOG_ERROR, BSMOD_RSRC, and BsModCtlBlk_T::m_bTrace.
|
static |
Module static information.
Definition at line 75 of file bsNullServer.c.
Referenced by bsModInfo().