-
Notifications
You must be signed in to change notification settings - Fork 26
/
master_server.h
153 lines (139 loc) · 3.55 KB
/
master_server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Linux DMR Master server
Copyright (C) 2014 Wim Hofman
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <pthread.h>
#include <strings.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>
#include <sqlite3.h>
#include <iconv.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <math.h>
#include <regex.h>
struct repeater{
struct sockaddr_in address;
int sockfd;
bool dmrOnline;
bool rdacOnline;
bool rdacUpdated;
bool sending[3];
int id;
time_t lastPTPPConnect;
time_t lastDMRConnect;
time_t lastRDACConnect;
unsigned char callsign[17];
unsigned char txFreq[10];
unsigned char shift[7];
unsigned char hardware[11];
unsigned char firmware[14];
unsigned char mode[4];
unsigned char language[50];
unsigned char geoLocation[20];
unsigned char aprsPass[6];
unsigned char aprsBeacon[100];
unsigned char aprsPHG[7];
};
struct idInfo{
int radioId;
char callsign[32];
char name[32];
long aprsTimeStamp;
char aprsSuffix[4];
char aprsBeacon[100];
int aprsSymbol;
int messageStore;
};
struct masterData{
struct sockaddr_in address;
int sockfd;
bool online;
bool sending[3];
};
struct masterInfo{
char ownName[20];
char ownCountryCode[5];
char ownRegion[2];
char sMasterIp[100];
char sMasterPort[6];
char announcedCC1[80];
char announcedCC2[80];
int ownCCInt;
int ownRegionInt;
int sMasterTS1GroupCount;
int sMasterTS2GroupCount;
int repTS1GroupCount;
int repTS2GroupCount;
};
struct ts{
unsigned char repTS1[100];
unsigned char repTS2[100];
unsigned char sMasterTS1[100];
unsigned char sMasterTS2[100];
};
struct sockInfo{
struct sockaddr_in address;
int port;
};
struct gpsCoordinates{
int radioId;
unsigned char latitude[9];
unsigned char longitude[10];
unsigned char speed[4];
unsigned char heading[4];
};
typedef enum {VOICE, DATA, IDLE} state;
extern struct repeater repeaterList[100];
extern struct repeater rdacList[100];
extern struct masterData sMaster;
extern struct masterInfo master;
extern struct ts tsInfo;
extern char databaseServer[50];
extern char databaseUser[20];
extern char databasePassword[20];
extern char database[20];
extern struct sockaddr_in discardList[100];
extern int highestRepeater;
extern int servicePort;
extern int dmrPort;
extern int baseDmrPort;
extern int rdacPort;
extern int baseRdacPort;
extern int maxRepeaters;
extern int echoId;
extern int rrsGpsId;
extern state dmrState[3];
extern int (*sMasterTS1List)[2];
extern int (*sMasterTS2List)[2];
extern int (*repTS1List)[2];
extern int (*repTS2List)[2];
extern int ownCCInt;
extern int ownRegionInt;
extern char version[5];
extern sqlite3 *db;
extern int restart;
extern char page[50];
extern char aprsUrl[100];
extern char aprsPort[7];