tor
master
|
Header file for replaycache.c. More...
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) |
Header file for replaycache.c.
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.
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.
void replaycache_free_ | ( | replaycache_t * | r | ) |
Free the replaycache r and all of its entries.
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.
void replaycache_scrub_if_needed | ( | replaycache_t * | r | ) |
Scrub aged entries out of r if sufficiently long has elapsed since r was last scrubbed.