EVPath
|
00001 #ifndef __EV_DFG__H__ 00002 00004 #include "evpath.h" 00005 00006 #ifdef __cplusplus 00007 extern "C" { 00008 #endif 00009 00012 /* 00013 ** Basic approach: 00014 ** Create a DFG of "virtual stones" to be later deployed. 00015 ** - Associate actions (created with our usual create action routines from StructDecls and text actions) 00016 ** - Associate attributes 00017 ** Actual deployment: 00018 ** - first version: 00019 ** * Centralized 00020 ** * Server or distinguished participant is informed of all participants, he gives them DFG 00021 ** segments and gets reports back of stone IDs, necessary stone IDs are then distributed to 00022 ** neighbors and the cohort is released. 00023 ** * require all participants to be present before continuing 00024 ** * manage "ready messages" so that DFG is realized without race conditions 00025 ** * Do "validation" of DFG pre-realization. Check for disconnected vertices, look at data 00026 ** types to see if they will be handled, etc. 00027 ** * deployment master may be distinguished participant or separate server. 00028 ** - optimization 00029 ** * eliminate actual stone IDs. As long as the number of stones per CM is relatively small, 00030 ** we can use DFG-assigned stone IDs in the event-message and do a table lookup to determine 00031 ** the right local stone when the message arrives. 00032 ** - next version 00033 ** * add nodes to (fixed) DFG as they come up. Provide early-arrivers with the contact lists of 00034 ** late-arriving neighbors as they join. 00035 */ 00036 00042 typedef struct _EVdfg *EVdfg; 00043 00049 typedef struct _EVmaster *EVmaster; 00050 00056 typedef struct _EVclient *EVclient; 00057 00063 typedef struct _EVdfg_stone *EVdfg_stone; 00064 00073 typedef struct _EVclient_sources *EVclient_sources; 00074 00084 typedef struct _EVclient_sinks *EVclient_sinks; 00085 00092 #define DFG_SOURCE -1 00093 00104 extern EVmaster EVmaster_create(CManager cm); 00105 00119 extern char *EVmaster_get_contact_list(EVmaster master); 00120 00150 extern EVclient EVclient_assoc(CManager cm, char *node_name, char *master_contact, 00151 EVclient_sources source_capabilities, EVclient_sinks sink_capabilities); 00152 00179 extern EVclient EVclient_assoc_local(CManager cm, char *node_name, EVmaster master, 00180 EVclient_sources source_capabilities, EVclient_sinks sink_capabilities); 00181 00182 00198 extern void EVmaster_register_node_list(EVmaster master, char** list); 00199 00221 typedef void (*EVmasterJoinHandlerFunc) (EVmaster master, char *identifier, void* available_sources, void *available_sinks); 00222 00242 typedef void (*EVmasterFailHandlerFunc) (EVdfg dfg, char *failed_client, int failed_stone); 00243 00259 typedef void (*EVmasterReconfigHandlerFunc) (EVdfg dfg); 00260 00267 extern void EVmaster_node_join_handler (EVmaster master, EVmasterJoinHandlerFunc func); 00268 00275 extern void EVmaster_node_fail_handler (EVmaster master, EVmasterFailHandlerFunc func); 00276 00283 extern void EVmaster_node_reconfig_handler (EVmaster master, EVmasterReconfigHandlerFunc func); 00284 00300 extern void EVdfg_realize(EVdfg dfg); 00301 00317 extern int EVclient_ready_wait(EVclient client); 00318 00336 extern EVclient_sources 00337 EVclient_register_source(char *name, EVsource src); 00338 00363 extern EVclient_sinks 00364 EVclient_register_sink_handler(CManager cm, char *name, FMStructDescList list, EVSimpleHandlerFunc handler, void* client_data); 00365 00386 extern EVclient_sinks 00387 EVclient_register_raw_sink_handler(CManager cm, char *name, EVRawHandlerFunc handler, void *client_data); 00388 00399 extern int EVclient_source_active(EVsource src); 00400 00410 extern unsigned int EVclient_active_sink_count(EVclient client); 00411 00426 extern int EVmaster_assign_canonical_name(EVmaster master, char *given_name, char *canonical_name); 00427 00436 extern EVdfg EVdfg_create(EVmaster master); 00437 00438 00454 extern EVdfg_stone EVdfg_create_stone(EVdfg dfg, char *action_spec); 00455 00467 extern void EVdfg_add_action (EVdfg_stone stone, char *action_spec); 00468 00485 extern EVdfg_stone EVdfg_create_source_stone(EVdfg dfg, char *source_name); 00486 00502 extern EVdfg_stone EVdfg_create_sink_stone(EVdfg dfg, char *handler_name); 00503 00518 extern void EVdfg_add_sink_action(EVdfg_stone stone, char *handler_name); 00519 00541 extern void EVdfg_link_port(EVdfg_stone source, int output_index, 00542 EVdfg_stone destination); 00543 00561 extern void EVdfg_link_dest(EVdfg_stone source, EVdfg_stone destination); 00562 00572 extern int EVdfg_unlink_port(EVdfg_stone source, int output_index); 00573 00583 extern int EVdfg_unlink_dest(EVdfg_stone source, EVdfg_stone destination); 00584 00599 extern int EVdfg_assign_node(EVdfg_stone stone, char *node); 00600 00617 extern void EVdfg_enable_auto_stone(EVdfg_stone stone, int period_sec, 00618 int period_usec); 00619 00630 extern void EVdfg_set_attr_list(EVdfg_stone stone, attr_list attrs); 00631 00647 extern attr_list EVdfg_get_attr_list(EVdfg_stone stone); 00648 00654 #define DFG_STATUS_SUCCESS 0 00655 00661 #define DFG_STATUS_FAILURE 1 00662 00681 extern int EVclient_shutdown(EVclient client, int result); 00682 00702 extern int EVclient_force_shutdown(EVclient client, int result); 00703 00716 extern void EVclient_ready_for_shutdown(EVclient client); 00717 00733 extern int EVclient_wait_for_shutdown(EVclient client); 00734 00746 extern int EVclient_test_for_shutdown(EVclient client); 00747 00748 #ifdef __cplusplus 00749 } 00750 #endif 00751 00752 #endif