Contiki 2.5
Files | Macros | Functions | Variables
Bloomfilter-based redundancy module

Files

file  redundancy_bloomfilter.c
 Implementation of a bloomfilter-based redundancy module.
 

Macros

#define REDUNDANCE_SIZE   128
 How much RAM can we invest into detecting redundant bundles?
 
#define REDUNDANCE_NUMBER   2
 How many bloomfilter shall we use in parallel?
 
#define REDUNDANCE_LIMIT   100
 How many bundles should go into each of the filters?
 

Functions

uint32_t bloomfilter_get_length ()
 Get the length of each bloomfilter. More...
 
char * bloomfilter_get_start (uint8_t filter)
 Returns the pointer to the start of a bloom filter. More...
 
void bloomfilter_set (uint32_t bit, uint8_t filter)
 Sets a bit in a given bloom filter. More...
 
uint8_t bloomfilter_get (uint32_t bit, uint8_t filter)
 Checks if a certain bit is set in a bloom filter. More...
 
void bloomfilter_clear (uint8_t filter)
 Clears the content of a bloom filter. More...
 
uint8_t redundancy_bloomfilter_check (uint32_t bundle_number)
 checks if bundle was delivered before More...
 
uint8_t redundancy_bloomfilter_set (uint32_t bundle_number)
 saves the bundle in a list of delivered bundles More...
 
void redundancy_bloomfilter_init (void)
 Initialize the bloomfilters and various other state.
 

Variables

char redundance_filters [REDUNDANCE_SIZE]
 Holds the bloomfilter(s)
 
uint8_t redundance_counter = 0
 Counts the number of bundles in a bloom filter.
 
uint8_t redundance_pointer = 0
 Points to the filter that is currently in use.
 

Detailed Description

Function Documentation

void bloomfilter_clear ( uint8_t  filter)

Clears the content of a bloom filter.

Parameters
filterNumber of the bloom filter

Definition at line 157 of file redundancy_bloomfilter.c.

References bloomfilter_get_length(), and bloomfilter_get_start().

Referenced by redundancy_bloomfilter_set().

uint8_t bloomfilter_get ( uint32_t  bit,
uint8_t  filter 
)

Checks if a certain bit is set in a bloom filter.

Parameters
bitOffset of the bit to check
filterNumber of the filter to look into
Returns
1 if set, 0 otherwise

Definition at line 127 of file redundancy_bloomfilter.c.

References bloomfilter_get_start(), and NULL.

Referenced by redundancy_bloomfilter_check().

uint32_t bloomfilter_get_length ( )

Get the length of each bloomfilter.

Returns
Length of each bloomfilter

Definition at line 76 of file redundancy_bloomfilter.c.

References REDUNDANCE_NUMBER, and REDUNDANCE_SIZE.

Referenced by bloomfilter_clear(), and bloomfilter_get_start().

char* bloomfilter_get_start ( uint8_t  filter)

Returns the pointer to the start of a bloom filter.

Parameters
filterNumber of the bloomfilter
Returns
Pointer to the filter

Definition at line 85 of file redundancy_bloomfilter.c.

References bloomfilter_get_length(), NULL, redundance_filters, and REDUNDANCE_NUMBER.

Referenced by bloomfilter_clear(), bloomfilter_get(), and bloomfilter_set().

void bloomfilter_set ( uint32_t  bit,
uint8_t  filter 
)

Sets a bit in a given bloom filter.

Parameters
bitOffset of the bit to set
filterNumber of the bloomfilter

Definition at line 98 of file redundancy_bloomfilter.c.

References bloomfilter_get_start(), and NULL.

Referenced by redundancy_bloomfilter_set().

uint8_t redundancy_bloomfilter_check ( uint32_t  bundle_number)

checks if bundle was delivered before

Parameters
bundlemempointer to bundle
Returns
1 if bundle was delivered before, 0 otherwise

Definition at line 166 of file redundancy_bloomfilter.c.

References bloomfilter_get(), and REDUNDANCE_NUMBER.

uint8_t redundancy_bloomfilter_set ( uint32_t  bundle_number)

saves the bundle in a list of delivered bundles

Parameters
bundlemempointer to bundle
Returns
1 on successor 0 on error

Definition at line 192 of file redundancy_bloomfilter.c.

References bloomfilter_clear(), bloomfilter_set(), redundance_counter, REDUNDANCE_LIMIT, REDUNDANCE_NUMBER, and redundance_pointer.