Code Search for Developers
 
 
  

Mdiff.h from EmStar at Krugle


Show Mdiff.h syntax highlighted

#ifndef __MDIFF_H__
#define __MDIFF_H__

// ??? Define TD_LOCAL_ADDR to be my_node_id

#include "libmisc/misc.h"
#include "libdev/status_dev.h"
#include "libdev/query_dev.h"
#include "libmisc/queue.h"
#include "link/link.h"
#include "link/neighbor.h"
#include "DiffTypes.h"

#define MDIFF_STATUS_DEV sim_path("/dev/Mdiff/status")
#define MDIFF_GRAD_STATUS_DEV sim_path("/dev/Mdiff/gradient")
#define MDIFF_FILTER_PACKET_DEV sim_path("/dev/Mdiff/filter_pd")

#define MDIFF_APP_PACKET_DEV sim_path("/dev/Mdiff/app_pd")
#define PKT_TYPE_MDIFF PKT_TYPE_USER(0)

#define SUCCESS 1
#define FAIL 0

// This needs to be set using lu_get_if_id().

typedef int result_t;

enum {
  // From User Application
  MdSendMsg,  
  MdSubscribe, 
  MdUnsubscribe,
  // To User Application
  MdHandle,      
  MdRecvMsg,
  // From Filter
  MdRecvFromFilter,
  MdSetPriority,
  // To Filter
  MdRecv  
};

typedef struct MdMsg_s {
  uint16_t type;
  size_t length;
  char data[];
} MdMsg_t;

typedef struct MdForwarder_state_s {
  uint8_t m_uiSeq;
} MdForwarder_state_t;


typedef struct IntDiffMsg_elem_s {
  IntDiffMsg_t * tMsg;
  QUEUE_ELEMENT_DECL(idm_ptrs, struct IntDiffMsg_elem_s);
} IntDiffMsg_elem_t;

typedef struct IntDiffMsg_queue_s {
  QUEUE_DECL(idm_list, struct IntDiffMsg_elem_s);
} IntDiffMsg_queue_t;

QUEUE_INLINE_INSTANTIATIONS(IntDiffMsg_queue, idm_ptrs, idm_list,
			    IntDiffMsg_elem_t, IntDiffMsg_queue_t);


#define TD_NUM_STANDARD_INTEREST_ATTRS 2 


// Queue related for DiffGradient_t
typedef struct DiffGradient_elem_s {
  DiffGradient_t * tMsg;
  QUEUE_ELEMENT_DECL(dg_ptrs, struct DiffGradient_elem_s);
} DiffGradient_elem_t;

typedef struct DiffGradient_queue_s {
  QUEUE_DECL(dg_list, struct DiffGradient_elem_s);
} DiffGradient_queue_t;

QUEUE_INLINE_INSTANTIATIONS(DiffGradient_queue, dg_ptrs, dg_list,
			    DiffGradient_elem_t, DiffGradient_queue_t);

// MdOppGradient State
typedef struct MdOppGradient_state_s {
  // Queue to hold Interests.
  IntDiffMsg_queue_t * interest_queue;
  // Queue to hold Gradients.
  DiffGradient_queue_t * gradient_queue;
  
  // Interest refresh timer.
  g_event_t * interest_timer;

  // Gradient timeout timer.
  g_event_t * gradient_timer;
  
  // This varible is used to assign handles to new gradients.
  int8_t      m_iHandleSeq;

  // This is the number of attributes in the interest array.
  uint8_t     m_uiNumInterestAttrs;

  // This array is used to define the matching of an interest.
  DiffAttr_t  m_pInterestAttr[ 2 ];

  // This is the number of attributes in the data attribute array.
  uint8_t     m_uiNumDataAttrs;

  // This array is used to define the matching of data.
  DiffAttr_t  m_pDataAttr[ 1 ];

  // This variable is used to initialize new interests when local subscriptions are
  // made.
  // Need this. Set it in the start() function.
  DiffAttr_t  m_pStdAttr[ TD_NUM_STANDARD_INTEREST_ATTRS  ];

} MdOppGradient_state_t;

typedef struct Mdiff_state_s {
  uint16_t MD_LOCAL_ADDRESS; // My interface ID. Set after setting up link.
  uint16_t MD_BCAST_ADDR;
  uint32_t addr_base; // stupid hack
  status_context_t * status_ref;
  status_context_t * grad_ref;
  pd_context_t * filter_pd_ref;
  pd_context_t * app_pd_ref;
  lu_context_t * link_ref;
  MdForwarder_state_t * MdForwarder;
  MdOppGradient_state_t * MdOppGradient;
  neighbor_t * nb_list;
  int nb_count;
  
} Mdiff_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

  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