Main Page   Compound List   File List   Compound Members   File Members  

ce.h

Go to the documentation of this file.
00001 /**************************************************************/
00002 /* CE.H */
00003 /* Author: Ohad Rodeh */
00004 /* Based on code by Mark Hayden and Alexey Vaysburd. */
00005 /**************************************************************/
00013 /**************************************************************/
00014 
00015 #ifndef __CE_H__
00016 #define __CE_H__
00017 
00018 #include "e_iovec.h"
00019 #include "ce_so.h"
00020 #include <memory.h>
00021 
00022 #ifdef _WIN32
00023 #include <winsock2.h>
00024 #endif
00025 
00026 
00027 
00028 
00032 typedef double      ce_float_t ;
00033 
00036 typedef int         ce_bool_t ;
00037 
00042 typedef int         ce_rank_t ;
00043 
00046 typedef int         ce_ltime_t ;
00047 
00050 typedef int         ce_len_t ;
00051 
00056 typedef void       *ce_env_t ;
00057 
00060 typedef double      ce_time_t ;
00061 
00065 typedef char*       ce_endpt_t;
00066 
00069 typedef char*       ce_addr_t;
00070 
00073 typedef char       *ce_data_t;
00074 
00078 typedef ce_iovec_t *ce_iovec_array_t;
00079 
00080 /* An array of boolean values. 
00081  */
00082 typedef ce_bool_t  *ce_bool_array_t;
00083 
00087 typedef ce_endpt_t *ce_endpt_array_t ;
00088 
00091 typedef ce_rank_t  *ce_rank_array_t ;
00092 
00096 typedef ce_addr_t  *ce_addr_array_t ;
00097 
00107 typedef struct ce_view_id_t {
00108     ce_ltime_t ltime ;
00109     ce_endpt_t endpt ;
00110 } ce_view_id_t ;
00111 
00114 typedef ce_view_id_t **ce_view_id_array_t;
00115 
00121 typedef struct ce_view_state_t {
00122     char* version ;                
00123     char* group ;                  
00124     char* proto ;                  
00125     ce_rank_t coord ;              
00126     int ltime ;                    
00127     ce_bool_t primary ;            
00128     ce_bool_t groupd ;             
00129     ce_bool_t xfer_view ;          
00130     char* key ;                    
00131     int num_ids ;                  
00132     ce_view_id_array_t prev_ids ;  
00133     char *params;                  
00134     ce_time_t uptime ;             
00135     ce_endpt_array_t view ;        
00136     ce_addr_array_t address ;      
00137 } ce_view_state_t ;
00138 
00143 typedef struct ce_local_state_t {
00144     ce_endpt_t endpt ;             
00145     ce_addr_t addr ;               
00146     ce_rank_t rank ;               
00147     char* name ;                   
00148     int nmembers ;                 
00149     ce_view_id_t *view_id ;        
00150     ce_bool_t am_coord ;           
00151 } ce_local_state_t ;
00152 
00157 typedef struct ce_jops_t {
00158     ce_time_t hrtbt_rate ;         
00159     char *transports ;             
00160     char *protocol ;               
00161     char *group_name ;             
00162     char *properties ;             
00163     ce_bool_t use_properties ;     
00164     ce_bool_t groupd ;             
00165     char *params ;                 
00166     ce_bool_t client;              
00167     ce_bool_t debug ;              
00168     char *endpt ;                  
00169     char *princ ;                  
00170     char *key ;                    
00171     ce_bool_t secure ;             
00172 } ce_jops_t;
00173 
00177 #define CE_DEFAULT_PROTOCOL "Top:Heal:Switch:Leave:Inter:Intra:Elect:Merge:Slander:Sync:Suspect:Stable:Vsync:Frag_Abv:Top_appl:Frag:Pt2ptw:Mflow:Pt2pt:Mnak:Bottom"
00178 
00179 
00184 #define CE_DEFAULT_PROPERTIES "Gmp:Sync:Heal:Switch:Frag:Suspect:Flow:Slander"
00185 
00186 /**************************************************************/
00187 /*
00188  * Utilities
00189  */
00190 
00193 #define record_create(type, var) ((type)malloc(sizeof(*var)))
00194 
00197 #define record_free(rec) free(rec)
00198 
00201 #define record_clear(rec) memset(rec, 0, sizeof(*rec))
00202 
00206 LINKDLL char *ce_copy_string(char *str);
00207 
00212 LINKDLL void ce_view_full_free(ce_local_state_t *ls, ce_view_state_t* vs);
00213 
00217 LINKDLL void ce_jops_free(ce_jops_t*) ;
00218 
00219 /**************************************************************/
00228 typedef void (*ce_appl_install_t)(ce_env_t, ce_local_state_t*, ce_view_state_t*);
00229 
00232 typedef void (*ce_appl_exit_t)(ce_env_t) ;
00233 
00239 typedef void (*ce_appl_receive_cast_t)(ce_env_t, ce_rank_t, int, ce_iovec_array_t) ;
00240 
00246 typedef void (*ce_appl_receive_send_t)(ce_env_t, ce_rank_t, int, ce_iovec_array_t) ;
00247 
00252 typedef void (*ce_appl_flow_block_t)(ce_env_t, ce_rank_t, ce_bool_t) ;
00253 
00258 typedef void (*ce_appl_block_t)(ce_env_t) ;
00259 
00263 typedef void (*ce_appl_heartbeat_t)(ce_env_t, ce_time_t) ;
00264 
00271 typedef struct ce_appl_intf_t ce_appl_intf_t ;
00272 
00294 LINKDLL ce_appl_intf_t*
00295 ce_create_intf(ce_env_t env, 
00296                ce_appl_exit_t exit,
00297                ce_appl_install_t install,
00298                ce_appl_flow_block_t flow_block,
00299                ce_appl_block_t block,
00300                ce_appl_receive_cast_t cast,
00301                ce_appl_receive_send_t send,
00302                ce_appl_heartbeat_t heartbeat
00303     );
00304 
00305 /**************************************************************/
00306 
00317 LINKDLL void ce_Init(
00318     int argc,
00319     char **argv
00320     ) ;
00321 
00324 LINKDLL void ce_Main_loop (void);
00325 
00330 LINKDLL void ce_Join(
00331     ce_jops_t *ops,
00332     ce_appl_intf_t *c_appl
00333     ) ;
00334 
00335 /**************************************************************/
00336 /* The set of actions supported on a group. 
00337  */
00338 
00342 LINKDLL void ce_Leave(ce_appl_intf_t *c_appl) ;
00343 
00349 LINKDLL void ce_Cast(
00350     ce_appl_intf_t *c_appl,
00351     int num,
00352     ce_iovec_array_t iovl
00353     ) ;
00354 
00362 LINKDLL void ce_Send(
00363     ce_appl_intf_t *c_appl,
00364     int num_dests,
00365     ce_rank_array_t dests,
00366     int num,
00367     ce_iovec_array_t iovl
00368     ) ;
00369 
00370 
00377 LINKDLL void ce_Send1(
00378     ce_appl_intf_t *c_appl,
00379     ce_rank_t dest,
00380     int num,
00381     ce_iovec_array_t iovl
00382     ) ;
00383 
00387 LINKDLL void ce_Prompt(
00388     ce_appl_intf_t *c_appl
00389     );
00390 
00396 LINKDLL void ce_Suspect(
00397     ce_appl_intf_t *c_appl,
00398     int num,
00399     ce_rank_array_t suspects
00400     );
00401 
00405 LINKDLL void ce_XferDone(
00406     ce_appl_intf_t *c_appl
00407     ) ;
00408 
00412 LINKDLL void ce_Rekey(
00413     ce_appl_intf_t *c_appl
00414     ) ;
00415 
00426 LINKDLL void ce_ChangeProtocol(
00427     ce_appl_intf_t *c_appl,
00428     char *protocol_name
00429     ) ;
00430 
00431 
00438 LINKDLL void ce_ChangeProperties(
00439     ce_appl_intf_t *c_appl,
00440     char *properties
00441     ) ;
00442 
00443 /**************************************************************/
00450 LINKDLL void ce_MLPrintOverride(
00451     void (*handler)(char *msg)
00452     ) ;
00453     
00457 LINKDLL void ce_MLUncaughtException(
00458     void (*handler)(char *info)
00459     ) ;
00460     
00461 /**************************************************************/
00465 #ifdef _WIN32
00466 typedef SOCKET CE_SOCKET ;
00467 #else
00468 typedef int    CE_SOCKET ;
00469 #endif
00470 
00473 typedef void (*ce_handler_t)(void*);
00474 
00482 LINKDLL void ce_AddSockRecv(
00483     CE_SOCKET socket,
00484     ce_handler_t handler,
00485     ce_env_t env
00486     );
00487 
00491 LINKDLL void ce_RmvSockRecv(
00492     CE_SOCKET socket
00493     );
00494 
00495 /**************************************************************/
00496 /* Here is a simpler "flat" inteface.
00497  * No iovec's are used, as above, things are zero-copy.
00498  */
00499 
00500 
00501 
00502 
00503 
00509 typedef void (*ce_appl_flat_receive_cast_t)(ce_env_t, ce_rank_t, ce_len_t, ce_data_t) ;
00510 
00516 typedef void (*ce_appl_flat_receive_send_t)(ce_env_t, ce_rank_t, ce_len_t, ce_data_t) ;
00517 
00520 LINKDLL ce_appl_intf_t*
00521 ce_create_flat_intf(ce_env_t env, 
00522                     ce_appl_exit_t exit,
00523                     ce_appl_install_t install,
00524                     ce_appl_flow_block_t flow_block,
00525                     ce_appl_block_t block,
00526                     ce_appl_flat_receive_cast_t cast,
00527                     ce_appl_flat_receive_send_t send,
00528                     ce_appl_heartbeat_t heartbeat
00529     );
00530 
00531 
00537 LINKDLL void ce_flat_Cast(
00538      ce_appl_intf_t *c_appl,
00539      ce_len_t len, 
00540      ce_data_t buf
00541      ) ;
00542 
00550 LINKDLL void ce_flat_Send(
00551     ce_appl_intf_t *c_appl,
00552     int num_dests,
00553     ce_rank_array_t dests,
00554     ce_len_t len, 
00555     ce_data_t buf
00556     ) ;
00557 
00558 
00565 LINKDLL void ce_flat_Send1(
00566     ce_appl_intf_t *c_appl,
00567     ce_rank_t dest,
00568     ce_len_t len, 
00569     ce_data_t buf
00570     ) ;
00571 
00572 #endif  /* __CE_H__ */
00573 
00574 /**************************************************************/
00575 

Generated at Thu May 23 11:28:39 2002 for CE by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001