Merge branch 'icom'

pull/5/head
Tom Early 8 years ago
commit 2e77ba3815

@ -18,7 +18,7 @@
*/
#include <stdint.h>
enum REPLY_TYPE {
RT_TIMEOUT,
RT_ERR,
@ -66,8 +66,8 @@ typedef struct dvp_register_tag {
union {
struct {
unsigned char flag[3];
unsigned char rpt1[8];
unsigned char rpt2[8];
unsigned char rpt1[8];
unsigned char urcall[8];
unsigned char mycall[8];
unsigned char sfx[4];

@ -41,11 +41,13 @@ ALL_PROGRAMS=qngateway qnlink qnremote qnvoice qnrelay qndvap qndvrptr
MDV_PROGRAMS=qngateway qnlink qnremote qnvoice qnrelay
DVP_PROGRAMS=qngateway qnlink qnremote qnvoice qndvap
DVR_PROGRAMS=qngateway qnlink qnremote qnvoice qndvrptr
ICM_PROGRAMS=qngateway qnlink qnremote qnvoice
all : $(ALL_PROGRAMS)
mmdvm : $(MDV_PROGRAMS)
dvap : $(DVP_PROGRAMS)
dvrptr : $(DVR_PROGRAMS)
icom : $(ICM_PROGRAMS)
qngateway : $(IRCOBJS) QnetGateway.o aprs.o
g++ $(CPPFLAGS) -o qngateway QnetGateway.o aprs.o $(IRCOBJS) $(LDFLAGS) -pthread
@ -74,7 +76,7 @@ qnvoice : QnetVoice.o Random.o
.PHONY: clean
clean:
$(RM) $(OBJS) $(DEPS) $(PROGRAMS)
$(RM) $(OBJS) $(DEPS) $(ALL_PROGRAMS)
-include $(DEPS)
@ -103,6 +105,25 @@ install : $(MDV_PROGRAMS) gwys.txt qn.cfg
systemctl daemon-reload
systemctl start qnrelay.service
installicom : $(ICM_PROGRAMS) gwys.txt qn.cfg
######### QnetGateway #########
/bin/cp -f qngateway $(BINDIR)
/bin/cp -f qnremote qnvoice $(BINDIR)
/bin/ln -s $(shell pwd)/qn.cfg $(CFGDIR)
/bin/cp -f system/qngateway.service $(SYSDIR)
systemctl enable qngateway.service
systemctl daemon-reload
systemctl start qngateway.service
######### QnetLink #########
/bin/cp -f qnlink $(BINDIR)
/bin/cp -f announce/*.dat $(CFGDIR)
/bin/ln -s $(shell pwd)/gwys.txt $(CFGDIR)
/bin/cp -f exec_?.sh $(CFGDIR)
/bin/cp -f system/qnlink.service $(SYSDIR)
systemctl enable qnlink.service
systemctl daemon-reload
systemctl start qnlink.service
installdvap : $(DVP_PROGRAMS) gwys.txt qn.cfg
######### QnetGateway #########
/bin/cp -f qngateway $(BINDIR)
@ -161,7 +182,7 @@ installdtmf : qndtmf
systemctl start qndtmf.service
installmmdvm : $(MMPATH)/MMDVMHost $(MMPATH)/MMDVM.qn
( /bin/cp -f $(MMPATH)/MMDVMHost $(BINDIR) )
/bin/cp -f $(MMPATH)/MMDVMHost $(BINDIR)
/bin/ln -s $(shell pwd)/$(MMPATH)/MMDVM.qn $(CFGDIR)
/bin/cp -f system/mmdvm.service $(SYSDIR)
/bin/cp -f system/mmdvm.timer $(SYSDIR)
@ -208,6 +229,30 @@ uninstall :
/bin/rm -f $(BINDIR)/qnrelay
systemctl daemon-reload
uninstallicom :
######### QnetGateway #########
systemctl stop qngateway.service
systemctl disable qngateway.service
/bin/rm -f $(SYSDIR)/qngateway.service
/bin/rm -f $(BINDIR)/qngateway
/bin/rm -f $(BINDIR)/qnremote
/bin/rm -f $(BINDIR)/qnvoice
/bin/rm -f $(CFGDIR)/qn.cfg
######### QnetLink #########
systemctl stop qnlink.service
systemctl disable qnlink.service
/bin/rm -f $(SYSDIR)/qnlink.service
/bin/rm -f $(BINDIR)/qnlink
/bin/rm -f $(CFGDIR)/already_linked.dat
/bin/rm -f $(CFGDIR)/already_unlinked.dat
/bin/rm -f $(CFGDIR)/failed_linked.dat
/bin/rm -f $(CFGDIR)/id.dat
/bin/rm -f $(CFGDIR)/linked.dat
/bin/rm -f $(CFGDIR)/unlinked.dat
/bin/rm -f $(CFGDIR)/RPT_STATUS.txt
/bin/rm -f $(CFGDIR)/gwys.txt
/bin/rm -f $(CFGDIR)/exec_?.sh
uninstalldvap :
######### QnetGateway #########
systemctl stop qngateway.service

@ -402,12 +402,12 @@ static void readFrom20000()
}
/* check the module and gateway */
if (net_buf.vpkt.hdr.r2[7] != RPTR_MOD) {
if (net_buf.vpkt.hdr.r1[7] != RPTR_MOD) {
FD_CLR(insock, &readfd);
break;
}
memcpy(net_buf.vpkt.hdr.r1, OWNER, 7);
net_buf.vpkt.hdr.r1[7] = 'G';
memcpy(net_buf.vpkt.hdr.r2, OWNER, 7);
net_buf.vpkt.hdr.r2[7] = 'G';
if (memcmp(RPTR, OWNER, RPTR_SIZE) != 0) {
// restriction mode
@ -447,7 +447,7 @@ static void readFrom20000()
net_buf.vpkt.streamid,
net_buf.vpkt.hdr.flag[0], net_buf.vpkt.hdr.flag[1], net_buf.vpkt.hdr.flag[2],
net_buf.vpkt.hdr.my, net_buf.vpkt.hdr.nm, net_buf.vpkt.hdr.ur,
net_buf.vpkt.hdr.r2, net_buf.vpkt.hdr.r1);
net_buf.vpkt.hdr.r1, net_buf.vpkt.hdr.r2);
/* save the streamid that is winning */
streamid = net_buf.vpkt.streamid;
@ -945,7 +945,7 @@ static void ReadDVAPThread()
printf("From DVAP: flags=%02x:%02x:%02x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s\n",
dr.frame.hdr.flag[0], dr.frame.hdr.flag[1], dr.frame.hdr.flag[2],
dr.frame.hdr.mycall, dr.frame.hdr.sfx, dr.frame.hdr.urcall,
dr.frame.hdr.rpt2, dr.frame.hdr.rpt1);
dr.frame.hdr.rpt1, dr.frame.hdr.rpt2);
ok = true;
@ -971,12 +971,14 @@ static void ReadDVAPThread()
}
}
memcpy(&net_buf.vpkt.hdr, dr.frame.hdr.flag, 41); // copy the header
memcpy(&net_buf.vpkt.hdr, dr.frame.hdr.flag, 41); // copy the header, but...
memcpy(net_buf.vpkt.hdr.r1, dr.frame.hdr.rpt1, 8); // swap r1 <--> r2
memcpy(net_buf.vpkt.hdr.r2, dr.frame.hdr.rpt2, 8); // Internet Labs DVAP Dongle Tech. Ref. V 1.01 has it backwards!
/* RPT1 must always be the repeater + module */
memcpy(net_buf.vpkt.hdr.r1, RPTR_and_MOD, 8);
/* copy RPT2 */
memcpy(net_buf.vpkt.hdr.r2, dr.frame.hdr.rpt1, 8);
memcpy(net_buf.vpkt.hdr.r2, dr.frame.hdr.rpt2, 8);
/* RPT2 must also be valid */
if ((net_buf.vpkt.hdr.r2[7] == 'A') ||

File diff suppressed because it is too large Load Diff

@ -85,7 +85,12 @@ class CQnetGateway {
public:
CQnetGateway();
~CQnetGateway();
void process();
int init(char *cfgfile);
private:
bool is_icom, is_not_icom;
SPORTIP g2_internal, g2_external, g2_link, ircddb;
std::string OWNER, owner, local_irc_ip, status_file, dtmf_dir, dtmf_file, echotest_dir, irc_pass;
@ -155,10 +160,10 @@ private:
// read configuration file
bool read_config(char *);
bool get_value(const Config &cfg, const char *path, int &value, int min, int max, int default_value);
bool get_value(const Config &cfg, const char *path, double &value, double min, double max, double default_value);
bool get_value(const Config &cfg, const char *path, bool &value, bool default_value);
bool get_value(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value);
bool get_value(const Config &cfg, const std::string path, int &value, int min, int max, int default_value);
bool get_value(const Config &cfg, const std::string path, double &value, double min, double max, double default_value);
bool get_value(const Config &cfg, const std::string path, bool &value, bool default_value);
bool get_value(const Config &cfg, const std::string path, std::string &value, int min, int max, const char *default_value);
/* aprs functions, borrowed from my retired IRLP node 4201 */
void gps_send(short int rptr_idx);
@ -169,8 +174,4 @@ private:
void set_dest_rptr(int mod_ndx, char *dest_rptr);
bool validate_csum(SBANDTXT &bt, bool is_gps);
public:
void process();
int init(char *cfgfile);
};

@ -41,6 +41,8 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <iostream>
#include <fstream>
#include <future>
#include <exception>
#include <atomic>
@ -197,7 +199,7 @@ void CQnetLink::RptrAckThread(char *arg)
dsvt.flagb[1] = 0x1;
dsvt.streamid = htons(streamid_raw);
dsvt.counter = 0x80;
dsvt.ctrl = 0x80;
dsvt.hdr.flag[0] = 0x1;
dsvt.hdr.flag[1] = dsvt.hdr.flag[2] = 0x0;
@ -223,7 +225,7 @@ void CQnetLink::RptrAckThread(char *arg)
/* start sending silence + announcement text */
for (int i=0; i<10; i++) {
dsvt.counter = (unsigned char)i;
dsvt.ctrl = (unsigned char)i;
switch (i) {
case 0:
dsvt.vasd.text[0] = 0x55;
@ -271,7 +273,7 @@ void CQnetLink::RptrAckThread(char *arg)
dsvt.vasd.text[2] = RADIO_ID[19] ^ 0x93;
break;
case 9:
dsvt.counter |= 0x40;
dsvt.ctrl |= 0x40;
dsvt.vasd.text[0] = 0x16;
dsvt.vasd.text[1] = 0x29;
dsvt.vasd.text[2] = 0xf5;
@ -682,6 +684,8 @@ bool CQnetLink::read_config(const char *cfgFile)
if (! get_value(cfg, "file.status", status_file, 2, FILENAME_MAX, "/usr/local/etc/RPTR_STATUS.txt"))
return true;
get_value(cfg, "file.qnvoicefile", qnvoice_file, 2, FILENAME_MAX, "/tmp/qnvoice.txt");
get_value(cfg, "timing.play.delay", delay_between, 9, 25, 19);
get_value(cfg, "link.acknowledge", bool_rptr_ack, true);
@ -1254,6 +1258,26 @@ void CQnetLink::Process()
time(&hb);
}
// play a qnvoice file if it is specified
std::ifstream voicefile(qnvoice_file.c_str(), std::ifstream::in);
if (voicefile) {
char line[FILENAME_MAX];
voicefile.getline(line, FILENAME_MAX);
// trim whitespace
char *start = line;
while (isspace(*start))
start++;
char *end = start + strlen(start) - 1;
while (isspace(*end))
*end-- = (char)0;
// anthing reasonable left?
if (strlen(start) > 2)
audio_notify(start);
//clean-up
voicefile.close();
remove(qnvoice_file.c_str());
}
FD_ZERO(&fdset);
FD_SET(xrf_g2_sock,&fdset);
FD_SET(dcs_g2_sock,&fdset);
@ -1716,7 +1740,7 @@ void CQnetLink::Process()
}
}
} else if (found) { // length is 27
if ((dsvt.counter & 0x40) != 0) {
if ((dsvt.ctrl & 0x40) != 0) {
for (int i=0; i<3; i++) {
if (old_sid[i].sid == dsvt.streamid) {
if (qso_details)
@ -1761,7 +1785,7 @@ void CQnetLink::Process()
sendto(rptr_sock, from_xrf_torptr_brd.title, 27, 0, (struct sockaddr *)&toLocalg2, sizeof(struct sockaddr_in));
}
if (dsvt.counter & 0x40) {
if (dsvt.ctrl & 0x40) {
brd_from_xrf.xrf_streamid = brd_from_xrf.rptr_streamid[0] = brd_from_xrf.rptr_streamid[1] = 0x0;
brd_from_xrf_idx = 0;
}
@ -1796,7 +1820,7 @@ void CQnetLink::Process()
memcpy(dcs_buf + 31, xrf_2_dcs[i].mycall, 8);
memcpy(dcs_buf + 39, xrf_2_dcs[i].sfx, 4);
memcpy(dcs_buf + 43, &dsvt.streamid, 2);
dcs_buf[45] = dsvt.counter; /* cycle sequence */
dcs_buf[45] = dsvt.ctrl; /* cycle sequence */
memcpy(dcs_buf + 46, dsvt.vasd.voice, 12);
dcs_buf[58] = (xrf_2_dcs[i].dcs_rptr_seq >> 0) & 0xff;
@ -1811,7 +1835,7 @@ void CQnetLink::Process()
sendto(dcs_g2_sock, dcs_buf, 100, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(to_remote_g2[i].toDst4));
}
if (dsvt.counter & 0x40) {
if (dsvt.ctrl & 0x40) {
to_remote_g2[i].in_streamid = 0x0;
}
break;
@ -2501,7 +2525,7 @@ void CQnetLink::Process()
}
}
} else if (found) {
if (rdsvt.dsvt.counter & 0x40U) {
if (rdsvt.dsvt.ctrl & 0x40U) {
for (int i=0; i<3; i++) {
if (old_sid[i].sid == rdsvt.dsvt.streamid) {
if (qso_details)
@ -2562,7 +2586,7 @@ void CQnetLink::Process()
sendto(dcs_g2_sock, dcs_buf, 100, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(to_remote_g2[i].toDst4));
}
if (rdsvt.dsvt.counter & 0x40) {
if (rdsvt.dsvt.ctrl & 0x40) {
to_remote_g2[i].in_streamid = 0x0;
}
break;
@ -2655,7 +2679,7 @@ void CQnetLink::Process()
else
rdsvt.dsvt.flagb[2] = 0x02;
memcpy(&rdsvt.dsvt.streamid, dcs_buf+43, 2);
rdsvt.dsvt.counter = 0x80;
rdsvt.dsvt.ctrl = 0x80;
rdsvt.dsvt.hdr.flag[0] = rdsvt.dsvt.hdr.flag[1] = rdsvt.dsvt.hdr.flag[2] = 0x00;
memcpy(rdsvt.dsvt.hdr.rpt1, owner.c_str(), CALL_SIZE);
rdsvt.dsvt.hdr.rpt1[7] = to_remote_g2[i].from_mod;
@ -2697,7 +2721,7 @@ void CQnetLink::Process()
else
rdsvt.dsvt.flagb[2] = 0x02;
memcpy(&rdsvt.dsvt.streamid, dcs_buf+43, 2);
rdsvt.dsvt.counter = dcs_buf[45];
rdsvt.dsvt.ctrl = dcs_buf[45];
memcpy(rdsvt.dsvt.vasd.voice, dcs_buf+46, 12);
/* send the data to the local gateway/repeater */
@ -3487,7 +3511,7 @@ void CQnetLink::AudioNotifyThread(char *arg)
dsvt.streamid = htons(streamid_raw);
if (rlen == 56) {
dsvt.hdr.flag[0] = 0x01;
dsvt.hdr.flag[0] = 0x0;
memcpy(dsvt.hdr.rpt1, owner.c_str(), CALL_SIZE);
dsvt.hdr.rpt1[7] = mod;

@ -81,7 +81,7 @@ private:
bool get_value(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value);
/* configuration data */
std::string login_call, owner, to_g2_external_ip, my_g2_link_ip, gwys, status_file, announce_dir;
std::string login_call, owner, to_g2_external_ip, my_g2_link_ip, gwys, status_file, qnvoice_file, announce_dir;
bool only_admin_login, only_link_unlink, qso_details, bool_rptr_ack, announce;
int rmt_xrf_port, rmt_ref_port, rmt_dcs_port, my_g2_link_port, to_g2_external_port, delay_between, delay_before;
char link_at_startup[CALL_SIZE+1];

@ -230,42 +230,49 @@ int CQnetRelay::SendTo(const int fd, const unsigned char *buf, const int size, c
bool CQnetRelay::ProcessGateway(const int len, const unsigned char *raw)
{
if (29==len || 58==len) { //here is dstar data
SDSTR buf;
::memcpy(buf.pkt_id, raw, len); // transfer raw data to SDSTR struct
SDSTR dstr;
::memcpy(dstr.pkt_id, raw, len); // transfer raw data to SDSTR struct
SDSRP pkt; // destination
SDSRP dsrp; // destination
// fill in some inital stuff
::memcpy(pkt.title, "DSRP", 4);
pkt.voice.id = buf.vpkt.streamid;
pkt.voice.seq = buf.vpkt.ctrl;
::memcpy(dsrp.title, "DSRP", 4);
dsrp.voice.id = dstr.vpkt.streamid; // voice or header is the same position
dsrp.voice.seq = dstr.vpkt.ctrl; // ditto
if (29 == len) { // write an AMBE packet
pkt.tag = 0x21U;
if (pkt.voice.seq & 0x40)
// printf("INFO: ProcessGateway: sending voice end-of-stream\n");
;
else if (pkt.voice.seq > 20)
printf("DEBUG: ProcessGateway: unexpected voice sequence number %d\n", pkt.voice.seq);
pkt.voice.err = 0; // NOT SURE WHERE TO GET THIS FROM THE INPUT buf
memcpy(pkt.voice.ambe, buf.vpkt.vasd.voice, 12);
int ret = SendTo(msock, pkt.title, 21, MMDVM_IP, MMDVM_IN_PORT);
dsrp.tag = 0x21U;
if (log_qso && dsrp.voice.seq&0x40)
printf("Sent DSRP end of streamid=%04x\n", ntohs(dsrp.voice.id));
else if (dsrp.voice.seq > 20)
printf("DEBUG: ProcessGateway: unexpected voice sequence number %d\n", dsrp.voice.seq);
dsrp.voice.err = 0; // NOT SURE WHERE TO GET THIS FROM THE INPUT buf
memcpy(dsrp.voice.ambe, dstr.vpkt.vasd.voice, 12);
int ret = SendTo(msock, dsrp.title, 21, MMDVM_IP, MMDVM_IN_PORT);
if (ret != 21) {
printf("ERROR: ProcessGateway: Could not write AMBE mmdvm packet\n");
return true;
}
} else { // write a Header packet
pkt.tag = 0x20U;
pkt.header.id = buf.vpkt.streamid;
if (pkt.header.seq) {
dsrp.tag = 0x20U;
if (dsrp.header.seq) {
// printf("DEBUG: ProcessGateway: unexpected pkt.header.seq %d, resetting to 0\n", pkt.header.seq);
pkt.header.seq = 0;
dsrp.header.seq = 0;
}
memcpy(pkt.header.flag, buf.vpkt.hdr.flag, 41);
int ret = SendTo(msock, pkt.title, 49, MMDVM_IP, MMDVM_IN_PORT);
//memcpy(dsrp.header.flag, dstr.vpkt.hdr.flag, 41);
memcpy(dsrp.header.flag, dstr.vpkt.hdr.flag, 3);
memcpy(dsrp.header.r1, dstr.vpkt.hdr.r1, 8);
memcpy(dsrp.header.r2, dstr.vpkt.hdr.r2, 8);
memcpy(dsrp.header.ur, dstr.vpkt.hdr.ur, 8);
memcpy(dsrp.header.my, dstr.vpkt.hdr.my, 8);
memcpy(dsrp.header.nm, dstr.vpkt.hdr.nm, 4);
memcpy(dsrp.header.pfcs, dstr.vpkt.hdr.pfcs, 2);
int ret = SendTo(msock, dsrp.title, 49, MMDVM_IP, MMDVM_IN_PORT);
if (ret != 49) {
printf("ERROR: ProcessGateway: Could not write Header mmdvm packet\n");
return true;
}
printf("INFO: ProcessGateway: sent header to port %u pkt = '%s'\n", MMDVM_IN_PORT, std::string((char *)pkt.header.r2, 36).c_str());
if (log_qso)
printf("Sent DSRP to %u, streamid=%04x ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s\n", MMDVM_IN_PORT, ntohs(dsrp.header.id),
dsrp.header.ur, dsrp.header.r1, dsrp.header.r2, dsrp.header.my, dsrp.header.nm);
}
} else
@ -277,53 +284,65 @@ bool CQnetRelay::ProcessMMDVM(const int len, const unsigned char *raw)
{
static short old_id = 0U;
static short stream_id = 0U;
SDSRP mpkt;
SDSRP dsrp;
if (len < 65)
::memcpy(mpkt.title, raw, len); // transfer raw data to SDSRP struct
::memcpy(dsrp.title, raw, len); // transfer raw data to SDSRP struct
if (49==len || 21==len) {
// grab the stream id if this is a header
if (49 == len) {
stream_id = mpkt.header.id;
stream_id = dsrp.header.id;
if (old_id == stream_id)
return false;
old_id = stream_id;
}
SDSTR gpkt; // destination
SDSTR dstr; // destination
// sets most of the params
::memcpy(gpkt.pkt_id, "DSTR", 4);
gpkt.counter = COUNTER++;
gpkt.flag[0] = 0x73;
gpkt.flag[1] = 0x12;
gpkt.flag[2] = 0x0;
gpkt.vpkt.icm_id = 0x20;
gpkt.vpkt.dst_rptr_id = 0x0;
gpkt.vpkt.snd_rptr_id = 0x1;
gpkt.vpkt.snd_term_id = ('B'==RPTR_MOD) ? 0x1 : (('C'==RPTR_MOD) ? 0x2 : 0x3);
gpkt.vpkt.streamid = stream_id;
::memcpy(dstr.pkt_id, "DSTR", 4);
dstr.counter = htons(COUNTER++);
dstr.flag[0] = 0x73;
dstr.flag[1] = 0x12;
dstr.flag[2] = 0x0;
dstr.vpkt.icm_id = 0x20;
dstr.vpkt.dst_rptr_id = 0x0;
dstr.vpkt.snd_rptr_id = 0x1;
dstr.vpkt.snd_term_id = ('B'==RPTR_MOD) ? 0x1 : (('C'==RPTR_MOD) ? 0x2 : 0x3);
dstr.vpkt.streamid = stream_id;
if (49 == len) { // header
gpkt.remaining = 0x30;
gpkt.vpkt.ctrl = 0x80;
::memcpy(gpkt.vpkt.hdr.flag, mpkt.header.flag, 41);
int ret = SendTo(msock, gpkt.pkt_id, 58, G2_INTERNAL_IP, G2_IN_PORT);
dstr.remaining = 0x30;
dstr.vpkt.ctrl = 0x80;
//memcpy(dstr.vpkt.hdr.flag, dsrp.header.flag, 41);
memcpy(dstr.vpkt.hdr.flag, dsrp.header.flag, 3);
memcpy(dstr.vpkt.hdr.r1, dsrp.header.r1, 8);
memcpy(dstr.vpkt.hdr.r2, dsrp.header.r2, 8);
memcpy(dstr.vpkt.hdr.ur, dsrp.header.ur, 8);
memcpy(dstr.vpkt.hdr.my, dsrp.header.my, 8);
memcpy(dstr.vpkt.hdr.nm, dsrp.header.nm, 4);
memcpy(dstr.vpkt.hdr.pfcs, dsrp.header.pfcs, 2);
int ret = SendTo(msock, dstr.pkt_id, 58, G2_INTERNAL_IP, G2_IN_PORT);
if (ret != 58) {
printf("ERROR: ProcessMMDVM: Could not write gateway header packet\n");
return true;
}
printf("INFO: ProcessMMDVM: sent header to port %u pkt = '%s'\n", G2_IN_PORT, std::string((char *)gpkt.vpkt.hdr.r2, 36).c_str());
if (log_qso)
printf("Sent DSTR to %u, streamid=%04x ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s\n", G2_IN_PORT, ntohs(dstr.vpkt.streamid),
dstr.vpkt.hdr.ur, dstr.vpkt.hdr.r1, dstr.vpkt.hdr.r2, dstr.vpkt.hdr.my, dstr.vpkt.hdr.nm);
} else if (21 == len) { // ambe
gpkt.remaining = 0x16;
gpkt.vpkt.ctrl = mpkt.header.seq;
::memcpy(gpkt.vpkt.vasd.voice, mpkt.voice.ambe, 12);
int ret = SendTo(msock, gpkt.pkt_id, 29, G2_INTERNAL_IP, G2_IN_PORT);
dstr.remaining = 0x16;
dstr.vpkt.ctrl = dsrp.header.seq;
memcpy(dstr.vpkt.vasd.voice, dsrp.voice.ambe, 12);
int ret = SendTo(msock, dstr.pkt_id, 29, G2_INTERNAL_IP, G2_IN_PORT);
if (log_qso && dstr.vpkt.ctrl&0x40)
printf("Sent dstr end of streamid=%04x\n", ntohs(dstr.vpkt.streamid));
if (ret != 29) {
printf("ERROR: ProcessMMDVM: Could not write gateway voice packet\n");
return true;
}
}
} else if (len < 65 && mpkt.tag == 0xAU) {
} else if (len < 65 && dsrp.tag == 0xAU) {
// printf("MMDVM Poll: '%s'\n", (char *)mpkt.poll_msg);
} else
printf("DEBUG: ProcessMMDVM: unusual packet len=%d\n", len);
@ -469,11 +488,7 @@ bool CQnetRelay::ReadConfig(const char *cfgFile)
} else
return true;
GetValue(cfg, "timing.play.delay", DELAY_BETWEEN, 9, 25, 19);
GetValue(cfg, "timing.play.wait", DELAY_BEFORE, 1, 10, 2);
GetValue(cfg, std::string(mmdvm_path+".packet_wait").c_str(), WAIT_FOR_PACKETS, 6, 100, 25);
GetValue(cfg, "log.qso", log_qso, false);
return false;
}
@ -495,8 +510,8 @@ int main(int argc, const char **argv)
}
if ('-' == argv[1][0]) {
printf("\nMMDVM Modem Version #%s Copyright (C) 2018 by Thomas A. Early N7TAE\n", MMDVM_VERSION);
printf("MMDVM Modem comes with ABSOLUTELY NO WARRANTY; see the LICENSE for details.\n");
printf("\nQnetRelay Version #%s Copyright (C) 2018 by Thomas A. Early N7TAE\n", RELAY_VERSION);
printf("QnetRelay comes with ABSOLUTELY NO WARRANTY; see the LICENSE for details.\n");
printf("This is free software, and you are welcome to distribute it\nunder certain conditions that are discussed in the LICENSE file.\n\n");
return 0;
}

@ -62,7 +62,7 @@ private:
char OWNER[CALL_SIZE + 1];
std::string MMDVM_IP, G2_INTERNAL_IP;
unsigned short MMDVM_IN_PORT, MMDVM_OUT_PORT, G2_IN_PORT, G2_OUT_PORT;
int WAIT_FOR_PACKETS, DELAY_BEFORE, DELAY_BETWEEN;
bool log_qso;
// parameters
int msock, gsock;

@ -50,6 +50,7 @@ short streamid_raw = 0;
bool isdefined[3] = { false, false, false };
std::string REPEATER, IP_ADDRESS;
int PORT, PLAY_WAIT, PLAY_DELAY;
bool is_icom = false;
unsigned char silence[9] = { 0x9E, 0x8D, 0x32, 0x88, 0x26, 0x1A, 0x3F, 0x61, 0xE8 };
@ -197,10 +198,11 @@ bool read_config(const char *cfgFile)
path += m + 'a';
std::string type;
if (cfg.lookupValue(std::string(path+".type").c_str(), type)) {
if (strcasecmp(type.c_str(), "dvap") && strcasecmp(type.c_str(), "dvrptr") && strcasecmp(type.c_str(), "mmdvm")) {
if (type.compare("dvap") && type.compare("dvrptr") && type.compare("mmdvm") && type.compare("icom")) {
printf("module type '%s' is invalid\n", type.c_str());
return true;
}
is_icom = type.compare("icom") ? false : true;
isdefined[m] = true;
}
}
@ -209,10 +211,10 @@ bool read_config(const char *cfgFile)
return true;
}
if (! get_value(cfg, "gateway.internal.ip", IP_ADDRESS, 7, 15, "127.0.0.1"))
if (! get_value(cfg, "gateway.internal.ip", IP_ADDRESS, 7, 15, is_icom ? "172.16.0.1" : "127.0.0.1"))
return true;
get_value(cfg, "gateway.internal.port", PORT, 16000, 65535, 19000);
get_value(cfg, "gateway.internal.port", PORT, 16000, 65535, is_icom ? 20000 : 19000);
get_value(cfg, "timing.play.wait", PLAY_WAIT, 1, 10, 2);
@ -234,11 +236,11 @@ int main(int argc, char *argv[])
if (argc != 4) {
printf("Usage: %s <module> <mycall> <yourcall>\n", argv[0]);
printf("Example: %s c n7tae xrf757cl\n", argv[0]);
printf("Example: %s c n7tae xrf757al\n", argv[0]);
printf("Where...\n");
printf(" c is the local repeater module\n");
printf(" n7tae is the value of mycall\n");
printf(" xrf757cl is the value of yourcall, in this case this is a Link command\n\n");
printf(" xrf757al is the value of yourcall, in this case this is a Link command\n\n");
return 0;
}

@ -72,7 +72,7 @@ typedef struct dsvt_tag {
unsigned char id; // 8 0x20
unsigned char flagb[3]; // 9 0x0 0x1 0x1
unsigned short streamid;// 12
unsigned char counter; // 14 hdr: 0x80 vsad: framecounter (mod 21)
unsigned char ctrl; // 14 hdr: 0x80 vsad: framecounter (mod 21)
union {
struct { // index
unsigned char flag[3]; // 15
@ -108,10 +108,10 @@ typedef struct dsrp_tag { // offset size
// 0x01 Dstar Relay Unavailable
unsigned char r2[8]; // Repeater 2 11
unsigned char r1[8]; // Repeater 1 19
unsigned char yr[8]; // Your Call 27
unsigned char ur[8]; // Your Call 27
unsigned char my[8]; // My Call 35
unsigned char nm[4]; // Name 43
unsigned short pfcs; // checksum 47 49
unsigned char pfcs[2]; // checksum 47 49
} header;
struct {
unsigned short id; // random id number 5

@ -18,112 +18,19 @@
*/
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <string>
#include <libconfig.h++>
#include "QnetTypeDefs.h"
#include "Random.h"
using namespace libconfig;
#define VERSION "v3.1"
bool isamod[3] = { false, false, false };
std::string announce_dir;
std::string qnvoice_file;
int sockDst = -1;
struct sockaddr_in toDst;
FILE *fp = NULL;
time_t tNow = 0;
short streamid_raw = 0;
int moduleport[3] = { 0, 0, 0 };
std::string REPEATER, IP_ADDRESS;
int PORT, PLAY_WAIT, PLAY_DELAY;
unsigned short crc_tabccitt[256] = {
0x0000,0x1189,0x2312,0x329b,0x4624,0x57ad,0x6536,0x74bf,0x8c48,0x9dc1,0xaf5a,0xbed3,0xca6c,0xdbe5,0xe97e,0xf8f7,
0x1081,0x0108,0x3393,0x221a,0x56a5,0x472c,0x75b7,0x643e,0x9cc9,0x8d40,0xbfdb,0xae52,0xdaed,0xcb64,0xf9ff,0xe876,
0x2102,0x308b,0x0210,0x1399,0x6726,0x76af,0x4434,0x55bd,0xad4a,0xbcc3,0x8e58,0x9fd1,0xeb6e,0xfae7,0xc87c,0xd9f5,
0x3183,0x200a,0x1291,0x0318,0x77a7,0x662e,0x54b5,0x453c,0xbdcb,0xac42,0x9ed9,0x8f50,0xfbef,0xea66,0xd8fd,0xc974,
0x4204,0x538d,0x6116,0x709f,0x0420,0x15a9,0x2732,0x36bb,0xce4c,0xdfc5,0xed5e,0xfcd7,0x8868,0x99e1,0xab7a,0xbaf3,
0x5285,0x430c,0x7197,0x601e,0x14a1,0x0528,0x37b3,0x263a,0xdecd,0xcf44,0xfddf,0xec56,0x98e9,0x8960,0xbbfb,0xaa72,
0x6306,0x728f,0x4014,0x519d,0x2522,0x34ab,0x0630,0x17b9,0xef4e,0xfec7,0xcc5c,0xddd5,0xa96a,0xb8e3,0x8a78,0x9bf1,
0x7387,0x620e,0x5095,0x411c,0x35a3,0x242a,0x16b1,0x0738,0xffcf,0xee46,0xdcdd,0xcd54,0xb9eb,0xa862,0x9af9,0x8b70,
0x8408,0x9581,0xa71a,0xb693,0xc22c,0xd3a5,0xe13e,0xf0b7,0x0840,0x19c9,0x2b52,0x3adb,0x4e64,0x5fed,0x6d76,0x7cff,
0x9489,0x8500,0xb79b,0xa612,0xd2ad,0xc324,0xf1bf,0xe036,0x18c1,0x0948,0x3bd3,0x2a5a,0x5ee5,0x4f6c,0x7df7,0x6c7e,
0xa50a,0xb483,0x8618,0x9791,0xe32e,0xf2a7,0xc03c,0xd1b5,0x2942,0x38cb,0x0a50,0x1bd9,0x6f66,0x7eef,0x4c74,0x5dfd,
0xb58b,0xa402,0x9699,0x8710,0xf3af,0xe226,0xd0bd,0xc134,0x39c3,0x284a,0x1ad1,0x0b58,0x7fe7,0x6e6e,0x5cf5,0x4d7c,
0xc60c,0xd785,0xe51e,0xf497,0x8028,0x91a1,0xa33a,0xb2b3,0x4a44,0x5bcd,0x6956,0x78df,0x0c60,0x1de9,0x2f72,0x3efb,
0xd68d,0xc704,0xf59f,0xe416,0x90a9,0x8120,0xb3bb,0xa232,0x5ac5,0x4b4c,0x79d7,0x685e,0x1ce1,0x0d68,0x3ff3,0x2e7a,
0xe70e,0xf687,0xc41c,0xd595,0xa12a,0xb0a3,0x8238,0x93b1,0x6b46,0x7acf,0x4854,0x59dd,0x2d62,0x3ceb,0x0e70,0x1ff9,
0xf78f,0xe606,0xd49d,0xc514,0xb1ab,0xa022,0x92b9,0x8330,0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
};
void calcPFCS(unsigned char rawbytes[58])
{
unsigned short crc_dstar_ffff = 0xffff;
unsigned short tmp, short_c;
short int i;
for (i = 17; i < 56 ; i++) {
short_c = 0x00ff & (unsigned short)rawbytes[i];
tmp = (crc_dstar_ffff & 0x00ff) ^ short_c;
crc_dstar_ffff = (crc_dstar_ffff >> 8) ^ crc_tabccitt[tmp];
}
crc_dstar_ffff = ~crc_dstar_ffff;
tmp = crc_dstar_ffff;
rawbytes[56] = (unsigned char)(crc_dstar_ffff & 0xff);
rawbytes[57] = (unsigned char)((tmp >> 8) & 0xff);
return;
}
bool dst_open(const char *ip, const int port)
{
int reuse = 1;
sockDst = socket(PF_INET,SOCK_DGRAM,0);
if (sockDst == -1) {
printf("Failed to create DSTAR socket\n");
return true;
}
if (setsockopt(sockDst,SOL_SOCKET,SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) {
close(sockDst);
sockDst = -1;
printf("setsockopt DSTAR REUSE failed\n");
return true;
}
memset(&toDst,0,sizeof(struct sockaddr_in));
toDst.sin_family = AF_INET;
toDst.sin_port = htons(port);
toDst.sin_addr.s_addr = inet_addr(ip);
fcntl(sockDst,F_SETFL,O_NONBLOCK);
return false;
}
void dst_close()
{
if (sockDst != -1) {
close(sockDst);
sockDst = -1;
}
return;
}
bool get_value(const Config &cfg, const char *path, int &value, int min, int max, int default_value)
{
@ -186,34 +93,22 @@ bool read_config(const char *cfgFile)
return true;
}
if (! get_value(cfg, "ircddb.login", REPEATER, 3, 6, "UNDEFINED"))
return true;
REPEATER.resize(6, ' ');
printf("REPEATER=[%s]\n", REPEATER.c_str());
for (short int m=0; m<3; m++) {
std::string path = "module.";
path += m + 'a';
std::string type;
if (cfg.lookupValue(std::string(path+".type").c_str(), type)) {
if (strcasecmp(type.c_str(), "dvap") && strcasecmp(type.c_str(), "dvrptr") && strcasecmp(type.c_str(), "mmdvm")) {
if (strcasecmp(type.c_str(), "dvap") && strcasecmp(type.c_str(), "dvrptr") && strcasecmp(type.c_str(), "mmdvm") && strcasecmp(type.c_str(), "icom")) {
printf("module type '%s' is invalid\n", type.c_str());
return true;
}
get_value(cfg, std::string(path+".port").c_str(), moduleport[m], 1000, 65535, 19998+m);
isamod[m] = true;
}
}
if (0==moduleport[0] && 0==moduleport[1] && 0==moduleport[2]) {
printf("No repeaters defined!\n");
return true;
}
if (! get_value(cfg, "gateway.internal.ip", IP_ADDRESS, 7, 15, "127.0.0.1"))
return true;
get_value(cfg, "timing.play.wait", PLAY_WAIT, 1, 10, 2);
get_value(cfg, "file.announce_dir", announce_dir, 2, FILENAME_MAX, "/usr/local/etc");
get_value(cfg, "timing.play.delay", PLAY_DELAY, 9, 25, 19);
get_value(cfg, "file.qnvoice_file", qnvoice_file, 2, FILENAME_MAX, "/tmp/qnvoice.txt");
return false;
}
@ -227,20 +122,15 @@ void ToUpper(std::string &str)
int main(int argc, char *argv[])
{
unsigned short rlen = 0;
static unsigned short G2_COUNTER = 0;
size_t nread = 0;
SDSVT dsvt;
SDSTR dstr;
char RADIO_ID[21];
short int TEXT_idx = 0;
if (argc != 4) {
printf("Usage: %s <module> <mycall> <dvtoolFile>\n", argv[0]);
printf("Usage: %s <module> <dvtoolFile> <txtMsg>\n", argv[0]);
printf("Where...\n");
printf(" module is one of your modules\n");
printf(" mycall is your personal callsign\n");
printf(" dvtoolFile is a dvtool file\n");
printf(" <module> is one of your modules: A, B or C\n");
printf(" <dvtoolFile> is an installed voice file in the configured\n");
printf(" directory, for example \"unlinked.dat\"\n");
printf(" <txtMsg> is an up to 20-character text message\n");
return 0;
}
@ -249,12 +139,6 @@ int main(int argc, char *argv[])
if (read_config(cfgfile.c_str()))
return 1;
if (REPEATER.size() > 6) {
printf("repeaterCallsign can not be more than 6 characters, %s is invalid\n", REPEATER.c_str());
return 1;
}
ToUpper(REPEATER);
char module = argv[1][0];
if (islower(module))
module = toupper(module);
@ -263,176 +147,33 @@ int main(int argc, char *argv[])
return 1;
}
PORT = moduleport[module - 'A'];
if (0 == PORT) {
printf("module %c has no port defined!\n", module);
return 1;
}
if (strlen(argv[2]) > 8) {
printf("MYCALL can not be more than 8 characters, %s is invalid\n", argv[2]);
return 1;
}
std::string mycall(argv[2]);
ToUpper(mycall);
char pathname[FILENAME_MAX];
snprintf(pathname, FILENAME_MAX, "%s/%s", announce_dir.c_str(), argv[2]);
fp = fopen(argv[3], "rb");
FILE *fp = fopen(pathname, "rb");
if (!fp) {
printf("Failed to open file %s for reading\n", argv[3]);
return 1;
}
/* DVTOOL + 4 byte num_of_records */
unsigned char buf[10];
nread = fread(buf, 10, 1, fp);
if (nread != 1) {
printf("Cant read first 10 bytes\n");
fclose(fp);
return 1;
}
if (0 != memcmp(buf, "DVTOOL", 6)) {
printf("DVTOOL signature not found in %s\n", argv[3]);
fclose(fp);
printf("Failed to find file %s for reading\n", pathname);
return 1;
}
fclose(fp);
memset(RADIO_ID, ' ', 20);
memset(RADIO_ID, '_', 20);
RADIO_ID[20] = '\0';
memcpy(RADIO_ID, "QnetVoice AMBE Data", 19);
unsigned long int delay = PLAY_DELAY * 1000L;
sleep(PLAY_WAIT);
unsigned int len = strlen(argv[3]);
strncpy(RADIO_ID, argv[3], len > 20 ? 20 : len);
for (int i=0; i<20; i++)
if (isspace(RADIO_ID[i]))
RADIO_ID[i] = '_';
time(&tNow);
CRandom Random;
if (dst_open(IP_ADDRESS.c_str(), PORT))
fp = fopen(qnvoice_file.c_str(), "w");
if (fp) {
fprintf(fp, "%c_%s_%s\n", module, argv[2], RADIO_ID);
fclose(fp);
} else {
printf("Failed to open %s for writing", qnvoice_file.c_str());
return 1;
// Read and reformat and write packets
while (true) {
/* 2 byte length */
nread = fread(&rlen, 2, 1, fp);
if (nread != 1) {
printf("End-Of-File\n");
break;
}
if (rlen == 56)
streamid_raw = Random.NewStreamID();
else if (rlen == 27)
;
else {
printf("Wrong packet size!\n");
return 1;
}
/* read the packet */
nread = fread(dsvt.title, rlen, 1, fp);
printf("Read %d byte packet from %s\n", (int)nread*rlen, argv[3]);
if (rlen == 56)
printf("rpt1=%.8s rpt2=%.8s urcall=%.8s, mycall=%.8s, sfx=%.4s\n",
dsvt.hdr.rpt1, dsvt.hdr.rpt2, dsvt.hdr.urcall, dsvt.hdr.mycall, dsvt.hdr.sfx);
else
printf("streamid=%04X counter=%02X\n", dsvt.streamid, dsvt.counter);
if (nread == 1) {
if (memcmp(dsvt.title, "DSVT", 4) != 0) {
printf("DVST title not found\n");
return 1;
}
if (dsvt.id != 0x20) {
printf("Not Voice type\n");
return 1;
}
if (dsvt.config!=0x10 && dsvt.config!=0x20) {
printf("Not a valid record type\n");
return 1;
}
dstr.counter = htons(G2_COUNTER++);
if (rlen == 56) {
memcpy(dstr.pkt_id, "DSTR", 4);
dstr.flag[0] = 0x73;
dstr.flag[1] = 0x12;
dstr.flag[2] = 0x00;
dstr.remaining = 0x30;
dstr.vpkt.icm_id = 0x20;
dstr.vpkt.dst_rptr_id = dsvt.flagb[0];
dstr.vpkt.snd_rptr_id = dsvt.flagb[1];
dstr.vpkt.snd_term_id = dsvt.flagb[2];
dstr.vpkt.streamid = htons(streamid_raw);
dstr.vpkt.ctrl = dsvt.counter;
for (int i=0; i<3; i++)
dstr.vpkt.hdr.flag[i] = dsvt.hdr.flag[i];
memset(dstr.vpkt.hdr.r2, ' ', 36);
memcpy(dstr.vpkt.hdr.r2, REPEATER.c_str(), REPEATER.size());
dstr.vpkt.hdr.r1[7] = 'G';
memcpy(dstr.vpkt.hdr.r1, REPEATER.c_str(), REPEATER.size());
dstr.vpkt.hdr.r2[7] = module;
memcpy(dstr.vpkt.hdr.ur, "CQCQCQ", 6); /* yrcall */
memcpy(dstr.vpkt.hdr.my, mycall.c_str(), mycall.size());
memcpy(dstr.vpkt.hdr.nm, "QNET", 4);
calcPFCS(dstr.pkt_id);
} else {
dstr.remaining = 0x13;
dstr.vpkt.ctrl = dsvt.counter;
memcpy(dstr.vpkt.vasd.voice, dsvt.vasd.voice, 12);
if ((dstr.vpkt.vasd.text[0] != 0x55) || (dstr.vpkt.vasd.text[1] != 0x2d) || (dstr.vpkt.vasd.text[2] != 0x16)) {
if (TEXT_idx == 0) {
dstr.vpkt.vasd.text[0] = '@' ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 2) {
dstr.vpkt.vasd.text[0] = RADIO_ID[TEXT_idx++] ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 5) {
dstr.vpkt.vasd.text[0] = 'A' ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 7) {
dstr.vpkt.vasd.text[0] = RADIO_ID[TEXT_idx++] ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 10) {
dstr.vpkt.vasd.text[0] = 'B' ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 12) {
dstr.vpkt.vasd.text[0] = RADIO_ID[TEXT_idx++] ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 15) {
dstr.vpkt.vasd.text[0] = 'C' ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else if (TEXT_idx == 17) {
dstr.vpkt.vasd.text[0] = RADIO_ID[TEXT_idx++] ^ 0x70;
dstr.vpkt.vasd.text[1] = RADIO_ID[TEXT_idx++] ^ 0x4f;
dstr.vpkt.vasd.text[2] = RADIO_ID[TEXT_idx++] ^ 0x93;
} else {
dstr.vpkt.vasd.text[0] = 0x70;
dstr.vpkt.vasd.text[1] = 0x4f;
dstr.vpkt.vasd.text[2] = 0x93;
}
}
}
int sent = sendto(sockDst, dstr.pkt_id, rlen + 2,0, (struct sockaddr *)&toDst, sizeof(toDst));
if (sent == 58)
printf("Sent DSTR HDR r2=%.8s r1=%.8s ur=%.8s my=%.8s nm=%.4s\n",
dstr.vpkt.hdr.r2, dstr.vpkt.hdr.r1, dstr.vpkt.hdr.ur, dstr.vpkt.hdr.my, dstr.vpkt.hdr.nm);
else if (sent == 29)
printf("Sent DSTR DATA streamid=%04X, ctrl=%02X\n", dstr.vpkt.streamid, dstr.vpkt.ctrl);
else
printf("ERROR: sendto returned %d!\n", sent);
}
usleep(delay);
}
dst_close();
fclose(fp);
return 0;
}

@ -1,10 +1,10 @@
# g2_ircddb Configuration
# Qnet Gateway Configuration
ircddb = {
login = "CHANGEME!!!!"; # login callsign for the ircDDB network
# host = "rr.openquad.net" # other include group1-irc.ircddb.net
# port = 9007 # not a good idea to change!
# password = "1111111111111" # not needed for Openquad
# password = "1111111111111" # not needed for rr.openquad.net
}
gateway = {
@ -285,6 +285,7 @@ file = {
# status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services
# DTMF = "/tmp" #
# echotest = "/tmp" # echo dat files will end up here
# qnvoicefile = /tmp/qnvoice.txt # where qnvoice will create the play command
# gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is.
# announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements
}

@ -0,0 +1,140 @@
# Qnet Gateway Configuration
ircddb = {
login = "CHANGEME!!!!"; # login callsign for the ircDDB network
# host = "rr.openquad.net" # other include group1-irc.ircddb.net
# port = 9007 # not a good idea to change!
# password = "1111111111111" # not needed for rr.openquad.net
}
gateway = {
# regen_header = true # regenerate headers from incoming data
# send_qrgs_maps = true # send frequecy, offset, cooridinates and url to irc-server
# local_irc_ip = "0.0.0.0" # 0.0.0.0 means accept any incoming connections
# aprs_send = true # send info to aprs
# ip = "127.0.0.1" # where the gateway is running
external = {
# ip = "0.0.0.0"
# port = 40000
}
internal = {
# ip = "172.16.0.1"
# port = 20000
}
}
module = {
a = { # an ICOM full stack might consist of up to three module
# Sorry, the 23 cm data module is not yet supported
# 23 cm module will use "a"
# 70 cm module will use "b"
# 2 M module will use "c"
# type = "icom" # you must define at least one module by uncommenting the type
# ip = "172.16.0.20" # all icom modules should have the same IP address
# port = 20000 # all icom modules should have the same UDP port
# frequency = 0 # in MHz, if you specify here, this frequency will show up on the QuadNet USER GATEWAYS webpage
# offset = 0
# range = 0 # the range of this repeater, in meters. 1609.344 meters is 1.0 miles
# agl = 0 # the height above ground level for this repeater's antenna
# latitude = 0 # you can leave this unspecified for a mobile rig
# longitude = 0 # like the latitude
# desc1 = "" # maximum of 20 characters, most special symbols are not allowed
# desc2 = "" # just like desc1
# url = "github.com/n7tae/g2_ircddb" # 80 characters max
}
b = {
# type = "icom"
# ip = "172.16.0.20" # all icom modules should have the same IP address
# port = 20000 # all icom modules should have the same UDP port
# frequency = 0
# offset = 0
# range = 0.0
# agl = 0.0
# latitude = 0.0
# longitude = 0.0
# desc1 = ""
# desc2 = ""
# url = "github.com/n7tae/g2_ircddb"
}
c = {
# type = "icom"
# ip = "172.16.0.20" # all icom modules should have the same IP address
# port = 20000 # all icom modules should have the same UDP port
# frequency = 0
# dvap_offset = 0
# range = 0.0
# agl = 0.0
# latitude = 0.0
# longitude = 0.0
# desc1 = ""
# desc2 = ""
# url = "github.com/n7tae/QnetGateway"
}
}
log = {
# debuging and extra logging switches
# qso = false # QSO info goes into the log
# irc = false # IRC debug info
# dtmf = false # DTMF debug info
}
aprs = { # APRS.NET connect info
# host = "rotate.aprs.net"
# port = 14580
# interval = 40
# filter = ""
}
link = {
# link_at_start = "NONE" # Link to a reflector at startup.
# to link repeater module B to REF001 C, use "BREF001C"
# ref_login = "" # for loging into REF reflectors, if undefined, ircddb.username will be used
# admin = [ "CALL1", "CALL2", "CALL3" ] # only these users can execute scripts, block dongles and reload the gwys.txt
# # you probabaly want you own callsign in the admin list!
# link_unlink = [ "CALL4", "CALL5", "CALL6" ] # if defined, only these users can link and unlink a repeater
# no_link_unlink = [ "CALL7", "CALL8", "CALL9" ] # if defined, these users cannot link or unlink, it's a blacklist
# # if the blacklist is defined (even if it's empty), the link_unlink will not be read
# incoming_ip = "0.0.0.0" # incoming ip address, "0.0.0.0" means accepts all connections.
# ip = "127.0.0.1" # where g2_link is running
# port = 18997 # port for communications to g2_link
# ref_port = 20001 # port for REF linking, don't change
# xrf_port = 30001 # port for XRF linking, don't change
# dcs_port = 30051 # port for DCS linking, don't change
# announce = true # do link, unlink, etc. announcements
# acknowledge = true # send text acknowledgement on key-up
# max_dongles = 5 # maximum number of linked hotspots
}
file = {
# status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services
# DTMF = "/tmp" #
# echotest = "/tmp" # echo dat files will end up here
# qnvoicefile = /tmp/qnvoice.txt # where qnvoice will create the play command
# gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is.
# announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements
}
timing = {
timeout = {
# echo = 1 # delay time in seconds for echo
# voicemail = 1 # delay time for voicemail
# remote_g2 = 2 # after this many seconds with no packets, we assume the tx is closed
# local_rptr = 1 # local timeout, in seconds
}
play = {
# wait = 2 # seconds before playback occurs, between 1 and 10
# delay = 19 # microseconds between frames playback, if echo sounds bad, adjust this up or down 1,2 microseconds
}
inactivity = {
# a = 0 # unlink repeater if no activity for this many minutes
# b = 0 # zero mean there will be no timer
# c = 0
}
}

@ -1,6 +1,8 @@
// version strings must be 55 characters or less!
#define IRCDDB_VERSION "linux-qngateway-6.1.1"
#define LINK_VERSION "6.0.0"
#define DVAP_VERSION "linux-qndvap-5.1.1"
#define DVRPTR_VERSION "linux-qndvrptr-5.1.0"
#define MMDVM_VERSION "mmdvm-qnmodem-0.1.0"
#define IRCDDB_VERSION "QnetGateway-7.0.0"
#define LINK_VERSION "QnetLink-6.0.0"
#define DVAP_VERSION "QnetDVAP-5.1.1"
#define RELAY_VERSION "QnetRelay-0.2.0"
#define DVRPTR_VERSION "QnetDVRPTR-5.1.0"
#define MMDVM_VERSION "QnetGateway-MMDVM-0.1.0"
#define ICOM_VERSION IRCDDB_VERSION

Loading…
Cancel
Save

Powered by TurnKey Linux.