diff --git a/thirdparty/EVPath/EVPath/.indent.pro b/thirdparty/EVPath/EVPath/.indent.pro index 7105acfffa..542b994d9c 100644 --- a/thirdparty/EVPath/EVPath/.indent.pro +++ b/thirdparty/EVPath/EVPath/.indent.pro @@ -1,4 +1,4 @@ -nbad -bap -nbc -br -c33 -cd33 -ncdb -ce -ci4 -brs --cli0 -cp33 -d0 -di1 -fc1 -fca -i4 -ip0 -l75 -lp +-cli0 -cp33 -d0 -di1 -fc1 -fca -i4 -ip0 -l120 -lp -npcs -psl -sc -nsob -nss -ts8 -TIOFile -TIOFormat -TIOConversionPtr -TIOFieldList -TIORecordType -TIOFieldPtr diff --git a/thirdparty/EVPath/EVPath/CMakeLists.txt b/thirdparty/EVPath/EVPath/CMakeLists.txt index 384160c512..4de146303f 100644 --- a/thirdparty/EVPath/EVPath/CMakeLists.txt +++ b/thirdparty/EVPath/EVPath/CMakeLists.txt @@ -1,28 +1,10 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.14) # The directory label is used for CDash to treat EVPath as a subproject of # GTKorvo set(CMAKE_DIRECTORY_LABELS EVPath) -project(EVPath VERSION 4.5.0 LANGUAGES C CXX) - -# Enable _ROOT variables for dependency searching -# CMake v3.12 -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() - -# Enable imported targets as library dependencies for CHECK_INCLUDE_FILE -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -# Let option(...) setings work with non-cache variables. Useful for including -# EVPath as a third party dependency in another project. -# CMake v3.13 -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() +project(EVPath VERSION 4.5.4 LANGUAGES C CXX) # Some boilerplate to setup nice output directories include(GNUInstallDirs) @@ -87,7 +69,6 @@ if(WIN32) -D_SCL_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) - set (MSVC_PERL_FLAGS "-msvc-long") endif() endif() @@ -138,7 +119,7 @@ add_library(EVPath cm.c cm_control.c cm_formats.c cm_util.c cm_transport.c cm_lock.c cm_perf.c cm_pbio.c cm_interface.c version.c cm_threadio.c cm_evol.c evp.c response.c metrics.c - dlloader.c ip_config.c chr_time.c + dlloader.c ip_config.c chr_time.c revpath.h revp_internal.h revp.c evp_compat.c thin_server.c evp_threads.c ev_dfg.c) add_library(EVPath::EVPath ALIAS EVPath) add_library(evpath ALIAS EVPath) @@ -297,10 +278,13 @@ if(EVPATH_TRANSPORT_MODULES) add_library(cmselect MODULE cmselect.c) add_library(cmsockets MODULE cmsockets.c ip_config.c) - add_library(cmudp MODULE cmudp.c) - add_library(cmmulticast MODULE cmmulticast.c) - - foreach(M cmselect cmsockets cmudp cmmulticast) + list (APPEND tgts cmselect cmsockets) + if(NOT WIN32) + add_library(cmudp MODULE cmudp.c) + add_library(cmmulticast MODULE cmmulticast.c) + list (APPEND tgts cmudp cmmulticast) + endif() + foreach(M ${tgts}) set_target_properties(${M} PROPERTIES OUTPUT_NAME ${EVPATH_LIBRARY_PREFIX}${M} LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${EVPATH_INSTALL_MODULE_DIR} @@ -310,10 +294,12 @@ if(EVPATH_TRANSPORT_MODULES) target_link_libraries(cmselect PRIVATE evpath_headers atl::atl) target_link_libraries(cmsockets PRIVATE evpath_headers atl::atl) - target_link_libraries(cmudp PRIVATE evpath_headers atl::atl) - target_link_libraries(cmmulticast PRIVATE evpath_headers atl::atl) - - list(APPEND EVPATH_TRANSPORT_TARGETS cmselect cmsockets cmudp cmmulticast) + list(APPEND EVPATH_TRANSPORT_TARGETS cmselect cmsockets) + if(NOT WIN32) + target_link_libraries(cmudp PRIVATE evpath_headers atl::atl) + target_link_libraries(cmmulticast PRIVATE evpath_headers atl::atl) + list (APPEND EVPATH_TRANSPORT_TARGETS cmudp cmmulticast) + endif() if (HAVE_SYS_EPOLL_H) add_library(cmepoll MODULE cmepoll.c) @@ -580,21 +566,42 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/cmake/ FILES_MATCHING PATTERN "Find*.cmake" PATTERN "CMake*.cmake" ) -add_custom_command( - OUTPUT "cm_interface.c" "revp.c" "revpath.h" - SOURCE - ${CMAKE_CURRENT_SOURCE_DIR}/evpath.h ${CMAKE_CURRENT_SOURCE_DIR}/ev_dfg.h - COMMAND perl - ${CMAKE_CURRENT_SOURCE_DIR}/gen_interface.pl - ${CMAKE_CURRENT_SOURCE_DIR}/evpath.h - ${CMAKE_CURRENT_SOURCE_DIR}/ev_dfg.h - ${CMAKE_CURRENT_SOURCE_DIR}/cm_schedule.h - DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/gen_interface.pl - ${CMAKE_CURRENT_SOURCE_DIR}/evpath.h - ${CMAKE_CURRENT_SOURCE_DIR}/ev_dfg.h - ${CMAKE_CURRENT_SOURCE_DIR}/cm_schedule.h -) +find_package(Perl) + +if (PERL_FOUND) + add_custom_command( + OUTPUT "cm_interface.c" "revp.c" "revpath.h" "revp_internal.h" + COMMAND ${PERL_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/gen_interface.pl + ${CMAKE_CURRENT_SOURCE_DIR}/evpath.h + ${CMAKE_CURRENT_SOURCE_DIR}/ev_dfg.h + ${CMAKE_CURRENT_SOURCE_DIR}/cm_schedule.h + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/gen_interface.pl + ${CMAKE_CURRENT_SOURCE_DIR}/evpath.h + ${CMAKE_CURRENT_SOURCE_DIR}/ev_dfg.h + ${CMAKE_CURRENT_SOURCE_DIR}/cm_schedule.h + ) +else() + add_custom_command(OUTPUT cm_interface.c + COMMAND ${CMAKE_COMMAND} -E copy + ${PROJECT_SOURCE_DIR}/pregen-source/cm_interface.c cm_interface.c + COMMENT "Copying pregen cm_interface.c to build area") + add_custom_command(OUTPUT revp.c + COMMAND ${CMAKE_COMMAND} -E copy + ${PROJECT_SOURCE_DIR}/pregen-source/revp.c revp.c + COMMENT "Copying pregen revp.c to build area") + add_custom_command(OUTPUT revpath.h + COMMAND ${CMAKE_COMMAND} -E copy + ${PROJECT_SOURCE_DIR}/pregen-source/revpath.h revpath.h + COMMENT "Copying pregen revpath.h to build area") + + add_custom_command(OUTPUT revp_internal.h + COMMAND ${CMAKE_COMMAND} -E copy + ${PROJECT_SOURCE_DIR}/pregen-source/revp_internal.h revp_internal.h + COMMENT "Copying pregen revp_internal.h to build area") + +endif() if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) set(USE_PTHREADS TRUE) @@ -604,6 +611,8 @@ CHECK_INCLUDE_FILE(hostlib.h HAVE_HOSTLIB_H) CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H) CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H) CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H) +CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H) +CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H) CHECK_INCLUDE_FILE(sockLib.h HAVE_SOCKLIB_H) CHECK_INCLUDE_FILE(stdarg.h STDC_HEADERS) CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) diff --git a/thirdparty/EVPath/EVPath/chr_time.c b/thirdparty/EVPath/EVPath/chr_time.c index 0cbd146b6d..55db08ec5f 100644 --- a/thirdparty/EVPath/EVPath/chr_time.c +++ b/thirdparty/EVPath/EVPath/chr_time.c @@ -5,7 +5,7 @@ #ifdef HAVE_SYS_TIME_H #include #endif -#ifdef _MSC_VER +#ifdef _WIN32 #include #include #include diff --git a/thirdparty/EVPath/EVPath/cm.c b/thirdparty/EVPath/EVPath/cm.c index e1bb4fdc9e..12179f2df4 100644 --- a/thirdparty/EVPath/EVPath/cm.c +++ b/thirdparty/EVPath/EVPath/cm.c @@ -17,9 +17,13 @@ #include #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #define __ANSI_CPP__ +#define lrand48() rand() +#define srand48(x) srand((unsigned int)(x)) #else #include #include @@ -60,6 +64,7 @@ extern void libcmselect_LTX_select_stop(CMtrans_services svc,void *client_data); static void CMinitialize (CManager cm); static atom_t CM_TRANSPORT = -1; +static atom_t CM_CMANAGER_ID = -1; static atom_t CM_NETWORK_POSTFIX = -1; static atom_t CM_CONN_BLOCKING = -1; atom_t CM_REBWM_RLEN = -1; @@ -232,7 +237,7 @@ static thr_thread_t thr_fork(void*(*func)(void*), void *arg) { thr_thread_t new_thread = 0; - int err = thr_thread_create(&new_thread, NULL, (void*(*)(void*))func, arg); + int err = thr_thread_create(&new_thread, NULL, (void*)func, arg); if (err != 0) { return (thr_thread_t) (intptr_t)NULL; } else { @@ -258,7 +263,7 @@ INT_CMfork_comm_thread(CManager cm) if (server_thread == (thr_thread_t)(intptr_t) NULL) { return 0; } - cm->control_list->server_thread = server_thread; + cm->control_list->server_thread = thr_get_thread_id(server_thread); cm->control_list->has_thread = 1; cm->reference_count++; CMtrace_out(cm, CMFreeVerbose, "Forked - CManager %p ref count now %d\n", @@ -575,6 +580,7 @@ CMinternal_listen(CManager cm, attr_list listen_info, int try_others) attrs = (*trans_list)->listen(cm, &CMstatic_trans_svcs, *trans_list, listen_info); + add_attr(attrs, CM_CMANAGER_ID, Attr_Int4, (intptr_t)cm->CManager_ID); if (iface) { add_string_attr(attrs, CM_IP_INTERFACE, strdup(iface)); } @@ -752,6 +758,7 @@ INT_CManager_create_control(char *control_module) if (atom_init == 0) { CM_TRANSPORT = attr_atom_from_string("CM_TRANSPORT"); + CM_CMANAGER_ID = attr_atom_from_string("CM_CMANAGER_ID"); CM_NETWORK_POSTFIX = attr_atom_from_string("CM_NETWORK_POSTFIX"); CM_CONN_BLOCKING = attr_atom_from_string("CM_CONN_BLOCKING"); CM_REBWM_RLEN = attr_atom_from_string("CM_REG_BW_RUN_LEN"); @@ -772,6 +779,9 @@ INT_CManager_create_control(char *control_module) cm->transports = NULL; cm->initialized = 0; cm->reference_count = 1; + uint64_t seed = getpid() + time(NULL); + srand48(seed); + cm->CManager_ID = (int)lrand48(); char *tmp; if ((tmp = getenv("CMControlModule"))) { @@ -1053,7 +1063,7 @@ CManager_free(CManager cm) new_list->select_data = NULL; new_list->add_select = NULL; new_list->remove_select = NULL; - new_list->server_thread = (thr_thread_t)(intptr_t) NULL; + new_list->server_thread = (thr_thread_id)0; new_list->network_blocking_function.func = NULL; new_list->network_polling_function.func = NULL; new_list->polling_function_list = NULL; @@ -1490,7 +1500,7 @@ INT_CMget_ip_config_diagnostics(CManager cm) msg[0] = 0x434d4800; /* CMH\0 */ msg[1] = (CURRENT_HANDSHAKE_VERSION << 24) + sizeof(msg); msg[2] = cm->FFSserver_identifier; - msg[3] = 5; /* not implemented yet */ + msg[3] = cm->CManager_ID; msg[4] = 0; /* not implemented yet */ if (conn->remote_format_server_ID != 0) { /* set high bit if we already have his ID */ @@ -1691,12 +1701,16 @@ timeout_conn(CManager cm, void *client_data) fprintf(cm->CMTrace_file, "In CMinternal_get_conn, attrs "); if (attrs) fdump_attr_list(cm->CMTrace_file, attrs); else fprintf(cm->CMTrace_file, "\n"); } + int target_cm_id = -1; + (void) get_int_attr(attrs, CM_CMANAGER_ID, &target_cm_id); for (i=0; iconnection_count; i++) { CMConnection tmp = cm->connections[i]; if (tmp->closed || tmp->failed) continue; - if (tmp->trans->connection_eq(cm, &CMstatic_trans_svcs, - tmp->trans, attrs, - tmp->transport_data)) { + + if ((tmp->remote_CManager_ID == target_cm_id) || + tmp->trans->connection_eq(cm, &CMstatic_trans_svcs, + tmp->trans, attrs, + tmp->transport_data)) { CMtrace_out(tmp->cm, CMFreeVerbose, "internal_get_conn found conn=%p ref count will be %d\n", tmp, tmp->conn_ref_count +1); @@ -2088,6 +2102,7 @@ timeout_conn(CManager cm, void *client_data) if (cm_preread_hook) { do_read = cm_preread_hook(buffer_full_point - buffer_data_end, tmp_message_buffer); } + CMtrace_out(cm, CMLowLevelVerbose, "P5\n"); if (do_read) { if (trans->read_to_buffer_func) { /* @@ -3851,7 +3866,7 @@ CM_init_select(CMControlList cl, CManager cm) } CMtrace_out(cm, CMLowLevelVerbose, "CM - Forked comm thread %p\n", (void*)(intptr_t)server_thread); - cm->control_list->server_thread = server_thread; + cm->control_list->server_thread = thr_get_thread_id(server_thread); cm->control_list->cl_reference_count++; cm->control_list->free_reference_count++; cl->has_thread = 1; @@ -3968,7 +3983,7 @@ int offset_compare(const void* lhsv, const void* rhsv) return lhs->offset.tv_usec - rhs->offset.tv_usec; } -#ifdef _MSC_VER +#ifdef _WIN32 static inline void timeradd(struct timeval *a, struct timeval *b, struct timeval *res) { diff --git a/thirdparty/EVPath/EVPath/cm_control.c b/thirdparty/EVPath/EVPath/cm_control.c index 4344aedf6c..63862ea49a 100644 --- a/thirdparty/EVPath/EVPath/cm_control.c +++ b/thirdparty/EVPath/EVPath/cm_control.c @@ -242,7 +242,7 @@ INT_CMCondition_wait(CManager cm, int condition) (void*)(intptr_t)cl->server_thread); } if (!cl->has_thread) { - if ((cl->server_thread == (thr_thread_t) (intptr_t) NULL) || (cl->server_thread == thr_thread_self())) { + if ((cl->server_thread == (thr_thread_id) 0) || (cl->server_thread == thr_thread_self())) { cl->cond_polling = 1; while (!(cond->signaled || cond->failed)) { if (cm_control_debug_flag) { @@ -255,7 +255,7 @@ INT_CMCondition_wait(CManager cm, int condition) fprintf(cm->CMTrace_file, "CMLowLevel after Polling for CMcondition %d\n", condition); } /* the poll and handle will set cl->server_thread, restore it */ - cl->server_thread = (thr_thread_t) (intptr_t)NULL; + cl->server_thread = (thr_thread_id) (intptr_t)NULL; if (cm_control_debug_flag) { fprintf(cm->CMTrace_file, "CMLowLevel In condition wait, reset server thread = %lx\n", (long)cl->server_thread); diff --git a/thirdparty/EVPath/EVPath/cm_evol.c b/thirdparty/EVPath/EVPath/cm_evol.c index dc62cddc39..8a46ae661c 100644 --- a/thirdparty/EVPath/EVPath/cm_evol.c +++ b/thirdparty/EVPath/EVPath/cm_evol.c @@ -11,7 +11,9 @@ #endif #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #define __ANSI_CPP__ #else diff --git a/thirdparty/EVPath/EVPath/cm_internal.h b/thirdparty/EVPath/EVPath/cm_internal.h index 173a1ce366..0837a2ed95 100644 --- a/thirdparty/EVPath/EVPath/cm_internal.h +++ b/thirdparty/EVPath/EVPath/cm_internal.h @@ -15,6 +15,8 @@ #include #define thr_mutex_t pthread_mutex_t #define thr_thread_t pthread_t +#define thr_thread_id thr_thread_t +#define thr_get_thread_id(t) (t) #define thr_condition_t pthread_cond_t #define thr_thread_self() pthread_self() #define thr_thread_exit(status) pthread_exit(status); @@ -34,24 +36,35 @@ #else //#include #include -#define thr_mutex_t HANDLE -#define thr_thread_t DWORD -#define thr_condition_t HANDLE -#define thr_thread_create(w,x,y,z) 0 +extern int win_thread_create(HANDLE* w, void* x, void* y, void* z); +extern void win_mutex_init(SRWLOCK *m); +extern void win_mutex_lock(SRWLOCK* m); +extern void win_mutex_unlock(SRWLOCK* m); +extern void win_mutex_free(SRWLOCK* m); +extern void win_condition_init(CONDITION_VARIABLE *c); +extern void win_condition_wait(CONDITION_VARIABLE *c, SRWLOCK *m); +extern void win_condition_signal(CONDITION_VARIABLE *c); +extern void win_condition_free(CONDITION_VARIABLE *c); +#define thr_mutex_t SRWLOCK +#define thr_thread_t HANDLE +#define thr_thread_id DWORD +#define thr_condition_t CONDITION_VARIABLE +#define thr_thread_create(w,x,y,z) win_thread_create(w,x,y,z) #define thr_thread_self() GetCurrentThreadId() -#define thr_thread_exit(status) +#define thr_thread_exit(status) ExitThread((DWORD)(intptr_t)status) +#define thr_get_thread_id(t) GetThreadId(t) #define thr_thread_detach(thread) #define thr_thread_yield() #define thr_thread_join(t, s) (void)s -#define thr_mutex_init(m) -#define thr_mutex_lock(m) -#define thr_mutex_unlock(m) -#define thr_mutex_free(m) -#define thr_condition_init(c) -#define thr_condition_wait(c, m) -#define thr_condition_signal(c) -#define thr_condition_broadcast(c) -#define thr_condition_free(c) +#define thr_mutex_init(m) win_mutex_init(&m) +#define thr_mutex_lock(m) win_mutex_lock(&m) +#define thr_mutex_unlock(m) win_mutex_unlock(&m) +#define thr_mutex_free(m) win_mutex_free(&m) +#define thr_condition_init(c) win_condition_init(&c) +#define thr_condition_wait(c, m) win_condition_wait(&c, &m) +#define thr_condition_signal(c) win_condition_signal(&c) +#define thr_condition_broadcast(c) error +#define thr_condition_free(c) win_condition_free(&c) #endif #include @@ -138,6 +151,7 @@ typedef struct _CManager { int initialized; int reference_count; char *control_module_choice; /* this is static, doesn't need to be free'd */ + int CManager_ID; CMControlList control_list; /* the control list for this DE */ @@ -240,7 +254,7 @@ typedef struct _CMControlList { int closed; int has_thread; int cond_polling; - thr_thread_t server_thread; + thr_thread_id server_thread; } CMControlList_s; struct queued_data_rec { diff --git a/thirdparty/EVPath/EVPath/cm_pbio.c b/thirdparty/EVPath/EVPath/cm_pbio.c index 84aedbc777..1dd42f9688 100644 --- a/thirdparty/EVPath/EVPath/cm_pbio.c +++ b/thirdparty/EVPath/EVPath/cm_pbio.c @@ -8,7 +8,9 @@ #endif #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #else #include diff --git a/thirdparty/EVPath/EVPath/cm_perf.c b/thirdparty/EVPath/EVPath/cm_perf.c index 30bce15e4b..0f3770b2bf 100644 --- a/thirdparty/EVPath/EVPath/cm_perf.c +++ b/thirdparty/EVPath/EVPath/cm_perf.c @@ -12,7 +12,9 @@ #endif #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #define __ANSI_CPP__ #else diff --git a/thirdparty/EVPath/EVPath/cm_schedule.h b/thirdparty/EVPath/EVPath/cm_schedule.h index 8b2132b373..766d80d24a 100644 --- a/thirdparty/EVPath/EVPath/cm_schedule.h +++ b/thirdparty/EVPath/EVPath/cm_schedule.h @@ -7,8 +7,10 @@ extern "C" { #endif -#ifdef _MSC_VER +#ifdef _WIN32 +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #endif typedef struct _avail_period { diff --git a/thirdparty/EVPath/EVPath/cm_threadio.c b/thirdparty/EVPath/EVPath/cm_threadio.c index 08441bbd12..ba64380d44 100644 --- a/thirdparty/EVPath/EVPath/cm_threadio.c +++ b/thirdparty/EVPath/EVPath/cm_threadio.c @@ -46,7 +46,7 @@ static thr_thread_t thr_fork(void*(*func)(void*), void *arg) { thr_thread_t new_thread = 0; - int err = thr_thread_create(&new_thread, NULL, (void*(*)(void*))func, arg); + int err = thr_thread_create(&new_thread, 0, (void*)func, arg); if (err != 0) { return (thr_thread_t) (intptr_t) NULL; } else { diff --git a/thirdparty/EVPath/EVPath/cm_util.c b/thirdparty/EVPath/EVPath/cm_util.c index d6509555db..082f1f0e31 100644 --- a/thirdparty/EVPath/EVPath/cm_util.c +++ b/thirdparty/EVPath/EVPath/cm_util.c @@ -1,5 +1,4 @@ #include "config.h" -#ifndef MODULE #include #ifdef HAVE_UNISTD_H @@ -12,11 +11,7 @@ #include #endif #include -#else -#include "kernel/kcm.h" -#include "kernel/cm_kernel.h" -#include "kernel/library.h" -#endif + #include "atl.h" #include "evpath.h" #include "chr_time.h" @@ -297,3 +292,50 @@ INT_CMfree(void *ptr) free(ptr); } +#ifdef _MSC_VER +#include +#include +#include +int +win_thread_create(HANDLE *threadp, void *attr, void *startfunc, void *arg) +{ + HANDLE h = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)startfunc, arg, 0, attr); + (*threadp) = h; + return 0; +} +void win_mutex_init(SRWLOCK *m) +{ + InitializeSRWLock(m); +} + + +void win_mutex_lock(SRWLOCK *m) +{ + AcquireSRWLockExclusive(m); +} +void win_mutex_unlock(SRWLOCK *m) +{ + ReleaseSRWLockExclusive(m); +} +void win_mutex_free(SRWLOCK *m) +{ + // nothing necessary +} +extern void win_condition_init(CONDITION_VARIABLE *c) +{ + InitializeConditionVariable(c); +} +extern void win_condition_wait(CONDITION_VARIABLE *c, SRWLOCK* m) +{ + SleepConditionVariableSRW(c, m, INFINITE, 0); +} + +extern void win_condition_signal(CONDITION_VARIABLE *c) +{ + WakeConditionVariable(c); +} +extern void win_condition_free(CONDITION_VARIABLE *c) +{ + // nothing necessary +} +#endif diff --git a/thirdparty/EVPath/EVPath/cmdemo.c b/thirdparty/EVPath/EVPath/cmdemo.c index bc9cc90db7..b4ee139b7f 100644 --- a/thirdparty/EVPath/EVPath/cmdemo.c +++ b/thirdparty/EVPath/EVPath/cmdemo.c @@ -25,14 +25,12 @@ typedef struct _nested_rec { complex item; } nested, *nested_ptr; -static IOField nested_field_list[] = -{ +static IOField nested_field_list[] = { {"item", "complex", sizeof(complex), IOOffset(nested_ptr, item)}, {NULL, NULL, 0, 0} }; -static IOField complex_field_list[] = -{ +static IOField complex_field_list[] = { {"r", "double", sizeof(double), IOOffset(complex_ptr, r)}, {"i", "double", sizeof(double), IOOffset(complex_ptr, i)}, {NULL, NULL, 0, 0} @@ -48,8 +46,7 @@ typedef struct _simple_rec { int scan_sum; } simple_rec, *simple_rec_ptr; -static IOField simple_field_list[] = -{ +static IOField simple_field_list[] = { {"integer_field", "integer", sizeof(int), IOOffset(simple_rec_ptr, integer_field)}, {"short_field", "integer", @@ -67,15 +64,14 @@ static IOField simple_field_list[] = {NULL, NULL, 0, 0} }; -static CMFormatRec simple_format_list[] = -{ +static CMFormatRec simple_format_list[] = { {"complex", complex_field_list}, {"nested", nested_field_list}, {NULL, NULL} }; static -void + void generate_record(event) simple_rec_ptr event; { @@ -103,7 +99,7 @@ simple_rec_ptr event; int quiet = -1; static -void + void simple_handler(cm, conn, vevent, client_data, attrs) CManager cm; CMConnection conn; @@ -123,8 +119,7 @@ attr_list attrs; sum = sum % 100; scan_sum = event->scan_sum; if (sum != scan_sum) { - printf("Received record checksum does not match. expected %d, got %d\n", - (int) sum, (int) scan_sum); + printf("Received record checksum does not match. expected %d, got %d\n", (int) sum, (int) scan_sum); } if ((quiet <= 0) || (sum != scan_sum)) { printf("In the handler, event data is :\n"); @@ -168,8 +163,7 @@ char **argv; CMlisten_specific(cm, listen_list); contact_list = CMget_contact_list(cm); printf("Contact list \"%s\"\n", attr_list_to_string(contact_list)); - format = CMregister_format(cm, "simple", simple_field_list, - simple_format_list); + format = CMregister_format(cm, "simple", simple_field_list, simple_format_list); CMregister_handler(format, simple_handler, NULL); CMsleep(cm, 120); } else { @@ -186,8 +180,7 @@ char **argv; exit(1); } } - format = CMregister_format(cm, "simple", simple_field_list, - simple_format_list); + format = CMregister_format(cm, "simple", simple_field_list, simple_format_list); generate_record(&data); attrs = create_attr_list(); #define CMDEMO_TEST_ATOM ATL_CHAR_CONS('C','\115','\104','t') diff --git a/thirdparty/EVPath/EVPath/cmenet.c b/thirdparty/EVPath/EVPath/cmenet.c index b33989de52..71d2eba533 100644 --- a/thirdparty/EVPath/EVPath/cmenet.c +++ b/thirdparty/EVPath/EVPath/cmenet.c @@ -6,7 +6,9 @@ #undef NDEBUG #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include @@ -39,8 +41,12 @@ #ifdef HAVE_STREAMS_UN_H #include #endif +#ifdef HAVE_NETINET_IN_H #include +#endif +#ifdef HAVE_ARPA_INET_H #include +#endif #ifdef HAVE_NETDB_H #include #endif @@ -189,9 +195,6 @@ extern void ZPLENETdummy() { // for warning suppression #define INTERFACE_NAME(NAME) libcmenet_LTX_ ## NAME #include #endif -#ifndef _MSC_VER -#include -#endif #include #ifdef HAVE_SYS_TIME_H #include diff --git a/thirdparty/EVPath/EVPath/cmepoll.c b/thirdparty/EVPath/EVPath/cmepoll.c index 84d95470c9..7b2513eb96 100644 --- a/thirdparty/EVPath/EVPath/cmepoll.c +++ b/thirdparty/EVPath/EVPath/cmepoll.c @@ -3,7 +3,9 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include diff --git a/thirdparty/EVPath/EVPath/cmib.c b/thirdparty/EVPath/EVPath/cmib.c index 1a956cedb1..4d81a1d5ba 100644 --- a/thirdparty/EVPath/EVPath/cmib.c +++ b/thirdparty/EVPath/EVPath/cmib.c @@ -3,7 +3,9 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #define getpid() _getpid() diff --git a/thirdparty/EVPath/EVPath/cmmulticast.c b/thirdparty/EVPath/EVPath/cmmulticast.c index 3d0e1f0897..e17e5a0373 100644 --- a/thirdparty/EVPath/EVPath/cmmulticast.c +++ b/thirdparty/EVPath/EVPath/cmmulticast.c @@ -3,12 +3,12 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include -#define getpid() _getpid() -#define close(x) closesocket(x) #else #ifdef HAVE_SYS_TIME_H #include @@ -60,6 +60,10 @@ #ifdef HAVE_MEMORY_H #include #endif +#ifdef _WIN32 +#define getpid() _getpid() +#define close(x) closesocket(x) +#endif #include #include "evpath.h" diff --git a/thirdparty/EVPath/EVPath/cmselect.c b/thirdparty/EVPath/EVPath/cmselect.c index ab0ad46a19..2b9403809d 100644 --- a/thirdparty/EVPath/EVPath/cmselect.c +++ b/thirdparty/EVPath/EVPath/cmselect.c @@ -3,7 +3,9 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include @@ -109,7 +111,7 @@ typedef struct func_list_item { } FunctionListElement; typedef struct select_data { - thr_thread_t server_thread; + thr_thread_id server_thread; void *fdset; /* bitmap of the fds for read select */ void *write_set; /* bitmap of the fds for write select */ @@ -153,7 +155,7 @@ init_select_data(CMtrans_services svc, select_data_ptr *sdp, CManager cm) EVPATH_FD_ZERO((fd_set *) sd->fdset); sd->write_set = svc->malloc_func(sizeof(fd_set)); EVPATH_FD_ZERO((fd_set *) sd->write_set); - sd->server_thread = (thr_thread_t)(intptr_t) NULL; + sd->server_thread = (thr_thread_id)(intptr_t) NULL; sd->closed = 0; sd->sel_item_max = 0; sd->select_items = (FunctionListElement *) svc->malloc_func(sizeof(FunctionListElement)); @@ -179,7 +181,7 @@ init_select_data(CMtrans_services svc, select_data_ptr *sdp, CManager cm) typedef struct _periodic_task { int period_sec; int period_usec; - thr_thread_t executing; + thr_thread_id executing; struct timeval next_time; select_list_func func; void *arg1; @@ -221,7 +223,7 @@ set_soonest_timeout(struct timeval *timeout, periodic_task_handle task_list, str if (task_list == NULL) return; this_delay.tv_sec = task_list->next_time.tv_sec - now.tv_sec; this_delay.tv_usec = task_list->next_time.tv_usec - now.tv_usec; - if (task_list->executing == (thr_thread_t)-1) { + if (task_list->executing == (thr_thread_id)-1) { /* this task not executing already, see when it needs to run */ if (this_delay.tv_usec < 0) { this_delay.tv_sec--; @@ -260,7 +262,7 @@ socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int tim int tmp_select_consistency_number = sd->select_consistency_number; if (sd->closed) { - sd->server_thread = (thr_thread_t)(intptr_t) NULL; + sd->server_thread = (thr_thread_id)(intptr_t) NULL; return; } @@ -268,7 +270,7 @@ socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int tim /* assert CM is locked */ assert(CM_LOCKED(svc, sd->cm)); } - if (sd->server_thread == (thr_thread_t)(intptr_t) NULL) { + if (sd->server_thread == (thr_thread_id)(intptr_t) NULL) { /* no server thread set, must be this one */ sd->server_thread = thr_thread_self(); } @@ -321,7 +323,7 @@ socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int tim ACQUIRE_CM_LOCK(svc, sd->cm); } if (sd->closed) { - sd->server_thread = (thr_thread_t)(intptr_t) NULL; + sd->server_thread = (thr_thread_id)(intptr_t) NULL; return; } #ifndef HAVE_WINDOWS_H @@ -440,7 +442,7 @@ socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int tim if (res != 0) { for (i = 0; i <= sd->sel_item_max; i++) { if (sd->closed) { - sd->server_thread = (thr_thread_t)(intptr_t) NULL; + sd->server_thread = (thr_thread_id)(intptr_t) NULL; return; } if (FD_ISSET(i, &wr_set)) { @@ -496,14 +498,14 @@ socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int tim increment_time(&this_periodic_task->next_time, this_periodic_task->period_sec, this_periodic_task->period_usec); - if (this_periodic_task->executing == (thr_thread_t)-1) { + if (this_periodic_task->executing == (thr_thread_id)-1) { this_periodic_task->executing = thr_thread_self(); DROP_CM_LOCK(svc, sd->cm); this_periodic_task->func(this_periodic_task->arg1, this_periodic_task->arg2); ACQUIRE_CM_LOCK(svc, sd->cm); next = this_periodic_task->next; - this_periodic_task->executing = (thr_thread_t) -1; + this_periodic_task->executing = (thr_thread_id) -1; if ((this_periodic_task->period_sec == 0) && (this_periodic_task->period_usec == 0)) { remove_periodic_task(sd, this_periodic_task); @@ -652,7 +654,7 @@ libcmselect_LTX_add_periodic(CMtrans_services svc, select_data_ptr *sdp, int int } handle->period_sec = interval_sec; handle->period_usec = interval_usec; - handle->executing = (thr_thread_t) -1; + handle->executing = (thr_thread_id) -1; #ifndef HAVE_WINDOWS_H gettimeofday(&handle->next_time, NULL); #else @@ -699,7 +701,7 @@ libcmselect_LTX_add_delayed_task(CMtrans_services svc, select_data_ptr *sdp, int } handle->period_sec = 0; handle->period_usec = 0; - handle->executing = (thr_thread_t) -1; + handle->executing = (thr_thread_id) -1; #ifndef HAVE_WINDOWS_H gettimeofday(&handle->next_time, NULL); #else @@ -751,7 +753,7 @@ remove_periodic_task(select_data_ptr sd, periodic_task_handle handle) if (handle->executing != thr_thread_self()) { /* someone besides us executing this ? */ int i = 0; - while (handle->executing != (thr_thread_t)-1) { + while (handle->executing != (thr_thread_id)-1) { /* wait until they're done */ thr_thread_yield(); i++; diff --git a/thirdparty/EVPath/EVPath/cmsockets.c b/thirdparty/EVPath/EVPath/cmsockets.c index a054fd452d..dc5d59eb8c 100644 --- a/thirdparty/EVPath/EVPath/cmsockets.c +++ b/thirdparty/EVPath/EVPath/cmsockets.c @@ -3,7 +3,9 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include @@ -856,7 +858,7 @@ static void set_block_state(CMtrans_services svc, socket_conn_data_ptr scd, socket_block_state needed_block_state) { -#ifndef _MSC_VER +#ifndef _WIN32 int fdflags = fcntl(scd->fd, F_GETFL, 0); if (fdflags == -1) { perror("getflags\n"); @@ -879,6 +881,26 @@ set_block_state(CMtrans_services svc, socket_conn_data_ptr scd, scd->fd); } #else + if ((needed_block_state == Block) && (scd->block_state == Non_Block)) { + u_long mode = 0; // 0 to enable blocking socket + int ret = ioctlsocket(scd->fd, FIONBIO, &mode); + scd->block_state = Block; + if (ret != NO_ERROR) + printf("ioctlsocket failed with error: %ld\n", ret); + + svc->trace_out(scd->sd->cm, "CMSocket switch fd %d to blocking WIN properly", + scd->fd); + } else if ((needed_block_state == Non_Block) && + (scd->block_state == Block)) { + u_long mode = 1; // 1 to enable non-blocking socket + int ret = ioctlsocket(scd->fd, FIONBIO, &mode); + if (ret != NO_ERROR) + printf("ioctlsocket failed with error: %ld\n", ret); + + scd->block_state = Non_Block; + svc->trace_out(scd->sd->cm, "CMSocket switch fd %d to nonblocking WIN properly", + scd->fd); + } #endif } @@ -886,7 +908,7 @@ extern ssize_t libcmsockets_LTX_read_to_buffer_func(CMtrans_services svc, socket_conn_data_ptr scd, void *buffer, ssize_t requested_len, int non_blocking) { ssize_t left, iget; -#ifndef _MSC_VER +#ifndef _WIN32 // GSE int fdflags = fcntl(scd->fd, F_GETFL, 0); if (fdflags == -1) { @@ -909,7 +931,8 @@ libcmsockets_LTX_read_to_buffer_func(CMtrans_services svc, socket_conn_data_ptr iget = read(scd->fd, (char *) buffer, (int)requested_len); if ((iget == -1) || (iget == 0)) { int lerrno = errno; - if ((lerrno != EWOULDBLOCK) && + if ((lerrno != 0) && + (lerrno != EWOULDBLOCK) && (lerrno != EAGAIN) && (lerrno != EINTR)) { /* serious error */ diff --git a/thirdparty/EVPath/EVPath/cmudp.c b/thirdparty/EVPath/EVPath/cmudp.c index 4c6815f2ad..226bb1d0cc 100644 --- a/thirdparty/EVPath/EVPath/cmudp.c +++ b/thirdparty/EVPath/EVPath/cmudp.c @@ -3,10 +3,11 @@ #include #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include -#define getpid() _getpid() #else #ifdef HAVE_SYS_TIME_H #include @@ -59,6 +60,9 @@ #include #endif +#ifdef _WIN32 +#define getpid() _getpid() +#endif #include #include "evpath.h" #include "cm_transport.h" @@ -627,7 +631,7 @@ libcmudp_LTX_writev_func(CMtrans_services svc, udp_conn_data_ptr ucd, struct iov fd = ucd->utd->socket_fd; svc->trace_out(ucd->utd->cm, "CMUdp writev of %d vectors on fd %d", iovcnt, fd); -#ifndef _MSC_VER +#ifndef _WIN32 struct sockaddr_in addr = ucd->dest_addr; struct msghdr msg; memset(&msg, 0, sizeof(msg)); diff --git a/thirdparty/EVPath/EVPath/config.h.cmake b/thirdparty/EVPath/EVPath/config.h.cmake index 13943a10a8..b7ffa68fed 100644 --- a/thirdparty/EVPath/EVPath/config.h.cmake +++ b/thirdparty/EVPath/EVPath/config.h.cmake @@ -72,6 +72,12 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NETDB_H +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDARG_H diff --git a/thirdparty/EVPath/EVPath/dlloader.c b/thirdparty/EVPath/EVPath/dlloader.c index 8cc58134d1..07ced47444 100644 --- a/thirdparty/EVPath/EVPath/dlloader.c +++ b/thirdparty/EVPath/EVPath/dlloader.c @@ -8,7 +8,7 @@ #include "dlloader.h" static char **search_list = NULL; -#ifdef _MSC_VER +#ifdef _WIN32 #include static struct { @@ -57,7 +57,11 @@ void* dlsym(void* handle, const char* name) return (void*)(intptr_t)fp; } +#ifndef DLFCN_EXPORT const char* dlerror(void) +#else +DLFCN_EXPORT char* dlerror(void) +#endif { static char errstr[88]; diff --git a/thirdparty/EVPath/EVPath/ev_internal.h b/thirdparty/EVPath/EVPath/ev_internal.h index f787a372b9..62ed43696e 100644 --- a/thirdparty/EVPath/EVPath/ev_internal.h +++ b/thirdparty/EVPath/EVPath/ev_internal.h @@ -234,7 +234,7 @@ typedef struct _EVclient_sources { typedef struct _ev_handler_activation_rec { struct _ev_handler_activation_rec *prev; - thr_thread_t thread_id; + thr_thread_id thread_id; EVstone stone_id; struct _ev_handler_activation_rec *next; } ev_handler_activation_rec, *ev_handler_activation_ptr; diff --git a/thirdparty/EVPath/EVPath/evp.c b/thirdparty/EVPath/EVPath/evp.c index d38ae3cc7c..77a10ff357 100644 --- a/thirdparty/EVPath/EVPath/evp.c +++ b/thirdparty/EVPath/EVPath/evp.c @@ -1632,7 +1632,7 @@ pop_activation_record_from_stack(CManager cm, ev_handler_activation_ptr rec) { event_path_data evp = cm->evp; ev_handler_activation_ptr tmp; - thr_thread_t self = thr_thread_self(); + thr_thread_id self = thr_thread_self(); if (!evp->activation_stack) { printf("Activation stack inconsistency! No records!\n"); return; @@ -1663,7 +1663,7 @@ find_activation_record_from_stack(CManager cm) { event_path_data evp = cm->evp; ev_handler_activation_ptr tmp; - thr_thread_t self = thr_thread_self(); + thr_thread_id self = thr_thread_self(); tmp = evp->activation_stack; while(tmp) { if (tmp->thread_id == self) { diff --git a/thirdparty/EVPath/EVPath/gen_interface.pl b/thirdparty/EVPath/EVPath/gen_interface.pl index d79335ea5d..791ea96efa 100755 --- a/thirdparty/EVPath/EVPath/gen_interface.pl +++ b/thirdparty/EVPath/EVPath/gen_interface.pl @@ -1,4 +1,4 @@ -#! /usr/bin/env - perl +#!perl use File::Basename; my $dirname = dirname(__FILE__); diff --git a/thirdparty/EVPath/EVPath/ip_config.c b/thirdparty/EVPath/EVPath/ip_config.c index e07b4ecd81..174c6a7fd2 100644 --- a/thirdparty/EVPath/EVPath/ip_config.c +++ b/thirdparty/EVPath/EVPath/ip_config.c @@ -7,7 +7,9 @@ #include #endif #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #include @@ -334,7 +336,27 @@ get_qual_hostname(char *buf, int len, attr_list attrs, trace_func(trace_data, "CM - Tentative Qualified hostname %s", buf); if (memchr(buf, '.', strlen(buf)) == NULL) { /* useless hostname if it's not fully qualified */ - buf[0] = 0; + struct addrinfo hints, *info, *p; + int gai_result; + + char hostname[1024]; + hostname[1023] = '\0'; + gethostname(hostname, 1023); + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_UNSPEC; /*either IPV4 or IPV6*/ + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + + if ((gai_result = getaddrinfo(hostname, NULL, &hints, &info)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(gai_result)); + } + + for(p = info; p != NULL; p = p->ai_next) { + strcpy(buf, p->ai_canonname); + } + + freeaddrinfo(info); } if ((buf[0] != 0) && ((host = gethostbyname(buf)) == NULL)) { /* useless hostname if we can't translate it */ @@ -484,7 +506,7 @@ dump_output(int length_estimate, char *format, ...) #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 255 #endif -#ifdef _MSC_VER +#ifdef _WIN32 static int inet_aton(const char* cp, struct in_addr* addr) { addr->s_addr = inet_addr(cp); diff --git a/thirdparty/EVPath/EVPath/metrics.c b/thirdparty/EVPath/EVPath/metrics.c index fdfc365f64..cf9c64380c 100644 --- a/thirdparty/EVPath/EVPath/metrics.c +++ b/thirdparty/EVPath/EVPath/metrics.c @@ -603,7 +603,7 @@ double dgettimeofday( void ) /**************OS FUNCTIONS**************/ char* os_type() { -#ifndef _MSC_VER +#ifndef _WIN32 static struct utsname output; static int first = 1; if (first) { @@ -617,7 +617,7 @@ char* os_type() { } char* os_release() { -#ifndef _MSC_VER +#ifndef _WIN32 static struct utsname output; static int first = 1; if (first) { diff --git a/thirdparty/EVPath/EVPath/mtests/cmconn.c b/thirdparty/EVPath/EVPath/mtests/cmconn.c index 6b723b4fda..6d0ae934ef 100644 --- a/thirdparty/EVPath/EVPath/mtests/cmconn.c +++ b/thirdparty/EVPath/EVPath/mtests/cmconn.c @@ -26,13 +26,18 @@ #include #endif #include "evpath.h" +<<<<<<< HEAD #include +======= +>>>>>>> upstream-EVPath #ifdef _MSC_VER #define drand48() (((double)rand())/((double)RAND_MAX)) #define lrand48() rand() #define srand48(x) #define kill(x,y) TerminateProcess(OpenProcess(0,0,(DWORD)x),y) +#else +#include #endif typedef struct _msg_rec { char *contact_list; diff --git a/thirdparty/EVPath/EVPath/mtests/support.c b/thirdparty/EVPath/EVPath/mtests/support.c index 01bb680382..5d9eb0b415 100644 --- a/thirdparty/EVPath/EVPath/mtests/support.c +++ b/thirdparty/EVPath/EVPath/mtests/support.c @@ -96,13 +96,40 @@ run_subprocess(char **args) { char **run_args = args; #ifdef HAVE_WINDOWS_H - intptr_t child; - child = _spawnv(_P_NOWAIT, "./evtest.exe", args); - if (child == -1) { - printf("failed for evtest\n"); - perror("spawnv"); + STARTUPINFO si; + PROCESS_INFORMATION pi; + char comm_line[8191]; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + char module[MAX_PATH]; + GetModuleFileName(NULL, &module[0], MAX_PATH); + int i = 1; + strcpy(comm_line, module); + strcat(comm_line, " "); + while (args[i] != NULL) { + strcat(comm_line, args[i]); + strcat(comm_line, " "); + i++; + } - return child; + if (!CreateProcess(module, + comm_line, + NULL, // Process handle not inheritable + NULL, // Thread handle not inheritable + FALSE, // Set handle inheritance to FALSE + 0, // No creation flags + NULL, // Use parent's environment block + NULL, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi ) + ) + { + printf( "CreateProcess failed (%d).\n", GetLastError() ); + return 0; + } + return (intptr_t) pi.hProcess; #else pid_t child; if (quiet <=0) {printf("Forking subprocess\n");} diff --git a/thirdparty/EVPath/EVPath/pregen-source/cm_interface.c b/thirdparty/EVPath/EVPath/pregen-source/cm_interface.c new file mode 100644 index 0000000000..ce16c335bb --- /dev/null +++ b/thirdparty/EVPath/EVPath/pregen-source/cm_interface.c @@ -0,0 +1,1590 @@ +/* + * This file is automatically generated by gen_interface.pl from evpath.h. + * + * DO NOT EDIT + * + */ +#include "config.h" +#include "stdio.h" +#include "string.h" +#include "stdlib.h" +#include "ffs.h" +#ifdef HAVE_COD_H +#include "cod.h" +#endif +#include "atl.h" +#include "evpath.h" +#include "cm_internal.h" +#include "ev_dfg.h" +#include "ev_dfg_internal.h" +#ifdef __cplusplus +extern "C" { +#endif + +extern int +CMCondition_get ( CManager cm, CMConnection dep ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMCondition_get(cm, dep); + CManager_unlock(cm); + return ret; +} + +extern void* +CMCondition_get_client_data ( CManager cm, int condition ) +{ + void* ret; + CManager_lock(cm); + ret = INT_CMCondition_get_client_data(cm, condition); + CManager_unlock(cm); + return ret; +} + +extern int +CMCondition_has_failed ( CManager cm, int condition ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMCondition_has_failed(cm, condition); + CManager_unlock(cm); + return ret; +} + +extern int +CMCondition_has_signaled ( CManager cm, int condition ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMCondition_has_signaled(cm, condition); + CManager_unlock(cm); + return ret; +} + +extern void +CMCondition_set_client_data ( CManager cm, int condition, void *client_data ) +{ + CManager_lock(cm); + INT_CMCondition_set_client_data(cm, condition, client_data); + CManager_unlock(cm); +} + +extern void +CMCondition_signal ( CManager cm, int condition ) +{ + CManager_lock(cm); + INT_CMCondition_signal(cm, condition); + CManager_unlock(cm); +} + +extern int +CMCondition_wait ( CManager cm, int condition ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMCondition_wait(cm, condition); + CManager_unlock(cm); + return ret; +} + +extern void +CMConnection_add_reference ( CMConnection conn ) +{ + CManager cm = conn->cm; + CManager_lock(cm); + INT_CMConnection_add_reference(conn); + CManager_unlock(cm); +} + +extern void +CMConnection_close ( CMConnection conn ) +{ + CManager cm = conn->cm; + CManager_lock(cm); + INT_CMConnection_close(conn); + CManager_unlock(cm); +} + +extern void +CMConnection_dereference ( CMConnection conn ) +{ + CManager cm = conn->cm; + CManager_lock(cm); + INT_CMConnection_dereference(conn); + CManager_unlock(cm); +} + +extern attr_list +CMConnection_get_attrs ( CMConnection conn ) +{ + attr_list ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMConnection_get_attrs(conn); + CManager_unlock(cm); + return ret; +} + +extern int +CMConnection_set_character ( CMConnection conn, attr_list attrs ) +{ + int ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMConnection_set_character(conn, attrs); + CManager_unlock(cm); + return ret; +} + +extern int +CMConnection_write_would_block ( CMConnection conn ) +{ + int ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMConnection_write_would_block(conn); + CManager_unlock(cm); + return ret; +} + +extern void +CMTrace_file_id ( int ID ) +{ + INT_CMTrace_file_id(ID); +} + +extern void +CM_fd_add_select ( CManager cm, SOCKET fd, select_func handler_func, void *param1, void *param2 ) +{ + CManager_lock(cm); + INT_CM_fd_add_select(cm, fd, handler_func, param1, param2); + CManager_unlock(cm); +} + +extern void +CM_insert_contact_info ( CManager cm, attr_list attrs ) +{ + CManager_lock(cm); + INT_CM_insert_contact_info(cm, attrs); + CManager_unlock(cm); +} + +extern CMTaskHandle +CMadd_delayed_task ( CManager cm, int secs, int usecs, CMPollFunc func, void *client_data ) +{ + CMTaskHandle ret; + CManager_lock(cm); + ret = INT_CMadd_delayed_task(cm, secs, usecs, func, client_data); + CManager_unlock(cm); + return ret; +} + +extern CMTaskHandle +CMadd_periodic ( CManager cm, long period, CMPollFunc func, void *client_data ) +{ + CMTaskHandle ret; + CManager_lock(cm); + ret = INT_CMadd_periodic(cm, period, func, client_data); + CManager_unlock(cm); + return ret; +} + +extern CMTaskHandle +CMadd_periodic_task ( CManager cm, int period_sec, int period_usec, CMPollFunc func, void *client_data ) +{ + CMTaskHandle ret; + CManager_lock(cm); + ret = INT_CMadd_periodic_task(cm, period_sec, period_usec, func, client_data); + CManager_unlock(cm); + return ret; +} + +extern void +CMadd_poll ( CManager cm, CMPollFunc func, void *client_data ) +{ + CManager_lock(cm); + INT_CMadd_poll(cm, func, client_data); + CManager_unlock(cm); +} + +extern void +CMadd_shutdown_task ( CManager cm, CMPollFunc func, void *client_data, int task_type ) +{ + CManager_lock(cm); + INT_CMadd_shutdown_task(cm, func, client_data, task_type); + CManager_unlock(cm); +} + +extern void +CMadd_stone_to_global_lookup ( CManager cm, int stone_num, int global_stone_num ) +{ + CManager_lock(cm); + INT_CMadd_stone_to_global_lookup(cm, stone_num, global_stone_num); + CManager_unlock(cm); +} + +extern void +CManager_close ( CManager cm ) +{ + CManager_lock(cm); + INT_CManager_close(cm); +} + +extern CManager +CManager_create ( ) +{ + CManager ret; + ret = INT_CManager_create(); + return ret; +} + +extern CManager +CManager_create_control ( char *control_module ) +{ + CManager ret; + ret = INT_CManager_create_control(control_module); + return ret; +} + +extern void +CMconn_register_close_handler ( CMConnection conn, CMCloseHandlerFunc func, void *client_data ) +{ + CManager cm = conn->cm; + CManager_lock(cm); + INT_CMconn_register_close_handler(conn, func, client_data); + CManager_unlock(cm); +} + +extern int +CMcontact_self_check ( CManager cm, attr_list attrs ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMcontact_self_check(cm, attrs); + CManager_unlock(cm); + return ret; +} + +extern attr_list +CMderef_and_copy_list ( CManager cm, attr_list attrs ) +{ + attr_list ret; + CManager_lock(cm); + ret = INT_CMderef_and_copy_list(cm, attrs); + CManager_unlock(cm); + return ret; +} + +extern int +CMfork_comm_thread ( CManager cm ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMfork_comm_thread(cm); + CManager_unlock(cm); + return ret; +} + +extern void +CMfree ( void *ptr ) +{ + INT_CMfree(ptr); +} + +extern FMContext +CMget_FMcontext ( CManager cm ) +{ + FMContext ret; + ret = INT_CMget_FMcontext(cm); + return ret; +} + +extern CMConnection +CMget_conn ( CManager cm, attr_list contact_list ) +{ + CMConnection ret; + CManager_lock(cm); + ret = INT_CMget_conn(cm, contact_list); + CManager_unlock(cm); + return ret; +} + +extern attr_list +CMget_contact_list ( CManager cm ) +{ + attr_list ret; + CManager_lock(cm); + ret = INT_CMget_contact_list(cm); + CManager_unlock(cm); + return ret; +} + +extern CMConnection +CMget_indexed_conn ( CManager cm, int i ) +{ + CMConnection ret; + CManager_lock(cm); + ret = INT_CMget_indexed_conn(cm, i); + CManager_unlock(cm); + return ret; +} + +extern char* +CMget_ip_config_diagnostics ( CManager cm ) +{ + char* ret; + ret = INT_CMget_ip_config_diagnostics(cm); + return ret; +} + +extern void +CMget_port_range ( CManager cm, int *high_bound, int *low_bound ) +{ + INT_CMget_port_range(cm, high_bound, low_bound); +} + +extern void +CMget_qual_hostname ( CManager cm, char *buf, int len ) +{ + INT_CMget_qual_hostname(cm, buf, len); +} + +extern int +CMget_self_ip_addr ( CManager cm ) +{ + int ret; + ret = INT_CMget_self_ip_addr(cm); + return ret; +} + +extern attr_list +CMget_specific_contact_list ( CManager cm, attr_list attrs ) +{ + attr_list ret; + CManager_lock(cm); + ret = INT_CMget_specific_contact_list(cm, attrs); + CManager_unlock(cm); + return ret; +} + +extern CMtrans_services +CMget_static_trans_services ( ) +{ + CMtrans_services ret; + ret = INT_CMget_static_trans_services(); + return ret; +} + +extern void* +CMget_transport_data ( CMConnection conn ) +{ + void* ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMget_transport_data(conn); + CManager_unlock(cm); + return ret; +} + +extern CMConnection +CMinitiate_conn ( CManager cm, attr_list contact_list ) +{ + CMConnection ret; + CManager_lock(cm); + ret = INT_CMinitiate_conn(cm, contact_list); + CManager_unlock(cm); + return ret; +} + +extern void +CMinstall_perf_upcall ( CManager cm, CMperf_upcall upcall ) +{ + CManager_lock(cm); + INT_CMinstall_perf_upcall(cm, upcall); + CManager_unlock(cm); +} + +extern int +CMinstall_pull_schedule ( CManager cm, struct timeval *base_time, struct timeval *period, CMavail_period_ptr avail ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMinstall_pull_schedule(cm, base_time, period, avail); + CManager_unlock(cm); + return ret; +} + +extern int +CMlisten ( CManager cm ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMlisten(cm); + CManager_unlock(cm); + return ret; +} + +extern int +CMlisten_specific ( CManager cm, attr_list listen_info ) +{ + int ret; + CManager_lock(cm); + ret = INT_CMlisten_specific(cm, listen_info); + CManager_unlock(cm); + return ret; +} + +extern CMFormat +CMlookup_format ( CManager cm, FMStructDescList format_list ) +{ + CMFormat ret; + CManager_lock(cm); + ret = INT_CMlookup_format(cm, format_list); + CManager_unlock(cm); + return ret; +} + +extern void* +CMmalloc ( long size ) +{ + void* ret; + ret = INT_CMmalloc(size); + return ret; +} + +extern void +CMpoll_network ( CManager cm ) +{ + CManager_lock(cm); + INT_CMpoll_network(cm); + CManager_unlock(cm); +} + +extern double +CMprobe_bandwidth ( CMConnection conn, long size, attr_list attrs ) +{ + double ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMprobe_bandwidth(conn, size, attrs); + CManager_unlock(cm); + return ret; +} + +extern long +CMprobe_latency ( CMConnection conn, long msg_size, attr_list attrs ) +{ + long ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMprobe_latency(conn, msg_size, attrs); + CManager_unlock(cm); + return ret; +} + +extern void* +CMrealloc ( void *ptr, long size ) +{ + void* ret; + ret = INT_CMrealloc(ptr, size); + return ret; +} + +extern CMFormat +CMregister_format ( CManager cm, FMStructDescList format_list ) +{ + CMFormat ret; + CManager_lock(cm); + ret = INT_CMregister_format(cm, format_list); + CManager_unlock(cm); + return ret; +} + +extern void +CMregister_handler ( CMFormat format, CMHandlerFunc handler, void *client_data ) +{ + CManager cm = format->cm; + CManager_lock(cm); + INT_CMregister_handler(format, handler, client_data); + CManager_unlock(cm); +} + +extern void +CMregister_invalid_message_handler ( CManager cm, CMUnregCMHandler handler ) +{ + INT_CMregister_invalid_message_handler(cm, handler); +} + +extern void +CMregister_non_CM_message_handler ( int header, CMNonCMHandler handler ) +{ + INT_CMregister_non_CM_message_handler(header, handler); +} + +extern CMFormat +CMregister_simple_format ( CManager cm, char *format_name, FMFieldList field_list, int struct_size ) +{ + CMFormat ret; + CManager_lock(cm); + ret = INT_CMregister_simple_format(cm, format_name, field_list, struct_size); + CManager_unlock(cm); + return ret; +} + +extern void +CMregister_write_callback ( CMConnection conn, CMWriteCallbackFunc handler, void *client_data ) +{ + CManager cm = conn->cm; + CManager_lock(cm); + INT_CMregister_write_callback(conn, handler, client_data); + CManager_unlock(cm); +} + +extern double +CMregressive_probe_bandwidth ( CMConnection conn, long size, attr_list attrs ) +{ + double ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMregressive_probe_bandwidth(conn, size, attrs); + CManager_unlock(cm); + return ret; +} + +extern void +CMremove_periodic ( CMTaskHandle handle ) +{ + CManager cm = handle->cm; + CManager_lock(cm); + INT_CMremove_periodic(handle); + CManager_unlock(cm); +} + +extern void +CMremove_task ( CMTaskHandle handle ) +{ + CManager cm = handle->cm; + CManager_lock(cm); + INT_CMremove_task(handle); + CManager_unlock(cm); +} + +extern void +CMreturn_buffer ( CManager cm, void *data ) +{ + CManager_lock(cm); + INT_CMreturn_buffer(cm, data); + CManager_unlock(cm); +} + +extern void +CMrun_network ( CManager cm ) +{ + CManager_lock(cm); + INT_CMrun_network(cm); + CManager_unlock(cm); +} + +extern void +CMsleep ( CManager cm, int secs ) +{ + CManager_lock(cm); + INT_CMsleep(cm, secs); + CManager_unlock(cm); +} + +extern void* +CMtake_buffer ( CManager cm, void *data ) +{ + void* ret; + CManager_lock(cm); + ret = INT_CMtake_buffer(cm, data); + CManager_unlock(cm); + return ret; +} + +extern attr_list +CMtest_transport ( CMConnection conn, attr_list how ) +{ + attr_list ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMtest_transport(conn, how); + CManager_unlock(cm); + return ret; +} + +extern void +CMusleep ( CManager cm, int usecs ) +{ + CManager_lock(cm); + INT_CMusleep(cm, usecs); + CManager_unlock(cm); +} + +extern int +CMwrite ( CMConnection conn, CMFormat format, void *data ) +{ + int ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMwrite(conn, format, data); + CManager_unlock(cm); + return ret; +} + +extern int +CMwrite_attr ( CMConnection conn, CMFormat format, void *data, attr_list attrs ) +{ + int ret; + CManager cm = conn->cm; + CManager_lock(cm); + ret = INT_CMwrite_attr(conn, format, data, attrs); + CManager_unlock(cm); + return ret; +} + +extern int +EVaction_add_split_target ( CManager cm, EVstone stone, EVaction action, EVstone target_stone ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVaction_add_split_target(cm, stone, action, target_stone); + CManager_unlock(cm); + return ret; +} + +extern void +EVaction_remove_split_target ( CManager cm, EVstone stone, EVaction action, EVstone target_stone ) +{ + CManager_lock(cm); + INT_EVaction_remove_split_target(cm, stone, action, target_stone); + CManager_unlock(cm); +} + +extern int +EVaction_set_output ( CManager cm, EVstone stone, EVaction action, int output_index, EVstone target_stone ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVaction_set_output(cm, stone, action, output_index, target_stone); + CManager_unlock(cm); + return ret; +} + +extern void +EVadd_dll_search_dir ( char *path_string ) +{ + INT_EVadd_dll_search_dir(path_string); +} + +extern void +EVadd_standard_routines ( CManager cm, char *extern_string, cod_extern_entry *externs ) +{ + CManager_lock(cm); + INT_EVadd_standard_routines(cm, extern_string, externs); + CManager_unlock(cm); +} + +extern void +EVadd_standard_structs ( CManager cm, FMStructDescList *lists ) +{ + CManager_lock(cm); + INT_EVadd_standard_structs(cm, lists); + CManager_unlock(cm); +} + +extern EVstone +EValloc_stone ( CManager cm ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EValloc_stone(cm); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_bridge_action ( CManager cm, EVstone stone, attr_list contact_list, EVstone remote_stone ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_bridge_action(cm, stone, contact_list, remote_stone); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_congestion_action ( CManager cm, EVstone stone, char *action_spec, void* client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_congestion_action(cm, stone, action_spec, client_data); + CManager_unlock(cm); + return ret; +} + +extern void +EVassoc_conversion_action ( CManager cm, int stone_id, int stage, FMFormat target_format, FMFormat incoming_format ) +{ + CManager_lock(cm); + INT_EVassoc_conversion_action(cm, stone_id, stage, target_format, incoming_format); + CManager_unlock(cm); +} + +extern EVaction +EVassoc_filter_action ( CManager cm, EVstone stone, FMStructDescList incoming_format_list, EVSimpleHandlerFunc handler, EVstone out_stone, void* client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_filter_action(cm, stone, incoming_format_list, handler, out_stone, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_immediate_action ( CManager cm, EVstone stone, char *action_spec, void *client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_immediate_action(cm, stone, action_spec, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_multi_action ( CManager cm, EVstone stone, char *action_spec, void *client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_multi_action(cm, stone, action_spec, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_raw_terminal_action ( CManager cm, EVstone stone, EVRawHandlerFunc handler, void* client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_raw_terminal_action(cm, stone, handler, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_split_action ( CManager cm, EVstone stone, EVstone *target_list ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_split_action(cm, stone, target_list); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_store_action ( CManager cm, EVstone stone_num, EVstone out_stone, int store_limit ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_store_action(cm, stone_num, out_stone, store_limit); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_terminal_action ( CManager cm, EVstone stone, FMStructDescList format_list, EVSimpleHandlerFunc handler, void* client_data ) +{ + EVaction ret; + CManager_lock(cm); + ret = INT_EVassoc_terminal_action(cm, stone, format_list, handler, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVaction +EVassoc_thread_bridge_action ( CManager cm, EVstone stone, CManager target_cm, EVstone target_stone ) +{ + EVaction ret; + CManager_lock(target_cm); + ret = INT_EVassoc_thread_bridge_action(cm, stone, target_cm, target_stone); + CManager_unlock(target_cm); + return ret; +} + +extern void +EVclear_stored ( CManager cm, EVstone stone_num, EVaction action_num ) +{ + CManager_lock(cm); + INT_EVclear_stored(cm, stone_num, action_num); + CManager_unlock(cm); +} + +extern unsigned int +EVclient_active_sink_count ( EVclient client ) +{ + unsigned int ret; + CManager_lock(client->cm); + ret = INT_EVclient_active_sink_count(client); + CManager_unlock(client->cm); + return ret; +} + +extern EVclient +EVclient_assoc ( CManager cm, char *node_name, char *master_contact, EVclient_sources source_capabilities, EVclient_sinks sink_capabilities ) +{ + EVclient ret; + CManager_lock(cm); + ret = INT_EVclient_assoc(cm, node_name, master_contact, source_capabilities, sink_capabilities); + CManager_unlock(cm); + return ret; +} + +extern EVclient +EVclient_assoc_local ( CManager cm, char *node_name, EVmaster master, EVclient_sources source_capabilities, EVclient_sinks sink_capabilities ) +{ + EVclient ret; + CManager_lock(master->cm); + ret = INT_EVclient_assoc_local(cm, node_name, master, source_capabilities, sink_capabilities); + CManager_unlock(master->cm); + return ret; +} + +extern int +EVclient_force_shutdown ( EVclient client, int result ) +{ + int ret; + CManager_lock(client->cm); + ret = INT_EVclient_force_shutdown(client, result); + CManager_unlock(client->cm); + return ret; +} + +extern void +EVclient_ready_for_shutdown ( EVclient client ) +{ + CManager_lock(client->cm); + INT_EVclient_ready_for_shutdown(client); + CManager_unlock(client->cm); +} + +extern int +EVclient_ready_wait ( EVclient client ) +{ + int ret; + CManager_lock(client->cm); + ret = INT_EVclient_ready_wait(client); + CManager_unlock(client->cm); + return ret; +} + +extern EVclient_sinks +EVclient_register_raw_sink_handler ( CManager cm, char *name, EVRawHandlerFunc handler, void *client_data ) +{ + EVclient_sinks ret; + CManager_lock(cm); + ret = INT_EVclient_register_raw_sink_handler(cm, name, handler, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVclient_sinks +EVclient_register_sink_handler ( CManager cm, char *name, FMStructDescList list, EVSimpleHandlerFunc handler, void* client_data ) +{ + EVclient_sinks ret; + CManager_lock(cm); + ret = INT_EVclient_register_sink_handler(cm, name, list, handler, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVclient_sources +EVclient_register_source ( char *name, EVsource src ) +{ + EVclient_sources ret; + CManager cm = src->cm; + CManager_lock(cm); + ret = INT_EVclient_register_source(name, src); + CManager_unlock(cm); + return ret; +} + +extern int +EVclient_shutdown ( EVclient client, int result ) +{ + int ret; + CManager_lock(client->cm); + ret = INT_EVclient_shutdown(client, result); + CManager_unlock(client->cm); + return ret; +} + +extern int +EVclient_source_active ( EVsource src ) +{ + int ret; + CManager cm = src->cm; + CManager_lock(cm); + ret = INT_EVclient_source_active(src); + CManager_unlock(cm); + return ret; +} + +extern int +EVclient_test_for_shutdown ( EVclient client ) +{ + int ret; + CManager_lock(client->cm); + ret = INT_EVclient_test_for_shutdown(client); + CManager_unlock(client->cm); + return ret; +} + +extern int +EVclient_wait_for_shutdown ( EVclient client ) +{ + int ret; + CManager_lock(client->cm); + ret = INT_EVclient_wait_for_shutdown(client); + CManager_unlock(client->cm); + return ret; +} + +extern EVstone +EVcreate_auto_stone ( CManager cm, int period_sec, int period_usec, char *action_spec, EVstone out_stone ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_auto_stone(cm, period_sec, period_usec, action_spec, out_stone); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_bridge_action ( CManager cm, attr_list contact_list, EVstone remote_stone ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_bridge_action(cm, contact_list, remote_stone); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_immediate_action ( CManager cm, char *action_spec, EVstone *target_list ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_immediate_action(cm, action_spec, target_list); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_split_action ( CManager cm, EVstone *target_list ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_split_action(cm, target_list); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_stone_action ( CManager cm, char *action_spec ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_stone_action(cm, action_spec); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_store_action ( CManager cm, EVstone out_stone, int store_limit ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_store_action(cm, out_stone, store_limit); + CManager_unlock(cm); + return ret; +} + +extern EVsource +EVcreate_submit_handle ( CManager cm, EVstone stone, FMStructDescList data_format ) +{ + EVsource ret; + CManager_lock(cm); + ret = INT_EVcreate_submit_handle(cm, stone, data_format); + CManager_unlock(cm); + return ret; +} + +extern EVsource +EVcreate_submit_handle_free ( CManager cm, EVstone stone, FMStructDescList data_format, EVFreeFunction free_func, void *client_data ) +{ + EVsource ret; + CManager_lock(cm); + ret = INT_EVcreate_submit_handle_free(cm, stone, data_format, free_func, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_terminal_action ( CManager cm, FMStructDescList format_list, EVSimpleHandlerFunc handler, void* client_data ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVcreate_terminal_action(cm, format_list, handler, client_data); + CManager_unlock(cm); + return ret; +} + +extern EVstone +EVcreate_thread_bridge_action ( CManager cm, CManager target_cm, EVstone target_stone ) +{ + EVstone ret; + CManager_lock(target_cm); + ret = INT_EVcreate_thread_bridge_action(cm, target_cm, target_stone); + CManager_unlock(target_cm); + return ret; +} + +extern int +EVdestroy_stone ( CManager cm, EVstone stone_id ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVdestroy_stone(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern void +EVdfg_add_action ( EVdfg_stone stone, char *action_spec ) +{ + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_add_action(stone, action_spec); + CManager_unlock(cm); +} + +extern void +EVdfg_add_sink_action ( EVdfg_stone stone, char *handler_name ) +{ + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_add_sink_action(stone, handler_name); + CManager_unlock(cm); +} + +extern int +EVdfg_assign_node ( EVdfg_stone stone, char *node ) +{ + int ret; + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_assign_node(stone, node); + CManager_unlock(cm); + return ret; +} + +extern EVdfg +EVdfg_create ( EVmaster master ) +{ + EVdfg ret; + CManager_lock(master->cm); + ret = INT_EVdfg_create(master); + CManager_unlock(master->cm); + return ret; +} + +extern EVdfg_stone +EVdfg_create_sink_stone ( EVdfg dfg, char *handler_name ) +{ + EVdfg_stone ret; + CManager cm = dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_create_sink_stone(dfg, handler_name); + CManager_unlock(cm); + return ret; +} + +extern EVdfg_stone +EVdfg_create_source_stone ( EVdfg dfg, char *source_name ) +{ + EVdfg_stone ret; + CManager cm = dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_create_source_stone(dfg, source_name); + CManager_unlock(cm); + return ret; +} + +extern EVdfg_stone +EVdfg_create_stone ( EVdfg dfg, char *action_spec ) +{ + EVdfg_stone ret; + CManager cm = dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_create_stone(dfg, action_spec); + CManager_unlock(cm); + return ret; +} + +extern void +EVdfg_dump_graph ( EVdfg_state_type which, EVdfg dfg ) +{ + CManager cm = dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_dump_graph(which, dfg); + CManager_unlock(cm); +} + +extern void +EVdfg_enable_auto_stone ( EVdfg_stone stone, int period_sec, int period_usec ) +{ + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_enable_auto_stone(stone, period_sec, period_usec); + CManager_unlock(cm); +} + +extern attr_list +EVdfg_get_attr_list ( EVdfg_stone stone ) +{ + attr_list ret; + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_get_attr_list(stone); + CManager_unlock(cm); + return ret; +} + +extern void +EVdfg_link_dest ( EVdfg_stone source, EVdfg_stone destination ) +{ + CManager cm = destination->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_link_dest(source, destination); + CManager_unlock(cm); +} + +extern void +EVdfg_link_port ( EVdfg_stone source, int output_index, EVdfg_stone destination ) +{ + CManager cm = destination->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_link_port(source, output_index, destination); + CManager_unlock(cm); +} + +extern void +EVdfg_realize ( EVdfg dfg ) +{ + CManager cm = dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_realize(dfg); + CManager_unlock(cm); +} + +extern void +EVdfg_set_attr_list ( EVdfg_stone stone, attr_list attrs ) +{ + CManager cm = stone->dfg->master->cm; + CManager_lock(cm); + INT_EVdfg_set_attr_list(stone, attrs); + CManager_unlock(cm); +} + +extern int +EVdfg_unlink_dest ( EVdfg_stone source, EVdfg_stone destination ) +{ + int ret; + CManager cm = destination->dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_unlink_dest(source, destination); + CManager_unlock(cm); + return ret; +} + +extern int +EVdfg_unlink_port ( EVdfg_stone source, int output_index ) +{ + int ret; + CManager cm = source->dfg->master->cm; + CManager_lock(cm); + ret = INT_EVdfg_unlink_port(source, output_index); + CManager_unlock(cm); + return ret; +} + +extern int +EVdrain_stone ( CManager cm, EVstone stone_id ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVdrain_stone(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern void +EVenable_auto_stone ( CManager cm, EVstone stone_num, int period_sec, int period_usec ) +{ + CManager_lock(cm); + INT_EVenable_auto_stone(cm, stone_num, period_sec, period_usec); + CManager_unlock(cm); +} + +extern EVstone +EVexecuting_stone ( CManager cm ) +{ + EVstone ret; + CManager_lock(cm); + ret = INT_EVexecuting_stone(cm); + CManager_unlock(cm); + return ret; +} + +extern attr_list +EVextract_attr_list ( CManager cm, EVstone stone_id ) +{ + attr_list ret; + CManager_lock(cm); + ret = INT_EVextract_attr_list(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern EVevent_list +EVextract_stone_events ( CManager cm, EVstone stone_id ) +{ + EVevent_list ret; + CManager_lock(cm); + ret = INT_EVextract_stone_events(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern void +EVfree_source ( EVsource source ) +{ + CManager cm = source->cm; + CManager_lock(cm); + INT_EVfree_source(source); + CManager_unlock(cm); +} + +extern void +EVfree_stone ( CManager cm, EVstone stone ) +{ + CManager_lock(cm); + INT_EVfree_stone(cm, stone); + CManager_unlock(cm); +} + +extern int +EVfreeze_stone ( CManager cm, EVstone stone_id ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVfreeze_stone(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern FMFormat +EVget_src_ref_format ( EVsource source ) +{ + FMFormat ret; + CManager cm = source->cm; + CManager_lock(cm); + ret = INT_EVget_src_ref_format(source); + CManager_unlock(cm); + return ret; +} + +extern int +EVmaster_assign_canonical_name ( EVmaster master, char *given_name, char *canonical_name ) +{ + int ret; + CManager_lock(master->cm); + ret = INT_EVmaster_assign_canonical_name(master, given_name, canonical_name); + CManager_unlock(master->cm); + return ret; +} + +extern EVmaster +EVmaster_create ( CManager cm ) +{ + EVmaster ret; + CManager_lock(cm); + ret = INT_EVmaster_create(cm); + CManager_unlock(cm); + return ret; +} + +extern char* +EVmaster_get_contact_list ( EVmaster master ) +{ + char* ret; + CManager_lock(master->cm); + ret = INT_EVmaster_get_contact_list(master); + CManager_unlock(master->cm); + return ret; +} + +extern void +EVmaster_node_fail_handler ( EVmaster master, EVmasterFailHandlerFunc func ) +{ + CManager_lock(master->cm); + INT_EVmaster_node_fail_handler(master, func); + CManager_unlock(master->cm); +} + +extern void +EVmaster_node_join_handler ( EVmaster master, EVmasterJoinHandlerFunc func ) +{ + CManager_lock(master->cm); + INT_EVmaster_node_join_handler(master, func); + CManager_unlock(master->cm); +} + +extern void +EVmaster_node_reconfig_handler ( EVmaster master, EVmasterReconfigHandlerFunc func ) +{ + CManager_lock(master->cm); + INT_EVmaster_node_reconfig_handler(master, func); + CManager_unlock(master->cm); +} + +extern void +EVmaster_register_node_list ( EVmaster master, char** list ) +{ + CManager_lock(master->cm); + INT_EVmaster_register_node_list(master, list); + CManager_unlock(master->cm); +} + +extern void +EVregister_close_handler ( CManager cm, EVStoneCloseHandlerFunc handler, void *client_data ) +{ + CManager_lock(cm); + INT_EVregister_close_handler(cm, handler, client_data); + CManager_unlock(cm); +} + +extern void +EVreturn_event_buffer ( CManager cm, void *event ) +{ + CManager_lock(cm); + INT_EVreturn_event_buffer(cm, event); + CManager_unlock(cm); +} + +extern void +EVsend_stored ( CManager cm, EVstone stone_num, EVaction action_num ) +{ + CManager_lock(cm); + INT_EVsend_stored(cm, stone_num, action_num); + CManager_unlock(cm); +} + +extern void +EVset_attr_list ( CManager cm, EVstone stone_id, attr_list list ) +{ + CManager_lock(cm); + INT_EVset_attr_list(cm, stone_id, list); + CManager_unlock(cm); +} + +extern void +EVset_store_limit ( CManager cm, EVstone stone_num, EVaction action_num, int store_limit ) +{ + CManager_lock(cm); + INT_EVset_store_limit(cm, stone_num, action_num, store_limit); + CManager_unlock(cm); +} + +extern void +EVstall_stone ( CManager cm, EVstone stone_id ) +{ + CManager_lock(cm); + INT_EVstall_stone(cm, stone_id); + CManager_unlock(cm); +} + +extern void +EVstone_add_split_target ( CManager cm, EVstone stone, EVstone target_stone ) +{ + CManager_lock(cm); + INT_EVstone_add_split_target(cm, stone, target_stone); + CManager_unlock(cm); +} + +extern void +EVstone_remove_split_target ( CManager cm, EVstone stone, EVstone target_stone ) +{ + CManager_lock(cm); + INT_EVstone_remove_split_target(cm, stone, target_stone); + CManager_unlock(cm); +} + +extern int +EVstone_set_output ( CManager cm, EVstone stone, int output_index, EVstone target_stone ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVstone_set_output(cm, stone, output_index, target_stone); + CManager_unlock(cm); + return ret; +} + +extern int +EVstore_count ( CManager cm, EVstone stone_num, EVaction action_num ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVstore_count(cm, stone_num, action_num); + CManager_unlock(cm); + return ret; +} + +extern int +EVstore_is_sending ( CManager cm, EVstone stone_num, EVaction action_num ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVstore_is_sending(cm, stone_num, action_num); + CManager_unlock(cm); + return ret; +} + +extern void +EVstore_start_send ( CManager cm, EVstone stone_num, EVaction action_num ) +{ + CManager_lock(cm); + INT_EVstore_start_send(cm, stone_num, action_num); + CManager_unlock(cm); +} + +extern void +EVsubmit ( EVsource source, void *data, attr_list attrs ) +{ + CManager cm = source->cm; + CManager_lock(cm); + INT_EVsubmit(source, data, attrs); + CManager_unlock(cm); +} + +extern void +EVsubmit_encoded ( CManager cm, EVstone stone, void *data, size_t data_len, attr_list attrs ) +{ + CManager_lock(cm); + INT_EVsubmit_encoded(cm, stone, data, data_len, attrs); + CManager_unlock(cm); +} + +extern int +EVsubmit_encoded_or_wait ( CManager cm, EVstone stone, void *data, int data_len, attr_list attrs, EVSubmitCallbackFunc cb, void *user_data ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVsubmit_encoded_or_wait(cm, stone, data, data_len, attrs, cb, user_data); + CManager_unlock(cm); + return ret; +} + +extern void +EVsubmit_general ( EVsource source, void *data, EVFreeFunction free_func, attr_list attrs ) +{ + CManager cm = source->cm; + CManager_lock(cm); + INT_EVsubmit_general(source, data, free_func, attrs); + CManager_unlock(cm); +} + +extern int +EVsubmit_or_wait ( EVsource source, void *data, attr_list attrs, EVSubmitCallbackFunc cb, void *user_data ) +{ + int ret; + CManager cm = source->cm; + CManager_lock(cm); + ret = INT_EVsubmit_or_wait(source, data, attrs, cb, user_data); + CManager_unlock(cm); + return ret; +} + +extern int +EVtake_event_buffer ( CManager cm, void *event ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVtake_event_buffer(cm, event); + CManager_unlock(cm); + return ret; +} + +extern int +EVtransfer_events ( CManager cm, EVstone src_stone, EVstone dest_stone ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVtransfer_events(cm, src_stone, dest_stone); + CManager_unlock(cm); + return ret; +} + +extern int +EVunfreeze_stone ( CManager cm, EVstone stone_id ) +{ + int ret; + CManager_lock(cm); + ret = INT_EVunfreeze_stone(cm, stone_id); + CManager_unlock(cm); + return ret; +} + +extern void +EVunstall_stone ( CManager cm, EVstone stone_id ) +{ + CManager_lock(cm); + INT_EVunstall_stone(cm, stone_id); + CManager_unlock(cm); +} + +extern char* +create_filter_action_spec ( FMStructDescList format_list, char *function ) +{ + char* ret; + ret = INT_create_filter_action_spec(format_list, function); + return ret; +} + +extern char* +create_multityped_action_spec ( FMStructDescList *input_format_lists, char *function ) +{ + char* ret; + ret = INT_create_multityped_action_spec(input_format_lists, function); + return ret; +} + +extern char* +create_router_action_spec ( FMStructDescList format_list, char *function ) +{ + char* ret; + ret = INT_create_router_action_spec(format_list, function); + return ret; +} + +extern char* +create_transform_action_spec ( FMStructDescList format_list, FMStructDescList out_format_list, char *function ) +{ + char* ret; + ret = INT_create_transform_action_spec(format_list, out_format_list, function); + return ret; +} +#ifdef __cplusplus +} +#endif diff --git a/thirdparty/EVPath/EVPath/pregen-source/revp.c b/thirdparty/EVPath/EVPath/pregen-source/revp.c new file mode 100644 index 0000000000..df4c7f92f5 --- /dev/null +++ b/thirdparty/EVPath/EVPath/pregen-source/revp.c @@ -0,0 +1,2756 @@ +/* + * This file is automatically generated by gen_interface.pl from evpath.h. + * + * DO NOT EDIT + * + */ +#include "config.h" +#include "ffs.h" +#include "atl.h" +#include "evpath.h" +#include "stdio.h" +#ifdef LT_LIBPREFIX +#include "ltdl.h" +#else +#ifdef _MSC_VER +#include +#define RTLD_GLOBAL 1 +#define RTLD_LAZY 2 +extern void* dlopen(const char* filename, int flags); +extern int dlclose(void* handle); +extern void* dlsym(void* handle, const char* name); +extern const char* dlerror(void); + +#else +#include +#endif + +#define lt_dlopen(x) dlopen(x, 0) +#define lt_dlsym(x, y) dlsym(x, y) +#define lt_dlhandle void* +#define lt_dlinit() 0 +#define lt_dlerror() "" +#endif +#include "stdio.h" +#include "string.h" +#include "stdlib.h" +#include "cm_internal.h" +#ifdef __cplusplus +extern "C" { +#endif +#if defined (__INTEL_COMPILER) +// Allow unused +# pragma warning (disable: 869) +#endif + +typedef struct _EV_void_response { + int condition_var; +} EV_void_response; + +FMField EV_void_response_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EV_void_response*, condition_var)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EV_void_response_formats[] = { + {"EV_void_response", EV_void_response_flds, sizeof(EV_void_response), NULL}, + {NULL, NULL, 0, NULL} +}; + +typedef struct _EV_int_response { + int condition_var; + int ret; +} EV_int_response; + +FMField EV_int_response_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EV_int_response*, condition_var)}, + {"ret", "integer", sizeof(EVstone), FMOffset(EV_int_response*,ret)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EV_int_response_formats[] = { + {"EV_int_response", EV_int_response_flds, sizeof(EV_int_response), NULL}, + {NULL, NULL, 0, NULL} +}; + +typedef struct _EV_string_response { + int condition_var; + char *ret; +} EV_string_response; + +FMField EV_string_response_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EV_string_response*, condition_var)}, + {"ret", "string", sizeof(char*), FMOffset(EV_string_response*,ret)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EV_string_response_formats[] = { + {"EV_string_response", EV_string_response_flds, sizeof(EV_string_response), NULL}, + {NULL, NULL, 0, NULL} +}; + +typedef struct _EV_EVevent_list_response { + int condition_var; + int ret_len; + EVevent_list ret; +} EV_EVevent_list_response; + +FMField EV_EVevent_list_response_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EV_EVevent_list_response*, condition_var)}, + {"ret_len", "integer", sizeof(int), FMOffset(EV_EVevent_list_response*,ret_len)}, + {"ret", "EVevent_list[ret_len]", sizeof(struct buf_entry), FMOffset(EV_EVevent_list_response*,ret)}, + {NULL, NULL, 0, 0} +}; + +FMField EVevent_list_flds[] = { + {"length", "integer", sizeof(int), FMOffset(EVevent_list,length)}, + {"event_buffer", "char[length]", sizeof(char), FMOffset(EVevent_list, buffer)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EV_EVevent_list_response_formats[] = { + {"EV_EVevent_response", EV_EVevent_list_response_flds, sizeof(EV_EVevent_list_response), NULL}, + {"EVevent_list", EVevent_list_flds, sizeof(struct buf_entry), NULL}, + {NULL, NULL, 0, NULL} +}; + +int +count_EVevent_list(EVevent_list list) +{ + int count = 0; + while (list && list[count].buffer != NULL) { + count++; + } + count++; + return count; +} + +EVevent_list +copy_EVevent_list(EVevent_list list) +{ + EVevent_list ret; + int i, size = count_EVevent_list(list); + ret = (EVevent_list) malloc(sizeof(ret[0]) * size); + for (i=0; i < size-1; i++) { + ret[i].length = list[i].length; + ret[i].buffer = malloc(list[i].length); + memcpy(ret[i].buffer, list[i].buffer, list[i].length); + } + ret[i].length = 0; + ret[i].buffer = NULL; + return ret; +} + +EVSimpleHandlerFunc +REVPlookup_handler(char *name) +{ + EVSimpleHandlerFunc f = NULL; + if (strncmp("0x", name, 2) == 0) { + /* hex constant */ + void *p; + sscanf(name, "0x%p", &p); + f = (EVSimpleHandlerFunc)p; + return f; + } +#if !NO_DYNAMIC_LINKING + static lt_dlhandle h = NULL; + static void *dh = NULL; + if (h == NULL) { + (void) lt_dlinit(); + h = lt_dlopen(NULL); + } + f = (EVSimpleHandlerFunc) lt_dlsym(h, name); + if (f == NULL) { + if (dh == NULL) { + dh = dlopen(NULL, 0); + } + printf("Querying dlopen()\n"); + f = (EVSimpleHandlerFunc)dlsym(dh, name); + } + if (f == NULL) { + if (dh == NULL) { + dh = dlopen(NULL, RTLD_GLOBAL|RTLD_LAZY); + } + f = (EVSimpleHandlerFunc)dlsym(dh, name); + } +#endif + if (f == NULL) { + printf("Dynamic symbol lookup for \"%s\" failed.\n\tEither the symbol is invalid, or symbol lookup is not enabled.\n", name); + printf("Make sure that the symbol is declared \"extern\" (not \"static\")\n"); + printf("Try linking the program with either \"-rdynamic\" (GCC) or \"-dlopen self\" (libtool)\n"); + } + return f; +} + +static char * +get_format_name(CManager cm, FMStructDescList structs) +{ + int id_len, i; + FMFormat format = EVregister_format_set(cm, structs); + char *tmp = get_server_ID_FMformat(format, &id_len); + char *str_tmp = malloc(id_len * 2 + 1); + for (i=0; i < id_len; i++) { + sprintf(&str_tmp[i*2], "%02x", ((unsigned char*)tmp)[i]); + } + return str_tmp; +} + +extern FMStructDescList +REVPlookup_format_structs(CManager cm, char *format_name) +{ + FMFormat format; + int slen = (int)strlen(format_name); + int i; + unsigned char *id = malloc(slen/2); + for (i=0; i < slen/2; i++) { + int x; + char tmp[3] = {0, 0, 0}; + tmp[0] = format_name[2*i]; + tmp[1] = format_name[2*i + 1]; + sscanf(tmp, "%x", &x); + id[i] = (unsigned char) x; + } + format = FMformat_from_ID(cm->evp->fmc, (char*)id); + free(id); + return format_list_of_FMFormat(format); +} + + +typedef struct _EVaction_add_split_target_request { + int condition_var; + EVstone stone; + EVaction action; + EVstone target_stone; +} EVaction_add_split_target_request; + +typedef struct _EVaction_add_split_target_response { + int condition_var; + int ret; +} EVaction_add_split_target_response; + +FMField EVaction_add_split_target_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVaction_add_split_target_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_add_split_target_request*,stone)}, + {"action", "integer", sizeof(EVaction), FMOffset(EVaction_add_split_target_request*,action)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_add_split_target_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVaction_add_split_target_req_formats[] = { + {"EV_EVaction_add_split_target_request", EVaction_add_split_target_req_flds, sizeof(EVaction_add_split_target_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVaction_add_split_target_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVaction_add_split_target_req_formats); + request.stone = stone; + request.action = action; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVaction_add_split_target_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVaction_add_split_target(conn, stone, action, target_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVaction_add_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVaction_add_split_target_request *request = (EVaction_add_split_target_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVaction_add_split_target(cm, request->stone, request->action, request->target_stone); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVaction_remove_split_target_request { + int condition_var; + EVstone stone; + EVaction action; + EVstone target_stone; +} EVaction_remove_split_target_request; + +typedef struct _EVaction_remove_split_target_response { + int condition_var; +} EVaction_remove_split_target_response; + +FMField EVaction_remove_split_target_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVaction_remove_split_target_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_remove_split_target_request*,stone)}, + {"action", "integer", sizeof(EVaction), FMOffset(EVaction_remove_split_target_request*,action)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_remove_split_target_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVaction_remove_split_target_req_formats[] = { + {"EV_EVaction_remove_split_target_request", EVaction_remove_split_target_req_flds, sizeof(EVaction_remove_split_target_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone) +{ + int cond; + CMFormat f; + EVaction_remove_split_target_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVaction_remove_split_target_req_formats); + request.stone = stone; + request.action = action; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVaction_remove_split_target_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone) +{ + CManager_lock(conn->cm); + INT_REVaction_remove_split_target(conn, stone, action, target_stone); + CManager_unlock(conn->cm); + return; +} + +static void +REVaction_remove_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVaction_remove_split_target_request *request = (EVaction_remove_split_target_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVaction_remove_split_target(cm, request->stone, request->action, request->target_stone); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVaction_set_output_request { + int condition_var; + EVstone stone; + EVaction action; + int output_index; + EVstone target_stone; +} EVaction_set_output_request; + +typedef struct _EVaction_set_output_response { + int condition_var; + int ret; +} EVaction_set_output_response; + +FMField EVaction_set_output_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVaction_set_output_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_set_output_request*,stone)}, + {"action", "integer", sizeof(EVaction), FMOffset(EVaction_set_output_request*,action)}, + {"output_index", "integer", sizeof(int), FMOffset(EVaction_set_output_request*,output_index)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_set_output_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVaction_set_output_req_formats[] = { + {"EV_EVaction_set_output_request", EVaction_set_output_req_flds, sizeof(EVaction_set_output_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVaction_set_output_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVaction_set_output_req_formats); + request.stone = stone; + request.action = action; + request.output_index = output_index; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVaction_set_output_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVaction_set_output(conn, stone, action, output_index, target_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVaction_set_output_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVaction_set_output_request *request = (EVaction_set_output_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVaction_set_output(cm, request->stone, request->action, request->output_index, request->target_stone); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EValloc_stone_request { + int condition_var; +} EValloc_stone_request; + +typedef struct _EValloc_stone_response { + int condition_var; + EVstone ret; +} EValloc_stone_response; + +FMField EValloc_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EValloc_stone_request*, condition_var)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EValloc_stone_req_formats[] = { + {"EV_EValloc_stone_request", EValloc_stone_req_flds, sizeof(EValloc_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REValloc_stone(CMConnection conn) +{ + int cond; + CMFormat f; + EV_int_response response; + EValloc_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EValloc_stone_req_formats); + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EValloc_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REValloc_stone(CMConnection conn) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REValloc_stone(conn); + CManager_unlock(conn->cm); + return ret; +} + +static void +REValloc_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EValloc_stone_request *request = (EValloc_stone_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EValloc_stone(cm); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_bridge_action_request { + int condition_var; + EVstone stone; + char* contact_list; + EVstone remote_stone; +} EVassoc_bridge_action_request; + +typedef struct _EVassoc_bridge_action_response { + int condition_var; + EVaction ret; +} EVassoc_bridge_action_response; + +FMField EVassoc_bridge_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_bridge_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_bridge_action_request*,stone)}, + {"contact_list", "string", sizeof(attr_list), FMOffset(EVassoc_bridge_action_request*,contact_list)}, + {"remote_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_bridge_action_request*,remote_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_bridge_action_req_formats[] = { + {"EV_EVassoc_bridge_action_request", EVassoc_bridge_action_req_flds, sizeof(EVassoc_bridge_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_bridge_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_bridge_action_req_formats); + request.stone = stone; + request.contact_list = attr_list_to_string(contact_list); + request.remote_stone = remote_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_bridge_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + free(request.contact_list); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_bridge_action(conn, stone, contact_list, remote_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_bridge_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_bridge_action_request *request = (EVassoc_bridge_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + attr_list contact_list = attr_list_from_string(request->contact_list); + ret = EVassoc_bridge_action(cm, request->stone, contact_list, request->remote_stone); +free_attr_list(contact_list); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_filter_action_request { + int condition_var; + EVstone stone; + char* incoming_format_list; + char* handler; + EVstone out_stone; +} EVassoc_filter_action_request; + +typedef struct _EVassoc_filter_action_response { + int condition_var; + EVaction ret; +} EVassoc_filter_action_response; + +FMField EVassoc_filter_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_filter_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_filter_action_request*,stone)}, + {"incoming_format_list", "string", sizeof(FMStructDescList), FMOffset(EVassoc_filter_action_request*,incoming_format_list)}, + {"handler", "string", sizeof(char*), FMOffset(EVassoc_filter_action_request*,handler)}, + {"out_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_filter_action_request*,out_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_filter_action_req_formats[] = { + {"EV_EVassoc_filter_action_request", EVassoc_filter_action_req_flds, sizeof(EVassoc_filter_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_filter_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_filter_action_req_formats); + request.stone = stone; + request.incoming_format_list = get_format_name(conn->cm, incoming_format_list); + request.handler = handler; + request.out_stone = out_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_filter_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_filter_action(conn, stone, incoming_format_list, handler, out_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_filter_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_filter_action_request *request = (EVassoc_filter_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + FMStructDescList incoming_format_list = REVPlookup_format_structs(conn->cm, request->incoming_format_list); + EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler); + ret = EVassoc_filter_action(cm, request->stone, incoming_format_list, handler, request->out_stone, NULL); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_immediate_action_request { + int condition_var; + EVstone stone; + char* action_spec; +} EVassoc_immediate_action_request; + +typedef struct _EVassoc_immediate_action_response { + int condition_var; + EVaction ret; +} EVassoc_immediate_action_response; + +FMField EVassoc_immediate_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_immediate_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_immediate_action_request*,stone)}, + {"action_spec", "string", sizeof(char*), FMOffset(EVassoc_immediate_action_request*,action_spec)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_immediate_action_req_formats[] = { + {"EV_EVassoc_immediate_action_request", EVassoc_immediate_action_req_flds, sizeof(EVassoc_immediate_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_immediate_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_immediate_action_req_formats); + request.stone = stone; + request.action_spec = action_spec; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_immediate_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_immediate_action(conn, stone, action_spec); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_immediate_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_immediate_action_request *request = (EVassoc_immediate_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVassoc_immediate_action(cm, request->stone, request->action_spec, NULL); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_multi_action_request { + int condition_var; + EVstone stone; + char* action_spec; +} EVassoc_multi_action_request; + +typedef struct _EVassoc_multi_action_response { + int condition_var; + EVaction ret; +} EVassoc_multi_action_response; + +FMField EVassoc_multi_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_multi_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_multi_action_request*,stone)}, + {"action_spec", "string", sizeof(char*), FMOffset(EVassoc_multi_action_request*,action_spec)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_multi_action_req_formats[] = { + {"EV_EVassoc_multi_action_request", EVassoc_multi_action_req_flds, sizeof(EVassoc_multi_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_multi_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_multi_action_req_formats); + request.stone = stone; + request.action_spec = action_spec; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_multi_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_multi_action(conn, stone, action_spec); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_multi_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_multi_action_request *request = (EVassoc_multi_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVassoc_multi_action(cm, request->stone, request->action_spec, NULL); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_split_action_request { + int condition_var; + EVstone stone; + int target_list_len; + int * target_list; +} EVassoc_split_action_request; + +typedef struct _EVassoc_split_action_response { + int condition_var; + EVaction ret; +} EVassoc_split_action_response; + +FMField EVassoc_split_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_split_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_split_action_request*,stone)}, + {"target_list", "integer", sizeof(EVstone*), FMOffset(EVassoc_split_action_request*,target_list)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_split_action_req_formats[] = { + {"EV_EVassoc_split_action_request", EVassoc_split_action_req_flds, sizeof(EVassoc_split_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_split_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_split_action_req_formats); + request.stone = stone; + request.target_list = target_list; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_split_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_split_action(conn, stone, target_list); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_split_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_split_action_request *request = (EVassoc_split_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVassoc_split_action(cm, request->stone, request->target_list); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_store_action_request { + int condition_var; + EVstone stone_num; + EVstone out_stone; + int store_limit; +} EVassoc_store_action_request; + +typedef struct _EVassoc_store_action_response { + int condition_var; + EVaction ret; +} EVassoc_store_action_response; + +FMField EVassoc_store_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_store_action_request*, condition_var)}, + {"stone_num", "integer", sizeof(EVstone), FMOffset(EVassoc_store_action_request*,stone_num)}, + {"out_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_store_action_request*,out_stone)}, + {"store_limit", "integer", sizeof(int), FMOffset(EVassoc_store_action_request*,store_limit)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_store_action_req_formats[] = { + {"EV_EVassoc_store_action_request", EVassoc_store_action_req_flds, sizeof(EVassoc_store_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_store_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_store_action_req_formats); + request.stone_num = stone_num; + request.out_stone = out_stone; + request.store_limit = store_limit; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_store_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_store_action(conn, stone_num, out_stone, store_limit); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_store_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_store_action_request *request = (EVassoc_store_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVassoc_store_action(cm, request->stone_num, request->out_stone, request->store_limit); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVassoc_terminal_action_request { + int condition_var; + EVstone stone; + char* format_list; + char* handler; +} EVassoc_terminal_action_request; + +typedef struct _EVassoc_terminal_action_response { + int condition_var; + EVaction ret; +} EVassoc_terminal_action_response; + +FMField EVassoc_terminal_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_terminal_action_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_terminal_action_request*,stone)}, + {"format_list", "string", sizeof(FMStructDescList), FMOffset(EVassoc_terminal_action_request*,format_list)}, + {"handler", "string", sizeof(char*), FMOffset(EVassoc_terminal_action_request*,handler)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVassoc_terminal_action_req_formats[] = { + {"EV_EVassoc_terminal_action_request", EVassoc_terminal_action_req_flds, sizeof(EVassoc_terminal_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVaction +INT_REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler) +{ + int cond; + CMFormat f; + EV_int_response response; + EVassoc_terminal_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVassoc_terminal_action_req_formats); + request.stone = stone; + request.format_list = get_format_name(conn->cm, format_list); + request.handler = handler; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVassoc_terminal_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVaction) response.ret; +} + +extern EVaction +REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler) +{ + EVaction ret; + CManager_lock(conn->cm); + ret = INT_REVassoc_terminal_action(conn, stone, format_list, handler); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVassoc_terminal_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVassoc_terminal_action_request *request = (EVassoc_terminal_action_request *) data; + EVaction ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + FMStructDescList format_list = REVPlookup_format_structs(conn->cm, request->format_list); + EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler); + ret = EVassoc_terminal_action(cm, request->stone, format_list, handler, NULL); + response.ret = (int) ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVclear_stored_request { + int condition_var; + EVstone stone_num; + EVaction action_num; +} EVclear_stored_request; + +typedef struct _EVclear_stored_response { + int condition_var; +} EVclear_stored_response; + +FMField EVclear_stored_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVclear_stored_request*, condition_var)}, + {"stone_num", "integer", sizeof(EVstone), FMOffset(EVclear_stored_request*,stone_num)}, + {"action_num", "integer", sizeof(EVaction), FMOffset(EVclear_stored_request*,action_num)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVclear_stored_req_formats[] = { + {"EV_EVclear_stored_request", EVclear_stored_req_flds, sizeof(EVclear_stored_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num) +{ + int cond; + CMFormat f; + EVclear_stored_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVclear_stored_req_formats); + request.stone_num = stone_num; + request.action_num = action_num; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVclear_stored_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num) +{ + CManager_lock(conn->cm); + INT_REVclear_stored(conn, stone_num, action_num); + CManager_unlock(conn->cm); + return; +} + +static void +REVclear_stored_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVclear_stored_request *request = (EVclear_stored_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVclear_stored(cm, request->stone_num, request->action_num); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_auto_stone_request { + int condition_var; + int period_sec; + int period_usec; + char* action_spec; + EVstone out_stone; +} EVcreate_auto_stone_request; + +typedef struct _EVcreate_auto_stone_response { + int condition_var; + EVstone ret; +} EVcreate_auto_stone_response; + +FMField EVcreate_auto_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*, condition_var)}, + {"period_sec", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*,period_sec)}, + {"period_usec", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*,period_usec)}, + {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_auto_stone_request*,action_spec)}, + {"out_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_auto_stone_request*,out_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_auto_stone_req_formats[] = { + {"EV_EVcreate_auto_stone_request", EVcreate_auto_stone_req_flds, sizeof(EVcreate_auto_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_auto_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_auto_stone_req_formats); + request.period_sec = period_sec; + request.period_usec = period_usec; + request.action_spec = action_spec; + request.out_stone = out_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_auto_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_auto_stone(conn, period_sec, period_usec, action_spec, out_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_auto_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_auto_stone_request *request = (EVcreate_auto_stone_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVcreate_auto_stone(cm, request->period_sec, request->period_usec, request->action_spec, request->out_stone); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_bridge_action_request { + int condition_var; + char* contact_list; + EVstone remote_stone; +} EVcreate_bridge_action_request; + +typedef struct _EVcreate_bridge_action_response { + int condition_var; + EVstone ret; +} EVcreate_bridge_action_response; + +FMField EVcreate_bridge_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_bridge_action_request*, condition_var)}, + {"contact_list", "string", sizeof(attr_list), FMOffset(EVcreate_bridge_action_request*,contact_list)}, + {"remote_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_bridge_action_request*,remote_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_bridge_action_req_formats[] = { + {"EV_EVcreate_bridge_action_request", EVcreate_bridge_action_req_flds, sizeof(EVcreate_bridge_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_bridge_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_bridge_action_req_formats); + request.contact_list = attr_list_to_string(contact_list); + request.remote_stone = remote_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_bridge_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + free(request.contact_list); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_bridge_action(conn, contact_list, remote_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_bridge_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_bridge_action_request *request = (EVcreate_bridge_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + attr_list contact_list = attr_list_from_string(request->contact_list); + ret = EVcreate_bridge_action(cm, contact_list, request->remote_stone); +free_attr_list(contact_list); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_immediate_action_request { + int condition_var; + char* action_spec; + int target_list_len; + int * target_list; +} EVcreate_immediate_action_request; + +typedef struct _EVcreate_immediate_action_response { + int condition_var; + EVstone ret; +} EVcreate_immediate_action_response; + +FMField EVcreate_immediate_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_immediate_action_request*, condition_var)}, + {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_immediate_action_request*,action_spec)}, + {"target_list", "integer", sizeof(EVstone*), FMOffset(EVcreate_immediate_action_request*,target_list)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_immediate_action_req_formats[] = { + {"EV_EVcreate_immediate_action_request", EVcreate_immediate_action_req_flds, sizeof(EVcreate_immediate_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_immediate_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_immediate_action_req_formats); + request.action_spec = action_spec; + request.target_list = target_list; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_immediate_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_immediate_action(conn, action_spec, target_list); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_immediate_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_immediate_action_request *request = (EVcreate_immediate_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVcreate_immediate_action(cm, request->action_spec, request->target_list); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_split_action_request { + int condition_var; + int target_list_len; + int * target_list; +} EVcreate_split_action_request; + +typedef struct _EVcreate_split_action_response { + int condition_var; + EVstone ret; +} EVcreate_split_action_response; + +FMField EVcreate_split_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_split_action_request*, condition_var)}, + {"target_list", "integer", sizeof(EVstone*), FMOffset(EVcreate_split_action_request*,target_list)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_split_action_req_formats[] = { + {"EV_EVcreate_split_action_request", EVcreate_split_action_req_flds, sizeof(EVcreate_split_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_split_action(CMConnection conn, EVstone *target_list) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_split_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_split_action_req_formats); + request.target_list = target_list; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_split_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_split_action(CMConnection conn, EVstone *target_list) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_split_action(conn, target_list); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_split_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_split_action_request *request = (EVcreate_split_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVcreate_split_action(cm, request->target_list); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_stone_action_request { + int condition_var; + char* action_spec; +} EVcreate_stone_action_request; + +typedef struct _EVcreate_stone_action_response { + int condition_var; + EVstone ret; +} EVcreate_stone_action_response; + +FMField EVcreate_stone_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_stone_action_request*, condition_var)}, + {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_stone_action_request*,action_spec)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_stone_action_req_formats[] = { + {"EV_EVcreate_stone_action_request", EVcreate_stone_action_req_flds, sizeof(EVcreate_stone_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_stone_action(CMConnection conn, char *action_spec) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_stone_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_stone_action_req_formats); + request.action_spec = action_spec; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_stone_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_stone_action(CMConnection conn, char *action_spec) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_stone_action(conn, action_spec); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_stone_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_stone_action_request *request = (EVcreate_stone_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVcreate_stone_action(cm, request->action_spec); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_store_action_request { + int condition_var; + EVstone out_stone; + int store_limit; +} EVcreate_store_action_request; + +typedef struct _EVcreate_store_action_response { + int condition_var; + EVstone ret; +} EVcreate_store_action_response; + +FMField EVcreate_store_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_store_action_request*, condition_var)}, + {"out_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_store_action_request*,out_stone)}, + {"store_limit", "integer", sizeof(int), FMOffset(EVcreate_store_action_request*,store_limit)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_store_action_req_formats[] = { + {"EV_EVcreate_store_action_request", EVcreate_store_action_req_flds, sizeof(EVcreate_store_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_store_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_store_action_req_formats); + request.out_stone = out_stone; + request.store_limit = store_limit; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_store_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_store_action(conn, out_stone, store_limit); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_store_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_store_action_request *request = (EVcreate_store_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVcreate_store_action(cm, request->out_stone, request->store_limit); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVcreate_terminal_action_request { + int condition_var; + char* format_list; + char* handler; +} EVcreate_terminal_action_request; + +typedef struct _EVcreate_terminal_action_response { + int condition_var; + EVstone ret; +} EVcreate_terminal_action_response; + +FMField EVcreate_terminal_action_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_terminal_action_request*, condition_var)}, + {"format_list", "string", sizeof(FMStructDescList), FMOffset(EVcreate_terminal_action_request*,format_list)}, + {"handler", "string", sizeof(char*), FMOffset(EVcreate_terminal_action_request*,handler)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVcreate_terminal_action_req_formats[] = { + {"EV_EVcreate_terminal_action_request", EVcreate_terminal_action_req_flds, sizeof(EVcreate_terminal_action_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern EVstone +INT_REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler) +{ + int cond; + CMFormat f; + EV_int_response response; + EVcreate_terminal_action_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVcreate_terminal_action_req_formats); + request.format_list = get_format_name(conn->cm, format_list); + request.handler = handler; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVcreate_terminal_action_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return (EVstone) response.ret; +} + +extern EVstone +REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler) +{ + EVstone ret; + CManager_lock(conn->cm); + ret = INT_REVcreate_terminal_action(conn, format_list, handler); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVcreate_terminal_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVcreate_terminal_action_request *request = (EVcreate_terminal_action_request *) data; + EVstone ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + FMStructDescList format_list = REVPlookup_format_structs(conn->cm, request->format_list); + EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler); + ret = EVcreate_terminal_action(cm, format_list, handler, NULL); + response.ret = (int)ret; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVdestroy_stone_request { + int condition_var; + EVstone stone_id; +} EVdestroy_stone_request; + +typedef struct _EVdestroy_stone_response { + int condition_var; + int ret; +} EVdestroy_stone_response; + +FMField EVdestroy_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVdestroy_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVdestroy_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVdestroy_stone_req_formats[] = { + {"EV_EVdestroy_stone_request", EVdestroy_stone_req_flds, sizeof(EVdestroy_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVdestroy_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EV_int_response response; + EVdestroy_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVdestroy_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVdestroy_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVdestroy_stone(CMConnection conn, EVstone stone_id) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVdestroy_stone(conn, stone_id); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVdestroy_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVdestroy_stone_request *request = (EVdestroy_stone_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVdestroy_stone(cm, request->stone_id); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVdrain_stone_request { + int condition_var; + EVstone stone_id; +} EVdrain_stone_request; + +typedef struct _EVdrain_stone_response { + int condition_var; + int ret; +} EVdrain_stone_response; + +FMField EVdrain_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVdrain_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVdrain_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVdrain_stone_req_formats[] = { + {"EV_EVdrain_stone_request", EVdrain_stone_req_flds, sizeof(EVdrain_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVdrain_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EV_int_response response; + EVdrain_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVdrain_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVdrain_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVdrain_stone(CMConnection conn, EVstone stone_id) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVdrain_stone(conn, stone_id); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVdrain_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVdrain_stone_request *request = (EVdrain_stone_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVdrain_stone(cm, request->stone_id); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVenable_auto_stone_request { + int condition_var; + EVstone stone_num; + int period_sec; + int period_usec; +} EVenable_auto_stone_request; + +typedef struct _EVenable_auto_stone_response { + int condition_var; +} EVenable_auto_stone_response; + +FMField EVenable_auto_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*, condition_var)}, + {"stone_num", "integer", sizeof(EVstone), FMOffset(EVenable_auto_stone_request*,stone_num)}, + {"period_sec", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*,period_sec)}, + {"period_usec", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*,period_usec)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVenable_auto_stone_req_formats[] = { + {"EV_EVenable_auto_stone_request", EVenable_auto_stone_req_flds, sizeof(EVenable_auto_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec) +{ + int cond; + CMFormat f; + EVenable_auto_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVenable_auto_stone_req_formats); + request.stone_num = stone_num; + request.period_sec = period_sec; + request.period_usec = period_usec; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVenable_auto_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec) +{ + CManager_lock(conn->cm); + INT_REVenable_auto_stone(conn, stone_num, period_sec, period_usec); + CManager_unlock(conn->cm); + return; +} + +static void +REVenable_auto_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVenable_auto_stone_request *request = (EVenable_auto_stone_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVenable_auto_stone(cm, request->stone_num, request->period_sec, request->period_usec); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVextract_attr_list_request { + int condition_var; + EVstone stone_id; +} EVextract_attr_list_request; + +typedef struct _EVextract_attr_list_response { + int condition_var; + char* ret; +} EVextract_attr_list_response; + +FMField EVextract_attr_list_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVextract_attr_list_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVextract_attr_list_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVextract_attr_list_req_formats[] = { + {"EV_EVextract_attr_list_request", EVextract_attr_list_req_flds, sizeof(EVextract_attr_list_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern attr_list +INT_REVextract_attr_list(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EV_string_response response; + EVextract_attr_list_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVextract_attr_list_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVextract_attr_list_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return attr_list_from_string(response.ret); +} + +extern attr_list +REVextract_attr_list(CMConnection conn, EVstone stone_id) +{ + attr_list ret; + CManager_lock(conn->cm); + ret = INT_REVextract_attr_list(conn, stone_id); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVextract_attr_list_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_string_response response; + EVextract_attr_list_request *request = (EVextract_attr_list_request *) data; + attr_list ret; + CMFormat f = CMlookup_format(conn->cm, EV_string_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_string_response_formats); + } + ret = EVextract_attr_list(cm, request->stone_id); + response.ret = attr_list_to_string(ret); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); + free(response.ret); +} + +typedef struct _EVfree_stone_request { + int condition_var; + EVstone stone; +} EVfree_stone_request; + +typedef struct _EVfree_stone_response { + int condition_var; +} EVfree_stone_response; + +FMField EVfree_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVfree_stone_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVfree_stone_request*,stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVfree_stone_req_formats[] = { + {"EV_EVfree_stone_request", EVfree_stone_req_flds, sizeof(EVfree_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVfree_stone(CMConnection conn, EVstone stone) +{ + int cond; + CMFormat f; + EVfree_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVfree_stone_req_formats); + request.stone = stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVfree_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVfree_stone(CMConnection conn, EVstone stone) +{ + CManager_lock(conn->cm); + INT_REVfree_stone(conn, stone); + CManager_unlock(conn->cm); + return; +} + +static void +REVfree_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVfree_stone_request *request = (EVfree_stone_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVfree_stone(cm, request->stone); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVfreeze_stone_request { + int condition_var; + EVstone stone_id; +} EVfreeze_stone_request; + +typedef struct _EVfreeze_stone_response { + int condition_var; + int ret; +} EVfreeze_stone_response; + +FMField EVfreeze_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVfreeze_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVfreeze_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVfreeze_stone_req_formats[] = { + {"EV_EVfreeze_stone_request", EVfreeze_stone_req_flds, sizeof(EVfreeze_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVfreeze_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EV_int_response response; + EVfreeze_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVfreeze_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVfreeze_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVfreeze_stone(CMConnection conn, EVstone stone_id) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVfreeze_stone(conn, stone_id); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVfreeze_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVfreeze_stone_request *request = (EVfreeze_stone_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVfreeze_stone(cm, request->stone_id); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVset_attr_list_request { + int condition_var; + EVstone stone_id; + char* list; +} EVset_attr_list_request; + +typedef struct _EVset_attr_list_response { + int condition_var; +} EVset_attr_list_response; + +FMField EVset_attr_list_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVset_attr_list_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVset_attr_list_request*,stone_id)}, + {"list", "string", sizeof(attr_list), FMOffset(EVset_attr_list_request*,list)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVset_attr_list_req_formats[] = { + {"EV_EVset_attr_list_request", EVset_attr_list_req_flds, sizeof(EVset_attr_list_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list) +{ + int cond; + CMFormat f; + EVset_attr_list_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVset_attr_list_req_formats); + request.stone_id = stone_id; + request.list = attr_list_to_string(list); + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVset_attr_list_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + free(request.list); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list) +{ + CManager_lock(conn->cm); + INT_REVset_attr_list(conn, stone_id, list); + CManager_unlock(conn->cm); + return; +} + +static void +REVset_attr_list_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVset_attr_list_request *request = (EVset_attr_list_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + attr_list list = attr_list_from_string(request->list); + EVset_attr_list(cm, request->stone_id, list); +free_attr_list(list); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVstall_stone_request { + int condition_var; + EVstone stone_id; +} EVstall_stone_request; + +typedef struct _EVstall_stone_response { + int condition_var; +} EVstall_stone_response; + +FMField EVstall_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVstall_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVstall_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVstall_stone_req_formats[] = { + {"EV_EVstall_stone_request", EVstall_stone_req_flds, sizeof(EVstall_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVstall_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EVstall_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVstall_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVstall_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVstall_stone(CMConnection conn, EVstone stone_id) +{ + CManager_lock(conn->cm); + INT_REVstall_stone(conn, stone_id); + CManager_unlock(conn->cm); + return; +} + +static void +REVstall_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVstall_stone_request *request = (EVstall_stone_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVstall_stone(cm, request->stone_id); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVstone_add_split_target_request { + int condition_var; + EVstone stone; + EVstone target_stone; +} EVstone_add_split_target_request; + +typedef struct _EVstone_add_split_target_response { + int condition_var; +} EVstone_add_split_target_response; + +FMField EVstone_add_split_target_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVstone_add_split_target_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_add_split_target_request*,stone)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_add_split_target_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVstone_add_split_target_req_formats[] = { + {"EV_EVstone_add_split_target_request", EVstone_add_split_target_req_flds, sizeof(EVstone_add_split_target_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone) +{ + int cond; + CMFormat f; + EVstone_add_split_target_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVstone_add_split_target_req_formats); + request.stone = stone; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVstone_add_split_target_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone) +{ + CManager_lock(conn->cm); + INT_REVstone_add_split_target(conn, stone, target_stone); + CManager_unlock(conn->cm); + return; +} + +static void +REVstone_add_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVstone_add_split_target_request *request = (EVstone_add_split_target_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVstone_add_split_target(cm, request->stone, request->target_stone); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVstone_remove_split_target_request { + int condition_var; + EVstone stone; + EVstone target_stone; +} EVstone_remove_split_target_request; + +typedef struct _EVstone_remove_split_target_response { + int condition_var; +} EVstone_remove_split_target_response; + +FMField EVstone_remove_split_target_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVstone_remove_split_target_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_remove_split_target_request*,stone)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_remove_split_target_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVstone_remove_split_target_req_formats[] = { + {"EV_EVstone_remove_split_target_request", EVstone_remove_split_target_req_flds, sizeof(EVstone_remove_split_target_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone) +{ + int cond; + CMFormat f; + EVstone_remove_split_target_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVstone_remove_split_target_req_formats); + request.stone = stone; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVstone_remove_split_target_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone) +{ + CManager_lock(conn->cm); + INT_REVstone_remove_split_target(conn, stone, target_stone); + CManager_unlock(conn->cm); + return; +} + +static void +REVstone_remove_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVstone_remove_split_target_request *request = (EVstone_remove_split_target_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVstone_remove_split_target(cm, request->stone, request->target_stone); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVstone_set_output_request { + int condition_var; + EVstone stone; + int output_index; + EVstone target_stone; +} EVstone_set_output_request; + +typedef struct _EVstone_set_output_response { + int condition_var; + int ret; +} EVstone_set_output_response; + +FMField EVstone_set_output_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVstone_set_output_request*, condition_var)}, + {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_set_output_request*,stone)}, + {"output_index", "integer", sizeof(int), FMOffset(EVstone_set_output_request*,output_index)}, + {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_set_output_request*,target_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVstone_set_output_req_formats[] = { + {"EV_EVstone_set_output_request", EVstone_set_output_req_flds, sizeof(EVstone_set_output_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVstone_set_output_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVstone_set_output_req_formats); + request.stone = stone; + request.output_index = output_index; + request.target_stone = target_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVstone_set_output_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVstone_set_output(conn, stone, output_index, target_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVstone_set_output_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVstone_set_output_request *request = (EVstone_set_output_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVstone_set_output(cm, request->stone, request->output_index, request->target_stone); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVtransfer_events_request { + int condition_var; + EVstone src_stone; + EVstone dest_stone; +} EVtransfer_events_request; + +typedef struct _EVtransfer_events_response { + int condition_var; + int ret; +} EVtransfer_events_response; + +FMField EVtransfer_events_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVtransfer_events_request*, condition_var)}, + {"src_stone", "integer", sizeof(EVstone), FMOffset(EVtransfer_events_request*,src_stone)}, + {"dest_stone", "integer", sizeof(EVstone), FMOffset(EVtransfer_events_request*,dest_stone)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVtransfer_events_req_formats[] = { + {"EV_EVtransfer_events_request", EVtransfer_events_req_flds, sizeof(EVtransfer_events_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone) +{ + int cond; + CMFormat f; + EV_int_response response; + EVtransfer_events_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVtransfer_events_req_formats); + request.src_stone = src_stone; + request.dest_stone = dest_stone; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVtransfer_events_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVtransfer_events(conn, src_stone, dest_stone); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVtransfer_events_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVtransfer_events_request *request = (EVtransfer_events_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVtransfer_events(cm, request->src_stone, request->dest_stone); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVunfreeze_stone_request { + int condition_var; + EVstone stone_id; +} EVunfreeze_stone_request; + +typedef struct _EVunfreeze_stone_response { + int condition_var; + int ret; +} EVunfreeze_stone_response; + +FMField EVunfreeze_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVunfreeze_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVunfreeze_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVunfreeze_stone_req_formats[] = { + {"EV_EVunfreeze_stone_request", EVunfreeze_stone_req_flds, sizeof(EVunfreeze_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern int +INT_REVunfreeze_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EV_int_response response; + EVunfreeze_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVunfreeze_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVunfreeze_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, &response); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); + return response.ret; +} + +extern int +REVunfreeze_stone(CMConnection conn, EVstone stone_id) +{ + int ret; + CManager_lock(conn->cm); + ret = INT_REVunfreeze_stone(conn, stone_id); + CManager_unlock(conn->cm); + return ret; +} + +static void +REVunfreeze_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_int_response response; + EVunfreeze_stone_request *request = (EVunfreeze_stone_request *) data; + int ret; + CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_int_response_formats); + } + ret = EVunfreeze_stone(cm, request->stone_id); + response.ret = ret;; + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} + +typedef struct _EVunstall_stone_request { + int condition_var; + EVstone stone_id; +} EVunstall_stone_request; + +typedef struct _EVunstall_stone_response { + int condition_var; +} EVunstall_stone_response; + +FMField EVunstall_stone_req_flds[] = { + {"condition_var", "integer", sizeof(int), FMOffset(EVunstall_stone_request*, condition_var)}, + {"stone_id", "integer", sizeof(EVstone), FMOffset(EVunstall_stone_request*,stone_id)}, + {NULL, NULL, 0, 0} +}; + +FMStructDescRec EVunstall_stone_req_formats[] = { + {"EV_EVunstall_stone_request", EVunstall_stone_req_flds, sizeof(EVunstall_stone_request), NULL}, + {NULL, NULL, 0, NULL} +}; + +extern void +INT_REVunstall_stone(CMConnection conn, EVstone stone_id) +{ + int cond; + CMFormat f; + EVunstall_stone_request request; + memset(&request, 0, sizeof(request)); + cond = INT_CMCondition_get(conn->cm, conn); + f = INT_CMlookup_format(conn->cm, EVunstall_stone_req_formats); + request.stone_id = stone_id; + request.condition_var = cond; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EVunstall_stone_req_formats); + } + INT_CMCondition_set_client_data(conn->cm, cond, NULL); + INT_CMwrite(conn, f, &request); + INT_CMCondition_wait(conn->cm, cond); +} + +extern void +REVunstall_stone(CMConnection conn, EVstone stone_id) +{ + CManager_lock(conn->cm); + INT_REVunstall_stone(conn, stone_id); + CManager_unlock(conn->cm); + return; +} + +static void +REVunstall_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs) +{ + EV_void_response response; + EVunstall_stone_request *request = (EVunstall_stone_request *) data; + CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats); + (void) message_attrs; + (void) client_data; + if (f == NULL) { + f = INT_CMregister_format(conn->cm, EV_void_response_formats); + } + EVunstall_stone(cm, request->stone_id); + response.condition_var = request->condition_var; + CMwrite(conn, f, &response); +} +static void +REV_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs) +{ + EV_void_response *response = (EV_void_response*) data; + void **response_ptr = CMCondition_get_client_data(cm, response->condition_var); + if (NULL != response_ptr) { + *response_ptr = data; + } + CMCondition_signal(cm, response->condition_var); +} + +static void +REV_int_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs) +{ + EV_void_response *response = (EV_void_response*) data; + void **response_ptr = CMCondition_get_client_data(cm, response->condition_var); + if (NULL != response_ptr) { + memcpy(response_ptr, data, sizeof(EV_int_response)); + } + CMCondition_signal(cm, response->condition_var); +} + +static void +REV_string_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs) +{ + EV_string_response *response = (EV_string_response*) data; + EV_string_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var); + if (NULL != stub_ptr) { + memcpy(stub_ptr, data, sizeof(EV_string_response)); + stub_ptr->ret = strdup(response->ret); + } + CMCondition_signal(cm, response->condition_var); +} + +static void +REV_EVevent_list_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs) +{ + EV_EVevent_list_response *response = (EV_EVevent_list_response*) data; + EV_EVevent_list_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var); + if (NULL != stub_ptr) { + memcpy(stub_ptr, data, sizeof(EV_EVevent_list_response)); + stub_ptr->ret = copy_EVevent_list(response->ret); + } + CMCondition_signal(cm, response->condition_var); +} + +extern void +REVPinit(CManager cm) +{ + CMFormat tmp_format; + + tmp_format = INT_CMregister_format(cm, EVaction_add_split_target_req_formats); + INT_CMregister_handler(tmp_format, REVaction_add_split_target_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVaction_remove_split_target_req_formats); + INT_CMregister_handler(tmp_format, REVaction_remove_split_target_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVaction_set_output_req_formats); + INT_CMregister_handler(tmp_format, REVaction_set_output_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EValloc_stone_req_formats); + INT_CMregister_handler(tmp_format, REValloc_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_bridge_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_bridge_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_filter_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_filter_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_immediate_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_immediate_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_multi_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_multi_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_split_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_split_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_store_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_store_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVassoc_terminal_action_req_formats); + INT_CMregister_handler(tmp_format, REVassoc_terminal_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVclear_stored_req_formats); + INT_CMregister_handler(tmp_format, REVclear_stored_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_auto_stone_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_auto_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_bridge_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_bridge_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_immediate_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_immediate_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_split_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_split_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_stone_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_stone_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_store_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_store_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVcreate_terminal_action_req_formats); + INT_CMregister_handler(tmp_format, REVcreate_terminal_action_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVdestroy_stone_req_formats); + INT_CMregister_handler(tmp_format, REVdestroy_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVdrain_stone_req_formats); + INT_CMregister_handler(tmp_format, REVdrain_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVenable_auto_stone_req_formats); + INT_CMregister_handler(tmp_format, REVenable_auto_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVextract_attr_list_req_formats); + INT_CMregister_handler(tmp_format, REVextract_attr_list_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVfree_stone_req_formats); + INT_CMregister_handler(tmp_format, REVfree_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVfreeze_stone_req_formats); + INT_CMregister_handler(tmp_format, REVfreeze_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVset_attr_list_req_formats); + INT_CMregister_handler(tmp_format, REVset_attr_list_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVstall_stone_req_formats); + INT_CMregister_handler(tmp_format, REVstall_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVstone_add_split_target_req_formats); + INT_CMregister_handler(tmp_format, REVstone_add_split_target_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVstone_remove_split_target_req_formats); + INT_CMregister_handler(tmp_format, REVstone_remove_split_target_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVstone_set_output_req_formats); + INT_CMregister_handler(tmp_format, REVstone_set_output_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVtransfer_events_req_formats); + INT_CMregister_handler(tmp_format, REVtransfer_events_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVunfreeze_stone_req_formats); + INT_CMregister_handler(tmp_format, REVunfreeze_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EVunstall_stone_req_formats); + INT_CMregister_handler(tmp_format, REVunstall_stone_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EV_int_response_formats); + INT_CMregister_handler(tmp_format, REV_int_response_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EV_void_response_formats); + INT_CMregister_handler(tmp_format, REV_response_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EV_string_response_formats); + INT_CMregister_handler(tmp_format, REV_string_response_handler, cm->evp); + + tmp_format = INT_CMregister_format(cm, EV_EVevent_list_response_formats); + INT_CMregister_handler(tmp_format, REV_EVevent_list_response_handler, cm->evp); +} diff --git a/thirdparty/EVPath/EVPath/pregen-source/revp_internal.h b/thirdparty/EVPath/EVPath/pregen-source/revp_internal.h new file mode 100644 index 0000000000..b8bace6a31 --- /dev/null +++ b/thirdparty/EVPath/EVPath/pregen-source/revp_internal.h @@ -0,0 +1,106 @@ +/* + * This file is automatically generated by gen_interface.pl from evpath.h. + * + * DO NOT EDIT + * + */ + + +extern int +INT_REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone); + +extern void +INT_REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone); + +extern int +INT_REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone); + +extern EVstone +INT_REValloc_stone(CMConnection conn); + +extern EVaction +INT_REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone); + +extern EVaction +INT_REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone); + +extern EVaction +INT_REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec); + +extern EVaction +INT_REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec); + +extern EVaction +INT_REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list); + +extern EVaction +INT_REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit); + +extern EVaction +INT_REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler); + +extern void +INT_REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num); + +extern EVstone +INT_REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone); + +extern EVstone +INT_REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone); + +extern EVstone +INT_REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list); + +extern EVstone +INT_REVcreate_split_action(CMConnection conn, EVstone *target_list); + +extern EVstone +INT_REVcreate_stone_action(CMConnection conn, char *action_spec); + +extern EVstone +INT_REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit); + +extern EVstone +INT_REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler); + +extern int +INT_REVdestroy_stone(CMConnection conn, EVstone stone_id); + +extern int +INT_REVdrain_stone(CMConnection conn, EVstone stone_id); + +extern void +INT_REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec); + +extern attr_list +INT_REVextract_attr_list(CMConnection conn, EVstone stone_id); + +extern void +INT_REVfree_stone(CMConnection conn, EVstone stone); + +extern int +INT_REVfreeze_stone(CMConnection conn, EVstone stone_id); + +extern void +INT_REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list); + +extern void +INT_REVstall_stone(CMConnection conn, EVstone stone_id); + +extern void +INT_REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone); + +extern void +INT_REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone); + +extern int +INT_REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone); + +extern int +INT_REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone); + +extern int +INT_REVunfreeze_stone(CMConnection conn, EVstone stone_id); + +extern void +INT_REVunstall_stone(CMConnection conn, EVstone stone_id); diff --git a/thirdparty/EVPath/EVPath/pregen-source/revpath.h b/thirdparty/EVPath/EVPath/pregen-source/revpath.h new file mode 100644 index 0000000000..8bc4aa865a --- /dev/null +++ b/thirdparty/EVPath/EVPath/pregen-source/revpath.h @@ -0,0 +1,113 @@ +/* + * This file is automatically generated by gen_interface.pl from evpath.h. + * + * DO NOT EDIT + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int +REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone); + +extern void +REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone); + +extern int +REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone); + +extern EVstone +REValloc_stone(CMConnection conn); + +extern EVaction +REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone); + +extern EVaction +REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone); + +extern EVaction +REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec); + +extern EVaction +REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec); + +extern EVaction +REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list); + +extern EVaction +REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit); + +extern EVaction +REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler); + +extern void +REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num); + +extern EVstone +REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone); + +extern EVstone +REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone); + +extern EVstone +REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list); + +extern EVstone +REVcreate_split_action(CMConnection conn, EVstone *target_list); + +extern EVstone +REVcreate_stone_action(CMConnection conn, char *action_spec); + +extern EVstone +REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit); + +extern EVstone +REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler); + +extern int +REVdestroy_stone(CMConnection conn, EVstone stone_id); + +extern int +REVdrain_stone(CMConnection conn, EVstone stone_id); + +extern void +REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec); + +extern attr_list +REVextract_attr_list(CMConnection conn, EVstone stone_id); + +extern void +REVfree_stone(CMConnection conn, EVstone stone); + +extern int +REVfreeze_stone(CMConnection conn, EVstone stone_id); + +extern void +REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list); + +extern void +REVstall_stone(CMConnection conn, EVstone stone_id); + +extern void +REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone); + +extern void +REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone); + +extern int +REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone); + +extern int +REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone); + +extern int +REVunfreeze_stone(CMConnection conn, EVstone stone_id); + +extern void +REVunstall_stone(CMConnection conn, EVstone stone_id); + +#ifdef __cplusplus +} +#endif diff --git a/thirdparty/EVPath/EVPath/qual_hostname.c b/thirdparty/EVPath/EVPath/qual_hostname.c index eed0e028f1..138dde1706 100644 --- a/thirdparty/EVPath/EVPath/qual_hostname.c +++ b/thirdparty/EVPath/EVPath/qual_hostname.c @@ -7,7 +7,9 @@ #include #endif #ifdef HAVE_WINDOWS_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #define __ANSI_CPP__ #else diff --git a/thirdparty/EVPath/EVPath/response.c b/thirdparty/EVPath/EVPath/response.c index fad8f71cac..8373149d01 100644 --- a/thirdparty/EVPath/EVPath/response.c +++ b/thirdparty/EVPath/EVPath/response.c @@ -1700,7 +1700,7 @@ internal_cod_submit(cod_exec_context ec, int port, void *data, void *type_info) internal_cod_submit_general(ec, port, data, type_info, NULL, NULL); } -#ifdef _MSC_VER +#ifdef _WIN32 static long lrand48() { return rand(); @@ -1709,12 +1709,14 @@ static long lrand48() static double drand48() { return (double)(rand()) / (double)(RAND_MAX); } +#ifndef HAVE_UNISTD_H static void sleep(int t) { Sleep(t * 1000); } #endif +#endif static void add_standard_routines(stone_type stone, cod_parse_context context) { diff --git a/thirdparty/EVPath/EVPath/tests/auto_test.c b/thirdparty/EVPath/EVPath/tests/auto_test.c index aeba229bf0..7d7046db26 100644 --- a/thirdparty/EVPath/EVPath/tests/auto_test.c +++ b/thirdparty/EVPath/EVPath/tests/auto_test.c @@ -345,11 +345,11 @@ do_regression_master_test() printf("Waiting for remote....\n"); } #ifdef HAVE_WINDOWS_H - if (_cwait(&exit_state, subproc_proc, 0) == -1) { - perror("cwait"); - } + WaitForSingleObject((HANDLE)subproc_proc, INFINITE ); + DWORD exitCode = 0; + GetExitCodeProcess((HANDLE)subproc_proc, &exitCode); + exit_state = exitCode; if (exit_state == 0) { - if (quiet <= 0) printf("Passed single remote subproc test\n"); } else { printf("Single remote subproc exit with status %d\n", diff --git a/thirdparty/EVPath/EVPath/tests/block_test.c b/thirdparty/EVPath/EVPath/tests/block_test.c index 4e64d7db0f..c5bb25e8a1 100644 --- a/thirdparty/EVPath/EVPath/tests/block_test.c +++ b/thirdparty/EVPath/EVPath/tests/block_test.c @@ -444,18 +444,6 @@ do_regression_master_test() printf("Waiting for remote....\n"); } while (!done) { -#ifdef HAVE_WINDOWS_H - if (_cwait(&exit_state, subproc_proc, 0) == -1) { - perror("cwait"); - } - if (exit_state == 0) { - if (quiet <= 0) - printf("Subproc exitted\n"); - } else { - printf("Single remote subproc exit with status %d\n", - exit_state); - } -#else int result, j; if (quiet <= 0) { printf(","); @@ -467,6 +455,18 @@ do_regression_master_test() } done++; /* CMsleep(cm, 50); done++;*/ +#ifdef HAVE_WINDOWS_H + WaitForSingleObject((HANDLE)subproc_proc, INFINITE ); + DWORD exitCode = 0; + GetExitCodeProcess((HANDLE)subproc_proc, &exitCode); + exit_state = exitCode; + if (exit_state == 0) { + printf("Passed single remote subproc test\n"); + } else { + printf("Single remote subproc exit with status %d\n", + exit_state); + } +#else result = waitpid(subproc_proc, &exit_state, WNOHANG); if (result == -1) { perror("waitpid"); diff --git a/thirdparty/EVPath/EVPath/tests/bulktest.c b/thirdparty/EVPath/EVPath/tests/bulktest.c index 9068ffd1f7..ada01bb033 100644 --- a/thirdparty/EVPath/EVPath/tests/bulktest.c +++ b/thirdparty/EVPath/EVPath/tests/bulktest.c @@ -263,7 +263,7 @@ main(int argc, char **argv) int regression_master = 1; int forked = 0; - argv0 = argv[0];\ + argv0 = argv[0]; while (argv[1] && (argv[1][0] == '-')) { if (strcmp(&argv[1][1], "size") == 0) { if (sscanf(argv[2], "%d", &size) != 1) { @@ -600,25 +600,28 @@ do_regression_master_test() printf("Waiting for remote....\n"); } while (!done) { -#ifdef HAVE_WINDOWS_H - if (_cwait(&exit_state, subproc_proc, 0) == -1) { - perror("cwait"); - } - if (exit_state == 0) { - if (quiet <= 0) - printf("Subproc exitted\n"); - } else { - printf("Single remote subproc exit with status %d\n", - exit_state); - } -#else - int result; if (quiet <= 0) { printf(","); fflush(stdout); } CMsleep(cm, 50); done++; +#ifdef HAVE_WINDOWS_H + DWORD result = WaitForSingleObject((HANDLE)subproc_proc, 1 ); + if (result != WAIT_TIMEOUT) { + DWORD exitCode = 0; + GetExitCodeProcess((HANDLE)subproc_proc, &exitCode); + exit_state = exitCode; + if (exit_state == 0) { + printf("Passed single remote subproc test\n"); + } else { + printf("Single remote subproc exit with status %d\n", + exit_state); + } + done++; + } +#else + int result; result = waitpid(subproc_proc, &exit_state, WNOHANG); if (result == -1) { perror("waitpid"); diff --git a/thirdparty/EVPath/EVPath/tests/evtest.c b/thirdparty/EVPath/EVPath/tests/evtest.c index 59481adf78..1a2cdf22fb 100644 --- a/thirdparty/EVPath/EVPath/tests/evtest.c +++ b/thirdparty/EVPath/EVPath/tests/evtest.c @@ -370,11 +370,11 @@ do_regression_master_test() printf("Waiting for remote....\n"); } #ifdef HAVE_WINDOWS_H - if (_cwait(&exit_state, subproc_proc, 0) == -1) { - perror("cwait"); - } + WaitForSingleObject((HANDLE)subproc_proc, INFINITE ); + DWORD exitCode = 0; + GetExitCodeProcess((HANDLE)subproc_proc, &exitCode); + exit_state = exitCode; if (exit_state == 0) { - if (quiet <= 0) printf("Passed single remote subproc test\n"); } else { printf("Single remote subproc exit with status %d\n", diff --git a/thirdparty/EVPath/EVPath/tests/support.c b/thirdparty/EVPath/EVPath/tests/support.c index 5a13be452c..f1ced333e1 100644 --- a/thirdparty/EVPath/EVPath/tests/support.c +++ b/thirdparty/EVPath/EVPath/tests/support.c @@ -103,13 +103,42 @@ run_subprocess(char **args) { char **run_args = args; #ifdef HAVE_WINDOWS_H - intptr_t child; - child = _spawnv(_P_NOWAIT, "./evtest.exe", args); - if (child == -1) { - printf("failed for evtest\n"); - perror("spawnv"); + STARTUPINFO si; + PROCESS_INFORMATION pi; + char comm_line[8191]; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + char module[MAX_PATH]; + GetModuleFileName(NULL, &module[0], MAX_PATH); + int i = 1; + strcpy(comm_line, module); + strcat(comm_line, " "); + while (args[i] != NULL) { + strcat(comm_line, args[i]); + strcat(comm_line, " "); + i++; + } - return child; + if (!CreateProcess(module, + comm_line, + NULL, // Process handle not inheritable + NULL, // Thread handle not inheritable + FALSE, // Set handle inheritance to FALSE + 0, // No creation flags + NULL, // Use parent's environment block + NULL, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi ) + ) + { + printf( "CreateProcess failed (%d).\n", GetLastError() ); + printf("Args were argv[0] = %s\n", args[0]); + printf("Args were argv[1] = %s, argv[2] = %s\n", args[1], args[2]); + return 0; + } + return (intptr_t) pi.hProcess; #else pid_t child; if (quiet <=0) {printf("Forking subprocess\n");} @@ -149,6 +178,7 @@ run_subprocess(char **args) while(run_args[i]) { printf("%s ", run_args[i++]); } + printf("\n"); } if (no_fork) { child = -1; diff --git a/thirdparty/EVPath/EVPath/thin_server.c b/thirdparty/EVPath/EVPath/thin_server.c index 6e2080bd90..9502cd35b5 100644 --- a/thirdparty/EVPath/EVPath/thin_server.c +++ b/thirdparty/EVPath/EVPath/thin_server.c @@ -3,7 +3,9 @@ #include #include #ifdef HAVE_WINSOCK2_H +#ifndef FD_SETSIZE #define FD_SETSIZE 1024 +#endif #include #include #define drand48() (((double)rand())/((double)RAND_MAX)) diff --git a/thirdparty/EVPath/EVPath/version.c b/thirdparty/EVPath/EVPath/version.c index eced0882d4..b31925a519 100644 --- a/thirdparty/EVPath/EVPath/version.c +++ b/thirdparty/EVPath/EVPath/version.c @@ -2,7 +2,7 @@ #include #include "config.h" -static char *EVPath_version = "EVPath Version 4.2.4 -- Mon Dec 4 16:21:33 EST 2017\n"; +static char *EVPath_version = "EVPath Version 4.5.3 -- Tue Aug 6 13:53:13 EDT 2024\n"; #if defined (__INTEL_COMPILER) // Allow extern declarations with no prior decl