Code Search for Developers
 
 
  

state_info.h from EmStar at Krugle


Show state_info.h syntax highlighted

#ifndef __BUNDLESERVER_STATE__
#define __BUNDLESERVER_STATE__

#include "libmisc/misc.h"
#include "link/link_structs.h"

#define PKT_TYPE_BUNDLESERVER_STATE PKT_TYPE_USER(2)

#define BUNDLESERVER_STATE_QUERY_DEV sim_path("/dev/bs_state/state_qd")

/*
 * If you update this, then you should also update
 * bundleserver_state_pkt_names.
 */
typedef enum
{
  BS_STATE_PKT_TYPE_ZERO = 0, // Do not  use
  BS_STATE_PKT_TYPE_BLOCK_HAVE,
  BS_STATE_PKT_TYPE_SINK_STATUS,  
  BS_STATE_PKT_TYPE_ACK_ARRAY,
  BS_STATE_PKT_TYPE_NEIGHBOR_LIST
}
bundleserver_state_pkt_type_t;

/*
 * This makes it easy to translate bundleserver_state_pkt_type_t
 * values into strings.
 */
char * bundleserver_state_pkt_names[] =
  {
    "ZERO",
    "BLOCK_HAVE",
    "SINK_STATUS",
    "ACK_ARRAY",
    "NEIGHBOR_LIST"
  };


/*
 * Sequence number struct that I use in various places.
 */
typedef struct
{
  uint32_t sec;
  uint32_t usec;
  uint32_t increment;
} 
bundleserver_seq_no_t;


/*
 * The bundle server uid structure is made up of the node id, and a
 * sequence number. This can be used as a sequence number for bundles,
 * and for UIDs of flooded messages.
 */
typedef struct
{
  uint32_t node_id;    // Originating node
  bundleserver_seq_no_t seq_no;
}
bundleserver_uid_t;


/*
 * Container for various state information.
 */
typedef struct
{
  uint32_t type;                // bundleserver_state_pkt_type_t
  uint32_t node_id;             // originating node ID
  bundleserver_seq_no_t seq_no; // sequence number
  uint32_t byte_length;
  char data[0];  
}
bundleserver_state_pkt_t;

/*
 * Block-have data structure. Indicates the blocks that currently
 * reside on a node.
 *
 * Data points to an array of bundleserver_uid_t;
 */
typedef struct
{
  uint32_t byte_length;
  char data[0];
} 
bundleserver_state_block_have_t;


/*
 * Basic sink information. When this gets transmitted, it's
 * transmitted as an array of sink packets.
 */
typedef struct
{
  uint32_t node_id;
  bundleserver_seq_no_t seq_no;
  uint32_t sink_state;
}
bundleserver_state_sink_t;


/*
 * Selective Acks from one node.
 */
typedef struct
{
  uint32_t node_id;                   // Broadcasting node
  uint32_t bundle_from_node_id;       // Where the bundles came from
  bundleserver_seq_no_t seq_no;       // Original Seq_no 
  uint32_t ack_array_bytes;           // Byte size of ack_array
  bundleserver_uid_t ack_array[0];    // The array. :)
} 
bundleserver_state_ack_array_pkt_t;

typedef struct
{
  GSList * sink_list; // List of bundleserver_state_sink_pkt_t;
  GSList * ack_array_list;  // List of bundleserver_ack_array_pkt_t;

  // Query device references
  query_context_t * sink_query_dev_ref;
  query_context_t * ack_array_query_dev_ref;
} 
bundleserver_state_state_t;




//////////////////////////////////////////////////////////////////////////

/*
  typedef struct node_info_s
{
  uint32_t node_id;
  bundleserver_seq_num_t seq_num;
  uint32_t sink_status;
  GArray * ack_array; // array of bundle UIDs
  uint32_t disk_space_allocated;
  uint32_t disk_space_used;
  GArray * bundle_info_array; // array of bundle info structs
  GArray * transient_bundle_array; // array of bundle UIDs that are transients
  GArray * neighbor_info_array; // array of neighbor info structs
} node_info_t;

typedef struct bundleserver_state_s
{
  uint32_t version;
  GPtrArray * node_info_array;
} bundleserver_state_t;
*/
#endif




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

  TODO
  bundleserver.c
  bundleserver_i.h
  reflect.h
  reflect_extras.c
  reflect_extras.h
  reflect_main.c
  state_info.c
  state_info.h