00001 /* 00002 * ** $Id: host_8h-source.html,v 1.1 2007/08/02 18:36:20 krishnap Exp $ 00003 * ** 00004 * ** Matthew Allen 00005 * ** description: 00006 * */ 00007 00008 #ifndef _HOST_H_ 00009 #define _HOST_H_ 00010 00011 #include "key.h" 00012 #include "jrb.h" 00013 00014 #define SUCCESS_WINDOW 20 00015 #define GOOD_LINK 0.8 00016 #define BAD_LINK 0.3 00017 00018 00019 typedef struct { 00020 char *name; 00021 unsigned long address; 00022 int failed; 00023 double failuretime; 00024 int port; 00025 double latency; 00026 double loss; 00027 double success; 00028 int success_win[SUCCESS_WINDOW]; 00029 int success_win_index; 00030 float success_avg; 00031 Key key; 00032 } ChimeraHost; 00033 00034 typedef struct { 00035 void * network; 00036 void * message; 00037 void * route; 00038 void * log; 00039 void * host; 00040 void * chimera; 00041 JRB bootstrapMsgStore; /* for future security enhancement */ 00042 pthread_mutex_t bootstrapMutex; /* for future security enhancement */ 00043 void *certificateStore; /* for future security enhancement */ 00044 pthread_mutex_t certificateMutex; /* for future security enhancement */ 00045 } ChimeraState; 00046 00051 ChimeraHost *host_get(ChimeraState *state,char *hn, int port); 00052 00058 void host_release(ChimeraState *state,ChimeraHost *host); 00059 00064 ChimeraHost *host_decode(ChimeraState *state,char *s); 00065 00070 void host_encode(char *s, int len, ChimeraHost *host); 00071 00075 void host_update_stat(ChimeraHost *host, int success); 00076 00080 void* host_init(void* logs,int size); 00081 00082 00083 #endif /* _HOST_H_ */