/common/stringring.h
#ifndef _STRINGRING_H
#define _STRINGRING_H

#include <stdint.h>

#define STRINGRING_DATA_SIZE 32
#define STRINGRING_N_ENTRIES 102

struct stringring_block {
	uint8_t counter;
	uint8_t reserved[15];
	struct {
		uint64_t timestamp;
		uint8_t data[STRINGRING_DATA_SIZE];
	} entries[STRINGRING_N_ENTRIES];
};

struct stringring {
	int fd;
	struct stringring_block *sb;
};

struct stringring * stringring_open(const char *filename);
void stringring_close(struct stringring *sr);
int stringring_add(struct stringring *sr, const char *data);
int stringring_find(struct stringring *sr, const char *data, unsigned int max_age);
int stringring_remove(struct stringring *sr, const char *data);
int stringring_touch(struct stringring *sr, const char *data);
int stringring_clear(struct stringring *sr);

#endif /* _STRINGRING_H */