Show lqe_i.h syntax highlighted
/*
*
* Copyright (c) 2003 The Regents of the University of California. All
* rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* Internal (implementation) header file for the lqe daemon.
* Defines internal packet formats and interfaces.
*
* $Id: lqe_i.h,v 1.1 2005/01/26 01:30:59 cerpa Exp $
*/
#ifndef __LQE_I_H__
#define __LQE_I_H__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <time.h>
#include "libmisc/misc.h"
#include "libdev/status_dev.h"
#include "emrun/emrun.h"
#include "link/link_pass.h"
#include "link/lqe.h"
#include <link/link_headers.h>
/* default interface that is exported */
#define DEFAULT_PROVIDED_INTERFACE "lqe0"
/* default initialization filename */
#define DEFAULT_INIT_FILENAME "../routing/examples/min-rnp/topo_file"
/* default EWMA alpha value for the RNP estimation */
#define DEFAULT_ALPHA 0.01
/********************** Typedefs and structs ***************************/
/* Typedef for seqnos, which are 64 bits */
typedef uint64_t seqno_t;
/* Typedef for packet received or lost, which are 8 bits */
typedef uint8_t pkt_t;
/*
* This is basically a wrapper around a neigh_t (the struct exported to
* users of this service). We use this wrapper to add additional info
* that we don't export, plus things like pointers so it can be in a
* linked list.
*/
typedef struct neighbor_el {
neigh_t info;
/* last seqno we heard from this neighbor/src pair */
seqno_t last_seqno_heard[MAX_SRC];
char keepalive[MAX_SRC]; /* ageing variable */
conn_t status_conn[MAX_SRC]; /* last conn value checked by status */
/* element of a neighbor list */
QUEUE_ELEMENT_DECL(_el, struct neighbor_el);
} neighbor_el_t;
typedef struct neighbor_list {
/* link opts command line info */
char *link_provides;
char *link_uses;
/* state for upper interface (link we provide) */
link_pass_ctx_t *pass_context;
/* handle to status interface */
status_context_t *status;
/* list of outgoing seqno based on the original sender and next hop */
seqno_t seq_num[MAX_SRC][MAX_SRC];
int num_neighbors; /* total number of neighbors */
conn_t init_rnp[MAX_SRC]; /* init rnp values for all neighbors
(for any source) */
char *init_file; /* filename with the initial rnp values */
conn_t alpha; /* alpha constant for the RNP EWMA */
QUEUE_DECL(_list, struct neighbor_el); /* head of the neighbor list */
} neighbor_list_t;
/* Neighbor queue declaration */
QUEUE_INLINE_INSTANTIATIONS(neighbor_list, _el, _list, struct
neighbor_el, struct neighbor_list);
/* Neighbor queue definition (note it's only included in the main file */
#ifdef __MAIN_C__
QUEUE_FUNCTION_INSTANTIATIONS(neighbor_list, _el, _list, struct
neighbor_el, struct neighbor_list);
#endif
/****************** Function Prototypes **************************/
/* lqe_passthru.c */
void lqe_register_passthru(neighbor_list_t *nl);
/* lqe_status.c */
void lqe_status_init(neighbor_list_t *nl);
/* lqe_util.c */
void lqe_util_init(neighbor_list_t *nl);
void update_stats(neighbor_list_t *nl, link_pkt_t *lpkt,
lqe_pkt_t *spkt);
#endif /* __LQE_I_H__ */
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
lqe_i.h
lqe_main.c
lqe_passthru.c
lqe_status.c
lqe_util.c