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

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

Go to the source code of this file.

Functions

static struct mid_entryolsr_lookup_mid_entry (const union olsr_ip_addr *)
static void olsr_expire_mid_entries (void *context)
void olsr_init_mid_set (void)
static void olsr_set_mid_timer (struct mid_entry *mid, uint32_t rel_timer)
static void olsr_flush_tc_duplicates (struct mid_entry *alias)
static void olsr_flush_nbr2_duplicates (struct tc_entry *tc)
static void olsr_fixup_mid_main_addr (const union olsr_ip_addr *main_addr, const union olsr_ip_addr *alias_addr)
static struct mid_entryolsr_insert_mid_entry (const union olsr_ip_addr *main_addr, const union olsr_ip_addr *alias_addr, uint32_t vtime)
static void olsr_update_mid_entry (const union olsr_ip_addr *main_addr, const union olsr_ip_addr *alias_addr, uint32_t vtime)
struct mid_entryolsr_lookup_tc_mid_entry (struct tc_entry *tc, const union olsr_ip_addr *adr)
union olsr_ip_addrolsr_lookup_main_addr_by_alias (const union olsr_ip_addr *adr)
void olsr_delete_mid_entry (struct mid_entry *alias)
void olsr_flush_mid_entries (struct tc_entry *tc)
void olsr_print_mid_set (void)
void olsr_input_mid (struct olsr_message *msg, struct interface *input_if __attribute__((unused)), union olsr_ip_addr *from_addr, enum duplicate_status status)
void generate_mid (void *p __attribute__((unused)))

Variables

struct avl_tree mid_tree
static struct olsr_memcookie_infomid_address_mem_cookie = NULL
static struct olsr_timer_infomid_validity_timer_info = NULL

Function Documentation

void generate_mid ( void *p   __attribute__(unused)  ) 
void olsr_delete_mid_entry ( struct mid_entry alias  ) 
static void olsr_expire_mid_entries ( void *  context  )  [static]

Wrapper for the timer callback.

Definition at line 93 of file mid_set.c.

References LOG_MID, mid_entry::mid_alias_addr, OLSR_DEBUG, olsr_delete_mid_entry(), and olsr_ip_to_string().

Referenced by olsr_init_mid_set().

Here is the call graph for this function:

static void olsr_fixup_mid_main_addr ( const union olsr_ip_addr main_addr,
const union olsr_ip_addr alias_addr 
) [static]

If we have an entry for this alias in neighbortable, we better adjust it's main address, because otherwise a fatal inconsistency between neighbortable and link_set will be created by way of this mid entry.

Definition at line 182 of file mid_set.c.

References LOG_MID, mid_entry::mid_tc, olsr_add_nbr_entry(), OLSR_DEBUG, olsr_delete_nbr_entry(), olsr_flush_mid_entries(), olsr_ip_to_string(), olsr_lookup_mid_entry(), olsr_lookup_nbr_entry(), and replace_neighbor_link_set().

Referenced by olsr_update_mid_entry().

Here is the call graph for this function:

void olsr_flush_mid_entries ( struct tc_entry tc  ) 

Delete all the MID aliases hanging off a tc entry.

Parameters:
entry the tc entry holding the aliases.

Definition at line 407 of file mid_set.c.

References olsr_delete_mid_entry(), and OLSR_FOR_ALL_TC_MID_ENTRIES.

Referenced by olsr_delete_tc_entry(), and olsr_fixup_mid_main_addr().

Here is the call graph for this function:

static void olsr_flush_nbr2_duplicates ( struct tc_entry tc  )  [static]

Delete possible duplicate entries in 2 hop set and delete duplicate neighbor entries. Redirect link entries to the correct neighbor entry. This optimization is not specified in rfc3626.

Definition at line 137 of file mid_set.c.

References tc_entry::addr, changes_neighborhood, LOG_MID, mid_entry::mid_alias_addr, OLSR_DEBUG, olsr_delete_nbr2_entry(), olsr_delete_nbr_entry(), OLSR_FOR_ALL_TC_MID_ENTRIES, olsr_ip_to_string(), olsr_lookup_nbr2_entry(), olsr_lookup_nbr_entry(), and replace_neighbor_link_set().

Referenced by olsr_update_mid_entry().

Here is the call graph for this function:

static void olsr_flush_tc_duplicates ( struct mid_entry alias  )  [static]

Delete possible duplicate entries in tc set. This optimization is not specified in rfc3626.

Definition at line 122 of file mid_set.c.

References mid_entry::mid_alias_addr, olsr_delete_tc_entry(), and olsr_lookup_tc_entry().

Referenced by olsr_update_mid_entry().

Here is the call graph for this function:

void olsr_init_mid_set ( void   ) 

Initialize the MID set

Definition at line 75 of file mid_set.c.

References avl_comp_default, avl_init(), LOG_MID, mid_tree, olsr_expire_mid_entries(), OLSR_INFO, olsr_memcookie_add(), and olsr_timer_add().

Referenced by main().

Here is the call graph for this function:

void olsr_input_mid ( struct olsr_message msg,
struct interface *input_if   __attribute__(unused),
union olsr_ip_addr from_addr,
enum duplicate_status  status 
)
static struct mid_entry* olsr_insert_mid_entry ( const union olsr_ip_addr main_addr,
const union olsr_ip_addr alias_addr,
uint32_t  vtime 
) [static, read]

Insert a fresh alias address for a node.

Parameters:
main_add the main address of the node
alias the alias address to insert
vtime the validity time
seq the sequence number to register a new node with

Definition at line 230 of file mid_set.c.

References avl_insert(), olsr_config::ipsize, avl_node::key, LOG_MID, mid_entry::mid_alias_addr, mid_entry::mid_node, mid_entry::mid_tc, mid_entry::mid_tc_node, mid_tree, tc_entry::mid_tree, olsr_cnf, OLSR_DEBUG, olsr_insert_routing_table(), olsr_ip_to_string(), olsr_locate_tc_entry(), olsr_memcookie_malloc(), OLSR_RT_ORIGIN_MID, and olsr_set_mid_timer().

Referenced by olsr_update_mid_entry().

Here is the call graph for this function:

union olsr_ip_addr* olsr_lookup_main_addr_by_alias ( const union olsr_ip_addr adr  )  [write]

Lookup the main address for an MID alias address

Parameters:
adr the alias address to check
Returns:
the main address registered on the alias or NULL if not found

Definition at line 358 of file mid_set.c.

References tc_entry::addr, mid_entry::mid_tc, and olsr_lookup_mid_entry().

Referenced by lq_etxff_packet_parser(), MainAddressOf(), olsr_forward_message(), olsr_lookup_nbr2_entry(), olsr_lookup_nbr_entry(), and process_message_neighbors().

Here is the call graph for this function:

static struct mid_entry * olsr_lookup_mid_entry ( const union olsr_ip_addr adr  )  [static, read]

Lookup an MID alias by address in the global tree.

Parameters:
adr the alias address to check
Returns:
the MID address entry or NULL if not found

Definition at line 343 of file mid_set.c.

References avl_find_element, mid_entry::mid_node, and mid_tree.

Referenced by olsr_fixup_mid_main_addr(), olsr_lookup_main_addr_by_alias(), and olsr_update_mid_entry().

struct mid_entry* olsr_lookup_tc_mid_entry ( struct tc_entry tc,
const union olsr_ip_addr adr 
) [read]

Lookup a MID alias hanging off a tc_entry by address

Parameters:
adr the alias address to check
Returns:
the MID address entry or NULL if not found

Definition at line 329 of file mid_set.c.

References avl_find_element, mid_entry::mid_tc_node, and tc_entry::mid_tree.

void olsr_print_mid_set ( void   ) 

Print all MID entries For debuging purposes

Definition at line 420 of file mid_set.c.

References tc_entry::addr, LOG_MID, mid_entry::mid_alias_addr, olsr_clock_getWallclockString(), OLSR_FOR_ALL_TC_ENTRIES, OLSR_FOR_ALL_TC_MID_ENTRIES, OLSR_INFO, OLSR_INFO_NH, and olsr_ip_to_string().

Referenced by olsr_process_changes().

Here is the call graph for this function:

static void olsr_set_mid_timer ( struct mid_entry mid,
uint32_t  rel_timer 
) [static]

Set the mid set expiration timer.

all timer setting shall be done using this function. The timer param is a relative timer expressed in milliseconds.

Definition at line 112 of file mid_set.c.

References mid_entry::mid_timer, OLSR_MID_JITTER, and olsr_timer_set().

Referenced by olsr_insert_mid_entry(), and olsr_update_mid_entry().

Here is the call graph for this function:

static void olsr_update_mid_entry ( const union olsr_ip_addr main_addr,
const union olsr_ip_addr alias_addr,
uint32_t  vtime 
) [static]

Update an alias address for a node. If the main address is not registered then a new entry is created.

Parameters:
main_add the main address of the node
alias the alias address to insert
vtime the validity time
seq the sequence number to register a new node with

Definition at line 284 of file mid_set.c.

References changes_neighborhood, changes_topology, mid_entry::mid_tc, olsr_fixup_mid_main_addr(), olsr_flush_nbr2_duplicates(), olsr_flush_tc_duplicates(), olsr_insert_mid_entry(), olsr_lookup_mid_entry(), olsr_set_mid_timer(), and olsr_validate_address().

Referenced by olsr_input_mid().

Here is the call graph for this function:


Variable Documentation

Definition at line 68 of file mid_set.c.

struct olsr_timer_info* mid_validity_timer_info = NULL [static]

Definition at line 69 of file mid_set.c.

Generated on Sat May 25 06:00:05 2013 for olsrd by  doxygen 1.6.3