1 
2 /*----------------------------------------------------------------------------
3  *
4  * Name:	igate.h
5  *
6  * Purpose:	Interface to the Internet Gateway functions.
7  *
8  *-----------------------------------------------------------------------------*/
9 
10 
11 #ifndef IGATE_H
12 #define IGATE_H 1
13 
14 
15 #include "ax25_pad.h"
16 #include "digipeater.h"
17 #include "audio.h"
18 
19 
20 #define DEFAULT_IGATE_PORT 14580
21 
22 
23 
24 struct igate_config_s {
25 
26 /*
27  * For logging into the IGate server.
28  */
29 	char t2_server_name[40];	/* Tier 2 IGate server name. */
30 
31 	int t2_server_port;		/* Typically 14580. */
32 
33 	char t2_login[AX25_MAX_ADDR_LEN];/* e.g. WA9XYZ-15 */
34 					/* Note that the ssid could be any two alphanumeric */
35 					/* characters not just 1 thru 15. */
36 					/* Could be same or different than the radio call(s). */
37 					/* Not sure what the consequences would be. */
38 
39 	char t2_passcode[8];		/* Max. 5 digits. Could be "-1". */
40 
41 	char *t2_filter;		/* Optional filter for IS -> RF direction. */
42 					/* This is the "server side" filter. */
43 					/* A better name would be subscription or something */
44 					/* like that because we can only ask for more. */
45 
46 /*
47  * For transmitting.
48  */
49 	int tx_chan;			/* Radio channel for transmitting. */
50 					/* 0=first, etc.  -1 for none. */
51 					/* Presently IGate can transmit on only a single channel. */
52 					/* A future version might generalize this.  */
53 					/* Each transmit channel would have its own client side filtering. */
54 
55 	char tx_via[80];		/* VIA path for transmitting third party packets. */
56 					/* Usual text representation.  */
57 					/* Must start with "," if not empty so it can */
58 					/* simply be inserted after the destination address. */
59 
60 	int max_digi_hops;		/* Maximum number of digipeater hops possible for via path. */
61 					/* Derived from the SSID when last character of address is a digit. */
62 					/* e.g.  "WIDE1-1,WIDE5-2" would be 3. */
63 					/* This is useful to know so we can determine how many */
64 					/* stations we might be able to reach. */
65 
66 	int tx_limit_1;			/* Max. packets to transmit in 1 minute. */
67 
68 	int tx_limit_5;			/* Max. packets to transmit in 5 minutes. */
69 
70 	int igmsp;			/* Number of message sender position reports to allow. */
71 					/* Common practice is to default to 1.  */
72 					/* We allow additional flexibility of 0 to disable feature */
73 					/* or a small number to allow more. */
74 
75 /*
76  * Receiver to IS data options.
77  */
78 	int rx2ig_dedupe_time;		/* seconds.  0 to disable. */
79 
80 /*
81  * Special SATgate mode to delay packets heard directly.
82  */
83 	int satgate_delay;		/* seconds.  0 to disable. */
84 };
85 
86 
87 #define IGATE_TX_LIMIT_1_DEFAULT 6
88 #define IGATE_TX_LIMIT_1_MAX     20
89 
90 #define IGATE_TX_LIMIT_5_DEFAULT 20
91 #define IGATE_TX_LIMIT_5_MAX     80
92 
93 #define IGATE_RX2IG_DEDUPE_TIME 0		/* Issue 85.  0 means disable dupe checking in RF>IS direction. */
94 						/* See comments in rx_to_ig_remember & rx_to_ig_allow. */
95 						/* Currently there is no configuration setting to change this. */
96 
97 #define DEFAULT_SATGATE_DELAY 10
98 #define MIN_SATGATE_DELAY 5
99 #define MAX_SATGATE_DELAY 30
100 
101 
102 /* Call this once at startup */
103 
104 void igate_init (struct audio_s *p_audio_config, struct igate_config_s *p_igate_config, struct digi_config_s *p_digi_config, int debug_level);
105 
106 /* Call this with each packet received from the radio. */
107 
108 void igate_send_rec_packet (int chan, packet_t recv_pp);
109 
110 /* This when digipeater transmits.  Set bydigi to 1 . */
111 
112 void ig_to_tx_remember (packet_t pp, int chan, int bydigi);
113 
114 
115 
116 /* Get statistics for IGATE status beacon. */
117 
118 int igate_get_msg_cnt (void);
119 
120 int igate_get_pkt_cnt (void);
121 
122 int igate_get_upl_cnt (void);
123 
124 int igate_get_dnl_cnt (void);
125 
126 
127 
128 #endif
129