tor  master
Macros | Typedefs | Functions
replaycache.h File Reference

Header file for replaycache.c. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define replaycache_free(r)   FREE_AND_NULL(replaycache_t, replaycache_free_, (r))
 

Typedefs

typedef struct replaycache_s replaycache_t
 

Functions

void replaycache_free_ (replaycache_t *r)
 
replaycache_t * replaycache_new (time_t horizon, time_t interval)
 
int replaycache_add_and_test (replaycache_t *r, const void *data, size_t len)
 
int replaycache_add_test_and_elapsed (replaycache_t *r, const void *data, size_t len, time_t *elapsed)
 
void replaycache_scrub_if_needed (replaycache_t *r)
 

Detailed Description

Header file for replaycache.c.

Function Documentation

◆ replaycache_add_and_test()

int replaycache_add_and_test ( replaycache_t *  r,
const void *  data,
size_t  len 
)

Test the buffer of length len point to by data against the replay cache r; the digest of the buffer will be added to the cache at the current time, and the function will return 1 if it was already seen within the cache's horizon, or 0 otherwise.

Here is the call graph for this function:

◆ replaycache_add_test_and_elapsed()

int replaycache_add_test_and_elapsed ( replaycache_t *  r,
const void *  data,
size_t  len,
time_t *  elapsed 
)

Like replaycache_add_and_test(), but if it's a hit also return the time elapsed since this digest was last seen.

Here is the call graph for this function:

◆ replaycache_free_()

void replaycache_free_ ( replaycache_t *  r)

Free the replaycache r and all of its entries.

◆ replaycache_new()

replaycache_t* replaycache_new ( time_t  horizon,
time_t  interval 
)

Allocate a new, empty replay detection cache, where horizon is the time for entries to age out and interval is the time after which the cache should be scrubbed for old entries.

◆ replaycache_scrub_if_needed()

void replaycache_scrub_if_needed ( replaycache_t *  r)

Scrub aged entries out of r if sufficiently long has elapsed since r was last scrubbed.

Here is the call graph for this function: