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_net.c File Reference

Networking primitives for WSN mesh. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <errno.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <asm/types.h>
#include <linux/filter.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <net/ethernet.h>
#include "mesh_net.h"
#include "mesh_protocol.h"
#include "mesh_discovery.h"
#include "mesh_link.h"
#include "mesh_neighbor.h"
#include "sensor_self.h"

Go to the source code of this file.

Defines

#define RAW_PACKETS
#define _BSD_SOURCE

Functions

int mesh_socket (char *ifname, unsigned int port)
ssize_t mesh_sendmsg (char *ifname, char *ifaddr, int sd, void *buf, size_t len, struct sockaddr_in *to)
ssize_t mesh_recvmsg (int sd, void *buf, size_t len, struct sockaddr_in *from, struct msghdr *msg_header, size_t ctl_msg_size)
int timed_recv (int sd, void *buf, int bytes, struct sockaddr_in *sa, int timeout)
int timed_recv_peek (int sd, void *buf, int bytes, struct sockaddr_in *sa, int timeout)
ssize_t mesh_raw_send (protocol_t *proto, int sd, void *buf, size_t len, struct sockaddr_in *to)
ssize_t mesh_send (protocol_t *proto, int sd, void *buf, size_t len, struct sockaddr_in *to)
ssize_t mesh_recv (self_t *self, int sd, void *buf, size_t len, struct sockaddr_in *from)
ssize_t mesh_send_nextdoor (self_t *self, int sd, void *buf, size_t len, double angle, double dist)
ssize_t mesh_recv_nextdoor (self_t *self, int sd, void *buf, size_t len, double *angle, double *dist)
int reliable_net (self_t *self)


Detailed Description

Networking primitives for WSN mesh.

Revision
1.2

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

Author
sean_m_brennan

Created: August 1, 2007

Date
2008/02/05 19:14:30

Definition in file mesh_net.c.


Define Documentation

#define _BSD_SOURCE
 

Definition at line 38 of file mesh_net.c.

#define RAW_PACKETS
 

Definition at line 35 of file mesh_net.c.


Function Documentation

ssize_t mesh_raw_send protocol_t proto,
int  sd,
void *  buf,
size_t  len,
struct sockaddr_in *  to
 

Definition at line 700 of file mesh_net.c.

References _self::interface, _self::mac_addr, memcpy, mesh_sendmsg(), mesh_hdr::nack, mesh_hdr::protocol_id, mesh_hdr::raw, _protocol::sensor, mesh_hdr::seq_num, and _protocol::unique_id.

ssize_t mesh_recv self_t self,
int  sd,
void *  buf,
size_t  len,
struct sockaddr_in *  from
 

Definition at line 763 of file mesh_net.c.

References _q::data, _self::interface, _q::len, _self::mac_addr, max_ctl_size(), MAX_SEQNUM, memcpy, mesh_recvmsg(), mesh_sendmsg(), mesh_hdr::nack, _q::port, protocol_by_id(), mesh_hdr::protocol_id, mesh_hdr::raw, _link_entry::recv_seq_num, retrieve_entry(), retrieve_msg(), and mesh_hdr::seq_num.

ssize_t mesh_recv_nextdoor self_t self,
int  sd,
void *  buf,
size_t  len,
double *  angle,
double *  dist
 

Definition at line 841 of file mesh_net.c.

References _neighbor_entry::bearing, _neighbor_entry::distance, and neighbor_by_ip().

ssize_t mesh_recvmsg int  sd,
void *  buf,
size_t  len,
struct sockaddr_in *  from,
struct msghdr *  msg_header,
size_t  ctl_msg_size
 

Definition at line 516 of file mesh_net.c.

References analyze(), and memcpy.

Referenced by mesh_recv(), and receive_routes().

ssize_t mesh_send protocol_t proto,
int  sd,
void *  buf,
size_t  len,
struct sockaddr_in *  to
 

Definition at line 722 of file mesh_net.c.

References add_msg(), _self::interface, _self::mac_addr, MAX_SEQNUM, memcpy, mesh_sendmsg(), mesh_hdr::nack, mesh_hdr::protocol_id, mesh_hdr::raw, retrieve_entry(), _link_entry::send_seq_num, _protocol::sensor, mesh_hdr::seq_num, and _protocol::unique_id.

ssize_t mesh_send_nextdoor self_t self,
int  sd,
void *  buf,
size_t  len,
double  angle,
double  dist
 

Definition at line 827 of file mesh_net.c.

References _neighbor_entry::ip, and neighbor_by_position().

ssize_t mesh_sendmsg char *  ifname,
char *  ifaddr,
int  sd,
void *  buf,
size_t  len,
struct sockaddr_in *  to
 

Definition at line 463 of file mesh_net.c.

References get_current_time(), and memcpy.

Referenced by find_neighbors(), mesh_raw_send(), mesh_recv(), mesh_send(), route_discovery_done(), and send_routes().

int mesh_socket char *  ifname,
unsigned int  port
 

Definition at line 365 of file mesh_net.c.

References error.

Referenced by find_neighbors(), neighbor_discovery(), and propagate_routes().

int reliable_net self_t self  ) 
 

Definition at line 860 of file mesh_net.c.

References avl_find_min(), avlnode::element, get_current_time(), _q::id, iterate_entries(), _protocol::iterator, min, _protocol::next, remove_msg(), _link_entry::send_queue, and _q::timeout.

Referenced by semi_reliability().

int timed_recv int  sd,
void *  buf,
int  bytes,
struct sockaddr_in *  sa,
int  timeout
 

Definition at line 579 of file mesh_net.c.

References memcpy.

Referenced by echo_statistics(), gather_statistics(), and neighbor_discovery().

int timed_recv_peek int  sd,
void *  buf,
int  bytes,
struct sockaddr_in *  sa,
int  timeout
 

Definition at line 628 of file mesh_net.c.

References memcpy.


© 2007, Los Alamos National Security, LLC.