User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.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. p_ub is pointer to UBF buffer, bfldid is field id to search for, len is input paramter for indicating the but length in bytes. Then len is mandatory only for BFLD_CARRAY fields.

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