Chimera: chimera_0-9/include/chimera.h File Reference

- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# chimera.h File Reference

`#include "host.h"`
`#include "key.h"`
`#include "log.h"`
`#include <pthread.h>`
`#include "message.h"`
`#include "semaphore.h"`

Go to the source code of this file.

## Classes
struct | ChimeraGlobal
## Typedefs
typedef void(* | chimera_forward_upcall_t )(Key **, Message **, ChimeraHost **)
typedef void(* | chimera_deliver_upcall_t )(Key *, Message *)
typedef void(* | chimera_update_upcall_t )(Key *, ChimeraHost *, int)
## Functions
ChimeraState * | chimera_init (int port)
void | chimera_join (ChimeraState *state, ChimeraHost *bootstrap)
void | chimera_route (ChimeraState *state, Key *key, Message *msg, ChimeraHost *hint)
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_setkey (ChimeraState *state, Key key)
void | chimera_register (ChimeraState *state, int type, int ack)
void | chimera_send (ChimeraState *state, Key key, int type, int len, char *data)
int | chimera_ping (ChimeraState *state, ChimeraHost *host)

## Typedef Documentation

typedef void(* chimera_deliver_upcall_t)(Key *, Message *)

typedef void(* chimera_forward_upcall_t)(Key **, Message **, ChimeraHost **)

typedef void(* chimera_update_upcall_t)(Key *, ChimeraHost *, int)

## Function Documentation

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

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

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_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_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