Code Search for Developers
 
 
  

DiffTypes.h from EmStar at Krugle


Show DiffTypes.h syntax highlighted

#ifndef _DIFFTYPES_H_
#define _DIFFTYPES_H_

#include <stdint.h>

#ifndef _DEF_TD_MAX_MSG_LEN
#define _DEF_TD_MAX_MSG_LEN 70
#endif

#ifndef _DEF_TD_FILTER_QUEUE_SIZE
#define _DEF_TD_FILTER_QUEUE_SIZE 3
#endif

#ifndef _DEF_TD_GRADIENT_BUFF_SIZE
#define _DEF_TD_GRADIENT_BUFF_SIZE 84
#endif

#ifndef _DEF_TD_GRADIENT_QUEUE_SIZE
#define _DEF_TD_GRADIENT_QUEUE_SIZE 3
#endif

#ifndef _DEF_TD_GRADIENT_TIMEOUT
#define _DEF_TD_GRADIENT_TIMEOUT 100
#endif

#ifndef _DEF_TD_GRADIENT_PERIOD
//#define _DEF_TD_GRADIENT_PERIOD 60000
#define _DEF_TD_GRADIENT_PERIOD 10000
#endif

#ifndef _DEF_TD_GRADIENT_MAX_ATTR
#define _DEF_TD_GRADIENT_MAX_ATTR 5
#endif

#ifndef _DEF_TD_MAX_LOCAL_GRADIENTS
#define _DEF_TD_MAX_LOCAL_GRADIENTS 3
#endif

#ifndef _DEF_TD_OUTBOUND_QUEUE_SIZE
#define _DEF_TD_OUTBOUND_QUEUE_SIZE 4
#endif

#ifndef _DEF_TD_OVERRIDE_RF_POWER
#define _DEF_TD_OVERRIDE_RF_POWER -1
#endif

#ifndef _DEF_TD_MAX_TTL
#define _DEF_TD_MAX_TTL 20
#endif

// This declaration is used to determine the
// maximum size a Tiny Diffusion message can
// be, and thus all pre-allocated DiffMsg_t's.
enum
{
  TD_MAX_MSG_LEN = _DEF_TD_MAX_MSG_LEN
};

// This declaration defines how many messages will
// be able to be traversing the Tiny Diffusion
// filter stack at any given time.
enum
{
  TD_FILTER_QUEUE_SIZE = _DEF_TD_FILTER_QUEUE_SIZE
};

// This parameter is used to define the size of the
// gradient buffer that holds all of the gradient
// info and attributes.
enum
{
  TD_GRADIENT_BUFF_SIZE = _DEF_TD_GRADIENT_BUFF_SIZE
};

// This parameter is used to define the queue size
// for the gradient's inbound message queue.
enum
{
  TD_GRADIENT_QUEUE_SIZE = _DEF_TD_GRADIENT_QUEUE_SIZE
};

// This parameter defines how many gradient periods (defined by
// TD_GRADIENT_PERIOD) may elapse before an gradient will be 
// timed out.
enum
{
  TD_GRADIENT_TIMEOUT = _DEF_TD_GRADIENT_TIMEOUT
};

// This parameter specifies the interval at which the gradient
// operations (such as checking gradient timeouts) will occur.
enum
{
  TD_GRADIENT_PERIOD = _DEF_TD_GRADIENT_PERIOD
};

// This parameter specifies the maximum number of attributes that are
// allowed in a gradient.
enum
{
  TD_GRADIENT_MAX_ATTR = _DEF_TD_GRADIENT_MAX_ATTR
};

// This parameter specifies the queue size for the interests
// that are periodically sent out for local subscriptions.
enum
{
  TD_MAX_LOCAL_GRADIENTS = _DEF_TD_MAX_LOCAL_GRADIENTS
};

// This parameter is used to specify the lenght of the outbound
// message queue, just above the MAC layer).
enum
{
  TD_OUTBOUND_QUEUE_SIZE = _DEF_TD_OUTBOUND_QUEUE_SIZE
};

// This parameter defines the max TTL (or network lifetime) of
// diffusion messages.
enum
{
  TD_MAX_TTL = _DEF_TD_MAX_TTL
};

// These defines are the matching operators
// used by Tiny Diffusion.
enum
{
  TD_IS = 0,
  TD_EQ,
  TD_LT,
  TD_GT,
  TD_LE,
  TD_GE,
  TD_NE,
  TD_ANY
};

// Standard attributes.
enum
{
  TD_ATTR_CLASS = 0,
  TD_ATTR_OPP_ROUND,
  TD_ATTR_NOOP,
  TD_ATTR_RESERVED_SYSTEM = TD_ATTR_CLASS + 10,
  TD_ATTR_USER_BASE_BLOB,
  TD_ATTR_USER_BASE_KEY = TD_ATTR_USER_BASE_BLOB + 7
};

// Standard attribute values.
enum
{
  TD_ATTR_INTEREST = 0,
  TD_ATTR_DATA
};

enum
{
  TD_LOCAL_ADDR = -2
};

// Filter Priorities
enum
{
  TD_FILTER_GRADIENT = 10,
  TD_FILTER_USER_BASE = 20
};

enum
{
  TD_MSG_TYPE = 61
};

enum
{
  TD_OVERRIDE_RF_POWER = _DEF_TD_OVERRIDE_RF_POWER
};
// This is a standard attribute used for matching
// purposes.
typedef struct DiffAttr_s
{
  uint8_t    m_uiAttr;
  uint8_t    m_uiOp;
  int16_t    m_iValue;
} __attribute__ ((packed)) DiffAttr_t;


// This is the external message type used by Tiny Diffusion.
typedef struct DiffMsg_s
{
  uint16_t  m_uiSrcAddr;
  uint8_t   m_uiTtl;
  uint8_t   m_uiSeq;
  uint16_t  m_uiDataLen;
  char      m_pData[ TD_MAX_MSG_LEN ];
  //DiffAttr_t m_pData[ 16 ];
} __attribute__ ((packed)) DiffMsg_t;

// This is an internal message that is used to wrap
// around Tiny Diffusion standard message.
typedef struct IntDiffMsg_s
{
  uint8_t    m_uiPriority;
  uint8_t    m_uiNumAttrs;
  uint16_t   m_uiLastHop;
  DiffMsg_t  m_tMsg;
} __attribute__ ((packed)) IntDiffMsg_t;

typedef struct DiffMsgWrapper_s
{
  uint16_t    m_uiAddr;
  DiffMsg_t   m_tMsg;
} __attribute__ ((packed)) DiffMsgWrapper_t;

// This is a BLOB attribute used to hold large,
// opaque data.
typedef struct DiffBlob_s
{
  uint8_t    m_uiAttr;
  // Changed m_uiLen to 16 bits and added _pad to keep things aligned.
  uint8_t    _pad;
  uint16_t   m_uiLen;
  char       m_pData[ 0 ];
} __attribute__ ((packed)) DiffBlob_t;

typedef struct DiffGradient_s
{
  int8_t     m_iHandle;
  uint8_t    m_uiLastSeen;
  uint16_t   m_uiSrcAddr;
  uint16_t   m_uiNextHop;
  uint8_t    m_uiLength; // DiffGradient_t + m_pAttrs.
  uint8_t    m_uiRound;
  char       m_pAttrs[ 0 ];
} __attribute__ ((packed)) DiffGradient_t;

typedef struct DiffBerkHeader_s
{
  uint16_t   m_uiSAddr;
  char       m_pData[ 0 ];
} __attribute__ ((packed)) DiffBerkHeader_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

  old/
    MDForwarder.c
    MDForwarder_i.h
    MDOppGradient.c
    MDOppGradient.h
    MD_i.h
    microdiff.c
    microdiff.h
  DiffTypes.h
  MdForwarder.c
  MdForwarder.h
  MdMatch.c
  MdMatch.h
  MdOppGradient.c
  MdOppGradient.h
  Mdiff.h
  Mdiff.txt
  Mdiff_main.c