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

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "common/avl.h"
#include "avl_olsr_comp.h"
#include "tc_set.h"
#include "olsr.h"
#include "lq_packet.h"
#include "net_olsr.h"
#include "link_set.h"
#include "mid_set.h"
#include "neighbor_table.h"
#include "olsr_logging.h"
Include dependency graph for tc_set.c:

Go to the source code of this file.

Functions

static bool delete_outdated_tc_edges (struct tc_entry *)
static void olsr_expire_tc_entry (void *context)
static void olsr_expire_tc_edge_gc (void *context)
static struct tc_entryolsr_add_tc_entry (const union olsr_ip_addr *adr)
void olsr_init_tc (void)
void olsr_change_myself_tc (void)
void olsr_delete_tc_entry (struct tc_entry *tc)
struct tc_entryolsr_lookup_tc_entry (const union olsr_ip_addr *adr)
struct tc_entryolsr_locate_tc_entry (const union olsr_ip_addr *adr)
static char * olsr_tc_edge_to_string (struct tc_edge_entry *tc_edge)
struct tc_edge_entryolsr_add_tc_edge_entry (struct tc_entry *tc, const union olsr_ip_addr *addr, uint16_t ansn)
static void internal_delete_tc_edge_entry (struct tc_edge_entry *tc_edge)
void olsr_delete_tc_edge_entry (struct tc_edge_entry *tc_edge)
static int olsr_delete_revoked_tc_edges (struct tc_entry *tc, uint16_t ansn, union olsr_ip_addr *lower_border, union olsr_ip_addr *upper_border)
static int olsr_tc_update_edge (struct tc_entry *tc, uint16_t ansn, const unsigned char **curr, union olsr_ip_addr *neighbor)
struct tc_edge_entryolsr_lookup_tc_edge (struct tc_entry *tc, const union olsr_ip_addr *edge_addr)
void olsr_print_tc_table (void)
static int olsr_calculate_tc_border (uint8_t lower_border, union olsr_ip_addr *lower_border_ip, uint8_t upper_border, union olsr_ip_addr *upper_border_ip)
void olsr_input_tc (struct olsr_message *msg, struct interface *input_if __attribute__((unused)), union olsr_ip_addr *from_addr, enum duplicate_status status)
uint32_t getRelevantTcCount (void)
void olsr_delete_all_tc_entries (void)
static uint8_t calculate_border_flag (void *lower_border, void *higher_border)
uint16_t get_local_ansn_number (void)
void increase_local_ansn_number (void)
static bool olsr_output_lq_tc_internal (void *ctx __attribute__((unused)), union olsr_ip_addr *nextIp, bool skip)
void olsr_output_lq_tc (void *ctx)

Variables

struct avl_tree tc_tree
struct tc_entrytc_myself = NULL
struct olsr_memcookie_infotc_mem_cookie = NULL
static struct olsr_timer_infotc_edge_gc_timer_info = NULL
static struct olsr_timer_infotc_validity_timer_info = NULL
static uint32_t relevantTcCount = 0
static int ttl_index = -32
static uint16_t local_ansn_number = 0

Function Documentation

static uint8_t calculate_border_flag ( void *  lower_border,
void *  higher_border 
) [static]

Definition at line 911 of file tc_set.c.

References olsr_config::ipsize, and olsr_cnf.

Referenced by olsr_output_lq_tc_internal().

static bool delete_outdated_tc_edges ( struct tc_entry tc  )  [static]

Delete all destinations that have a lower ANSN.

Parameters:
tc the entry to delete edges from
Returns:
TRUE if any destinations were deleted, FALSE if not

Definition at line 508 of file tc_set.c.

References tc_edge_entry::ansn, tc_entry::ansn, changes_topology, LOG_TC, OLSR_DEBUG, olsr_delete_tc_edge_entry(), OLSR_FOR_ALL_TC_EDGE_ENTRIES, and SEQNO_GREATER_THAN.

Referenced by olsr_expire_tc_edge_gc().

Here is the call graph for this function:

uint16_t get_local_ansn_number ( void   ) 

Definition at line 940 of file tc_set.c.

References local_ansn_number.

Referenced by olsr_output_lq_tc_internal().

uint32_t getRelevantTcCount ( void   ) 

Definition at line 878 of file tc_set.c.

References relevantTcCount.

void increase_local_ansn_number ( void   ) 

Definition at line 945 of file tc_set.c.

References local_ansn_number.

Referenced by olsr_process_changes().

static void internal_delete_tc_edge_entry ( struct tc_edge_entry tc_edge  )  [static]
struct tc_edge_entry* olsr_add_tc_edge_entry ( struct tc_entry tc,
const union olsr_ip_addr addr,
uint16_t  ansn 
) [read]
static struct tc_entry* olsr_add_tc_entry ( const union olsr_ip_addr adr  )  [static, read]
static int olsr_calculate_tc_border ( uint8_t  lower_border,
union olsr_ip_addr lower_border_ip,
uint8_t  upper_border,
union olsr_ip_addr upper_border_ip 
) [static]

Definition at line 714 of file tc_set.c.

References olsr_config::ipsize, olsr_cnf, in6_addr::s6_addr, and olsr_ip_addr::v6.

Referenced by olsr_input_tc().

void olsr_change_myself_tc ( void   ) 

The main ip address has changed. Do the needful.

check if a main ip change destroyed our TC entries

Definition at line 164 of file tc_set.c.

References tc_entry::addr, changes_topology, nbr_entry::nbr_addr, tc_edge_entry::neighbor, olsr_add_tc_edge_entry(), olsr_add_tc_entry(), olsr_cnf, olsr_delete_tc_edge_entry(), olsr_delete_tc_entry(), OLSR_FOR_ALL_NBR_ENTRIES, olsr_ipcmp(), olsr_config::router_id, and nbr_entry::tc_edge.

Referenced by add_interface(), and olsr_calculate_routing_table().

Here is the call graph for this function:

void olsr_delete_all_tc_entries ( void   ) 
static int olsr_delete_revoked_tc_edges ( struct tc_entry tc,
uint16_t  ansn,
union olsr_ip_addr lower_border,
union olsr_ip_addr upper_border 
) [static]

Delete all destinations that are inside the borders but not updated in the last tc.

Parameters:
tc the entry to delete edges from
ansn the advertised neighbor set sequence number
Returns:
1 if any destinations were deleted 0 if not

Definition at line 536 of file tc_set.c.

References tc_edge_entry::ansn, avl_comp_default, changes_topology, tc_edge_entry::common_cost, tc_edge_entry::cost, tc_edge_entry::edge_inv, LINK_COST_BROKEN, LOG_TC, OLSR_DEBUG, olsr_delete_tc_edge_entry(), OLSR_FOR_ALL_TC_EDGE_ENTRIES, SEQNO_GREATER_THAN, and tc_edge_entry::T_dest_addr.

Referenced by olsr_input_tc().

Here is the call graph for this function:

void olsr_delete_tc_edge_entry ( struct tc_edge_entry tc_edge  ) 

Delete a TC edge entry.

Parameters:
tc the TC entry
tc_edge the TC edge entry
Returns:
true if the tc entry was deleted, false otherwise

Definition at line 460 of file tc_set.c.

References changes_topology, tc_edge_entry::edge_inv, internal_delete_tc_edge_entry(), LOG_TC, tc_edge_entry::neighbor, OLSR_DEBUG, olsr_tc_edge_to_string(), olsr_timer_set(), tc_edge_entry::tc, tc_entry::validity_timer, tc_entry::virtual, and tc_edge_entry::virtual.

Referenced by delete_outdated_tc_edges(), olsr_change_myself_tc(), olsr_delete_nbr_entry(), olsr_delete_revoked_tc_edges(), and olsr_delete_tc_entry().

Here is the call graph for this function:

void olsr_delete_tc_entry ( struct tc_entry tc  ) 
static void olsr_expire_tc_edge_gc ( void *  context  )  [static]

Wrapper for the timer callback. Does the garbage collection of older ansn entries after no edge addition to the TC entry has happened for OLSR_TC_EDGE_GC_TIME.

Definition at line 345 of file tc_set.c.

References tc_entry::addr, changes_topology, delete_outdated_tc_edges(), tc_entry::edge_gc_timer, LOG_TC, OLSR_DEBUG, and olsr_ip_to_string().

Referenced by olsr_init_tc().

Here is the call graph for this function:

static void olsr_expire_tc_entry ( void *  context  )  [static]

Wrapper for the timer callback. A TC entry has not been refreshed in time. Remove it from the link-state database.

Definition at line 324 of file tc_set.c.

References tc_entry::addr, changes_topology, LOG_TC, OLSR_DEBUG, olsr_delete_tc_entry(), olsr_ip_to_string(), and tc_entry::validity_timer.

Referenced by olsr_init_tc().

Here is the call graph for this function:

void olsr_init_tc ( void   ) 

Initialize the topology set

Definition at line 141 of file tc_set.c.

References avl_comp_default, avl_init(), local_ansn_number, LOG_TC, olsr_expire_tc_edge_gc(), olsr_expire_tc_entry(), OLSR_INFO, olsr_memcookie_add(), olsr_timer_add(), random(), and tc_tree.

Referenced by main().

Here is the call graph for this function:

void olsr_input_tc ( struct olsr_message msg,
struct interface *input_if   __attribute__(unused),
union olsr_ip_addr from_addr,
enum duplicate_status  status 
)
struct tc_entry* olsr_locate_tc_entry ( const union olsr_ip_addr adr  )  [read]

Definition at line 290 of file tc_set.c.

References olsr_add_tc_entry(), and olsr_lookup_tc_entry().

Referenced by olsr_input_hna(), olsr_input_mid(), olsr_insert_mid_entry(), olsr_insert_routing_table(), and olsr_update_hna_entry().

Here is the call graph for this function:

struct tc_edge_entry* olsr_lookup_tc_edge ( struct tc_entry tc,
const union olsr_ip_addr edge_addr 
) [read]

Lookup an edge hanging off a TC entry.

Parameters:
entry the entry to check
dst_addr the destination address to check for
Returns:
a pointer to the tc_edge found - or NULL

Definition at line 645 of file tc_set.c.

References avl_find_element, tc_edge_entry::edge_node, and tc_entry::edge_tree.

Referenced by FindNeighbors(), olsr_add_nbr_entry(), olsr_add_tc_edge_entry(), and olsr_tc_update_edge().

struct tc_entry* olsr_lookup_tc_entry ( const union olsr_ip_addr adr  )  [read]

Look up a entry from the TC tree based on address

Parameters:
adr the address to look for
Returns:
the entry found or NULL

Definition at line 278 of file tc_set.c.

References avl_find_element, tc_tree, and tc_entry::vertex_node.

Referenced by FindNeighbors(), olsr_add_tc_edge_entry(), olsr_delete_routing_table(), olsr_flush_tc_duplicates(), olsr_input_tc(), olsr_locate_tc_entry(), and write_hosts_file().

void olsr_output_lq_tc ( void *  ctx  ) 

Definition at line 1089 of file tc_set.c.

References olsr_output_lq_tc_internal().

Referenced by main().

Here is the call graph for this function:

static bool olsr_output_lq_tc_internal ( void *ctx   __attribute__(unused),
union olsr_ip_addr nextIp,
bool  skip 
) [static]
void olsr_print_tc_table ( void   ) 
static char* olsr_tc_edge_to_string ( struct tc_edge_entry tc_edge  )  [static]

Format tc_edge contents into a buffer.

Definition at line 302 of file tc_set.c.

References tc_entry::addr, tc_edge_entry::ansn, tc_edge_entry::cost, LQTEXT_MAXLENGTH, olsr_get_linkcost_text(), olsr_ip_to_string(), tc_edge_entry::T_dest_addr, and tc_edge_entry::tc.

Referenced by olsr_add_tc_edge_entry(), olsr_delete_tc_edge_entry(), and olsr_tc_update_edge().

Here is the call graph for this function:

static int olsr_tc_update_edge ( struct tc_entry tc,
uint16_t  ansn,
const unsigned char **  curr,
union olsr_ip_addr neighbor 
) [static]

Update an edge registered on an entry. Creates new edge-entries if not registered. Bases update on a received TC message

Parameters:
entry the TC entry to check the TC edge entry in the packet
Returns:
1 if entries are added 0 if not

Definition at line 583 of file tc_set.c.

References tc_edge_entry::ansn, tc_edge_entry::common_cost, tc_edge_entry::cost, tc_edge_entry::edge_inv, LOG_TC, olsr_add_tc_edge_entry(), olsr_calc_tc_cost(), OLSR_DEBUG, olsr_deserialize_tc_lq_pair(), olsr_lookup_tc_edge(), olsr_tc_edge_to_string(), olsr_validate_address(), pkt_get_ipaddress(), tc_entry::virtual, and tc_edge_entry::virtual.

Referenced by olsr_input_tc().

Here is the call graph for this function:


Variable Documentation

uint16_t local_ansn_number = 0 [static]

Definition at line 78 of file tc_set.c.

Referenced by get_local_ansn_number(), increase_local_ansn_number(), and olsr_init_tc().

uint32_t relevantTcCount = 0 [static]

Definition at line 73 of file tc_set.c.

Referenced by getRelevantTcCount(), and olsr_input_tc().

struct olsr_timer_info* tc_edge_gc_timer_info = NULL [static]

Definition at line 70 of file tc_set.c.

Definition at line 69 of file tc_set.c.

struct tc_entry* tc_myself = NULL

Definition at line 66 of file tc_set.c.

Referenced by olsr_add_nbr_entry(), and olsr_calculate_routing_table().

struct avl_tree tc_tree
struct olsr_timer_info* tc_validity_timer_info = NULL [static]

Definition at line 71 of file tc_set.c.

int ttl_index = -32 [static]

Definition at line 76 of file tc_set.c.

Referenced by olsr_output_lq_tc_internal().

Generated on Sun May 26 06:00:53 2013 for olsrd by  doxygen 1.6.3