N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/Vaike/linux/system-addons/networking/mesh_link.h File Reference

WSN mesh network routing links. More...

#include <net/route.h>
#include <limits.h>
#include "mesh_protocol.h"
#include "mesh_metrics.h"
#include "mesh_net.h"

Go to the source code of this file.

Classes

struct  _q
struct  header_t
struct  link_t
struct  _link_entry
struct  _db

Defines

#define MESH_LINK_STRLEN   (NET_ADDR_LEN * 2 + 32 * 5)
#define NUM_LINK_METRICS   4
#define MAX_SEQNUM   UINT32_MAX
#define MAX_MTU   2048
#define MESH_LINK_STR_FORMAT   "%s:%u:%d:%d:%d:%d:%s"

Typedefs

typedef _q msg_queue_t
typedef _link_entry link_entry_t
typedef _db database_t

Functions

void init_link (protocol_t *proto, link_t *link)
void init_link_entry (protocol_t *proto, link_entry_t *entry)
link_entry_tnew_link_entry (protocol_t *proto)
void link_to_string (link_t *link, char *string)
database_tnew_database (protocol_t *proto, unsigned int size)
size_t database_size (unsigned int num_links)
void pack_database (database_t *db)
void unpack_database (database_t *db)
int add_entry (protocol_t *proto, unsigned int id, link_entry_t *entry)
int remove_entry (protocol_t *proto, unsigned int id, link_entry_t *entry)
link_entry_tretrieve_entry (protocol_t *proto, unsigned int id)
link_entry_titerate_entries (protocol_t *proto)
unsigned int num_entries (protocol_t *proto)
void empty_entries (protocol_t *proto)
int add_msg (link_entry_t *link, unsigned int seq_num, msg_queue_t *msg)
int remove_msg (link_entry_t *link, unsigned int seq_num, msg_queue_t *msg)
msg_queue_tretrieve_msg (link_entry_t *link, unsigned int seq_num)
void empty_msgs (link_entry_t *link)
unsigned int ip_to_id (char *addr)
char * ip_to_dot (unsigned int addr)
size_t header_size (void)
void unpack_header (header_t *hdr)


Detailed Description

WSN mesh network routing links.

Revision
1.1

Original Author: Sean M. Brennan <brennan@lanl.gov>

Author
sean_m_brennan

Created: August 1, 2007

Date
2008/02/03 22:00:48

Definition in file mesh_link.h.


Define Documentation

#define MAX_MTU   2048
 

Definition at line 48 of file mesh_link.h.

#define MAX_SEQNUM   UINT32_MAX
 

Definition at line 47 of file mesh_link.h.

Referenced by mesh_recv(), and mesh_send().

#define MESH_LINK_STR_FORMAT   "%s:%u:%d:%d:%d:%d:%s"
 

Definition at line 76 of file mesh_link.h.

Referenced by link_to_string().

#define MESH_LINK_STRLEN   (NET_ADDR_LEN * 2 + 32 * 5)
 

Definition at line 45 of file mesh_link.h.

Referenced by link_entry_to_rtentry(), pack_database(), strength_send_mesh_discovery(), and unpack_database().

#define NUM_LINK_METRICS   4
 

Definition at line 46 of file mesh_link.h.

Referenced by init_link(), pack_database(), and unpack_database().


Typedef Documentation

typedef struct _db database_t
 

typedef struct _link_entry link_entry_t
 

typedef struct _q msg_queue_t
 


Function Documentation

int add_entry protocol_t proto,
unsigned int  id,
link_entry_t entry
 

Definition at line 220 of file mesh_link.c.

References avl_insert(), _protocol::network, and _link_entry::node_id.

Referenced by init_simulator_iface().

int add_msg link_entry_t link,
unsigned int  seq_num,
msg_queue_t msg
 

Definition at line 282 of file mesh_link.c.

References avl_insert(), get_current_time(), _q::id, _link_entry::protocol, _protocol::queue_timeout, _link_entry::send_queue, and _q::timeout.

Referenced by mesh_send().

size_t database_size unsigned int  num_links  ) 
 

Definition at line 131 of file mesh_link.c.

References header_size().

Referenced by new_database(), receive_routes(), send_routes(), and strength_recv_mesh_discovery().

void empty_entries protocol_t proto  ) 
 

Definition at line 268 of file mesh_link.c.

References destroy_avltree(), iterate_entries(), _protocol::iterator, _protocol::network, and avltree::root.

Referenced by strength_send_mesh_discovery().

void empty_msgs link_entry_t link  ) 
 

Definition at line 312 of file mesh_link.c.

References avl_find_min(), destroy_avltree(), avlnode::element, avlnode::next, avltree::root, and _link_entry::send_queue.

size_t header_size void   ) 
 

Definition at line 126 of file mesh_link.c.

Referenced by database_size().

void init_link protocol_t proto,
link_t link
 

Definition at line 71 of file mesh_link.c.

References link_t::hop_count, _self::ip_addr, link_t::metrics, link_t::next_hop, link_t::node, NUM_LINK_METRICS, link_t::rediscover, and _protocol::sensor.

Referenced by init_link_entry().

void init_link_entry protocol_t proto,
link_entry_t entry
 

Definition at line 81 of file mesh_link.c.

References _link_entry::bcast, _self::broadcast, _link_entry::iface, init_link(), init_metrics(), _self::interface, _self::ip_addr, ip_to_id(), _link_entry::last_packet, _link_entry::link, _link_entry::metrics, _self::netmask, _link_entry::next, _link_entry::nmask, _link_entry::node_id, _link_entry::protocol, _link_entry::recv_seq_num, avltree::root, _link_entry::routing_backlog, _link_entry::routing_pending, _link_entry::send_queue, _link_entry::send_seq_num, _protocol::sensor, and _link_entry::time_last_used.

Referenced by new_link_entry().

char* ip_to_dot unsigned int  addr  ) 
 

Definition at line 63 of file mesh_link.c.

Referenced by packet_usage(), and strength_send_mesh_discovery().

unsigned int ip_to_id char *  addr  ) 
 

Definition at line 52 of file mesh_link.c.

Referenced by compile_mesh_metrics(), gather_statistics(), and init_link_entry().

link_entry_t* iterate_entries protocol_t proto  ) 
 

Definition at line 248 of file mesh_link.c.

References avl_find_min(), avlnode::element, _protocol::iterator, _protocol::network, and avlnode::next.

Referenced by empty_entries(), reliable_net(), and strength_send_mesh_discovery().

void link_to_string link_t link,
char *  string
 

Definition at line 114 of file mesh_link.c.

References link_t::hop_count, MESH_LINK_STR_FORMAT, link_t::metrics, NET_ADDR_LEN, link_t::next_hop, and link_t::node.

Referenced by link_entry_to_rtentry(), pack_database(), strength_send_mesh_discovery(), and unpack_database().

database_t* new_database protocol_t proto,
unsigned int  size
 

Definition at line 137 of file mesh_link.c.

References database_size(), _db::header, header_t::protocol, header_t::size, and _protocol::unique_id.

Referenced by strength_send_mesh_discovery().

link_entry_t* new_link_entry protocol_t proto  ) 
 

Definition at line 106 of file mesh_link.c.

References init_link_entry().

Referenced by strength_send_mesh_discovery().

unsigned int num_entries protocol_t proto  ) 
 

Definition at line 262 of file mesh_link.c.

References avl_size(), and _protocol::network.

Referenced by strength_send_mesh_discovery().

void pack_database database_t db  ) 
 

Definition at line 147 of file mesh_link.c.

References _db::header, link_t::hop_count, link_to_string(), _db::links, MESH_LINK_STRLEN, link_t::metrics, NUM_LINK_METRICS, header_t::protocol, link_t::rediscover, and header_t::size.

Referenced by send_routes().

int remove_entry protocol_t proto,
unsigned int  id,
link_entry_t entry
 

Definition at line 232 of file mesh_link.c.

References avl_delete(), and _protocol::network.

int remove_msg link_entry_t link,
unsigned int  seq_num,
msg_queue_t msg
 

Definition at line 296 of file mesh_link.c.

References avl_delete(), and _link_entry::send_queue.

Referenced by reliable_net().

link_entry_t* retrieve_entry protocol_t proto,
unsigned int  id
 

Definition at line 242 of file mesh_link.c.

References avl_retrieve(), and _protocol::network.

Referenced by compile_mesh_metrics(), gather_statistics(), mesh_recv(), mesh_send(), packet_usage(), route_discovery_done(), and route_idle_time().

msg_queue_t* retrieve_msg link_entry_t link,
unsigned int  seq_num
 

Definition at line 306 of file mesh_link.c.

References avl_retrieve(), and _link_entry::send_queue.

Referenced by mesh_recv().

void unpack_database database_t db  ) 
 

Definition at line 189 of file mesh_link.c.

References _db::header, link_t::hop_count, link_to_string(), _db::links, MESH_LINK_STRLEN, link_t::metrics, NUM_LINK_METRICS, header_t::protocol, link_t::rediscover, header_t::size, and unpack_header().

Referenced by receive_routes().

void unpack_header header_t hdr  ) 
 

Definition at line 179 of file mesh_link.c.

References header_t::protocol, and header_t::size.

Referenced by unpack_database().


© 2007, Los Alamos National Security, LLC.