User Tools

Site Tools


Sidebar

Table Of Contents

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

bfindocc

Name

Bfindocc — find field occurrence in buffer by given value

Synopsis

#include <ubf.h>

BFLDOCC Bfindocc (UBFH *p_ub, BFLDID bfldid, char *buf, BFLDLEN len);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function on success returns the occurrence of the field found in p_ub buffer. The value is searched by buf/len pair which value matches the field value. For BFLD_STRING typed fields value present in buf is treated as regular expression which is matched against field value in UBF buffer. p_ub is pointer to UBF buffer, bfldid is field id to search for, len is input parameter for indicating the but length in bytes. Then len is mandatory only for BFLD_CARRAY fields.

In case if searching for BFLD_VIEW field, the buf shall point to initialized BVIEWFLD structure where vname field shall be set to view name and data shall be set to pointer to actual view field to compare in search.

RETURN VALUE

On success, Bfindocc() return occurrence where the value is found; 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.

BNOTPRES Field not present.

BEINVAL buf is NULL.

BBADFLD invalid field passed in (type incorrect).

EXAMPLE

See ubftest/test_find.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd