Back to home page

Enduro/X

 
 

    


0001 BREADCB(3)
0002 ==========
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 Breadcb - Read the UBF buffer from Bwritecb(3) serialized format
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 
0014 #include <ubf.h>
0015 
0016 int Breadcb (UBFH * p_ub, long (*p_readf)(char *buffer, long bufsz, void *dataptr1), void *dataptr1);
0017 
0018 Link with '-lubf -lnstd -lm -lpthread'
0019 
0020 DESCRIPTION
0021 -----------
0022 *Breadcb()* is a function which reads UBF/'p_ub' buffer from the callback function.
0023 specified in 'p_readf' argument. The arguments to callback are 'buffer' which
0024 is data buffer into which data must be read. The number of bytes required by
0025 particular request are specified in 'bufsz'. This is precise number of bytes
0026 that are required to be read from the data source. Basically two read requests
0027 are performed by the function. The first reads the header and the scond extracts
0028 from the header buffer length and remaining bytes are read. The 'dataptr1' argument
0029 to callback are forwarded from main function arguments. This is usable for cases
0030 when some other control objects must be passed to callback. The callback must
0031 return number of bytes read from the source. For success case parameter
0032 'bufsz' must be return from the callback (i.e. read bytes matches),
0033 otherwise *Breadcb()* will fail.
0034 In case of failure inside the callback, return value *-1*.
0035 
0036 RETURN VALUE
0037 ------------
0038 On success, *Breadcb()* return zero; on error, -1 is returned, 
0039 with *Berror* set to indicate the error.
0040 
0041 ERRORS
0042 ------
0043 Note that *Bstrerror()* returns generic error message plus custom message with 
0044 debug info from last function call.
0045 
0046 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0047 
0048 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0049 
0050 *BEINVAL* 'readf' is NULL.
0051 
0052 *BEUNIX* Failed to read from stream.
0053 
0054 EXAMPLE
0055 -------
0056 See *ubftest/test_readwrite.c* for sample code.
0057 
0058 BUGS
0059 ----
0060 Report bugs to support@mavimax.com
0061 
0062 SEE ALSO
0063 --------
0064 *Bfprint(3)* *Bprint(3)* *Bwrite(3)* *Bwritecb(3)* *ud(8)* *Bextread(3)*
0065 
0066 COPYING
0067 -------
0068 (C) Mavimax, Ltd
0069