User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:ubf:cbadd.3

cbadd

Name

CBadd — Convert and add field to UBF buffer

Synopsis

#include <ubf.h>

int CBadd (UBFH *p_ub, BFLDID bfldid, char *buf, BFLDLEN len, int usrtype);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Add field to UBF buffer by converting given user type usrtype to buffer field’s type (see BFLD_* types). The UBF buffer pointer is passed by p_ub, field id in bfldid. The user field value is passed in buf. The len is used only if usrtype is BFLD_CARRAY, for which length cannot be detected from passed data.

RETURN VALUE

On success, CBadd() return zero; on error, -1 is returned, with Berror set to indicate the error.

ERRORS

Note that Bstrerror() returns generic error message plus custom message with debug info from last function call.

BALIGNERR Corrupted buffer or pointing to not aligned memory area.

BNOTFLD Buffer not fielded, not correctly allocated or corrupted.

BNOSPACE No space in buffer for string data.

BMALLOC Failed to allocate type conversion buffer.

EXAMPLE

See ubftest/ubfunit1.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd