User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v8.0.x:api:ubf:cbget.3

cbget

Name

CBget — Get and convert to user type data from UBF buffer

Synopsis

#include <ubf.h>

int CBget (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, char *buf, BFLDLEN *len, int usrtype);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function is used to get field data from UBF buffer. p_ub is pointer to UBF buffer, bfldid is field id, occ is field occurrence at buffer, which needs to be read. buf is buffer where to output the data. len is used as input for indicating the length of the bytes for the target buffer (buf). If the data is larger than len indicated, then error of BNOSPACE. Then len is optional. If set to NULL, then no such checks are made. len is used for BFLD_STRING and BFLD_CARRAY. On output len (if not NULL), indicates the length of data loaded in bytes. usrtype indicates the data type of the buf.

Function operations on field types BFLD_UBF and BFLD_VIEW are not supported. This includes type of bfldid or usrtype having any unsupported field types for this function.

RETURN VALUE

On success, CBget() 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 buf.

BMALLOC Failed to allocate type conversion buffer.

BBADFLD Invalid field id passed.

BNOTPRES Field not present.

BEBADOP Operation not supported (e.g. work with BFLD_UBF or BFLD_VIEW type fields)

EXAMPLE

See ubftest/test_cbget.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd