aliases, not typdefs

pull/14/head
Tom Early 6 years ago
parent a125cb0778
commit 5a61ff3a23

@ -1,6 +1,6 @@
#pragma once #pragma once
/* /*
* Copyright 2017 by Thomas Early, N7TAE * Copyright 2017,2020 by Thomas Early, N7TAE
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@ enum REPLY_TYPE {
}; };
#pragma pack(push,1) #pragma pack(push,1)
typedef struct dvp_register_tag { using SDVAP_REGISTER = struct dvp_register_tag {
uint16_t header; uint16_t header;
union { union {
uint8_t nul; uint8_t nul;
@ -80,7 +80,7 @@ typedef struct dvp_register_tag {
}; };
} frame; } frame;
}; };
} SDVAP_REGISTER; };
#pragma pack(pop) #pragma pack(pop)
class CDVAPDongle class CDVAPDongle

@ -50,7 +50,7 @@
#include "QnetGateway.h" #include "QnetGateway.h"
#include "Utilities.h" #include "Utilities.h"
const std::string IRCDDB_VERSION("QnetGateway-9.2"); const std::string GW_VERSION("QnetGateway-9.3");
extern void dstar_dv_init(); extern void dstar_dv_init();
extern int dstar_dv_decode(const unsigned char *d, int data[3]); extern int dstar_dv_decode(const unsigned char *d, int data[3]);
@ -251,11 +251,11 @@ bool CQnetGateway::ReadConfig(char *cfgFile)
rptr.mod[m].defined = false; rptr.mod[m].defined = false;
} else { } else {
printf("Found Module: %s = '%s'\n", path.c_str(), type.c_str()); printf("Found Module: %s = '%s'\n", path.c_str(), type.c_str());
if (0 == type.compare("dvap")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".DVAP"); } if (0 == type.compare("dvap")) { rptr.mod[m].package_version.assign(GW_VERSION+".DVAP"); }
else if (0 == type.compare("dvrptr")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".DVRPTR"); } else if (0 == type.compare("dvrptr")) { rptr.mod[m].package_version.assign(GW_VERSION+".DVRPTR"); }
else if (0 == type.compare("mmdvmhost")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".Relay"); } else if (0 == type.compare("mmdvmhost")) { rptr.mod[m].package_version.assign(GW_VERSION+".Relay"); }
else if (0 == type.compare("mmdvmmodem")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".Modem"); } else if (0 == type.compare("mmdvmmodem")) { rptr.mod[m].package_version.assign(GW_VERSION+".Modem"); }
else if (0 == type.compare("itap")) { rptr.mod[m].package_version.assign(IRCDDB_VERSION+".ITAP"); } else if (0 == type.compare("itap")) { rptr.mod[m].package_version.assign(GW_VERSION+".ITAP"); }
else { else {
printf("module type '%s' is invalid\n", type.c_str()); printf("module type '%s' is invalid\n", type.c_str());
return true; return true;
@ -304,6 +304,8 @@ bool CQnetGateway::ReadConfig(char *cfgFile)
cfg.GetValue(path+"desc1", estr, rptr.mod[m].desc1, 0, 20); cfg.GetValue(path+"desc1", estr, rptr.mod[m].desc1, 0, 20);
cfg.GetValue(path+"desc2", estr, rptr.mod[m].desc2, 0, 20); cfg.GetValue(path+"desc2", estr, rptr.mod[m].desc2, 0, 20);
cfg.GetValue(path+"url", estr, rptr.mod[m].url, 0, 80); cfg.GetValue(path+"url", estr, rptr.mod[m].url, 0, 80);
if (rptr.mod[m].desc1.empty()) rptr.mod[m].desc2.assign(GW_VERSION);
if (rptr.mod[m].desc2.empty()) rptr.mod[m].desc2.assign("by N7TAE");
rptr.mod[m].desc = trim_copy(rptr.mod[m].desc1) + " " + trim_copy(rptr.mod[m].desc2); rptr.mod[m].desc = trim_copy(rptr.mod[m].desc1) + " " + trim_copy(rptr.mod[m].desc2);
} }
} }
@ -1973,7 +1975,7 @@ void CQnetGateway::Process()
if (keep_running) if (keep_running)
printf("get_irc_data thread[%d] started\n", i); printf("get_irc_data thread[%d] started\n", i);
ii[i]->kickWatchdog(IRCDDB_VERSION); ii[i]->kickWatchdog(GW_VERSION);
} }
} }
@ -2528,7 +2530,7 @@ bool CQnetGateway::Init(char *cfgfile)
for (int j=0; j<2; j++) { for (int j=0; j<2; j++) {
if (ircddb[j].ip.empty()) if (ircddb[j].ip.empty())
continue; continue;
ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], IRCDDB_VERSION.c_str()); ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str());
bool ok = ii[j]->open(); bool ok = ii[j]->open();
if (!ok) { if (!ok) {
printf("%s open failed\n", ircddb[j].ip.c_str()); printf("%s open failed\n", ircddb[j].ip.c_str());
@ -2904,7 +2906,7 @@ bool CQnetGateway::verify_gps_csum(char *gps_text, char *csum_text)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
printf("VERSION %s\n", IRCDDB_VERSION.c_str()); printf("VERSION %s\n", GW_VERSION.c_str());
if (argc != 2) { if (argc != 2) {
printf("usage: %s qn.cfg\n", argv[0]); printf("usage: %s qn.cfg\n", argv[0]);
return 1; return 1;

@ -30,13 +30,13 @@
#define CALL_SIZE 8 #define CALL_SIZE 8
#define MAX_DTMF_BUF 32 #define MAX_DTMF_BUF 32
typedef struct to_remote_g2_tag { using STOREMOTEG2 = struct to_remote_g2_tag {
unsigned short streamid; unsigned short streamid;
CSockAddress toDstar; CSockAddress toDstar;
time_t last_time; time_t last_time;
} STOREMOTEG2; };
typedef struct torepeater_tag { using STOREPEATER = struct torepeater_tag {
// help with header re-generation // help with header re-generation
SDSVT saved_hdr; // repeater format SDSVT saved_hdr; // repeater format
CSockAddress saved_addr; CSockAddress saved_addr;
@ -45,9 +45,9 @@ typedef struct torepeater_tag {
CSockAddress addr; CSockAddress addr;
time_t last_time; time_t last_time;
unsigned char sequence; unsigned char sequence;
} STOREPEATER; };
typedef struct band_txt_tag { using SBANDTXT = struct band_txt_tag {
unsigned short streamID; unsigned short streamID;
unsigned char flags[3]; unsigned char flags[3];
char lh_mycall[CALL_SIZE + 1]; char lh_mycall[CALL_SIZE + 1];
@ -73,7 +73,7 @@ typedef struct band_txt_tag {
int num_dv_frames; int num_dv_frames;
int num_dv_silent_frames; int num_dv_silent_frames;
int num_bit_errors; int num_bit_errors;
} SBANDTXT; };
class CQnetGateway { class CQnetGateway {
public: public:

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 by Thomas A. Early N7TAE * Copyright (C) 2018-2020 by Thomas A. Early N7TAE
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -43,7 +43,7 @@ enum REPLY_TYPE {
// Icom Terminal and Access Point Mode data structure // Icom Terminal and Access Point Mode data structure
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct itap_tag { using SITAP = struct itap_tag {
unsigned char length; unsigned char length;
// 41 for header // 41 for header
// 16 for voice // 16 for voice
@ -73,7 +73,7 @@ typedef struct itap_tag {
unsigned char text[3]; unsigned char text[3];
} voice; } voice;
}; };
} SITAP; };
#pragma pack(pop) #pragma pack(pop)
class CFrame class CFrame

@ -41,12 +41,12 @@
#define TIMEOUT 50 #define TIMEOUT 50
#define LH_MAX_SIZE 39 #define LH_MAX_SIZE 39
typedef struct refdsvt_tag { using SREFDSVT = struct refdsvt_tag {
unsigned char head[2]; unsigned char head[2];
SDSVT dsvt; SDSVT dsvt;
} SREFDSVT; };
typedef struct to_remote_g2_tag { using STOREMOTE = struct to_remote_g2_tag {
char cs[CALL_SIZE + 1]; char cs[CALL_SIZE + 1];
CSockAddress addr; CSockAddress addr;
char from_mod, to_mod; char from_mod, to_mod;
@ -54,17 +54,17 @@ typedef struct to_remote_g2_tag {
bool auto_link, is_connected; bool auto_link, is_connected;
unsigned short in_streamid; // incoming from remote systems unsigned short in_streamid; // incoming from remote systems
unsigned short out_streamid; // outgoing to remote systems unsigned short out_streamid; // outgoing to remote systems
} STOREMOTE; };
// This is the data payload in the map: inbound_list // This is the data payload in the map: inbound_list
// This is for inbound dongles // This is for inbound dongles
typedef struct inbound_tag { using SINBOUND = struct inbound_tag {
char call[CALL_SIZE + 1]; // the callsign of the remote char call[CALL_SIZE + 1]; // the callsign of the remote
CSockAddress addr; // IP and port of remote CSockAddress addr; // IP and port of remote
short countdown; // if countdown expires, the connection is terminated short countdown; // if countdown expires, the connection is terminated
char mod; // A B C This user talked on this module char mod; // A B C This user talked on this module
char client; // dvap, dvdongle char client; // dvap, dvdongle
} SINBOUND; };
class CQnetLink { class CQnetLink {
public: public:

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 by Thomas A. Early N7TAE * Copyright (C) 2019-2020 by Thomas A. Early N7TAE
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -59,15 +59,15 @@ enum class EHardwareType {
// Icom Terminal and Access Point Mode data structure // Icom Terminal and Access Point Mode data structure
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct version_tag { using SVERSION = struct version_tag {
unsigned char start; unsigned char start;
unsigned char length; unsigned char length;
unsigned char type; unsigned char type;
unsigned char protocol; unsigned char protocol;
unsigned char version[251]; unsigned char version[251];
} SVERSION; };
typedef struct mmodem_tag { using SMODEM = struct mmodem_tag {
unsigned char start; // always 0xEOU unsigned char start; // always 0xEOU
unsigned char length; // 3 - 255 unsigned char length; // 3 - 255
unsigned char type; unsigned char type;
@ -149,7 +149,7 @@ typedef struct mmodem_tag {
unsigned char text[3]; unsigned char text[3];
} voice; } voice;
}; };
} SMODEM; };
#pragma pack(pop) #pragma pack(pop)
class CFrame class CFrame

@ -1,6 +1,6 @@
#pragma once #pragma once
/* /*
* Copyright 2017-2019 by Thomas Early, N7TAE * Copyright 2017-2020 by Thomas Early, N7TAE
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
// for communicating with the g2 gateway on the internal port // for communicating with the g2 gateway on the internal port
#pragma pack(push, 1) // used internally by Icom stacks #pragma pack(push, 1) // used internally by Icom stacks
typedef struct dstr_tag { using SDSTR = struct dstr_tag {
unsigned char pkt_id[4]; // 0 "DSTR" unsigned char pkt_id[4]; // 0 "DSTR"
unsigned short counter; // 4 unsigned short counter; // 4
unsigned char flag[3]; // 6 { 0x73, 0x12, 0x00 } unsigned char flag[3]; // 6 { 0x73, 0x12, 0x00 }
@ -60,12 +60,12 @@ typedef struct dstr_tag {
}; };
} vpkt; } vpkt;
}; };
} SDSTR; };
#pragma pack(pop) #pragma pack(pop)
// for the g2 external port and between QnetGateway programs // for the g2 external port and between QnetGateway programs
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct dsvt_tag { using SDSVT = struct dsvt_tag {
unsigned char title[4]; // 0 "DSVT" unsigned char title[4]; // 0 "DSVT"
unsigned char config; // 4 0x10 is hdr 0x20 is vasd unsigned char config; // 4 0x10 is hdr 0x20 is vasd
unsigned char flaga[3]; // 5 zeros unsigned char flaga[3]; // 5 zeros
@ -88,12 +88,12 @@ typedef struct dsvt_tag {
unsigned char text[3]; // 24 unsigned char text[3]; // 24
} vasd; // voice and slow data total 27 } vasd; // voice and slow data total 27
}; };
} SDSVT; };
#pragma pack(pop) #pragma pack(pop)
// for mmdvm // for mmdvm
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct dsrp_tag { // offset size using SDSRP = struct dsrp_tag { // offset size
unsigned char title[4]; // "DSRP" 0 unsigned char title[4]; // "DSRP" 0
unsigned char tag; // Poll : 0xA 4 unsigned char tag; // Poll : 0xA 4
// Header : busy ? 0x22 : 0x20 // Header : busy ? 0x22 : 0x20
@ -121,12 +121,12 @@ typedef struct dsrp_tag { // offset size
unsigned char ambe[12]; // voice + slow data 9 21 unsigned char ambe[12]; // voice + slow data 9 21
} voice; } voice;
}; };
} SDSRP; };
#pragma pack(pop) #pragma pack(pop)
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct link_family_tag { using SLINKFAMILY = struct link_family_tag {
char title[4]; char title[4];
int family[3]; int family[3];
} SLINKFAMILY; };
#pragma pack(pop) #pragma pack(pop)

@ -1,6 +1,6 @@
#pragma once #pragma once
/* /*
* Copyright 2018-2019 by Thomas Early, N7TAE * Copyright 2018-2020 by Thomas Early, N7TAE
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
typedef struct echo_tag { using SECHO = struct echo_tag {
bool is_linked; bool is_linked;
time_t last_time; time_t last_time;
unsigned short streamid; unsigned short streamid;
@ -25,4 +25,4 @@ typedef struct echo_tag {
char message[24]; char message[24];
SDSVT header; // only used in qnlink (qngateway writes the header to the file) SDSVT header; // only used in qnlink (qngateway writes the header to the file)
char file[FILENAME_MAX + 1]; char file[FILENAME_MAX + 1];
} SECHO; };

@ -30,26 +30,26 @@ enum aprs_level { al_none, al_$1, al_$2, al_c1, al_r1, al_c2, al_csum1, al_csum2
enum slow_level { sl_first, sl_second }; enum slow_level { sl_first, sl_second };
typedef struct portip_tag { using SPORTIP = struct portip_tag {
std::string ip; std::string ip;
int port; int port;
} SPORTIP; };
typedef struct rptr_tag{ using SRPTR = struct aprs_info {
SPORTIP aprs; SPORTIP aprs;
std::string aprs_filter; std::string aprs_filter;
int aprs_hash; int aprs_hash;
int aprs_interval; int aprs_interval;
/* 0=A, 1=B, 2=C */ /* 0=A, 1=B, 2=C */
struct mod_tag { struct aprs_module {
std::string call; /* KJ4NHF-B */ std::string call; /* KJ4NHF-B */
bool defined; bool defined;
std::string band; /* 23cm ... */ std::string band; /* 23cm ... */
double frequency, offset, latitude, longitude, range, agl; double frequency, offset, latitude, longitude, range, agl;
std::string desc1, desc2, desc, url, package_version; std::string desc1, desc2, desc, url, package_version;
} mod[3]; } mod[3];
} SRPTR; };
class CAPRS { class CAPRS {
public: public:

@ -61,8 +61,8 @@ gateway_gate2modemb_d='gate2modemb'
gateway_gate2modemc_d='gate2modemc' gateway_gate2modemc_d='gate2modemc'
gateway_latitude_d=0 # you can leave this unspecified for a mobile rig gateway_latitude_d=0 # you can leave this unspecified for a mobile rig
gateway_longitude_d=0 # like the latitude gateway_longitude_d=0 # like the latitude
gateway_desc1_d='QnetGateway' # maximum of 20 characters, most special symbols are not allowed gateway_desc1_d='' # maximum of 20 characters, most special symbols are not allowed
gateway_desc2_d='by N7TAE' # just like desc1 gateway_desc2_d='' # just like desc1
gateway_url_d='github.com/n7tae/QnetGateway' # 80 characters max gateway_url_d='github.com/n7tae/QnetGateway' # 80 characters max
gateway_find_route_d='' # CSV list of route(s) to load on boot-up (prevents the "not in cache" message) gateway_find_route_d='' # CSV list of route(s) to load on boot-up (prevents the "not in cache" message)

@ -99,7 +99,7 @@
function LastHeardPage() function LastHeardPage()
{ {
echo 'Last Heard:<br><code>', "\n"; echo 'Last Heard:<br><code>', "\n";
$rstr = 'MyCall Sfx URCall Module Gateway Time<br>'; $rstr = 'MyCall/Sfx URCall Module Gateway Last Time<br>';
echo str_replace(' ', '&nbsp;', $rstr), "\n"; echo str_replace(' ', '&nbsp;', $rstr), "\n";
echo '</code><br>', "\n"; echo '</code><br>', "\n";
$dbname = GetCFGValue('dashboard_sql_filename'); $dbname = GetCFGValue('dashboard_sql_filename');
@ -108,7 +108,8 @@
if ($stmnt = $db->prepare()) { if ($stmnt = $db->prepare()) {
if ($result = $stmnt->execute()) { if ($result = $stmnt->execute()) {
while ($row = $result->FetchArray(SQLITE3_NUM)) { while ($row = $result->FetchArray(SQLITE3_NUM)) {
$rstr = $row[0].'/'.$row[1].' '.$row[2].' '.$row[3].' '.$row[4].' '.SecToStrstring($row[4]).'<br>'; $cs = str_pad($trim($row[0])./.$trim($row[1]), 13);
$rstr = $cs.' '.$row[2].' '.$row[3].' '.$row[4].' '.SecToStrstring($row[4]).'<br>';
echo str_replace(' ', '&nbsp;', $rstr), "\n"; echo str_replace(' ', '&nbsp;', $rstr), "\n";
} }
$result->finalize(); $result->finalize();

Loading…
Cancel
Save

Powered by TurnKey Linux.