Fix ordering in perl subscription_list
[blerg.git] / common / stringring.h
1 #ifndef _STRINGRING_H
2 #define _STRINGRING_H
3
4 #include <stdint.h>
5
6 #define STRINGRING_DATA_SIZE 32
7 #define STRINGRING_N_ENTRIES 102
8
9 struct stringring_block {
10         uint8_t counter;
11         uint8_t reserved[15];
12         struct {
13                 uint64_t timestamp;
14                 uint8_t data[STRINGRING_DATA_SIZE];
15         } entries[STRINGRING_N_ENTRIES];
16 };
17
18 struct stringring {
19         int fd;
20         struct stringring_block *sb;
21 };
22
23 struct stringring * stringring_open(const char *filename);
24 void stringring_close(struct stringring *sr);
25 int stringring_add(struct stringring *sr, const char *data);
26 int stringring_find(struct stringring *sr, const char *data, unsigned int max_age);
27 int stringring_remove(struct stringring *sr, const char *data);
28 int stringring_touch(struct stringring *sr, const char *data);
29 int stringring_clear(struct stringring *sr);
30
31 #endif /* _STRINGRING_H */