Back to home page

Enduro/X

 
 

    


0001 BWRITECB(3)
0002 =========
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 Bwritecb - Write the UBF buffer to callback function
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 
0014 #include <ubf.h>
0015 
0016 int Bwritecb (UBFH *p_ub, 
0017         long (*p_writef)(char *buffer, long bufsz, void *dataptr1), void *dataptr1);
0018 
0019 Link with '-lubf -lnstd -lm -lpthread'
0020 
0021 DESCRIPTION
0022 -----------
0023 Transfer UBF buffer presented by 'p_ub' to callback function set by 'p_writef'.
0024 The callback function accepts 'buffer' which contains UBF buffer, the 'bufsz'
0025 contains the number of bytes in buffer. The 'dataptr1' from main function is
0026 forwarded to callback, so that customer user pointer can be passed to callback.
0027 The callback must return number of bytes written, which for case of success
0028 must be equal to the 'bufsz' passed to callback function. Otherwise error will
0029 be generated. In case if callback fails, -1 shall be returned to callback
0030 function. Currently the whole buffer is present in single write callback, but
0031 this subject of change in future.
0032 
0033 RETURN VALUE
0034 ------------
0035 On success, *Bwrite()* return zero; on error, -1 is returned, 
0036 with *Berror* set to indicate the error.
0037 
0038 ERRORS
0039 ------
0040 Note that *Bstrerror()* returns generic error message plus custom message 
0041 with debug info from last function call.
0042 
0043 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0044 
0045 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0046 
0047 *BEINVAL* 'p_writef' is NULL.
0048 
0049 *BEUNIX* Failed to read from stream.
0050 
0051 *BNOSPACE* No space in 'p_ub'.
0052 
0053 EXAMPLE
0054 -------
0055 See *ubftest/test_readwrite.c* for sample code.
0056 
0057 BUGS
0058 ----
0059 Report bugs to support@mavimax.com
0060 
0061 SEE ALSO
0062 --------
0063 *Bfprint(3)* *Bprint(3)* *Bread(3)* *Breadcb(3)* *ud(8)* *Bextread(3)*
0064 
0065 COPYING
0066 -------
0067 (C) Mavimax, Ltd
0068