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

#include "common/avl.h"
#include "common/string.h"
#include "defs.h"
#include "avl_olsr_comp.h"
#include "interfaces.h"
#include "olsr_timer.h"
#include "olsr_socket.h"
#include "olsr.h"
#include "parser.h"
#include "net_olsr.h"
#include "ipcalc.h"
#include "olsr_logging.h"
#include "os_net.h"
#include <assert.h>
#include <sys/time.h>
#include <sys/select.h>
#include "olsr_types.h"
#include <signal.h>
#include <unistd.h>
Include dependency graph for interfaces.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ifchgf

Defines

#define BUFSPACE   (127*1024)

Functions

static void check_interface_updates (void *)
bool init_interfaces (void)
static void remove_lost_interface_ip (struct interface_lost *lost)
static void add_lost_interface_ip (union olsr_ip_addr *ip, uint32_t hello_timeout)
static struct interface_lostget_lost_interface_ip (union olsr_ip_addr *ip)
bool is_lost_interface_ip (union olsr_ip_addr *ip)
void destroy_interfaces (void)
struct interfaceadd_interface (struct olsr_if_config *iface)
static void check_interface_updates (void *foo __attribute__((unused)))
void remove_interface (struct interface *ifp)
void run_ifchg_cbs (struct interface *ifp, int flag)
struct interfaceif_ifwithaddr (const union olsr_ip_addr *addr)
struct interfaceif_ifwithsock (int fd)
struct interfaceif_ifwithname (const char *if_name)
struct interfaceif_ifwithindex (const int if_index)
const char * if_ifwithindex_name (const int if_index)
void lock_interface (struct interface *ifp)
void unlock_interface (struct interface *ifp)
void add_ifchgf (ifchg_cb_func f)

Variables

const char * INTERFACE_MODE_NAMES []
struct list_entity interface_head
struct avl_tree interface_lost_tree
static struct ifchgfifchgf_list = NULL
static struct olsr_memcookie_infointerface_mem_cookie = NULL
static struct olsr_memcookie_infointerface_lost_mem_cookie = NULL
static struct olsr_timer_infointerface_poll_timerinfo = NULL
static struct olsr_timer_infohello_gen_timerinfo = NULL

Define Documentation

#define BUFSPACE   (127*1024)

Definition at line 61 of file interfaces.c.

Referenced by add_interface().


Function Documentation

void add_ifchgf ( ifchg_cb_func  f  ) 

Add an ifchange function. These functions are called on all (non-initial) changes in the interface set.

Definition at line 525 of file interfaces.c.

References ifchgf::function, ifchgf::next, and olsr_malloc().

Referenced by olsrd_plugin_init().

Here is the call graph for this function:

struct interface* add_interface ( struct olsr_if_config iface  )  [read]
static void add_lost_interface_ip ( union olsr_ip_addr ip,
uint32_t  hello_timeout 
) [static]

Definition at line 141 of file interfaces.c.

References avl_insert(), interface_lost_tree, LOG_INTERFACE, olsr_clock_getAbsolute(), OLSR_DEBUG, olsr_ip_to_string(), and olsr_memcookie_malloc().

Referenced by remove_interface().

Here is the call graph for this function:

static void check_interface_updates ( void *foo   __attribute__(unused)  )  [static]
static void check_interface_updates ( void *   )  [static]

Referenced by init_interfaces().

void destroy_interfaces ( void   ) 

Definition at line 170 of file interfaces.c.

References OLSR_FOR_ALL_INTERFACES, OLSR_FOR_ALL_LOSTIF_ENTRIES, remove_interface(), and remove_lost_interface_ip().

Referenced by olsr_shutdown().

Here is the call graph for this function:

static struct interface_lost* get_lost_interface_ip ( union olsr_ip_addr ip  )  [static, read]
struct interface* if_ifwithaddr ( const union olsr_ip_addr addr  )  [read]

Find the local interface with a given address.

Parameters:
addr the address to check.
Returns:
the interface struct representing the interface that matched the address.

Definition at line 392 of file interfaces.c.

References interface::ip_addr, OLSR_FOR_ALL_INTERFACES, and olsr_ipcmp().

Referenced by BmfEncapsulationPacketReceived(), CreateBmfNetworkInterfaces(), FindNeighbors(), olsr_input(), os_init_interface(), parse_challenge(), parse_cres(), parse_rres(), process_message_neighbors(), and set_loss_link_multiplier().

Here is the call graph for this function:

struct interface* if_ifwithindex ( const int  if_index  )  [read]

Find the interface with a given interface index.

Parameters:
iif_index of the interface to find.
Returns:
return the interface struct representing the interface that matched the iif_index.

Definition at line 462 of file interfaces.c.

References interface::if_index, and OLSR_FOR_ALL_INTERFACES.

Referenced by if_ifwithindex_name().

const char* if_ifwithindex_name ( const int  if_index  ) 

Get an interface name for a given interface index

Parameters:
iif_index of the interface to find.
Returns:
"" or interface name.

Definition at line 481 of file interfaces.c.

References if_ifwithindex(), and interface::int_name.

Referenced by add_del_route(), and olsr_new_netlink_route().

Here is the call graph for this function:

struct interface* if_ifwithname ( const char *  if_name  )  [read]

Find the interface with a given label.

Parameters:
if_name the label of the interface to find.
Returns:
return the interface struct representing the interface that matched the label.

Definition at line 440 of file interfaces.c.

References interface::int_name, and OLSR_FOR_ALL_INTERFACES.

struct interface* if_ifwithsock ( int  fd  )  [read]

Find the interface with a given number.

Parameters:
nr the number of the interface to find.
Returns:
return the interface struct representing the interface that matched the number.

Definition at line 415 of file interfaces.c.

References olsr_socket_entry::fd, OLSR_FOR_ALL_INTERFACES, interface::olsr_socket, and interface::send_socket_fd.

Referenced by olsr_input(), os_recvfrom(), and os_sendto().

bool init_interfaces ( void   ) 

Do initialization of various data needed for network interface management. This function also tries to set up the given interfaces.

Returns:
if more than zero interfaces were configured

Definition at line 98 of file interfaces.c.

References add_interface(), avl_comp_default, avl_init(), check_interface_updates(), generate_hello(), olsr_config::if_configs, interface_head, interface_lost_tree, list_init_head(), list_is_empty(), LOG_INTERFACE, olsr_if_config::next, olsr_config::nic_chgs_pollrate, olsr_cnf, OLSR_INFO, olsr_memcookie_add(), olsr_timer_add(), and olsr_timer_start().

Referenced by main().

Here is the call graph for this function:

bool is_lost_interface_ip ( union olsr_ip_addr ip  ) 

Definition at line 165 of file interfaces.c.

References get_lost_interface_ip().

Referenced by deserialize_hello().

Here is the call graph for this function:

void lock_interface ( struct interface ifp  ) 

Lock an interface.

Definition at line 491 of file interfaces.c.

References interface::refcount.

Referenced by add_interface(), add_link_entry(), olsr_add_route(), and olsr_update_rt_path().

void remove_interface ( struct interface ifp  ) 
static void remove_lost_interface_ip ( struct interface_lost lost  )  [static]
void run_ifchg_cbs ( struct interface ifp,
int  flag 
)

Definition at line 376 of file interfaces.c.

References ifchgf::function, and ifchgf::next.

Referenced by add_interface(), chk_if_changed(), and remove_interface().

void unlock_interface ( struct interface ifp  ) 

Unlock an interface and free it if the refcount went down to zero.

Definition at line 502 of file interfaces.c.

References interface::int_name, interface::int_node, list_node_added(), olsr_memcookie_free(), and interface::refcount.

Referenced by olsr_del_route(), olsr_delete_link_entry(), olsr_delete_rt_path(), olsr_update_rt_path(), and remove_interface().

Here is the call graph for this function:


Variable Documentation

struct olsr_timer_info* hello_gen_timerinfo = NULL [static]

Definition at line 87 of file interfaces.c.

struct ifchgf* ifchgf_list = NULL [static]

Definition at line 80 of file interfaces.c.

Definition at line 69 of file interfaces.c.

Referenced by add_interface(), init_interfaces(), and remove_interface().

Definition at line 84 of file interfaces.c.

struct olsr_memcookie_info* interface_mem_cookie = NULL [static]

Definition at line 83 of file interfaces.c.

const char* INTERFACE_MODE_NAMES[]
Initial value:
 {
  "mesh",
  "ether"
}

Definition at line 63 of file interfaces.c.

Referenced by parse_cfg_interface().

struct olsr_timer_info* interface_poll_timerinfo = NULL [static]

Definition at line 86 of file interfaces.c.

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