/common/home/bel/bella/lnx/exports/build/current/all/sys-tools/xfer-lib/xfer.h

00001 #ifndef _XFER_H_
00002 #define _XFER_H_
00003 
00004 #include <sys/socket.h>
00005 
00006 
00049 #ifdef  __cplusplus
00050 extern "C" {
00051 #endif
00052 
00053 
00062 #define xf_offs(a,b) ( (char *) (&((a)->b)) - (char *)(a) )
00064 #define XF_TYPE_EMPTY    0x00 
00066 #define XF_TYPE_STR      0x01 
00068 #define XF_TYPE_FP       0x02 
00070 #define XF_TYPE_LONG     0x03 
00072 #define XF_TYPE_INT      0x04 
00074 #define XF_TYPE_BYTE     0x05 
00076 #define XF_TYPE_BOOLEAN  0x06
00078 #define XF_TYPE_OBJECT   0x07
00080 #define XF_TYPE_VEC      0x08 
00082 #define XF_TYPE_UNION    0x09 
00084 #define XF_TYPE_REC      0x0A 
00086 #define XF_TYPE_ARRAY    0x0B
00087 
00089 
00092 typedef struct xf_descr_list_s xf_descr_list_t;
00093 
00095 
00102 xf_descr_list_t *xf_descr_list_new( int no, char *name );
00103 
00105 
00118 int xf_descr_list_add( xf_descr_list_t *pd, int idx, 
00119     int type, int size, int offs, int noffs, xf_descr_list_t *pl );
00125 
00126 
00129 typedef struct xf_refl_s xf_refl_t; 
00130 
00132 
00143 xf_refl_t *xf_refl_new( char *name, int size, char *version, 
00144     xf_descr_list_t *pdescr, void *userdata );
00145 
00147 
00151 void xf_refl_setuserdata( xf_refl_t *prefl, void *puserdata );
00152 
00154 
00160 void *xf_refl_getuserdata( xf_refl_t *prefl );
00161 
00163 
00166 char *xf_refl_getname( xf_refl_t *prefl );
00173 
00174 
00178 typedef struct xf_instance_s xf_instance_t;
00179 
00181 
00189 xf_instance_t *xf_instance_new( void *pobj,  xf_refl_t *prefl );
00190 
00192 
00202 void *xf_instance_cloneobj( xf_instance_t *pinst );
00203 
00205 
00213 void *xf_instance_rcloneobj( xf_instance_t *pinst );
00214 
00216 
00226 int xf_instance_cpobj( void *ptarget, xf_instance_t *pinst );
00227 
00229 
00240 int xf_instance_rcpobj( void *ptarget, xf_instance_t *pinst );
00241 
00243 
00250 int xf_instance_free( xf_instance_t *pinst );
00251 
00253 
00261 int xf_instance_rfree( xf_instance_t *pinst );
00262 
00264 
00269 int  xf_instance_obj_free( xf_instance_t *pinst );
00270 
00272 
00276 int  xf_instance_obj_ofree( xf_instance_t *pinst );
00277 
00279 
00285 int  xf_instance_obj_rfree( xf_instance_t *pinst );
00286 
00288 
00293 int  xf_instance_obj_dfree( xf_instance_t *pinst );
00294 
00296 
00302 int  xf_instance_obj_drfree( xf_instance_t *pinst );
00303 
00304 
00306 
00313 int xf_instance_setuserdata( xf_instance_t *pinst, void *userdata );
00314 
00316 
00320 void *xf_instance_getuserdata( xf_instance_t *pinst );
00321 
00323 
00329 xf_refl_t *xf_instance_getrefl( xf_instance_t *pinst );
00330 
00332 
00338 void *xf_instance_getobj( xf_instance_t *pinst );
00339 
00341 
00348 void * xf_instance_setobj( xf_instance_t *pinst, void *pobj );
00349 
00350 /*************************************************************************
00351  * XML serializer 
00352  ************************************************************************/
00353 
00355 
00358 typedef struct xf_buffer_s xf_buffer_t;
00359 
00361 
00368 xf_buffer_t *xf_buffer_new( char *adr, int size );
00369 
00371 
00375 void  xf_buffer_free( xf_buffer_t *pb);
00376 
00378 
00383 char *xf_buffer_getadr( xf_buffer_t *pb);
00384 
00386 
00393 int xf_buffer_reset( xf_buffer_t *pb );
00394 
00396 
00406 int  xf_instance_write( xf_instance_t *pinst, int fd, xf_buffer_t *pbuf,
00407     int openflag, int closeflag );
00415 
00416 
00419 typedef struct xf_s xf_t;
00420 
00422 
00430 xf_t *xf_new( xf_refl_t **pprefl, int fd, char *info );
00431 
00433 
00439 char *xf_getinfo( xf_t *pxf );
00440 
00442 
00460 int xf_getpeer( xf_t *pxf, struct sockaddr *address, socklen_t *address_len);
00461 
00462 
00464 
00470 xf_refl_t **xf_getrefl( xf_t *pxf );
00471 
00473 
00484 int xf_parse( xf_t *pxf, xf_instance_t **ppret );
00485 
00487 
00490 void * xf_getuserdata ( xf_t *pxf );
00491 
00493 
00496 int xf_setuserdata ( xf_t *pxf, void *userdata );
00497 
00498 
00500 
00505 int xf_isreply( xf_t *pxf );
00506 
00508 
00513 int xf_setreply( xf_t *pxf );
00514 
00516 
00520 int xf_isclosed( xf_t *pxf );
00521 
00523 
00528 int xf_setclosed( xf_t *pxf );
00529 
00531 
00536 int xf_getfd( xf_t *pxf );
00537 
00539 
00542 int xf_free( xf_t *pxf );
00545 #ifdef  __cplusplus
00546 }
00547 #endif
00548 
00549 #endif
00550 

Generated on 4 Mar 2014 for xfer by  doxygen 1.4.7