1 /*
2  *	aprsc
3  *
4  *	(c) Heikki Hannikainen, OH7LZB <hessu@hes.iki.fi>
5  *
6  *     This program is licensed under the BSD license, which can be found
7  *     in the file LICENSE.
8  *
9  */
10 
11 #ifndef DUPECHECK_H
12 #define DUPECHECK_H
13 
14 #include "worker.h"
15 #include "cellmalloc.h"
16 
17 struct dupe_record_t {
18 	struct dupe_record_t *next;
19 	uint32_t hash;
20 	time_t	 t;
21 	int	 dtype; // dupecheck dupe type
22 	int	 len;	// address + payload length
23 	char	*packet;
24 	char	 packetbuf[220]; /* 99.9+ % of time this is enough.. */
25 };
26 
27 #define DUPECHECK_CELL_SIZE sizeof(struct dupe_record_t)
28 
29 #define DTYPE_SPACE_TRIM	1
30 #define DTYPE_STRIP_8BIT	2
31 #define DTYPE_CLEAR_8BIT	3
32 #define DTYPE_SPACED_8BIT	4
33 #define DTYPE_LOWDATA_STRIP	5
34 #define DTYPE_LOWDATA_SPACED	6
35 #define DTYPE_DEL_STRIP		7
36 #define DTYPE_DEL_SPACED	8
37 #define DTYPE_MAX		8
38 
39 extern long long dupecheck_outcount;  /* statistics counter */
40 extern long long dupecheck_dupecount; /* statistics counter */
41 extern long long dupecheck_dupetypes[DTYPE_MAX+1];
42 extern long      dupecheck_cellgauge; /* statistics gauge   */
43 
44 extern int dupecheck_eventfd;
45 
46 extern int  outgoing_lag_report(struct worker_t *self, int*lag, int*dupelag);
47 
48 extern void dupecheck_init(void);
49 extern void dupecheck_start(void);
50 extern void dupecheck_stop(void);
51 extern void dupecheck_atend(void);
52 
53 /* cellmalloc status */
54 #ifndef _FOR_VALGRIND_
55 extern void dupecheck_cell_stats(struct cellstatus_t *cellst);
56 #endif
57 
58 #endif
59