Code Search for Developers
 
 
  

scaled_i.h from EmStar at Krugle


Show scaled_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.
 *
 */
 

/*
 * scaled_i.h: Internal implementation header file for the scale 
 * measurement tool.
 *
 * $Id: scaled_i.h,v 1.4 2005/10/31 09:25:51 cerpa Exp $
 */

#ifndef __SCALED_I_H__
#define __SCALED_I_H__

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <math.h>

#include "libmisc/misc.h"
#include "emrun/emrun.h"
#include "link/link.h"
#include <link/link_headers.h>
#include "timesync/sync.h"

/************** Defaults for scale parameters *************************/

#define DEFAULT_ROOT_NODE_ID  100
#define DEFAULT_PKT_SIZE      500
#define DEFAULT_TOTAL_PKTS     20
#define DEFAULT_PERIOD      12000
#define DEFAULT_TX_WINDOW    1000

#define TIME_GUARD_BAND        30       /* in seconds */

/********************** Typedefs and structs **************************/

/* Typedef for seqnos, which are 16 bits */
typedef uint64_t seqno_t;

/* Scale packet header */
typedef struct scale_pkt {
  uint32_t src_id;
} scale_pkt_t;

/* Typedef for the main neighbor list structure */
typedef struct neighbor_list {
  seqno_t seqno;              /* Last outgoing seqno we generated */
  char *string_gps_time;      /* GPS reference time passed at init */
  struct timeval gps_time;    /* timeval struct with the GPS time ref */
  uint32_t root_node_id;      /* first node id (assumes sequential ids) */
  uint32_t pkt_size;          /* Packet size of the sending probe */
  uint32_t total_pkts;        /* Total pkts to be sent in each tx window */
  uint32_t period;            /* How often do we start transmitting (cycle) */
  uint32_t tx_window;         /* How long is the window of transmission? */
  
  /* logging state */
  int use_logging;
  char *log_dir;
  FILE *fp;

  char *link_name;            /* the name of the link to connect to */

  /* handles to various events */
  lu_context_t *link;         /* Link we use for this application */
  link_status_t link_status;  /* Status from the link device */

} neighbor_list_t;


/****************** Function Prototypes **************************/

/* scaled_net.c */
void scaled_net_init(neighbor_list_t *nl);
void scaled_net_start(neighbor_list_t *nl);
int scaled_cpu_to_gps_time(struct timeval *src_tv, struct timeval *dest_tv);
int scaled_gps_to_cpu_time(struct timeval *src_tv, struct timeval *dest_tv);


#endif /* __SCALED_I_H__ */




See more files for this project here

EmStar

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

  scaled_i.h
  scaled_main.c
  scaled_net.c