Show block.h syntax highlighted
#ifndef __ADP_BLOCK_H__
#define __ADP_BLOCK_H__
#include <glib.h>
#include <stdint.h>
#include "libmisc/misc.h"
/*
* If you change this, you must update block_uid_unparse() in src/block.c
*/
#define BLOCK_UID_NAME_LEN 32
#define MAX_HOPS 100
#define PREFIX SSYNC_MULTIHOP_PREFIX
#define BLOCK_DIR_PATTERN "/tmp/RDD_ID_%d/blocks_repository"
#define PKT_TYPE_RDD_BLOCK PKT_TYPE_USER(1)
#define PUBLISH_BLOCKS_TIMER 10000
#define UPDATE_BLOCKS_TIMER 10000
#define NEEDBLOCK_TIMER 10000
#define ACKBLOCK_TIMER 10000
#define DELETE_TIMER 15000
#define REREAD_PERIOD 5000
#define BROADCAST_TIMER 1000
#define DELAY_PER_FILE 70
#define MIN_DELAY 2000
#define TIMER_DELAY(files) (MIN_DELAY + files * DELAY_PER_FILE)
#define MHSYNC_ONE_HOP 1
#define REFRACTORY 2000
typedef struct
{
uint32_t node_id; // Originating node
char name[BLOCK_UID_NAME_LEN]; // Globally Unique File name (no directory)
uint32_t total_length; // Total length in bytes
} __attribute__ ((packed)) block_uid_t;
/*
* If you change this, you must update block_unparse() in src/block.c
*/
typedef struct
{
block_uid_t uid; // Globally Unique Identifier for block
uint32_t offset; // Offset into block
uint32_t length; // Length of this segment
} __attribute__ ((packed)) block_t;
typedef void (*block_unparse_fp) (buf_t * buf, void *entry, int len,
char *indent);
void block_unparse (buf_t * buf, const void *entry, const char *indent);
void
block_uid_unparse (buf_t * buf, const block_uid_t * buid, const char *indent);
// Assumes that if uid.name's are the same, then the uid.total_lengths
// are the same.
gint
block_uid_GCompareData (gconstpointer a, gconstpointer b, gpointer user_data);
gint
block_GCompareData (gconstpointer a, gconstpointer b, gpointer user_data);
void block_GDestroyNotify (gpointer data);
void block_remove_array_from_tree (GArray * array, GTree * tree);
gboolean block_GTraverse (gpointer key, gpointer value, gpointer data);
void block_append_tree_to_array (GTree * tree, GArray ** array_ref);
GArray *block_tree_to_array (GTree * tree);
block_t *block_get_from_disk (const char *blocks_dir,
const block_t * key_block);
void block_write_to_disk (const char *blocks_dir, const block_t * block);
void block_generic_shutdown (void *data);
int block_delete_from_disk (const char *blocks_dir, const block_t * block);
int
block_isempty(block_t * block);
block_t *
block_new_empty();
block_t
block_create_empty();
void
block_remove_empty_from_tree (GTree * tree);
GTree *
block_array_to_array_tree(GArray * array);
void
bufprintf_file_state(buf_t * buf, GArray * array, int segments);
void
block_pretty_bufprintf_array(buf_t * buf, GArray * array);
#endif
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
ackblock.h
block.h
block_macros.h
haveblock.h
ioutils.h
needblock.h
rddhop.h