#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>
Go to the source code of this file.
Functions | |
| static struct mid_entry * | olsr_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_entry * | olsr_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_entry * | olsr_lookup_tc_mid_entry (struct tc_entry *tc, const union olsr_ip_addr *adr) |
| union olsr_ip_addr * | olsr_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_info * | mid_address_mem_cookie = NULL |
| static struct olsr_timer_info * | mid_validity_timer_info = NULL |
| void generate_mid | ( | void *p | __attribute__(unused) | ) |
Definition at line 496 of file mid_set.c.
References __attribute__(), get_msg_seqno(), olsr_message::hopcnt, interface::ip_addr, olsr_config::ipsize, LOG_MID, LOG_PACKET_CREATION, MAX_TTL, MAXMESSAGESIZE, MID_MESSAGE, olsr_config::mid_params, net_outbuffer_bytes_left(), net_outbuffer_push(), net_output(), olsr_cnf, OLSR_FOR_ALL_INTERFACES, OLSR_HEADERSIZE, OLSR_INFO, olsr_ipcmp(), olsr_put_msg_hdr(), OLSR_WARN, olsr_message::originator, pkt_put_ipaddress(), pkt_put_u16(), olsr_config::router_id, olsr_message::seqno, set_buffer_timer(), olsr_message::size, olsr_message::ttl, olsr_message::type, olsr_msg_params::validity_time, and olsr_message::vtime.
Referenced by main().

| void olsr_delete_mid_entry | ( | struct mid_entry * | alias | ) |
Delete a single MID alias.
| alias | the alias to delete. |
Definition at line 373 of file mid_set.c.
References tc_entry::addr, avl_delete(), olsr_config::ipsize, mid_entry::mid_alias_addr, mid_entry::mid_node, mid_entry::mid_tc, mid_entry::mid_tc_node, mid_entry::mid_timer, mid_tree, tc_entry::mid_tree, olsr_cnf, olsr_delete_routing_table(), olsr_memcookie_free(), OLSR_RT_ORIGIN_MID, and olsr_timer_stop().
Referenced by olsr_expire_mid_entries(), olsr_flush_mid_entries(), and olsr_shutdown().

| 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().

| 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().

| void olsr_flush_mid_entries | ( | struct tc_entry * | tc | ) |
Delete all the MID aliases hanging off a tc entry.
| 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().

| 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().

| 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().

| 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().

| void olsr_input_mid | ( | struct olsr_message * | msg, | |
| struct interface *input_if | __attribute__(unused), | |||
| union olsr_ip_addr * | from_addr, | |||
| enum duplicate_status | status | |||
| ) |
Process an incoming MID message.
Definition at line 443 of file mid_set.c.
References check_neighbor_link(), olsr_message::end, olsr_config::ipsize, LOG_MID, MID_MESSAGE, tc_entry::mid_seq, olsr_cnf, OLSR_DEBUG, olsr_ip_to_string(), olsr_locate_tc_entry(), olsr_seqno_diff(), olsr_update_mid_entry(), olsr_message::originator, olsr_message::payload, pkt_get_ipaddress(), RESET_SEQNO_OLSR_MESSAGE, olsr_message::seqno, SYM_LINK, olsr_message::type, and olsr_message::vtime.
Referenced by olsr_deinit_package_process(), and olsr_init_package_process().

| 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.
| 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().

| 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
| adr | the alias address to check |
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().

| 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.
| adr | the alias address to check |
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
| adr | the alias address to check |
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().

| 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().

| 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.
| 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().

struct olsr_memcookie_info* mid_address_mem_cookie = NULL [static] |
Definition at line 65 of file mid_set.c.
Referenced by olsr_delete_mid_entry(), olsr_init_mid_set(), olsr_insert_mid_entry(), and olsr_lookup_mid_entry().
struct olsr_timer_info* mid_validity_timer_info = NULL [static] |
1.6.3