botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsNullMsgs.h File Reference

BotSense bsProxy server - client /dev/null NetMsgs XML Definition. More...

#include "rnr/rnrconfig.h"
#include "rnr/netmsgs.h"
#include "botsense/BotSense.h"

Go to the source code of this file.

Classes

struct  BsNullReqWrite_T
 
struct  BsNullRspWrite_T
 

Macros

#define BSNULL_REQWRITE_WRITEBUF_LEN   (NMFVAL_LEN_MAX_VECTOR)
 

Enumerations

enum  BsNullMsgId_T {
  BsNullMsgIdNone = 0,
  BsNullMsgIdReqWrite = 1,
  BsNullMsgIdRspWrite = 2,
  BsNullMsgIdNumOf = 3
}
 

Functions

const NMMsgDef_T * BsNullLookupMsgDef (BsNullMsgId_T eMsgId)
 Look up the message definition associated with the message id. More...
 
size_t BsNullLookupMsgMaxLen (BsNullMsgId_T eMsgId)
 Look up the message maximum length associated with the message id. More...
 
int BsNullPackMsg (BsNullMsgId_T eMsgId, void *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
 Pack a ITV message in big-endian byte order. More...
 
int BsNullUnpackMsg (BsNullMsgId_T eMsgId, byte_t buf[], size_t uMsgLen, void *pStruct, bool_t bTrace)
 Unpack a ITV message in big-endian byte order. More...
 
INLINE_IN_H int BsNullPackReqWrite (BsNullReqWrite_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
 Pack a BsNullReqWrite ITV message in big-endian byte order into the output buffer. More...
 
INLINE_IN_H int BsNullUnpackReqWrite (byte_t buf[], size_t uMsgLen, BsNullReqWrite_T *pStruct, bool_t bTrace)
 Unpack a BsNullReqWrite ITV message in big-endian byte order from the input buffer. More...
 
INLINE_IN_H int BsNullPackRspWrite (BsNullRspWrite_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
 Pack a BsNullRspWrite ITV message in big-endian byte order into the output buffer. More...
 
INLINE_IN_H int BsNullUnpackRspWrite (byte_t buf[], size_t uMsgLen, BsNullRspWrite_T *pStruct, bool_t bTrace)
 Unpack a BsNullRspWrite ITV message in big-endian byte order from the input buffer. More...
 

Variables

const NMMsgDef_T * BsNullMsgDefLookupTbl []
 
size_t BsNullMsgMaxLenLookupTbl []
 

Detailed Description

BotSense bsProxy server - client /dev/null NetMsgs XML Definition.

Warning
This file was auto-generated on 2018.08.10 13:54:23 from the NetMsgs XML specification bsNullMsgs.xml.
Copyright:
(C) 2018. RoadNarrows LLC (http://www.roadnarrows.com) All Rights Reserved

Definition in file bsNullMsgs.h.

Macro Definition Documentation

#define BSNULL_REQWRITE_WRITEBUF_LEN   (NMFVAL_LEN_MAX_VECTOR)

ReqWrite writebuf maximum vector length

Definition at line 54 of file bsNullMsgs.h.

Referenced by bsNullReqWrite().

Enumeration Type Documentation

BsNull Message Id Enumeration

Enumerator
BsNullMsgIdNone 

no message

BsNullMsgIdReqWrite 

ReqWrite.

BsNullMsgIdRspWrite 

RspWrite.

BsNullMsgIdNumOf 

number of message ids

Definition at line 35 of file bsNullMsgs.h.

36 {
37  BsNullMsgIdNone = 0, ///< no message
38  BsNullMsgIdReqWrite = 1, ///< ReqWrite
39  BsNullMsgIdRspWrite = 2, ///< RspWrite
40  BsNullMsgIdNumOf = 3 ///< number of message ids
no message
Definition: bsNullMsgs.h:37
number of message ids
Definition: bsNullMsgs.h:40
BsNullMsgId_T
Definition: bsNullMsgs.h:35

Function Documentation

const NMMsgDef_T* BsNullLookupMsgDef ( BsNullMsgId_T  eMsgId)

Look up the message definition associated with the message id.

Parameters
eMsgIdMessage Id.
Returns
On success, returns the pointer to the NMMsgDef_T. On error, NULL is returned.

Definition at line 186 of file bsNullMsgs.c.

References BsNullMsgDefLookupTbl, and BsNullMsgIdNumOf.

Referenced by bsNullGetMsgName(), BsNullPackMsg(), and BsNullUnpackMsg().

187 {
188  if( (uint_t)eMsgId >= (uint_t)BsNullMsgIdNumOf )
189  {
190  return NULL;
191  }
192  else
193  {
194  return BsNullMsgDefLookupTbl[(uint_t)eMsgId];
195  }
196 }
const NMMsgDef_T * BsNullMsgDefLookupTbl[]
Definition: bsNullMsgs.c:153
number of message ids
Definition: bsNullMsgs.h:40
size_t BsNullLookupMsgMaxLen ( BsNullMsgId_T  eMsgId)

Look up the message maximum length associated with the message id.

The maximum length is the total number of packed bytes possible for the given message. The message may be much shorter.

Parameters
eMsgIdMessage Id.
Returns
On success, returns the number of bytes. On error, 0 is returned.

Definition at line 210 of file bsNullMsgs.c.

References BsNullMsgIdNumOf, and BsNullMsgMaxLenLookupTbl.

211 {
212  if( (uint_t)eMsgId >= (uint_t)BsNullMsgIdNumOf )
213  {
214  return (size_t)0;
215  }
216  else
217  {
218  return BsNullMsgMaxLenLookupTbl[(uint_t)eMsgId];
219  }
220 }
size_t BsNullMsgMaxLenLookupTbl[]
Definition: bsNullMsgs.c:164
number of message ids
Definition: bsNullMsgs.h:40
int BsNullPackMsg ( BsNullMsgId_T  eMsgId,
void *  pStruct,
byte_t  buf[],
size_t  bufSize,
bool_t  bTrace 
)

Pack a ITV message in big-endian byte order.

Parameters
eMsgIdMessage Id.
[in]pStructPointer to the associated, populated message structure.
[out]bufOutput message buffer.
bufSizeSize of output buffer.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes packed. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 236 of file bsNullMsgs.c.

References BsNullLookupMsgDef().

Referenced by BsNullPackReqWrite(), and BsNullPackRspWrite().

241 {
242  const NMMsgDef_T *pMsgDef;
243 
244  if( (pMsgDef = BsNullLookupMsgDef(eMsgId)) == NULL )
245  {
246  LOGERROR("%s(ecode=%d): msgid=%u.",
247  nmStrError(NM_ECODE_MSGID), NM_ECODE_MSGID, eMsgId);
248  return -NM_ECODE_MSGID;
249  }
250 
251  if( bTrace )
252  {
253  return nmPackITVMsgDebug(pMsgDef, pStruct, buf, bufSize, NMEndianBig);
254  }
255  else
256  {
257  return nmPackITVMsg(pMsgDef, pStruct, buf, bufSize, NMEndianBig);
258  }
259 }
const NMMsgDef_T * BsNullLookupMsgDef(BsNullMsgId_T eMsgId)
Look up the message definition associated with the message id.
Definition: bsNullMsgs.c:186
INLINE_IN_H int BsNullPackReqWrite ( BsNullReqWrite_T pStruct,
byte_t  buf[],
size_t  bufSize,
bool_t  bTrace 
)

Pack a BsNullReqWrite ITV message in big-endian byte order into the output buffer.

Parameters
[in]pStructPointer to the associated, populated message structure.
[out]bufOutput message buffer.
bufSizeSize of output buffer.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes packed. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 138 of file bsNullMsgs.h.

References BsNullMsgIdReqWrite, and BsNullPackMsg().

Referenced by bsNullReqWrite().

142 {
143  return BsNullPackMsg(BsNullMsgIdReqWrite, pStruct, buf, bufSize, bTrace);
144 }
int BsNullPackMsg(BsNullMsgId_T eMsgId, void *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a ITV message in big-endian byte order.
Definition: bsNullMsgs.c:236
INLINE_IN_H int BsNullPackRspWrite ( BsNullRspWrite_T pStruct,
byte_t  buf[],
size_t  bufSize,
bool_t  bTrace 
)

Pack a BsNullRspWrite ITV message in big-endian byte order into the output buffer.

Parameters
[in]pStructPointer to the associated, populated message structure.
[out]bufOutput message buffer.
bufSizeSize of output buffer.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes packed. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 181 of file bsNullMsgs.h.

References BsNullMsgIdRspWrite, and BsNullPackMsg().

Referenced by bsModNullReqWrite().

185 {
186  return BsNullPackMsg(BsNullMsgIdRspWrite, pStruct, buf, bufSize, bTrace);
187 }
int BsNullPackMsg(BsNullMsgId_T eMsgId, void *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a ITV message in big-endian byte order.
Definition: bsNullMsgs.c:236
int BsNullUnpackMsg ( BsNullMsgId_T  eMsgId,
byte_t  buf[],
size_t  uMsgLen,
void *  pStruct,
bool_t  bTrace 
)

Unpack a ITV message in big-endian byte order.

Parameters
eMsgIdMessage Id.
[in]bufInput message buffer.
uMsgLenLength of message (bytes) in input buffer.
[out]pStructPointer to the associated message structure.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes unpacked. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 274 of file bsNullMsgs.c.

References BsNullLookupMsgDef().

Referenced by BsNullUnpackReqWrite(), and BsNullUnpackRspWrite().

279 {
280  const NMMsgDef_T *pMsgDef;
281 
282  if( (pMsgDef = BsNullLookupMsgDef(eMsgId)) == NULL )
283  {
284  LOGERROR("%s(ecode=%d): msgid=%u.",
285  nmStrError(NM_ECODE_MSGID), NM_ECODE_MSGID, eMsgId);
286  return -NM_ECODE_MSGID;
287  }
288 
289  if( bTrace )
290  {
291  return nmUnpackITVMsgDebug(pMsgDef, buf, uMsgLen, pStruct, NMEndianBig);
292  }
293  else
294  {
295  return nmUnpackITVMsg(pMsgDef, buf, uMsgLen, pStruct, NMEndianBig);
296  }
297 }
const NMMsgDef_T * BsNullLookupMsgDef(BsNullMsgId_T eMsgId)
Look up the message definition associated with the message id.
Definition: bsNullMsgs.c:186
INLINE_IN_H int BsNullUnpackReqWrite ( byte_t  buf[],
size_t  uMsgLen,
BsNullReqWrite_T pStruct,
bool_t  bTrace 
)

Unpack a BsNullReqWrite ITV message in big-endian byte order from the input buffer.

Parameters
[in]bufOutput message buffer.
uMsgLenLength of message (bytes) in input buffer.
[out]pStructPointer to the associated message structure.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes unpacked. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 159 of file bsNullMsgs.h.

References BsNullMsgIdReqWrite, and BsNullUnpackMsg().

Referenced by bsModNullReqWrite().

163 {
164  return BsNullUnpackMsg(BsNullMsgIdReqWrite, buf, uMsgLen, pStruct, bTrace);
165 }
int BsNullUnpackMsg(BsNullMsgId_T eMsgId, byte_t buf[], size_t uMsgLen, void *pStruct, bool_t bTrace)
Unpack a ITV message in big-endian byte order.
Definition: bsNullMsgs.c:274
INLINE_IN_H int BsNullUnpackRspWrite ( byte_t  buf[],
size_t  uMsgLen,
BsNullRspWrite_T pStruct,
bool_t  bTrace 
)

Unpack a BsNullRspWrite ITV message in big-endian byte order from the input buffer.

Parameters
[in]bufOutput message buffer.
uMsgLenLength of message (bytes) in input buffer.
[out]pStructPointer to the associated message structure.
bTraceDo [not] trace packing.
Returns
On success, returns the number of bytes unpacked. On error, returns the appropriate < 0 negated NM_ECODE.

Definition at line 202 of file bsNullMsgs.h.

References BsNullMsgIdRspWrite, and BsNullUnpackMsg().

Referenced by bsNullReqWrite().

206 {
207  return BsNullUnpackMsg(BsNullMsgIdRspWrite, buf, uMsgLen, pStruct, bTrace);
208 }
int BsNullUnpackMsg(BsNullMsgId_T eMsgId, byte_t buf[], size_t uMsgLen, void *pStruct, bool_t bTrace)
Unpack a ITV message in big-endian byte order.
Definition: bsNullMsgs.c:274

Variable Documentation

const NMMsgDef_T* BsNullMsgDefLookupTbl[]

BsNull Message Definition Look-Up Table. Indexed by BsNullMsgId_T enum.

Definition at line 153 of file bsNullMsgs.c.

Referenced by BsNullLookupMsgDef().

size_t BsNullMsgMaxLenLookupTbl[]

BsNull Message Maximum Size Look-Up Table. Indexed by BsNullMsgId_T enum.

Definition at line 164 of file bsNullMsgs.c.

Referenced by BsNullLookupMsgMaxLen().