/home/aaron/olsrd-current/olsrd/src/core/neighbor_table.c File Reference

#include <assert.h>
#include <stdlib.h>
#include "common/avl.h"
#include "avl_olsr_comp.h"
#include "ipcalc.h"
#include "defs.h"
#include "mid_set.h"
#include "neighbor_table.h"
#include "olsr.h"
#include "olsr_timer.h"
#include "olsr_socket.h"
#include "link_set.h"
#include "net_olsr.h"
#include "olsr_logging.h"
Include dependency graph for neighbor_table.c:

Go to the source code of this file.

Functions

static void olsr_expire_nbr_con (void *)
static void internal_delete_nbr_con (struct nbr_con *connector)
void olsr_init_neighbor_table (void)
struct nbr_entryolsr_add_nbr_entry (const union olsr_ip_addr *addr)
void olsr_delete_nbr_entry (struct nbr_entry *nbr)
struct nbr_entryolsr_lookup_nbr_entry (const union olsr_ip_addr *addr, bool lookupalias)
void olsr_update_nbr_status (struct nbr_entry *entry)
struct nbr2_entryolsr_add_nbr2_entry (const union olsr_ip_addr *addr)
void olsr_delete_nbr2_entry (struct nbr2_entry *nbr2)
struct nbr2_entryolsr_lookup_nbr2_entry (const union olsr_ip_addr *addr, bool lookupalias)
struct nbr_conolsr_link_nbr_nbr2 (struct nbr_entry *nbr, const union olsr_ip_addr *nbr2_addr, uint32_t vtime)
void olsr_delete_nbr_con (struct nbr_con *connector)
struct nbr_conolsr_lookup_nbr_con_entry (struct nbr_entry *nbr, const union olsr_ip_addr *nbr2_addr)
struct nbr_conolsr_lookup_nbr2_con_entry (struct nbr2_entry *nbr2, const union olsr_ip_addr *nbr_addr)
void olsr_print_neighbor_table (void)

Variables

struct avl_tree nbr_tree
struct avl_tree nbr2_tree
static struct olsr_memcookie_infonbr2_mem_cookie = NULL
static struct olsr_memcookie_infonbr_mem_cookie = NULL
static struct olsr_memcookie_infonbr_connector_mem_cookie = NULL
static struct olsr_timer_infonbr_connector_timer_info = NULL

Function Documentation

static void internal_delete_nbr_con ( struct nbr_con connector  )  [static]

Deletes a nbr-connector without deleting the 2-hop neighbor

Parameters:
connector the connector between neighbors

Definition at line 395 of file neighbor_table.c.

References avl_delete(), nbr2_entry::con_tree, nbr_entry::con_tree, nbr_con::nbr, nbr_con::nbr2, nbr_con::nbr2_con_timer, nbr_con::nbr2_tree_node, nbr_con::nbr_tree_node, olsr_memcookie_free(), and olsr_timer_stop().

Referenced by olsr_delete_nbr2_entry(), and olsr_delete_nbr_con().

Here is the call graph for this function:

struct nbr2_entry* olsr_add_nbr2_entry ( const union olsr_ip_addr addr  )  [read]

Insert a new entry to the two hop neighbor table.

Parameters:
addr the entry to insert
Returns:
nada

Definition at line 268 of file neighbor_table.c.

References avl_comp_default, avl_init(), avl_insert(), nbr2_entry::con_tree, avl_node::key, LOG_2NEIGH, nbr2_entry::nbr2_addr, nbr2_entry::nbr2_node, nbr2_tree, OLSR_DEBUG, olsr_ip_to_string(), olsr_lookup_nbr2_entry(), and olsr_memcookie_malloc().

Referenced by olsr_link_nbr_nbr2().

Here is the call graph for this function:

struct nbr_entry* olsr_add_nbr_entry ( const union olsr_ip_addr addr  )  [read]

Insert a neighbor entry in the neighbor table.

Parameters:
addr the main address of the new node
Returns:
pointer to an already existting (or new created) neighbor entry

Definition at line 98 of file neighbor_table.c.

References avl_comp_default, avl_init(), avl_insert(), nbr_entry::con_tree, nbr_entry::is_mpr, nbr_entry::is_sym, avl_node::key, nbr_entry::linkcount, LOG_NEIGHTABLE, nbr_entry::nbr_addr, nbr_entry::nbr_node, nbr_tree, tc_edge_entry::neighbor, olsr_add_tc_edge_entry(), OLSR_DEBUG, olsr_ip_to_string(), olsr_lookup_nbr_entry(), olsr_lookup_tc_edge(), olsr_memcookie_malloc(), nbr_entry::tc_edge, tc_myself, nbr_entry::was_mpr, WILL_NEVER, and nbr_entry::willingness.

Referenced by add_link_entry(), and olsr_fixup_mid_main_addr().

Here is the call graph for this function:

void olsr_delete_nbr2_entry ( struct nbr2_entry nbr2  ) 

Delete an entry from the two hop neighbor table.

Parameters:
nbr2 the two hop neighbor to delete.

Definition at line 304 of file neighbor_table.c.

References avl_delete(), changes_neighborhood, internal_delete_nbr_con(), LOG_NEIGHTABLE, nbr2_entry::nbr2_addr, nbr2_entry::nbr2_node, nbr2_tree, OLSR_DEBUG, OLSR_FOR_ALL_NBR2_CON_ENTRIES, olsr_ip_to_string(), and olsr_memcookie_free().

Referenced by olsr_delete_nbr_con(), olsr_flush_nbr2_duplicates(), and olsr_update_nbr_status().

Here is the call graph for this function:

void olsr_delete_nbr_con ( struct nbr_con connector  ) 

Unlinks an one-hop and a 2-hop neighbor.

Parameters:
connector the connector between the neighbors

Definition at line 411 of file neighbor_table.c.

References nbr2_entry::con_tree, avl_tree::count, internal_delete_nbr_con(), nbr_con::nbr2, and olsr_delete_nbr2_entry().

Referenced by olsr_delete_nbr_entry(), and olsr_expire_nbr_con().

Here is the call graph for this function:

void olsr_delete_nbr_entry ( struct nbr_entry nbr  ) 

Delete a neighbor table entry.

Remember: Deleting a neighbor entry results the deletion of its 2 hop neighbors list!!!

Parameters:
addr the neighbor entry to delete

Definition at line 153 of file neighbor_table.c.

References avl_delete(), changes_neighborhood, changes_topology, LOG_NEIGHTABLE, nbr_entry::nbr_addr, nbr_entry::nbr_node, nbr_tree, tc_edge_entry::neighbor, OLSR_DEBUG, olsr_delete_nbr_con(), olsr_delete_tc_edge_entry(), OLSR_FOR_ALL_NBR_CON_ENTRIES, olsr_ip_to_string(), olsr_memcookie_free(), and nbr_entry::tc_edge.

Referenced by olsr_delete_link_entry(), olsr_fixup_mid_main_addr(), and olsr_flush_nbr2_duplicates().

Here is the call graph for this function:

static void olsr_expire_nbr_con ( void *  context  )  [static]

Definition at line 457 of file neighbor_table.c.

References nbr_con::nbr2_con_timer, and olsr_delete_nbr_con().

Referenced by olsr_init_neighbor_table().

Here is the call graph for this function:

void olsr_init_neighbor_table ( void   ) 

Definition at line 77 of file neighbor_table.c.

References avl_comp_default, avl_init(), LOG_NEIGHTABLE, nbr2_tree, nbr_tree, olsr_expire_nbr_con(), OLSR_INFO, olsr_memcookie_add(), and olsr_timer_add().

Referenced by main().

Here is the call graph for this function:

struct nbr_con* olsr_link_nbr_nbr2 ( struct nbr_entry nbr,
const union olsr_ip_addr nbr2_addr,
uint32_t  vtime 
) [read]

Links a one-hop neighbor with a 2-hop neighbor.

Parameters:
nbr the 1-hop neighbor
nbr2 the 2-hop neighbor
vtime validity time of the 2hop neighbor

Definition at line 354 of file neighbor_table.c.

References avl_insert(), nbr2_entry::con_tree, nbr_entry::con_tree, avl_node::key, LINK_COST_BROKEN, nbr_con::nbr, nbr_con::nbr2, nbr2_entry::nbr2_addr, nbr_con::nbr2_con_timer, nbr_con::nbr2_tree_node, nbr_entry::nbr_addr, nbr_con::nbr_tree_node, olsr_add_nbr2_entry(), olsr_lookup_nbr_con_entry(), olsr_memcookie_malloc(), OLSR_NBR2_LIST_JITTER, olsr_timer_change(), olsr_timer_start(), and nbr_con::path_linkcost.

Referenced by process_message_neighbors().

Here is the call graph for this function:

struct nbr_con* olsr_lookup_nbr2_con_entry ( struct nbr2_entry nbr2,
const union olsr_ip_addr nbr_addr 
) [read]

Looks up the connection object of an 2-hop neighbor to an one-hop neighbor ip address.

Parameters:
nbr2 the 2-hop neighbor
nbr_addr the ip of the one-hop neighbor
Returns:
nbr_con, or NULL if not found

Definition at line 447 of file neighbor_table.c.

References avl_find_element, nbr2_entry::con_tree, and nbr_con::nbr2_tree_node.

struct nbr2_entry* olsr_lookup_nbr2_entry ( const union olsr_ip_addr addr,
bool  lookupalias 
) [read]

Definition at line 328 of file neighbor_table.c.

References avl_find_element, nbr2_entry::nbr2_node, nbr2_tree, and olsr_lookup_main_addr_by_alias().

Referenced by olsr_add_nbr2_entry(), olsr_flush_nbr2_duplicates(), and olsr_update_nbr_status().

Here is the call graph for this function:

struct nbr_con* olsr_lookup_nbr_con_entry ( struct nbr_entry nbr,
const union olsr_ip_addr nbr2_addr 
) [read]

Looks up the connection object of an one-hop neighbor to a 2-hop neighbor ip address.

Parameters:
nbr the one-hop neighbor
nbr2_addr the ip of the 2-hop neighbor
Returns:
nbr_con, or NULL if not found

Definition at line 432 of file neighbor_table.c.

References avl_find_element, nbr_entry::con_tree, and nbr_con::nbr_tree_node.

Referenced by olsr_link_nbr_nbr2(), and process_message_neighbors().

struct nbr_entry* olsr_lookup_nbr_entry ( const union olsr_ip_addr addr,
bool  lookupalias 
) [read]

Lookup a neighbor entry in the neighbortable based on an address. Unalias the passed in address before.

Parameters:
addr the IP address of the neighbor to look up
Returns:
a pointer to the neighbor struct registered on the given address. NULL if not found.

Definition at line 197 of file neighbor_table.c.

References avl_find_element, nbr_entry::nbr_node, nbr_tree, and olsr_lookup_main_addr_by_alias().

Referenced by add_link_entry(), get_best_link_to_neighbor_ip(), isMprOfAddress(), olsr_add_nbr_entry(), olsr_calculate_lq_mpr2(), olsr_fixup_mid_main_addr(), olsr_flush_nbr2_duplicates(), and olsr_forward_message().

Here is the call graph for this function:

void olsr_print_neighbor_table ( void   ) 
void olsr_update_nbr_status ( struct nbr_entry entry  ) 

Variable Documentation

struct olsr_memcookie_info* nbr2_mem_cookie = NULL [static]

Definition at line 63 of file neighbor_table.c.

Definition at line 65 of file neighbor_table.c.

struct olsr_timer_info* nbr_connector_timer_info = NULL [static]

Definition at line 68 of file neighbor_table.c.

struct olsr_memcookie_info* nbr_mem_cookie = NULL [static]

Definition at line 64 of file neighbor_table.c.

Generated on Wed Jun 19 06:00:05 2013 for olsrd by  doxygen 1.6.3