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

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

Go to the source code of this file.

Functions

static void olsr_expire_link_entry (void *context)
static void olsr_expire_link_loss_timer (void *context)
static void olsr_expire_link_sym_timer (void *context)
void signal_link_changes (bool val)
static int check_link_status (const struct lq_hello_message *message, const struct interface *in_if)
static struct link_entryadd_link_entry (const union olsr_ip_addr *, const union olsr_ip_addr *, union olsr_ip_addr *, uint32_t, uint32_t, struct interface *)
void olsr_init_link_set (void)
int lookup_link_status (const struct link_entry *entry)
struct link_entryget_best_link_to_neighbor_ip (const union olsr_ip_addr *remote)
struct link_entryget_best_link_to_neighbor (struct nbr_entry *nbr)
static void set_loss_link_multiplier (struct link_entry *entry)
static void olsr_delete_link_entry (struct link_entry *link)
void olsr_delete_link_entry_by_if (const struct interface *ifp)
void olsr_expire_link_hello_timer (void *context)
static void olsr_set_link_timer (struct link_entry *link, unsigned int rel_timer)
int check_neighbor_link (const union olsr_ip_addr *int_addr)
struct link_entrylookup_link_entry (const union olsr_ip_addr *remote, const union olsr_ip_addr *remote_main, const struct interface *local)
struct link_entryupdate_link_entry (const union olsr_ip_addr *local, const union olsr_ip_addr *remote, struct lq_hello_message *message, struct interface *in_if)
int replace_neighbor_link_set (const struct nbr_entry *old, struct nbr_entry *new)
void olsr_print_link_set (void)
void olsr_update_packet_loss_hello_int (struct link_entry *entry, uint32_t loss_hello_int)
void olsr_update_packet_loss (struct link_entry *entry)
void generate_hello (void *p)

Variables

struct list_entity link_entry_head
static struct olsr_timer_infolink_dead_timer_info = NULL
static struct olsr_timer_infolink_loss_timer_info = NULL
static struct olsr_timer_infolink_sym_timer_info = NULL
bool link_changes

Function Documentation

static struct link_entry * add_link_entry ( const union olsr_ip_addr local,
const union olsr_ip_addr remote,
union olsr_ip_addr remote_main,
uint32_t  vtime,
uint32_t  htime,
struct interface local_if 
) [static, read]

Nothing mysterious here. Adding a new link entry to the link set.

Parameters:
local the local IP address
remote the remote IP address
remote_main the remote nodes main address
vtime the validity time of the entry
htime the HELLO interval of the remote node
local_if the local interface
Returns:
the new (or already existing) link_entry

Definition at line 364 of file link_set.c.

References ASYM_LINK, changes_neighborhood, interface::int_name, olsr_config::ipsize, LINK_COST_BROKEN, link_entry_head, nbr_entry::linkcount, list_add_before(), lock_interface(), LOG_LINKS, lookup_link_entry(), olsr_add_nbr_entry(), olsr_cnf, OLSR_DEBUG, olsr_insert_routing_table(), olsr_ip_to_string(), OLSR_LINK_LOSS_JITTER, olsr_lookup_nbr_entry(), olsr_malloc_link_entry(), OLSR_RT_ORIGIN_LINK, olsr_set_link_timer(), olsr_timer_set(), set_loss_link_multiplier(), and nbr_entry::tc_edge.

Referenced by update_link_entry().

Here is the call graph for this function:

static int check_link_status ( const struct lq_hello_message message,
const struct interface in_if 
) [static]

Checks the link status to a neighbor by looking in a received HELLO message.

Parameters:
message the HELLO message to check
Returns:
the link status

Definition at line 604 of file link_set.c.

References lq_hello_neighbor::addr, interface::ip_addr, lq_hello_neighbor::link_type, lq_hello_message::neigh, lq_hello_neighbor::next, olsr_ipcmp(), SYM_LINK, and UNSPEC_LINK.

Referenced by update_link_entry().

Here is the call graph for this function:

int check_neighbor_link ( const union olsr_ip_addr int_addr  ) 

Lookup the status of a link.

Parameters:
int_addr address of the remote interface
Returns:
1 of the link is symmertic 0 if not

Definition at line 463 of file link_set.c.

References lookup_link_status(), link_entry::neighbor_iface_addr, OLSR_FOR_ALL_LINK_ENTRIES, olsr_ipcmp(), and UNSPEC_LINK.

Referenced by olsr_input_hna(), olsr_input_mid(), olsr_input_tc(), and olsr_parser().

Here is the call graph for this function:

void generate_hello ( void *  p  ) 
struct link_entry* get_best_link_to_neighbor ( struct nbr_entry nbr  )  [read]
struct link_entry* get_best_link_to_neighbor_ip ( const union olsr_ip_addr remote  )  [read]

Find best link to a neighbor

Definition at line 131 of file link_set.c.

References get_best_link_to_neighbor(), and olsr_lookup_nbr_entry().

Referenced by BmfPacketCaptured(), FindNeighbors(), ipc_print_neigh_link(), olsr_output_lq_tc_internal(), and olsr_print_neighbor_table().

Here is the call graph for this function:

struct link_entry* lookup_link_entry ( const union olsr_ip_addr remote,
const union olsr_ip_addr remote_main,
const struct interface local 
) [read]

Lookup a link entry

Parameters:
remote the remote interface address
remote_main the remote nodes main address
local the local interface address
Returns:
the link entry if found, NULL if not

Definition at line 485 of file link_set.c.

References link_entry::if_name, interface::int_name, interface::ip_addr, link_entry::local_iface_addr, LOG_LINKS, nbr_entry::nbr_addr, link_entry::neighbor, link_entry::neighbor_iface_addr, OLSR_DEBUG, OLSR_FOR_ALL_LINK_ENTRIES, olsr_ip_to_string(), and olsr_ipcmp().

Referenced by add_link_entry(), and lq_etxff_packet_parser().

Here is the call graph for this function:

int lookup_link_status ( const struct link_entry entry  ) 

Get the status of a link. The status is based upon different timeouts in the link entry.

Parameters:
remote address of the remote interface
Returns:
the link status of the link

Definition at line 110 of file link_set.c.

References ASYM_LINK, link_entry::ASYM_time, link_entry_head, link_entry::link_sym_timer, list_is_empty(), LOST_LINK, olsr_clock_isPast(), SYM_LINK, and UNSPEC_LINK.

Referenced by check_neighbor_link(), generate_hello(), get_best_link_to_neighbor(), olsr_expire_link_sym_timer(), and olsr_update_nbr_status().

Here is the call graph for this function:

static void olsr_delete_link_entry ( struct link_entry link  )  [static]
void olsr_delete_link_entry_by_if ( const struct interface ifp  ) 

Delete all link entries matching a given interface id

Definition at line 260 of file link_set.c.

References interface::int_name, link_entry::inter, LOG_LINKS, link_entry::neighbor_iface_addr, OLSR_DEBUG, olsr_delete_link_entry(), OLSR_FOR_ALL_LINK_ENTRIES, and olsr_ip_to_string().

Referenced by remove_interface().

Here is the call graph for this function:

static void olsr_expire_link_entry ( void *  context  )  [static]

Callback for the link timer.

Definition at line 331 of file link_set.c.

References link_entry::link_timer, and olsr_delete_link_entry().

Referenced by olsr_init_link_set().

Here is the call graph for this function:

void olsr_expire_link_hello_timer ( void *  context  ) 

Callback for the link_hello timer.

Definition at line 317 of file link_set.c.

References link_entry::neighbor, and olsr_update_nbr_status().

Here is the call graph for this function:

static void olsr_expire_link_loss_timer ( void *  context  )  [static]

Callback for the link loss timer.

Definition at line 280 of file link_set.c.

References link_entry::link_loss_timer, link_entry::loss_helloint, OLSR_LINK_LOSS_JITTER, olsr_lq_hello_handler(), and olsr_timer_change().

Referenced by olsr_init_link_set().

Here is the call graph for this function:

static void olsr_expire_link_sym_timer ( void *  context  )  [static]

Callback for the link SYM timer.

Definition at line 297 of file link_set.c.

References changes_neighborhood, link_entry::link_sym_timer, lookup_link_status(), link_entry::neighbor, olsr_update_nbr_status(), link_entry::status, and SYM_LINK.

Referenced by olsr_init_link_set().

Here is the call graph for this function:

void olsr_init_link_set ( void   ) 

Definition at line 88 of file link_set.c.

References link_entry_head, list_init_head(), LOG_LINKS, olsr_expire_link_entry(), olsr_expire_link_loss_timer(), olsr_expire_link_sym_timer(), OLSR_INFO, and olsr_timer_add().

Referenced by main().

Here is the call graph for this function:

void olsr_print_link_set ( void   ) 
static void olsr_set_link_timer ( struct link_entry link,
unsigned int  rel_timer 
) [static]

Set the link expiration timer.

Definition at line 345 of file link_set.c.

References link_entry::link_timer, OLSR_LINK_JITTER, and olsr_timer_set().

Referenced by add_link_entry(), and update_link_entry().

Here is the call graph for this function:

void olsr_update_packet_loss ( struct link_entry entry  ) 

Definition at line 721 of file link_set.c.

References link_entry::link_loss_timer, link_entry::loss_helloint, OLSR_LINK_LOSS_JITTER, olsr_lq_hello_handler(), and olsr_timer_set().

Referenced by hello_tap().

Here is the call graph for this function:

void olsr_update_packet_loss_hello_int ( struct link_entry entry,
uint32_t  loss_hello_int 
)

Definition at line 715 of file link_set.c.

References link_entry::loss_helloint.

Referenced by hello_tap().

int replace_neighbor_link_set ( const struct nbr_entry old,
struct nbr_entry new 
)

Function that updates all registered pointers to one neighbor entry with another pointer Used by MID updates.

the pointer to replace the pointer to use instead of "old"

Returns:
the number of entries updated

Definition at line 575 of file link_set.c.

References link_entry_head, list_is_empty(), link_entry::neighbor, and OLSR_FOR_ALL_LINK_ENTRIES.

Referenced by olsr_fixup_mid_main_addr(), and olsr_flush_nbr2_duplicates().

Here is the call graph for this function:

static void set_loss_link_multiplier ( struct link_entry entry  )  [static]
void signal_link_changes ( bool  val  ) 
struct link_entry* update_link_entry ( const union olsr_ip_addr local,
const union olsr_ip_addr remote,
struct lq_hello_message message,
struct interface in_if 
) [read]

Update a link entry. This is the "main entrypoint" in the link-sensing. This function is called from the HELLO parser function. It makes sure a entry is updated or created.

Parameters:
local the local IP address
remote the remote IP address
message the HELLO message
in_if the interface on which this HELLO was received
Returns:
the link_entry struct describing this link entry

Definition at line 521 of file link_set.c.

References add_link_entry(), ASYM_LINK, link_entry::ASYM_time, check_link_status(), lq_hello_message::comm, lq_hello_message::htime, link_entry::link_sym_timer, link_entry::link_timer, LOST_LINK, NEIGHB_HOLD_TIME, link_entry::neighbor, olsr_clock_getAbsolute(), olsr_clock_getRelative(), OLSR_LINK_SYM_JITTER, olsr_set_link_timer(), olsr_timer_set(), olsr_timer_stop(), olsr_update_nbr_status(), olsr_message::originator, link_entry::status, SYM_LINK, olsr_timer_entry::timer_clock, link_entry::vtime, and olsr_message::vtime.

Referenced by hello_tap().

Here is the call graph for this function:


Variable Documentation

Definition at line 73 of file link_set.c.

Referenced by main(), and signal_link_changes().

struct olsr_timer_info* link_dead_timer_info = NULL [static]

Definition at line 69 of file link_set.c.

struct olsr_timer_info* link_loss_timer_info = NULL [static]

Definition at line 70 of file link_set.c.

struct olsr_timer_info* link_sym_timer_info = NULL [static]

Definition at line 71 of file link_set.c.

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