User Tools

Site Tools


Sidebar

Table Of Contents

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

cbfindocc

Name

CBfindocc — find field occurrence in buffer by given user value

Synopsis

#include <ubf.h>

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

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 converted from user type specified in usrtype. p_ub is pointer to UBF buffer, bfldid is field id, len is input parameter for indicating the user type length in bytes. Then len is mandatory only for BFLD_CARRAY fields.

Function basically is the same as Bfindocc(3), only this version includes user type conversion to buffer type before compare.

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, CBfindocc() 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.

BMALLOC Failed to allocate type conversion buffer.

BTYPERR Invalid user type.

BEINVAL buf is NULL.

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

BBADFLD Invalid field id passed.

EXAMPLE

See ubftest/test_find.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd