/home/dko/projects/mobilec/trunk/src/include/df.h

Go to the documentation of this file.
00001 /* SVN FILE INFO
00002  * $Revision: 174 $ : Last Committed Revision
00003  * $Date: 2008年06月24日 10:50:29 -0700 (2008年6月24日) $ : Last Committed Date */
00004 /*[
00005  * Copyright (c) 2007 Integration Engineering Laboratory
00006  University of California, Davis
00007  *
00008  * Permission to use, copy, and distribute this software and its
00009  * documentation for any purpose with or without fee is hereby granted,
00010  * provided that the above copyright notice appear in all copies and
00011  * that both that copyright notice and this permission notice appear
00012  * in supporting documentation.
00013  *
00014  * Permission to modify the software is granted, but not the right to
00015  * distribute the complete modified source code. Modifications are to
00016  * be distributed as patches to the released version. Permission to
00017  * distribute binaries produced by compiling modified sources is granted,
00018  * provided you
00019  * 1. distribute the corresponding source modifications from the
00020  * released version in the form of a patch file along with the binaries,
00021  * 2. add special version identification to distinguish your version
00022  * in addition to the base release version number,
00023  * 3. provide your name and address as the primary contact for the
00024  * support of your modified version, and
00025  * 4. retain our contact information in regard to use of the base
00026  * software.
00027  * Permission to distribute the released version of the source code along
00028  * with corresponding source modifications in the form of a patch file is
00029  * granted with same provisions 2 through 4 for binary distributions.
00030  *
00031  * This software is provided "as is" without express or implied warranty
00032  * to the extent permitted by applicable law.
00033 ]*/
00034 
00035 #ifndef _DF_H_
00036 #define _DF_H_
00037 #include "../mc_list/list.h"
00038 #include "../include/macros.h"
00039 #ifdef _WIN32
00040 #include <windows.h>
00041 #endif
00042 
00043 struct mc_platform_s;
00044 
00045 /* Command Indices */
00046 enum df_request_list_index_e{
00047 #define REQUEST(name, string, description) REQUEST_##name, 
00048 #include "df_request.x.h"
00049 #undef REQUEST
00050 REQUEST_COUNT
00051 };
00052 
00053 enum service_types_e {
00054 ZERO,
00055 MISC,
00056 INSERT,
00057 SOME,
00058 TYPES,
00059 HERE
00060 };
00061 
00062 STRUCT(df_request_list_node,
00063 
00064 MUTEX_T *lock;
00065 COND_T *cond;
00066 const char* command;
00067 void* data;
00068 int data_size;
00069 )
00070 
00071 STRUCT( df_request_list,
00072 
00073 MUTEX_T *lock;
00074 COND_T *cond;
00075 int size;
00076 list_p request_list;
00077 )
00078 
00079 STRUCT( df_search_results,
00080 
00081 char **agent_names;
00082 char **service_names;
00083 int *agent_ids;
00084 int num_results;
00085 )
00086 
00087 STRUCT( df_request_search,
00088 MUTEX_T *lock;
00089 COND_T *cond;
00090 char *search_string;
00091 df_search_results_p search_results;
00092 )
00093 
00094 STRUCT( df_node,
00095 
00096 MUTEX_T *lock;
00097 
00098 int agent_id;
00099 char *agent_name;
00100 
00101 int num_services;
00102 char **service_names;
00103 enum service_types_e service_types;
00104 )
00105 
00106 STRUCT( df,
00107 struct mc_platform_s* mc_platform;
00108 MUTEX_T *lock;
00109 COND_T *cond;
00110 list_p service_list;
00111 df_request_list_p request_list;
00112 
00113 int num_entries;
00114 int waiting; /* Flag indicating if thread is waiting for activity */
00115 MUTEX_T *waiting_lock;
00116 COND_T *waiting_cond;
00117 THREAD_T thread;
00118 )
00119 
00120 STRUCT( df_deregister,
00121 
00122 int agent_id;
00123 char *service_name;
00124 )
00125 
00126 
00127 /* df functions */
00128 int 
00129 df_Add(struct df_s* df, struct df_node_s * node);
00130 
00131 int 
00132 df_AddRequest(struct df_s* df, struct df_request_list_node_s* node);
00133 
00134 int 
00135 df_Destroy(df_p df);
00136 
00137 df_p 
00138 df_Initialize(struct mc_platform_s* mc_platform);
00139 
00140 int df_ProcessRequest(
00141 struct mc_platform_s* global
00142 );
00143 
00144 int 
00145 df_SearchForService(
00146 df_p df,
00147 const char* searchstring, 
00148 char*** agent_names,
00149 char*** service_names,
00150 int** agent_ids,
00151 int* num_entries
00152 );
00153 
00154 void
00155 df_Start(struct mc_platform_s* mc_platform);
00156 
00157 /* df_node functions */
00158 int
00159 df_node_Destroy(df_node_p df_node);
00160 
00161 /* df_request_list_node functions */
00162 int 
00163 df_request_list_node_Destroy(df_request_list_node_p node);
00164 
00165 df_request_list_node_p 
00166 df_request_list_node_New(void);
00167 
00168 /* df_request_list functions */
00169 int
00170 df_request_list_Destroy(df_request_list_p df_request_list);
00171 
00172 df_request_list_p 
00173 df_request_list_New(void);
00174 
00175 df_request_list_node_p
00176 df_request_list_Pop(df_request_list_p requests);
00177 
00178 /* df_request_search functions */
00179 
00180 df_request_search_p
00181 df_request_search_New(void);
00182 
00183 int 
00184 df_request_search_Destroy(df_request_search_p node);
00185 
00186 #ifndef _WIN32
00187 void* df_Thread(void* arg);
00188 #else
00189 DWORD WINAPI df_Thread( LPVOID arg );
00190 #endif
00191 
00192 /* Request Handler Function Prototypes */
00193 #define REQUEST(name, string, description) \
00194  int request_handler_##name (struct mc_platform_s *global, void* data);
00195 #include "df_request.x.h"
00196 #undef REQUEST
00197 
00198 
00199 #endif /* AP_DF_H */

Generated on Tue Oct 28 17:03:22 2008 for Mobile-C by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /