0001 SYNOPSIS
0002 --------
0003
0004 #include <ubf.h>
0005
0006 int Bgetr (UBFH * p_ub, BFLDID *fldidocc, char * buf, BFLDLEN * buflen);
0007
0008 int Bgetrv (UBFH * p_ub, char * buf, BFLDLEN * buflen, ...);
0009
0010 int CBgetr (UBFH * p_ub, BFLDID *fldidocc,
0011 char * buf, BFLDLEN * buflen, int usrtype);
0012
0013 int CBgetrv (UBFH * p_ub, char * buf, BFLDLEN * buflen, int usrtype, ...);
0014
0015 char* Bfindr (UBFH *p_ub, BFLDID *fldidocc, BFLDLEN *p_len);
0016
0017 char* Bfindrv (UBFH *p_ub, BFLDLEN *p_len, ...);
0018
0019 char *CBfindr (UBFH *p_ub, BFLDID *fldidocc, BFLDLEN *len, int usrtype);
0020
0021 char *CBfindrv (UBFH *p_ub, BFLDLEN *len, int usrtype, ...);
0022
0023 int Bpresr (UBFH *p_ub, BFLDID *fldidocc);
0024
0025 int Bpresrv (UBFH *p_ub, ...);
0026
0027 int CBvgetr(UBFH *p_ub, BFLDID *fldidocc, char *cname, BFLDOCC occ,
0028 char *buf, BFLDLEN *len, int usrtype, long flags);
0029
0030 int CBvgetrv(UBFH *p_ub, char *cname, BFLDOCC occ,
0031 char *buf, BFLDLEN *len, int usrtype, long flags, ...);
0032
0033 char * CBgetallocr (UBFH *p_ub, BFLDID *fldidocc, int usrtype, BFLDLEN *extralen);
0034
0035 char * CBgetallocrv (UBFH *p_ub, int usrtype, BFLDLEN *extralen, ...);
0036
0037 int Bvnullr(UBFH *p_ub, BFLDID *fldidocc, char *cname, BFLDOCC occ);
0038
0039 int Bvnullrv(UBFH *p_ub, char *cname, BFLDOCC occ, ...);
0040
0041 char * CBvgetallocr(UBFH *p_ub, BFLDID *fldidocc, char *cname, BFLDOCC occ,
0042 int usrtype, long flags, BFLDLEN *extralen);
0043
0044 char* CBvgetallocrv(UBFH *p_ub, char *cname, BFLDOCC occ,
0045 int usrtype, long flags, BFLDLEN *extralen, ...);
0046
0047 Link with '-lubf -lnstd -lm -lpthread'
0048
0049 DESCRIPTION
0050 -----------
0051 Group of macro functions used lookup to the field in sub-UBF buffers. The exact field
0052 from which to take the value at given sub-level, is specified in field id sequence.
0053 Functions with *r* suffix encodes the field id sequence in array specified in
0054 'fldidocc' parameter. Functions with *rv* suffix encodes the field id sequence in
0055 var-args. Last field id in sequence (leaf) identifies the UBF field id on which the
0056 target operation must be executed. For *view* operations, this field must correspond
0057 to the *view* field present in UBF buffer.
0058
0059 Field id sequence must be present in following form:
0060
0061 *<FLDID>, <OCC>, ..., <FLDID>, <OCC>, BBADFLDOCC*.
0062
0063 Internally function uses *Bfind(3)* to search the sub-UBF buffer from internal UBF field IDs.
0064
0065 Function mapping is following where leaf field id is executed on sub-ubf buffer:
0066
0067 . *Bgetr(3)* and *Bgetrv(3)* translates to *Bget(3)* call.
0068
0069 . *CBgetr(3)* and *CBgetrv(3)* translates to *CBget(3)* call.
0070
0071 . *CBgetallocr(3)* and *CBgetallocrv(3)* translates to *CBgetalloc(3)* call.
0072
0073 . *Bfindr(3)* and *Bfindrv(3)* translates to *Bfindr(3)* call.
0074
0075 . *Bpresr(3)* and *Bpresrv(3)* translates to *Bpres(3)* call.
0076
0077 . *CBvgetr(3)* and *CBvgetrv(3)* translates to *CBvget(3)* call. Note that here it
0078 is expected that leaf field in field id sequence matches the *view* typed field
0079 in UBF buffer. Thus on this field value in UBF buffer *CBvget(3)* is executed.
0080
0081 . *CBvgetallocr(3)* and *CBvgetallocrv(3)* translates to *CBvgetalloc(3)* call. Note that here it
0082 is expected that leaf field in field id sequence matches the *view* typed field
0083 in UBF buffer. Thus on this field value in UBF buffer *CBvgetalloc(3)* is executed.
0084
0085 . *Bvnullr(3)* and *Bvnullrv(3)* translates to *Bvnull(3)* call. Note that here it
0086 is expected that leaf field in field id sequence matches the *view* typed field
0087 in UBF buffer. Thus on this field value in UBF buffer *Bvnull(3)* is executed.
0088
0089
0090 *Usage:*
0091
0092 Assuming that UBF buffer contains following data:
0093
0094 --------------------------------------------------------------------------------
0095
0096 T_STRING_8_FLD HELLO WORLD1
0097 T_STRING_9_FLD 01
0098 T_STRING_9_FLD 20
0099 T_STRING_9_FLD 31
0100 T_CARRAY_2_FLD
0101 T_CARRAY_2_FLD TEST CARRAY
0102 T_PTR_3_FLD 0xc7
0103 T_PTR_3_FLD 0x12b
0104 T_UBF_FLD
0105 T_SHORT_1_FLD 6500
0106 T_LONG_1_FLD 3200
0107 T_UBF_FLD
0108 T_LONG_3_FLD 9999
0109 T_LONG_3_FLD 8888
0110 T_UBF_3_FLD
0111 T_STRING_9_FLD HELLO WORLD ONE
0112 T_STRING_9_FLD HELLO WORLD TWO
0113 T_STRING_9_FLD HELLO WORLD THREE
0114
0115 --------------------------------------------------------------------------------
0116
0117 To extract *T_STRING_9_FLD* third occurrence value from *T_UBF_FLD/T_UBF_3_FLD* sub-buffer field,
0118 use following syntax:
0119
0120 --------------------------------------------------------------------------------
0121
0122 ret=Bgetr(p_ub, (int []){ T_UBF_FLD, 1, T_UBF_3_FLD, 0, T_UBF_2_FLD, 0, T_STRING_9_FLD, 2, BBADFLDOCC}, buf, &len)
0123
0124 --------------------------------------------------------------------------------
0125
0126 or with var-args:
0127
0128 --------------------------------------------------------------------------------
0129
0130 ret=Bgetrv(p_ub, buf, &len, T_UBF_FLD, 1, T_UBF_3_FLD, 0, T_UBF_2_FLD, 0, T_STRING_9_FLD, 2, BBADFLDOCC)
0131
0132 --------------------------------------------------------------------------------
0133
0134
0135 RETURN VALUE
0136 ------------
0137 On success, *Bgetr()* and *Bgetrv()* return zero; on error, -1 is returned, with *Berror* set to
0138 indicate the error.
0139
0140 ERRORS
0141 ------
0142 Note that *Bstrerror()* returns generic error message plus custom message with
0143 debug info from last function call. Function my return errors from *Bfind(3)* and
0144 corresponding mapped operation, e.g. *Bget(3)*, *Bfind(3)*, etc.
0145
0146 Following additional errors may be returned by this function:
0147
0148 *BBADFLD* Invalid sequence of field identifier, not encoded according the the rules.
0149
0150 *BEBADOP* For view operations (CBvgetr/CBvgetrv/Bvnullr/Bvnullrv), the leaf
0151 field identifier in sequence does not match the *view* type.
0152
0153 EXAMPLE
0154 -------
0155 See *ubftest/test_embubf.c* for sample code.
0156
0157 BUGS
0158 ----
0159 Report bugs to support@mavimax.com
0160
0161 SEE ALSO
0162 --------
0163 *Bget(3)* *CBget(3)* *Bfind(3)* *CBfind(3)* *Bpres(3)* *CBvget(3)* *Bvnull(3)*
0164
0165 COPYING
0166 -------
0167 (C) Mavimax, Ltd
0168