chimera.c File Reference

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <netdb.h>
#include <netinet/in.h>
#include "chimera.h"
#include "host.h"
#include "message.h"
#include "route.h"
#include "semaphore.h"
#include "key.h"
#include "log.h"
#include "dtime.h"
#include "network.h"

Defines

#define CHIMERA_JOIN   1
#define CHIMERA_JOIN_ACK   2
#define CHIMERA_UPDATE   3
#define CHIMERA_PIGGY   4
#define CHIMERA_JOIN_NACK   5
#define CHIMERA_PING   6
#define LEAFSET_CHECK_PERIOD   20
#define GRACEPERIOD   30

Functions

int chimera_encodehosts (void *logs, char *s, int size, ChimeraHost **host)
ChimeraHost ** chimera_decodehosts (ChimeraState *state, char *s)
void chimera_send_rowinfo (ChimeraState *state, Message *message)
void chimera_join_complete (ChimeraState *state, ChimeraHost *host)
void * chimera_check_leafset (void *chstate)
int chimera_check_leafset_init (ChimeraState *state)
void chimera_join_denied (ChimeraState *state, Message *message)
void chimera_route (ChimeraState *state, Key *key, Message *message, ChimeraHost *host)
void chimera_join_acknowledged (ChimeraState *state, Message *message)
void chimera_message (ChimeraState *state, Message *message)
void chimera_register (ChimeraState *state, int type, int ack)
void chimera_update_message (ChimeraState *state, Message *message)
void chimera_piggy_message (ChimeraState *state, Message *message)
void route_keyupdate ()
void chimera_setkey (ChimeraState *state, Key key)
int chimera_ping (ChimeraState *state, ChimeraHost *host)
void chimera_ping_reply (ChimeraState *state, Message *message)
ChimeraStatechimera_init (int port)
void chimera_join (ChimeraState *state, ChimeraHost *bootstrap)
void chimera_send (ChimeraState *state, Key key, int type, int size, char *data)
void chimera_forward (ChimeraState *state, chimera_forward_upcall_t func)
void chimera_deliver (ChimeraState *state, chimera_deliver_upcall_t func)
void chimera_update (ChimeraState *state, chimera_update_upcall_t func)
void chimera_update_upcall (ChimeraState *state, Key *k, ChimeraHost *h, int joined)

Define Documentation

#define CHIMERA_JOIN   1
 

#define CHIMERA_JOIN_ACK   2
 

#define CHIMERA_JOIN_NACK   5
 

#define CHIMERA_PIGGY   4
 

#define CHIMERA_PING   6
 

#define CHIMERA_UPDATE   3
 

#define GRACEPERIOD   30
 

GRACEPERIOD is the time that has to be elapsed before a node can be accepted to the network again after last send to it failed

#define LEAFSET_CHECK_PERIOD   20
 

interval that members of leafset are checked to see if they are alive or not


Function Documentation

void* chimera_check_leafset void *  chstate  ) 
 

chimera_check_leafset: runs as a separate thread. it should send a PING message to each member of the leafset frequently and sends the leafset to other members of its leafset periodically. pinging frequecy is LEAFSET_CHECK_PERIOD.

int chimera_check_leafset_init ChimeraState state  ) 
 

ChimeraHost** chimera_decodehosts ChimeraState state,
char *  s
 

void chimera_deliver ChimeraState state,
chimera_deliver_upcall_t  func
 

chimera_deliver: Set the chimera deliver upcall to func. This handler will be called every time a message is delivered to the current node

int chimera_encodehosts void *  logs,
char *  s,
int  size,
ChimeraHost **  host
 

void chimera_forward ChimeraState state,
chimera_forward_upcall_t  func
 

chimera_forward: Set the chimera forward upcall to func. This handler will be called every time a message is routed to a key through the current node. The host argument is upsupported, but will allow the programmer to choose the next hop

ChimeraState* chimera_init int  port  ) 
 

chimera_init: Initializes Chimera on port port and returns the ChimeraState * which contains global state of different chimera modules.

void chimera_join ChimeraState state,
ChimeraHost bootstrap
 

chimera_join: Join the network that the bootstrap host is a part of

void chimera_join_acknowledged ChimeraState state,
Message message
 

chimera_join_acknowledge: called when the current host is joining the network and has just revieced its leaf set. This function sends an update message to all nodes in its new leaf set to announce its arrival.

void chimera_join_complete ChimeraState state,
ChimeraHost host
 

chimera_join_complete: internal function that is called at the destination of a JOIN message. This call encodes the leaf set of the current host and sends it to the joiner.

void chimera_join_denied ChimeraState state,
Message message
 

chimera_join_denied internal function that is called when the sender of a JOIN message receives the JOIN_NACK message type which is join denial from the current key root in the network.

void chimera_message ChimeraState state,
Message message
 

void chimera_piggy_message ChimeraState state,
Message message
 

int chimera_ping ChimeraState state,
ChimeraHost host
 

chimera_ping: sends a PING message to the host. The message is acknowledged in network layer.

void chimera_ping_reply ChimeraState state,
Message message
 

void chimera_register ChimeraState state,
int  type,
int  ack
 

chimera_register: register an integer message type to be routed by the chimera routing layer ack is the argument that defines wether this message type should be acked or not ack ==1 means message will be acknowledged, ack=2 means no acknowledge is necessary for this type of message.

void chimera_route ChimeraState state,
Key key,
Message message,
ChimeraHost host
 

chimera_route: routes a message one step closer to its destination key. Delivers the message to its destination if it is the current host through the deliver upcall, otherwise it makes the route upcall

void chimera_send ChimeraState state,
Key  key,
int  type,
int  size,
char *  data
 

chimera_send: Route a message of type to key containing size bytes of data. This will send data through the Chimera system and deliver it to the host closest to the key.

void chimera_send_rowinfo ChimeraState state,
Message message
 

void chimera_setkey ChimeraState state,
Key  key
 

chimera_setkey: Manually sets the key for the current node

void chimera_update ChimeraState state,
chimera_update_upcall_t  func
 

chimera_update: Set the chimera update upcall to func. This handler will be called every time a host leaves or joins your neighbor set. The final integer is a 1 if the host joins and a 0 if the host leaves

void chimera_update_message ChimeraState state,
Message message
 

void chimera_update_upcall ChimeraState state,
Key k,
ChimeraHost h,
int  joined
 

void route_keyupdate  ) 
 


Generated on Thu Feb 16 21:42:39 2006 for Chimera by  doxygen 1.4.5