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 
00030 typedef double      ce_float_t ;
00031 
00034 typedef int         ce_bool_t ;
00035 
00040 typedef int         ce_rank_t ;
00041 
00044 typedef int         ce_ltime_t ;
00045 
00048 typedef int         ce_len_t ;
00049 
00054 typedef void       *ce_env_t ;
00055 
00058 typedef double      ce_time_t ;
00059 
00063 typedef char*       ce_endpt_t;
00064 
00067 typedef char*       ce_addr_t;
00068 
00071 typedef char       *ce_data_t;
00072 
00076 typedef ce_iovec_t *ce_iovec_array_t;
00077 
00078 /* An array of boolean values. 
00079  */
00080 typedef ce_bool_t  *ce_bool_array_t;
00081 
00085 typedef ce_endpt_t *ce_endpt_array_t ;
00086 
00089 typedef ce_rank_t  *ce_rank_array_t ;
00090 
00094 typedef ce_addr_t  *ce_addr_array_t ;
00095 
00105 typedef struct ce_view_id_t {
00106     ce_ltime_t ltime ;
00107     ce_endpt_t endpt ;
00108 } ce_view_id_t ;
00109 
00112 typedef ce_view_id_t **ce_view_id_array_t;
00113 
00119 typedef struct ce_view_state_t {
00120     char* version ;                
00121     char* group ;                  
00122     char* proto ;                  
00123     ce_rank_t coord ;              
00124     int ltime ;                    
00125     ce_bool_t primary ;            
00126     ce_bool_t groupd ;             
00127     ce_bool_t xfer_view ;          
00128     char* key ;                    
00129     int num_ids ;                  
00130     ce_view_id_array_t prev_ids ;  
00131     char *params;                  
00132     ce_time_t uptime ;             
00133     ce_endpt_array_t view ;        
00134     ce_addr_array_t address ;      
00135 } ce_view_state_t ;
00136 
00141 typedef struct ce_local_state_t {
00142     ce_endpt_t endpt ;             
00143     ce_addr_t addr ;               
00144     ce_rank_t rank ;               
00145     char* name ;                   
00146     int nmembers ;                 
00147     ce_view_id_t *view_id ;        
00148     ce_bool_t am_coord ;           
00149 } ce_local_state_t ;
00150 
00155 typedef struct ce_jops_t {
00156     ce_time_t hrtbt_rate ;         
00157     char *transports ;             
00158     char *protocol ;               
00159     char *group_name ;             
00160     char *properties ;             
00161     ce_bool_t use_properties ;     
00162     ce_bool_t groupd ;             
00163     char *params ;                 
00164     ce_bool_t client;              
00165     ce_bool_t debug ;              
00166     char *endpt ;                  
00167     char *princ ;                  
00168     char *key ;                    
00169     ce_bool_t secure ;             
00170 } ce_jops_t;
00171 
00175 #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"
00176 
00177 
00182 #define CE_DEFAULT_PROPERTIES "Gmp:Sync:Heal:Switch:Frag:Suspect:Flow:Slander"
00183 
00184 /**************************************************************/
00185 /*
00186  * Utilities
00187  */
00188 
00191 #define record_create(type, var) ((type)malloc(sizeof(*var)))
00192 
00195 #define record_free(rec) free(rec)
00196 
00199 #define record_clear(rec) memset(rec, 0, sizeof(*rec))
00200 
00204 LINKDLL char *ce_copy_string(char *str);
00205 
00210 LINKDLL void ce_view_full_free(ce_local_state_t *ls, ce_view_state_t* vs);
00211 
00215 LINKDLL void ce_jops_free(ce_jops_t*) ;
00216 
00217 /**************************************************************/
00226 typedef void (*ce_appl_install_t)(ce_env_t, ce_local_state_t*, ce_view_state_t*);
00227 
00230 typedef void (*ce_appl_exit_t)(ce_env_t) ;
00231 
00237 typedef void (*ce_appl_receive_cast_t)(ce_env_t, ce_rank_t, int, ce_iovec_array_t) ;
00238 
00244 typedef void (*ce_appl_receive_send_t)(ce_env_t, ce_rank_t, int, ce_iovec_array_t) ;
00245 
00250 typedef void (*ce_appl_flow_block_t)(ce_env_t, ce_rank_t, ce_bool_t) ;
00251 
00256 typedef void (*ce_appl_block_t)(ce_env_t) ;
00257 
00261 typedef void (*ce_appl_heartbeat_t)(ce_env_t, ce_time_t) ;
00262 
00269 typedef struct ce_appl_intf_t ce_appl_intf_t ;
00270 
00292 LINKDLL ce_appl_intf_t*
00293 ce_create_intf(ce_env_t env, 
00294                ce_appl_exit_t exit,
00295                ce_appl_install_t install,
00296                ce_appl_flow_block_t flow_block,
00297                ce_appl_block_t block,
00298                ce_appl_receive_cast_t cast,
00299                ce_appl_receive_send_t send,
00300                ce_appl_heartbeat_t heartbeat
00301     );
00302 
00303 /**************************************************************/
00304 
00315 LINKDLL void ce_Init(
00316     int argc,
00317     char **argv
00318     ) ;
00319 
00322 LINKDLL void ce_Main_loop (void);
00323 
00328 LINKDLL void ce_Join(
00329     ce_jops_t *ops,
00330     ce_appl_intf_t *c_appl
00331     ) ;
00332 
00333 /**************************************************************/
00334 /* The set of actions supported on a group. 
00335  */
00336 
00340 LINKDLL void ce_Leave(ce_appl_intf_t *c_appl) ;
00341 
00347 LINKDLL void ce_Cast(
00348     ce_appl_intf_t *c_appl,
00349     int num,
00350     ce_iovec_array_t iovl
00351     ) ;
00352 
00360 LINKDLL void ce_Send(
00361     ce_appl_intf_t *c_appl,
00362     int num_dests,
00363     ce_rank_array_t dests,
00364     int num,
00365     ce_iovec_array_t iovl
00366     ) ;
00367 
00368 
00375 LINKDLL void ce_Send1(
00376     ce_appl_intf_t *c_appl,
00377     ce_rank_t dest,
00378     int num,
00379     ce_iovec_array_t iovl
00380     ) ;
00381 
00385 LINKDLL void ce_Prompt(
00386     ce_appl_intf_t *c_appl
00387     );
00388 
00394 LINKDLL void ce_Suspect(
00395     ce_appl_intf_t *c_appl,
00396     int num,
00397     ce_rank_array_t suspects
00398     );
00399 
00403 LINKDLL void ce_XferDone(
00404     ce_appl_intf_t *c_appl
00405     ) ;
00406 
00410 LINKDLL void ce_Rekey(
00411     ce_appl_intf_t *c_appl
00412     ) ;
00413 
00424 LINKDLL void ce_ChangeProtocol(
00425     ce_appl_intf_t *c_appl,
00426     char *protocol_name
00427     ) ;
00428 
00429 
00436 LINKDLL void ce_ChangeProperties(
00437     ce_appl_intf_t *c_appl,
00438     char *properties
00439     ) ;
00440 
00441 /**************************************************************/
00448 LINKDLL void ce_MLPrintOverride(
00449     void (*handler)(char *msg)
00450     ) ;
00451     
00455 LINKDLL void ce_MLUncaughtException(
00456     void (*handler)(char *info)
00457     ) ;
00458     
00459 /**************************************************************/
00463 #ifdef _WIN32
00464 typedef SOCKET CE_SOCKET ;
00465 #else
00466 typedef int    CE_SOCKET ;
00467 #endif
00468 
00471 typedef void (*ce_handler_t)(void*);
00472 
00480 LINKDLL void ce_AddSockRecv(
00481     CE_SOCKET socket,
00482     ce_handler_t handler,
00483     ce_env_t env
00484     );
00485 
00489 LINKDLL void ce_RmvSockRecv(
00490     CE_SOCKET socket
00491     );
00492 
00493 /**************************************************************/
00494 /* Here is a simpler "flat" inteface.
00495  * No iovec's are used, as above, things are zero-copy.
00496  */
00497 
00498 
00499 
00500 
00501 
00507 typedef void (*ce_appl_flat_receive_cast_t)(ce_env_t, ce_rank_t, ce_len_t, ce_data_t) ;
00508 
00514 typedef void (*ce_appl_flat_receive_send_t)(ce_env_t, ce_rank_t, ce_len_t, ce_data_t) ;
00515 
00518 LINKDLL ce_appl_intf_t*
00519 ce_create_flat_intf(ce_env_t env, 
00520                     ce_appl_exit_t exit,
00521                     ce_appl_install_t install,
00522                     ce_appl_flow_block_t flow_block,
00523                     ce_appl_block_t block,
00524                     ce_appl_flat_receive_cast_t cast,
00525                     ce_appl_flat_receive_send_t send,
00526                     ce_appl_heartbeat_t heartbeat
00527     );
00528 
00529 
00535 LINKDLL void ce_flat_Cast(
00536      ce_appl_intf_t *c_appl,
00537      ce_len_t len, 
00538      ce_data_t buf
00539      ) ;
00540 
00548 LINKDLL void ce_flat_Send(
00549     ce_appl_intf_t *c_appl,
00550     int num_dests,
00551     ce_rank_array_t dests,
00552     ce_len_t len, 
00553     ce_data_t buf
00554     ) ;
00555 
00556 
00563 LINKDLL void ce_flat_Send1(
00564     ce_appl_intf_t *c_appl,
00565     ce_rank_t dest,
00566     ce_len_t len, 
00567     ce_data_t buf
00568     ) ;
00569 
00570 #endif  /* __CE_H__ */
00571 
00572 /**************************************************************/
00573 

Generated at Tue Jul 23 09:05:19 2002 for CE by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001