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

00001 #ifndef I_UV_H
00002 #define I_UV_H
00003 
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <string.h>
00007 #include <math.h>
00008 #include <values.h>
00009 #include "ix_tools.h"
00010 #include "xfer.h"
00011 #include "xvalue.h"
00012 #include "xfreader.h"
00013 
00014 
00015 #define METAINF_NAME "meta"
00016 #define SIMINF_NAME "sim"
00017 #define UV_MAX_SIM 1024
00018 
00019 #define LISTENER_MAX 64
00020 #define UV_MSG_MAX 256
00021 
00022 typedef struct 
00023 {
00024   char *description;
00025   char *mive; 
00026   char isFolder;
00027   char isMountpoint;
00028   char isFifo;
00029   char isFile;
00030   int uid;
00031   int gid;
00032   int type;
00033   int mode;
00034   int major;
00035   int minor;
00036   char fn[PATH_MAX];
00037   char path[PATH_MAX];
00038   char file[PATH_MAX];
00039 } uv_metainf_t;
00040 
00041 typedef struct 
00042 {
00043   char fn[PATH_MAX];
00044   char *path;
00045   char *file;
00046 
00047   char isFolder;
00048   char isMountpoint;
00049   char isFifo;
00050   char isFile;
00051 
00052   int type;
00053   UV_VALUE min;
00054   UV_VALUE max;
00055   char *uvadr;  // uv adr of simulated file
00056 
00057   int update_s; // update interval in sec
00058   UV_VALUE val[256]; // array the value is taken from
00059 
00060   UV_VALUE range_delta; // value is changed with delta
00061   UV_VALUE range_min;   // minimum value when changed
00062   UV_VALUE range_max;   // maximum value when change
00063 
00064   UV_VALUE konst;       // value is constant
00065 
00066   // random is default  // 
00067 
00068   // nominal
00069   char *actualuvadr;
00070   int delay_s;
00071 
00072 } uv_siminf_t;
00073 
00074 #define UV_TREE_VALUE "type"
00075 #define UV_TREE_VERSION "version"
00076 #define UV_TREE_MIVE "mive"
00077 #define UV_TREE_DESCRIPTION "description"
00078 #define UV_TREE_MODE "mode"
00079 #define UV_TREE_UID "uid"
00080 #define UV_TREE_GID "gid"
00081 
00082 #define UV_ACTUAL 0x0
00083 #define UV_NOMINAL 0x1
00084 
00085 struct uv_s 
00086 {
00087   int fd;
00088   xf_t *pxf;
00089   xvalue_notify_t notify;
00090   xvalue_event_t event;
00091   xvalue_structurechange_t structurechange;
00092   void *userarg;
00093   ix_cs_t *cs;
00094 };
00095 
00096 /*
00097  * 
00098  * main type of universal value handler
00099  */
00100 typedef struct uv_s uv_t;
00101 
00102 // listener 
00103 typedef struct
00104 {
00105   xvalue_subscribe_t *psub;
00106   xf_t *pxf;
00107 } listener_t;
00108 
00109 // file traversing callback, return != 0 breaks traversing
00110 typedef int ( * FILE_CB)( xvalue_file_t *pf, void *userdata );
00111 
00112 extern xf_refl_t *uv_refl_list[];
00113 extern xf_refl_t *uv_xvalue_refl;
00114 //extern xf_refl_t *uv_xpara_refl;
00115 //extern xf_refl_t *uv_xdata_refl;
00116 extern ix_event_t *uv_pev;
00117 extern ix_queue_t *uv_pmq;
00118 extern uv_folder_t uv_root;
00119 extern ix_list_t *uv_listener_list;
00120 extern UV_CHANGE_CB uv_change_cb;
00121 extern UV_ADD_CB uv_add_cb;
00122 extern UV_RM_CB uv_rm_cb;
00123 extern ix_cs_t *pchange_structure_cs;
00124 
00125 int _proc_request( xvalue_request_t *preq, xf_t *pxf, int online );
00126 int rm_listener( xf_t *pxf);
00127 xvalue_file_t *find_file_r( xvalue_file_t *proot, char *file, 
00128     xvalue_file_t **parent, char *relpath );
00129 int uv_add_listener( xvalue_file_t *pfile, xvalue_subscriber_t *psubadd );
00130 int uv_rm_listener( xvalue_file_t *pfile, xf_t *psubhandle );
00131 int _send_notification( xf_t *pxf, xvalue_notify_t *pnotify );
00132 int send_event( xf_t *pxf, xvalue_event_t *pevent );
00133 int send_structurechange( xf_t *pxf, xvalue_structurechange_t *pstructurechange );
00134 int uv_add_to_folder( xvalue_folder_t *pfolder, xvalue_file_t *pfile );
00135 int uv_send_notification( uv_t *puv );
00136 int uv_send_event( uv_t *puv );
00137 int uv_send_structurechange( uv_t *puv );
00138 int uv_notify_setup( xvalue_subscriber_t *psub, xvalue_file_t *pf, 
00139     double derivation );
00140 void * get_filevalue( xvalue_filevalue_u *pfv, int type, int *pcnt );
00141 void listener_notify_setup( char  *filepath, xvalue_file_t *pf, 
00142     double derivation );
00143 int uv_filevalue_set( xvalue_file_t *pfile, xvalue_value_t *pvalue  );
00144 int uv_add_to_parentfile( xvalue_file_t *pfile, 
00145     xvalue_file_t *parentfile, char *parentname );
00146 int uv_rm_from_parent( xvalue_file_t *pfile, char *filepath, 
00147     xvalue_file_t *pparentfile );
00148 int uv_push_to_queue( xvalue_file_t *pfile, xvalue_file_t *pqueue );
00149 uv_t *uv_new( xf_t *pxf, void *userarg );
00150 int uv_close( uv_t *puv );
00151 
00152 // buf.c
00153 void *conv_val( void *p, char *buf, int type, int *pcount );
00154 
00155 // tree.c
00156 void *read_val( char *fn, int type, int *pcount  );
00157 
00158 #endif
00159 

Generated on 4 Mar 2014 for uv by  doxygen 1.4.7