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

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

#include "rnr/rnrconfig.h"
#include "rnr/log.h"
#include "rnr/netmsgs.h"
#include "botsense/bsNullMsgs.h"

Go to the source code of this file.

Macros

#define EOFDEF   {NULL, 0, NMFTypeNone, 0, }
 

Enumerations

enum  BsNullReqWriteFId_T {
  BsNullReqWriteFIdReserved = 0,
  BsNullReqWriteFIdwritebuf = 1,
  BsNullReqWriteFIdNumOf = 2
}
 
enum  BsNullRspWriteFId_T {
  BsNullRspWriteFIdReserved = 0,
  BsNullRspWriteFIdbyteswritten = 1,
  BsNullRspWriteFIdNumOf = 2
}
 

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...
 

Variables

static const NMFieldDef_T BsNullReqWritewritebufFieldDef []
 
static const NMFieldDef_T BsNullReqWriteFieldDefs []
 
static const NMMsgDef_T BsNullReqWriteMsgDef
 
static const NMFieldDef_T BsNullRspWriteFieldDefs []
 
static const NMMsgDef_T BsNullRspWriteMsgDef
 
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.c.

Macro Definition Documentation

#define EOFDEF   {NULL, 0, NMFTypeNone, 0, }

End of Field Definition entry.

Definition at line 29 of file bsNullMsgs.c.

Enumeration Type Documentation

BsNullReqWrite Field Id Enumeration

Enumerator
BsNullReqWriteFIdReserved 

reserved field id

BsNullReqWriteFIdwritebuf 

writebuf field id

BsNullReqWriteFIdNumOf 

number of fields

Definition at line 63 of file bsNullMsgs.c.

64 {
65  BsNullReqWriteFIdReserved = 0, ///< reserved field id
66  BsNullReqWriteFIdwritebuf = 1, ///< writebuf field id
67  BsNullReqWriteFIdNumOf = 2 ///< number of fields
writebuf field id
Definition: bsNullMsgs.c:66
BsNullReqWriteFId_T
Definition: bsNullMsgs.c:63
reserved field id
Definition: bsNullMsgs.c:65
number of fields
Definition: bsNullMsgs.c:67

BsNullRspWrite Field Id Enumeration

Enumerator
BsNullRspWriteFIdReserved 

reserved field id

BsNullRspWriteFIdbyteswritten 

byteswritten field id

BsNullRspWriteFIdNumOf 

number of fields

Definition at line 109 of file bsNullMsgs.c.

110 {
111  BsNullRspWriteFIdReserved = 0, ///< reserved field id
112  BsNullRspWriteFIdbyteswritten = 1, ///< byteswritten field id
113  BsNullRspWriteFIdNumOf = 2 ///< number of fields
number of fields
Definition: bsNullMsgs.c:113
BsNullRspWriteFId_T
Definition: bsNullMsgs.c:109
byteswritten field id
Definition: bsNullMsgs.c:112
reserved field id
Definition: bsNullMsgs.c:111

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
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

Variable Documentation

const NMMsgDef_T* BsNullMsgDefLookupTbl[]
Initial value:
=
{
NULL,
NULL
}
static const NMMsgDef_T BsNullReqWriteMsgDef
Definition: bsNullMsgs.c:93
static const NMMsgDef_T BsNullRspWriteMsgDef
Definition: bsNullMsgs.c:137

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[]
Initial value:
=
{
(size_t)(0),
(size_t)(262),
(size_t)(6),
(size_t)(0)
}

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

Definition at line 164 of file bsNullMsgs.c.

Referenced by BsNullLookupMsgMaxLen().

const NMFieldDef_T BsNullReqWriteFieldDefs[]
static
Initial value:
=
{
{
.m_sFName = "writebuf",
.m_eFType = NMFTypeVector,
.m_uOffset = memberoffset(BsNullReqWrite_T, m_writebuf),
.m_this.m_vector.m_uMaxCount
.m_this.m_vector.m_uElemSize
= sizeof(byte_t),
.m_this.m_vector.m_pThisElem
},
{NULL, 0, NMFTypeNone, 0, }
}
writebuf field id
Definition: bsNullMsgs.c:66
#define BSNULL_REQWRITE_WRITEBUF_LEN
Definition: bsNullMsgs.h:54
static const NMFieldDef_T BsNullReqWritewritebufFieldDef[]
Definition: bsNullMsgs.c:45

BsNullReqWrite Field Definitions

Definition at line 73 of file bsNullMsgs.c.

const NMMsgDef_T BsNullReqWriteMsgDef
static
Initial value:
=
{
.m_sMsgName = "BsNullReqWrite",
.m_eMsgId = BsNullMsgIdReqWrite,
.m_uCount = (size_t)(1),
}
static const NMFieldDef_T BsNullReqWriteFieldDefs[]
Definition: bsNullMsgs.c:73

BsNullReqWrite Message Definition

Definition at line 93 of file bsNullMsgs.c.

const NMFieldDef_T BsNullReqWritewritebufFieldDef[]
static
Initial value:
=
{
{
.m_sFName = "writebuf",
.m_eFId = 0,
.m_eFType = NMFTypeU8,
.m_uOffset = (size_t)0,
.m_this.m_u8.m_bits = (byte_t)(0),
.m_this.m_u8.m_valMin = (byte_t)(0),
.m_this.m_u8.m_valMax = (byte_t)(0),
.m_this.m_u8.m_valConst = (byte_t)(0),
},
{NULL, 0, NMFTypeNone, 0, }
}

BsNullReqWritewritebuf Field Definitions

Definition at line 45 of file bsNullMsgs.c.

const NMFieldDef_T BsNullRspWriteFieldDefs[]
static
Initial value:
=
{
{
.m_sFName = "byteswritten",
.m_eFType = NMFTypeU8,
.m_uOffset = memberoffset(BsNullRspWrite_T, m_byteswritten),
.m_this.m_u8.m_bits = (byte_t)(0),
.m_this.m_u8.m_valMin = (byte_t)(0),
.m_this.m_u8.m_valMax = (byte_t)(0),
.m_this.m_u8.m_valConst = (byte_t)(0),
},
{NULL, 0, NMFTypeNone, 0, }
}
byteswritten field id
Definition: bsNullMsgs.c:112

BsNullRspWrite Field Definitions

Definition at line 119 of file bsNullMsgs.c.

const NMMsgDef_T BsNullRspWriteMsgDef
static
Initial value:
=
{
.m_sMsgName = "BsNullRspWrite",
.m_eMsgId = BsNullMsgIdRspWrite,
.m_uCount = (size_t)(1),
}
static const NMFieldDef_T BsNullRspWriteFieldDefs[]
Definition: bsNullMsgs.c:119

BsNullRspWrite Message Definition

Definition at line 137 of file bsNullMsgs.c.