Chimera: chimera_0-9/src/route.c File Reference

- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# route.c File Reference

`#include <stdio.h>`
`#include <string.h>`
`#include <pthread.h>`
`#include <stdlib.h>`
`#include "route.h"`
`#include "host.h"`
`#include "jrb.h"`
`#include "jval.h"`
`#include "log.h"`

## Functions
void | leafset_update (ChimeraState *state, ChimeraHost *host, int joined, ChimeraHost **deleted, ChimeraHost **added)
int | leafset_size (ChimeraHost **arr)
void | leafset_range_update (RouteGlobal *routglob, Key *rrange, Key *lrange)
void | leafset_insert (ChimeraState *state, ChimeraHost *host, int right_or_left, ChimeraHost **deleted, ChimeraHost **added)
void | leafset_delete (ChimeraState *state, ChimeraHost *host, int right_or_left, ChimeraHost **deleted)
void | leafset_print (ChimeraState *state)
void | sort_hosts (void *logs, ChimeraHost **hosts, Key key, int size)
void | sort_hosts_key (void *logs, ChimeraHost **hosts, Key key, int size)
int | power (int base, int n)
int | hexalpha_to_int (int c)
void | route_keyupdate (void *routeglob, ChimeraHost *me)
void * | route_init (ChimeraHost *me)
ChimeraHost ** | route_get_table (ChimeraState *state)
ChimeraHost ** | route_row_lookup (ChimeraState *state, Key key)
ChimeraHost ** | route_lookup (ChimeraState *state, Key key, int count, int is_safe)
void | chimera_update_upcall (ChimeraState *state, Key *k, ChimeraHost *h, int joined)
ChimeraHost ** | route_neighbors (ChimeraState *state, int count)
void | route_update (ChimeraState *state, ChimeraHost *host, int joined)
void | gethostinfo (ChimeraHost *CHost)
void | printTable (ChimeraState *state)

## Function Documentation

void chimera_update_upcall | ( | ChimeraState * | state,
|  | Key * | k,
|  | ChimeraHost * | h,
|  | int | joined
| ) |

void gethostinfo | ( | ChimeraHost * | CHost | ) |

int hexalpha_to_int | ( | int | c | ) |

void leafset_delete | ( | ChimeraState * | state,
|  | ChimeraHost * | host,
|  | int | right_or_left,
|  | ChimeraHost ** | deleted
| ) |

void leafset_insert | ( | ChimeraState * | state,
|  | ChimeraHost * | host,
|  | int | right_or_left,
|  | ChimeraHost ** | deleted,
|  | ChimeraHost ** | added
| ) |

void leafset_print | ( | ChimeraState * | state | ) |

void leafset_range_update | ( | RouteGlobal * | routglob,
|  | Key * | rrange,
|  | Key * | lrange
| ) |

int leafset_size | ( | ChimeraHost ** | arr | ) |

void leafset_update | ( | ChimeraState * | state,
|  | ChimeraHost * | host,
|  | int | joined,
|  | ChimeraHost ** | deleted,
|  | ChimeraHost ** | added
| ) |

int power | ( | int | base,
|  | int | n
| ) |

void printTable | ( | ChimeraState * | state | ) |

| prints routing table,

ChimeraHost** route_get_table | ( | ChimeraState * | state | ) |

| route_get_table: returns all the entries in the routing table in an array of ChimeraHost.

void* route_init | ( | ChimeraHost * | me | ) |

| route_init: Ininitiates routing table and leafsets

void route_keyupdate | ( | void * | routeglob,
|  | ChimeraHost * | me
| ) |

ChimeraHost** route_lookup | ( | ChimeraState * | state,
|  | Key | key,
|  | int | count,
|  | int | is_safe
| ) |

| route_lookup: returns an array of count# nodes that are acceptable next hops for a message being routed to key#. is_save# is ignored for now.

ChimeraHost** route_neighbors | ( | ChimeraState * | state,
|  | int | count
| ) |

| route_neighbors: returns an array of count# neighbor nodes with priority to closer nodes

ChimeraHost** route_row_lookup | ( | ChimeraState * | state,
|  | Key | key
| ) |

| route_row_lookup:key return the row in the routing table that matches the longest prefix with key#

void route_update | ( | ChimeraState * | state,
|  | ChimeraHost * | host,
|  | int | joined
| ) |

| route_update: updated the routing table in regard to host#. If the host is joining the network (and joined# == 1), then it is added to the routing table if it is appropriate. If it is leaving the network (and joined# == 0), then it is removed from the routing tables

void sort_hosts | ( | void * | logs,
|  | ChimeraHost ** | hosts,
|  | Key | key,
|  | int | size
| ) |

| sort_hosts: Sorts hosts# based on common prefix match and key distance from Key#

void sort_hosts_key | ( | void * | logs,
|  | ChimeraHost ** | hosts,
|  | Key | key,
|  | int | size
| ) |

| sort_hosts_key: Sorts hosts# based on their key distance from Key#, closest node first