tor  0.4.2.0-alpha-dev
Data Structures | Macros | Typedefs | Functions
fp_pair.h File Reference

Go to the source code of this file.

Data Structures

struct  fp_pair_t
 

Macros

#define fp_pair_map_free(map, free_val)
 

Typedefs

typedef struct fp_pair_map_entry_s fp_pair_map_entry_t
 
typedef struct fp_pair_map_s fp_pair_map_t
 
typedef fp_pair_map_entry_tfp_pair_map_iter_t
 

Functions

fp_pair_map_tfp_pair_map_new (void)
 
void * fp_pair_map_set (fp_pair_map_t *map, const fp_pair_t *key, void *val)
 
void * fp_pair_map_set_by_digests (fp_pair_map_t *map, const char *first, const char *second, void *val)
 
void * fp_pair_map_get (const fp_pair_map_t *map, const fp_pair_t *key)
 
void * fp_pair_map_get_by_digests (const fp_pair_map_t *map, const char *first, const char *second)
 
void * fp_pair_map_remove (fp_pair_map_t *map, const fp_pair_t *key)
 
void fp_pair_map_free_ (fp_pair_map_t *map, void(*free_val)(void *))
 
int fp_pair_map_isempty (const fp_pair_map_t *map)
 
int fp_pair_map_size (const fp_pair_map_t *map)
 
fp_pair_map_iter_tfp_pair_map_iter_init (fp_pair_map_t *map)
 
fp_pair_map_iter_tfp_pair_map_iter_next (fp_pair_map_t *map, fp_pair_map_iter_t *iter)
 
fp_pair_map_iter_tfp_pair_map_iter_next_rmv (fp_pair_map_t *map, fp_pair_map_iter_t *iter)
 
void fp_pair_map_iter_get (fp_pair_map_iter_t *iter, fp_pair_t *key_out, void **val_out)
 
int fp_pair_map_iter_done (fp_pair_map_iter_t *iter)
 
void fp_pair_map_assert_ok (const fp_pair_map_t *map)
 

Detailed Description

Header file for fp_pair.c.

Definition in file fp_pair.h.

Macro Definition Documentation

◆ fp_pair_map_free

#define fp_pair_map_free (   map,
  free_val 
)
Value:
do { \
fp_pair_map_free_((map), (free_val)); \
(map) = NULL; \
} while (0)

Definition at line 36 of file fp_pair.h.

Function Documentation

◆ fp_pair_map_assert_ok()

void fp_pair_map_assert_ok ( const fp_pair_map_t map)

Assert if anything has gone wrong with the internal representation of map.

Definition at line 311 of file fp_pair.c.

References tor_assert().

◆ fp_pair_map_free_()

void fp_pair_map_free_ ( fp_pair_map_t map,
void(*)(void *)  free_val 
)

Remove all entries from map, and deallocate storage for those entries. If free_val is provided, it is invoked on every value in map.

Definition at line 199 of file fp_pair.c.

References tor_assert(), and tor_free.

◆ fp_pair_map_get()

void* fp_pair_map_get ( const fp_pair_map_t map,
const fp_pair_t key 
)

Return the current value associated with key, or NULL if no value is set.

Definition at line 133 of file fp_pair.c.

References tor_assert().

Referenced by fp_pair_map_get_by_digests().

◆ fp_pair_map_get_by_digests()

void* fp_pair_map_get_by_digests ( const fp_pair_map_t map,
const char *  first,
const char *  second 
)

Return the current value associated the key (first, second), or NULL if no value is set.

Definition at line 154 of file fp_pair.c.

References DIGEST_LEN, fp_pair_map_get(), and tor_assert().

◆ fp_pair_map_isempty()

int fp_pair_map_isempty ( const fp_pair_map_t map)

Return true iff map has no entries.

Definition at line 221 of file fp_pair.c.

References tor_assert().

◆ fp_pair_map_iter_done()

int fp_pair_map_iter_done ( fp_pair_map_iter_t iter)

Return true iff iter has advanced past the last entry of its map.

Definition at line 301 of file fp_pair.c.

◆ fp_pair_map_iter_get()

void fp_pair_map_iter_get ( fp_pair_map_iter_t iter,
fp_pair_t key_out,
void **  val_out 
)

Set *key_out and *val_out to the current entry pointed to by iter.

Definition at line 287 of file fp_pair.c.

References tor_assert().

◆ fp_pair_map_iter_init()

fp_pair_map_iter_t* fp_pair_map_iter_init ( fp_pair_map_t map)

return an iterator pointing to the start of map.

Definition at line 243 of file fp_pair.c.

References tor_assert().

◆ fp_pair_map_iter_next()

fp_pair_map_iter_t* fp_pair_map_iter_next ( fp_pair_map_t map,
fp_pair_map_iter_t iter 
)

Advance iter a single step to the next entry of map, and return its new value.

Definition at line 255 of file fp_pair.c.

References tor_assert().

◆ fp_pair_map_iter_next_rmv()

fp_pair_map_iter_t* fp_pair_map_iter_next_rmv ( fp_pair_map_t map,
fp_pair_map_iter_t iter 
)

Advance iter a single step to the next entry of map, removing the current entry, and return its new value.

Definition at line 268 of file fp_pair.c.

References tor_assert(), and tor_free.

◆ fp_pair_map_remove()

void* fp_pair_map_remove ( fp_pair_map_t map,
const fp_pair_t key 
)

Remove the value currently associated with key from the map. Return the value if one was set, or NULL if there was no entry for key. The caller must free any storage associated with the returned value.

Definition at line 175 of file fp_pair.c.

References tor_assert(), and tor_free.

◆ fp_pair_map_set()

void* fp_pair_map_set ( fp_pair_map_t map,
const fp_pair_t key,
void *  val 
)

Set the current value for key to val; returns the previous value for key if one was set, or NULL if one was not.

Definition at line 83 of file fp_pair.c.

References tor_assert().

Referenced by fp_pair_map_set_by_digests().

◆ fp_pair_map_set_by_digests()

void* fp_pair_map_set_by_digests ( fp_pair_map_t map,
const char *  first,
const char *  second,
void *  val 
)

Set the current value for the key (first, second) to val; returns the previous value for key if one was set, or NULL if one was not.

Definition at line 114 of file fp_pair.c.

References DIGEST_LEN, fp_pair_map_set(), and tor_assert().

◆ fp_pair_map_size()

int fp_pair_map_size ( const fp_pair_map_t map)

Return the number of items in map.

Definition at line 232 of file fp_pair.c.

References tor_assert().