00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
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;
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
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
00158 int
00159 df_node_Destroy(df_node_p df_node);
00160
00161
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
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
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
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