55 #include "rnr/rnrconfig.h" 74 #define _NMSET_VAL(_this, pv, T) \ 75 (T)(_this.m_bits & NMBITS_HAS_CONST? (T)(_this.m_valConst): *((T*)pv)) 88 #define _NMCHK_MIN(fname, _this, v, T, fmt) \ 91 if( _this.m_bits & NMBITS_HAS_MIN ) \ 93 if( (v) < (T)(_this.m_valMin) ) \ 95 NMLIB_RAISE_ERROR(NM_ECODE_RANGE, "%s val=" fmt " < min=" fmt, \ 96 fname, v, (T)(_this.m_valMin)); \ 112 #define _NMCHK_MAX(fname, _this, v, T, fmt) \ 115 if( _this.m_bits & NMBITS_HAS_MAX ) \ 117 if( (v) > (T)(_this.m_valMax) ) \ 119 NMLIB_RAISE_ERROR(NM_ECODE_RANGE, "%s val=" fmt " > max=" fmt, \ 120 fname, v, (T)(_this.m_valMax)); \ 143 0, 0xff, 0xff, 1, 0xff, 0xff, 0xff, 2,
146 0xff, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff,
149 0xff, 5, 6, 0xff, 0xff, 0xff, 0xff, 0xff,
152 0xff, 0xff, 0xff, 0xff, 7, 0xff, 0xff, 0xff,
155 0xff, 0xff, 0xff, 8, 9, 0xff, 0xff, 10,
158 0xff, 11, 12, 0xff, 0xff, 0xff, 0xff, 0xff,
161 0xff, 13, 14, 0xff, 15, 0xff, 0xff, 0xff,
164 0xff, 16, 0xff, 0xff, 17
225 val,
signed char,
"%hhd");
229 val,
signed char,
"%hhd");
258 val, ushort_t,
"%hu");
262 val, ushort_t,
"%hu");
377 ulonglong_t *pValOut)
386 val, ulonglong_t,
"%llu");
390 val, ulonglong_t,
"%llu");
419 val,
long long,
"%hhu");
423 val,
long long,
"%hhu");
517 vsnprintf(bufRepr,
sizeof(bufRepr), sFmt, ap);
519 bufRepr[
sizeof(bufRepr)-1] = 0;
521 uIndent = uDepth * 2;
523 if( pFieldDef != NULL )
528 n = fprintf(stderr,
"%*s%c:%s(%u) = %s: ",
530 pFieldDef->
m_eFId, bufRepr);
535 n = fprintf(stderr,
"%*s[%c]: = %s: ",
536 uIndent,
"", pFieldDef->
m_eFType, bufRepr);
541 n = fprintf(stderr,
"%*s%s: ", uDepth*2,
"", bufRepr);
548 fprintf(stderr,
"\n");
552 fprintf(stderr,
"%*s", 38-n,
"");
555 fprintf(stderr,
"\n");
557 #endif // NMLIB_DEBUG const size_t NMHashNumEntries
int nmSetU32(const NMFieldDef_T *pFieldDef, void *pValIn, uint_t *pValOut)
Helper function to set an unsigned 32-bit integer.
NMFieldThisU8_T m_u8
[unsigned] 8-bit integer specific info
const int NMHashNoIdx
hash no index value
#define _NMSET_VAL(_this, pv, T)
Set field value.
NMFType_T m_eFType
field type
#define NMFID_NONE
no field id (reserved)
#define NM_OK
not an error, success
int nmSetF64(const NMFieldDef_T *pFieldDef, void *pValIn, double *pValOut)
Helper function to set a 64-bit floating point number.
NMFieldThis_T m_this
specific field information
int nmSetS8(const NMFieldDef_T *pFieldDef, void *pValIn, signed char *pValOut)
Helper function to set a signed 8-bit integer.
int nmSetU8(const NMFieldDef_T *pFieldDef, void *pValIn, byte_t *pValOut)
Helper function to set an unsigned 8-bit integer.
int nmSetF32(const NMFieldDef_T *pFieldDef, void *pValIn, float *pValOut)
Helper function to set a 32-bit floating point number.
NMFieldThisU32_T m_u32
[unsigned] 32-bit integer specific info
#define _NMCHK_MAX(fname, _this, v, T, fmt)
Check value is ≤ maximum.
int nmSetS16(const NMFieldDef_T *pFieldDef, void *pValIn, short *pValOut)
Helper function to set a signed 16-bit integer.
const char * m_sFName
field string name
const int NMHashOffset
hash base offset
void nmTraceField(const NMFieldDef_T *pFieldDef, byte_t buf[], size_t uCount, uint_t uDepth, const char *sFmt,...)
Trace packing/unpacking of a message field.
int nmSetS32(const NMFieldDef_T *pFieldDef, void *pValIn, int *pValOut)
Helper function to set a signed 32-bit integer.
NMFieldThisF32_T m_f32
32-bit fpn specific info
NMFieldThisU64_T m_u64
[unsigned] 64-bit integer specific info
int nmSetS64(const NMFieldDef_T *pFieldDef, void *pValIn, long long *pValOut)
Helper function to set a signed 64-bit integer.
Internal intra-library declarations.
int nmSetU64(const NMFieldDef_T *pFieldDef, void *pValIn, ulonglong_t *pValOut)
Helper function to set an unsigned 64-bit integer.
void nmPrintBuf(FILE *fp, const char *sPreface, byte_t buf[], size_t uCount, size_t uNLFreq, uint_t uCol)
Pretty print buffer to opened file stream.
#define _NMCHK_MIN(fname, _this, v, T, fmt)
Check value is ≥ minimum.
NMFieldThisU16_T m_u16
[unsigned] 16-bit integer specific info
Network Messaging declarations.
int nmSetU16(const NMFieldDef_T *pFieldDef, void *pValIn, ushort_t *pValOut)
Helper function to set an unsigned 16-bit integer.
NMFieldThisF64_T m_f64
64-bit fpn specific info
uint_t m_eFId
filed id (message/struct unique)