Show sink_types.h syntax highlighted
#ifndef __DTS_SINK_TYPES_H__
#define __DTS_SINK_TYPES_H__
#include <emrun/emrun.h>
#include <devel/state/ssync.h>
#include <devel/state/ssync_macros.h>
#include <devel/state/ssync_types.h>
#include <link/neighbor.h>
#include <libmisc/misc.h>
#include <time.h>
#include <devel/dts/dts_shared.h>
#include <devel/dts/dts_sink.h>
#include <routing/routing_table.h>
//char dts_sink_types_h_cvsid[] = "$Id: sink_types.h,v 1.5 2006/04/15 22:20:01 mlukac Exp $";
/*
* state sync stuff
*/
// moved into state sync stuff
typedef struct {
uint32_t node_id;
// uint16_t seqno;
uint32_t sink_node;
uint16_t hops_to_sink;
uint32_t my_next_hop;
float etx_to_sink;
char data[0];
} __attribute__ ((packed)) sink_tree_t;
/*
* neighbor list
*/
typedef struct _sink_tree_state sink_tree_state_t;
typedef struct _sneigh sneigh_t;
struct _sneigh {
uint32_t node_id; /* the node we heard from */
if_id_t ip;
/* hop stuff */
uint32_t sink_node; /* who is the sink */
uint16_t hops_to_sink;
uint32_t my_next_hop;
float etx_to_sink;
node_id_t *path_to_sink;
float fdr; /* get this from state sync */
float rdr; /* get this from the linkstats */
float localetx; /* localetx is 1 / ( fdr * rdr ) */
uint8_t status;
neighbor_t last_info;
//neigh_t last_info;
struct timeval ssync_dropped_timer;
int ssync_dropped;
sink_tree_state_t *container;
QUEUE_ELEMENT_DECL(_,sneigh_t);
};
#define NEIGHBOR_STANDBY 0
#define NEIGHBOR_ACTIVE 1
#define NEIGHBOR_STALE 2
#define NEIGHBOR_DEAD 4
#define NEIGHBOR_ACT_TO_STALE 60000 /* 1 min */
#define NEIGHBOR_STALE_TO_DEAD 300000 /* 5 mins */
/*
* state for everyone
*/
struct _sink_tree_state
{
uint8_t is_sink;
uint32_t curr_sink;
sneigh_t * curr_next_hop;
sneigh_t * prev_next_hop;
QUEUE_DECL(nlist,sneigh_t);
ssync_sub_t *ssync_sub;
status_context_t *sink_status;
status_context_t *sink_status_next_hop;
status_client_context_t *neighbor_service;
status_client_context_t *neighbor_service2;
//status_client_context_t *linkstats_service;
time_t status_notify_delay;
g_event_t *pub_timer;
g_event_t *decide_timer;
};
/*
* nlist stuff
*/
QUEUE_INLINE_INSTANTIATIONS(nlist,_,nlist,sneigh_t,sink_tree_state_t);
void sink_nlist_el_print(sneigh_t *sn, buf_t *buf);
void sink_nlist_print(sink_tree_state_t *sts, buf_t *buf);
void sink_nlist_fill_array(sink_tree_state_t *sts, sneigh_t ** array);
sneigh_t *sink_nlist_get_or_init(sink_tree_state_t *sts, uint32_t node);
sneigh_t *sink_nlist_get(sink_tree_state_t *sts, uint32_t node);
/*
* Functions for processing the neighbor service data
*/
int neighbor_stats_update(neighbor_t *nb_list, int count, void *data);
/*
* Decide who is the next hop
*/
void sink_decide_next_hop(sink_tree_state_t *sts);
int sink_decide_status(void *data, int interval, g_event_t *event);
/*
* State sync tree stuff
*/
int sink_tree_repub_hops(void *data, int interval, g_event_t *event);
//int sink_tree_update(ssync_sub_t *sub, sink_tree_table_t *table,
// int count, void *data);
int sink_tree_update(ssync_sub_t *sub, ssync_elt_t *table,
int count);
/*
* Status stuff
*/
int sink_status_next_hop(status_context_t *ctx, buf_t *buf);
int sink_status_print(status_context_t *ctx, buf_t *buf);
int sink_status_binary(status_context_t *ctx, buf_t *buf);
int sink_status_command(status_context_t *ctx, char *command, size_t buf_size);
int sink_status_routing_output(status_context_t *ctx, buf_t *buf);
/*
* Link stats
*/
int sink_linkstats_new_stats(void *buf, size_t size, void *data);
#endif
See more files for this project here
EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.
Project homepage:
http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other
process_ns.c
sink_decision.c
sink_main.c
sink_nlist.c
sink_status.c
sink_tree.c
sink_types.h