User Tools

Site Tools


Sidebar

Table Of Contents

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

bget

Name

Bget — Get data from UBF buffer

Synopsis

#include <ubf.h>

int Bget (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, char *buf, BFLDLEN *buflen);

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 indicates, then error of BNOSPACE. Then len is optional. If set to NULL, then no such checks are made. len is used for BFLD_STRING, BFLD_CARRAY, BFLD_UBF and BFLD_VIEW. On output len (if not NULL), indicates the length of data loaded in bytes. buf pointed data type must match the field type in buffer.

When bfldid data type is BFLD_VIEW, it is expected that buf points to BVIEWFLD structure, where BVIEWFLD.data pointers it set to are where data shall be unloaded. The BVIEWFLD.vname is set to view name, vflags currently is not used. When processing BFLD_VIEW field, len on input indicates the area size of BVIEWFLD.data.

RETURN VALUE

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

BBADFLD Invalid field id passed.

BNOTPRES Field not present.

EXAMPLE

See ubftest/test_get.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd