From b6faa3a3a18ef0d126c1160513c3821be729082c Mon Sep 17 00:00:00 2001 From: Tom Early Date: Fri, 6 Apr 2018 08:15:02 -0700 Subject: [PATCH] changes to SPKT --- dvap_rptr.cpp | 10 +++++----- g2_ircddb.cpp | 24 ++++++++++++------------ g2_typedefs.h | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/dvap_rptr.cpp b/dvap_rptr.cpp index 3c9c83a..e0d8940 100644 --- a/dvap_rptr.cpp +++ b/dvap_rptr.cpp @@ -922,8 +922,8 @@ static void ReadDVAPThread() spack.counter = 0; spack.flag[0] = 0x73; spack.flag[1] = 0x21; - spack.nothing2[0] = 0x00; - spack.nothing2[1] = 0x10; + spack.flag[2] = 0x00; + spack.remaining = 0x10; while (keep_running) { time(&tnow); @@ -1103,8 +1103,8 @@ static void ReadDVAPThread() net_buf.counter = C_COUNTER; net_buf.flag[0] = 0x73; net_buf.flag[1] = 0x12; - net_buf.nothing2[0] = 0x00; - net_buf.nothing2[1] = 0x30; + net_buf.flag[2] = 0x00; + net_buf.remaining = 0x30; net_buf.vpkt.icm_id = 0x20; net_buf.vpkt.dst_rptr_id = 0x00; net_buf.vpkt.snd_rptr_id = 0x01; @@ -1131,7 +1131,7 @@ static void ReadDVAPThread() the_end = ((dr.frame.framepos & 0x40) == 0x40); net_buf.counter = C_COUNTER; - net_buf.nothing2[1] = 0x13; + net_buf.remaining = 0x13; net_buf.vpkt.ctrl = sequence++; if (the_end) net_buf.vpkt.ctrl = sequence | 0x40; diff --git a/g2_ircddb.cpp b/g2_ircddb.cpp index 84ee53b..eeabd01 100644 --- a/g2_ircddb.cpp +++ b/g2_ircddb.cpp @@ -837,8 +837,8 @@ void CG2_ircddb::process() rptrbuf.counter = toRptr[i].G2_COUNTER; rptrbuf.flag[0] = 0x73; rptrbuf.flag[1] = 0x12; - rptrbuf.nothing2[0] = 0x00; - rptrbuf.nothing2[1] = 0x30; + rptrbuf.flag[2] = 0x00; + rptrbuf.remaining = 0x30; rptrbuf.vpkt.icm_id = 0x20; memcpy(&rptrbuf.vpkt.dst_rptr_id, g2buf.flagb, 47); sendto(srv_sock, rptrbuf.pkt_id, 58, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in)); @@ -876,8 +876,8 @@ void CG2_ircddb::process() rptrbuf.counter = toRptr[i].G2_COUNTER; rptrbuf.flag[0] = 0x73; rptrbuf.flag[1] = 0x12; - rptrbuf.nothing2[0] = 0x00; - rptrbuf.nothing2[1]= 0x13; + rptrbuf.flag[2] = 0x00; + rptrbuf.remaining= 0x13; rptrbuf.vpkt.icm_id = 0x20; memcpy(&rptrbuf.vpkt.dst_rptr_id, g2buf.flagb, 18); @@ -935,8 +935,8 @@ void CG2_ircddb::process() rptrbuf.counter = toRptr[i].G2_COUNTER; rptrbuf.flag[0] = 0x73; rptrbuf.flag[1] = 0x12; - rptrbuf.nothing2[0] = 0x00; - rptrbuf.nothing2[1] = 0x13; + rptrbuf.flag[2] = 0x00; + rptrbuf.remaining = 0x13; rptrbuf.vpkt.icm_id = 0x20; memcpy(&rptrbuf.vpkt.dst_rptr_id, g2buf.flagb, 18); @@ -974,10 +974,10 @@ void CG2_ircddb::process() if ( ((recvlen == 58) || (recvlen == 29) || (recvlen == 32)) && (rptrbuf.flag[0] == 0x73) && (rptrbuf.flag[1] == 0x12) && (0 == memcmp(rptrbuf.pkt_id,"DSTR", 4)) && - (rptrbuf.vpkt.icm_id == 0x20) && (rptrbuf.nothing2[0] == 0x00) && - ((rptrbuf.nothing2[1] == 0x30) || /* 48 bytes follow */ - (rptrbuf.nothing2[1] == 0x13) || /* 19 bytes follow */ - (rptrbuf.nothing2[1] == 0x16)) ) { /* 22 bytes follow */ + (rptrbuf.vpkt.icm_id == 0x20) && (rptrbuf.flag[2] == 0x00) && + ((rptrbuf.remaining == 0x30) || /* 48 bytes follow */ + (rptrbuf.remaining == 0x13) || /* 19 bytes follow */ + (rptrbuf.remaining == 0x16)) ) { /* 22 bytes follow */ int dtmf_buf_count[3] = {0, 0, 0}; char dtmf_buf[3][MAX_DTMF_BUF + 1] = { {""}, {""}, {""} }; @@ -2562,8 +2562,8 @@ int CG2_ircddb::init(char *cfgfile) memcpy(end_of_audio.pkt_id, "DSTR", 4); end_of_audio.flag[0] = 0x73; end_of_audio.flag[1] = 0x12; - end_of_audio.nothing2[0] = 0x00; - end_of_audio.nothing2[1] = 0x13; + end_of_audio.flag[2] = 0x00; + end_of_audio.remaining = 0x13; end_of_audio.vpkt.icm_id = 0x20; end_of_audio.vpkt.dst_rptr_id = 0x00; end_of_audio.vpkt.snd_rptr_id = 0x01; diff --git a/g2_typedefs.h b/g2_typedefs.h index b5fc0db..960fb0b 100644 --- a/g2_typedefs.h +++ b/g2_typedefs.h @@ -23,8 +23,8 @@ typedef struct pkt_tag { unsigned char pkt_id[4]; // 0 unsigned short counter; // 4 - unsigned char flag[2]; // 6 - unsigned char nothing2[2]; // 8 nothing[1] is the number of bytes left in the packet + unsigned char flag[3]; // 6 { 0x72, 0x12, 0x00 } + unsigned char remaining; // 9 the number of bytes left in the packet union { struct { unsigned char mycall[8]; // 10