1 
2 
3 #ifndef DIGIPEATER_H
4 #define DIGIPEATER_H 1
5 
6 #include "regex.h"
7 
8 #include "direwolf.h"		/* for MAX_CHANS */
9 #include "ax25_pad.h"		/* for packet_t */
10 #include "audio.h"		/* for radio channel properties */
11 
12 
13 /*
14  * Information required for digipeating.
15  *
16  * The configuration file reader fills in this information
17  * and it is passed to digipeater_init at application start up time.
18  */
19 
20 
21 struct digi_config_s {
22 
23 
24 	int	dedupe_time;	/* Don't digipeat duplicate packets */
25 				/* within this number of seconds. */
26 
27 #define DEFAULT_DEDUPE 30
28 
29 /*
30  * Rules for each of the [from_chan][to_chan] combinations.
31  */
32 
33 	regex_t	alias[MAX_CHANS][MAX_CHANS];
34 
35 	regex_t	wide[MAX_CHANS][MAX_CHANS];
36 
37 	int	enabled[MAX_CHANS][MAX_CHANS];
38 
39 	enum preempt_e { PREEMPT_OFF, PREEMPT_DROP, PREEMPT_MARK, PREEMPT_TRACE } preempt[MAX_CHANS][MAX_CHANS];
40 
41 	char *filter_str[MAX_CHANS+1][MAX_CHANS+1];
42 						// NULL or optional Packet Filter strings such as "t/m".
43 						// Notice the size of arrays is one larger than normal.
44 						// That extra position is for the IGate.
45 
46 	int regen[MAX_CHANS][MAX_CHANS];	// Regenerate packet.
47 						// Sort of like digipeating but passed along unchanged.
48 };
49 
50 /*
51  * Call once at application start up time.
52  */
53 
54 extern void digipeater_init (struct audio_s *p_audio_config, struct digi_config_s *p_digi_config);
55 
56 /*
57  * Call this for each packet received.
58  * Suitable packets will be queued for transmission.
59  */
60 
61 extern void digipeater (int from_chan, packet_t pp);
62 
63 void digi_regen (int from_chan, packet_t pp);
64 
65 
66 /* Make statistics available. */
67 
68 int digipeater_get_count (int from_chan, int to_chan);
69 
70 
71 #endif
72 
73 /* end digipeater.h */
74 
75