moved dcs_buf, readBuffer and ReadBuffer into runit()

pull/1/head
Tom Early 9 years ago
parent 58229f3368
commit 9e6ce866a0

@ -1594,55 +1594,54 @@ static void runit()
} }
} }
} }
} else /* check for cross-banding */
/* check for cross-banding */ } else if (0 == (memcmp(rptrbuf.vpkt.hdr.urcall, "CQCQCQ", 6)) && /* yrcall is CQCQCQ */
if (0 == (memcmp(rptrbuf.vpkt.hdr.urcall, "CQCQCQ", 6)) && /* yrcall is CQCQCQ */ (0 == memcmp(rptrbuf.vpkt.hdr.rpt1, OWNER.c_str(), 7)) && /* rpt1 is this repeater */
(0 == memcmp(rptrbuf.vpkt.hdr.rpt1, OWNER.c_str(), 7)) && /* rpt1 is this repeater */ (0 == memcmp(rptrbuf.vpkt.hdr.rpt2, OWNER.c_str(), 7)) && /* rpt2 is this repeater */
(0 == memcmp(rptrbuf.vpkt.hdr.rpt2, OWNER.c_str(), 7)) && /* rpt2 is this repeater */ ((rptrbuf.vpkt.hdr.rpt2[7] == 'A') ||
((rptrbuf.vpkt.hdr.rpt2[7] == 'A') || (rptrbuf.vpkt.hdr.rpt2[7] == 'B') ||
(rptrbuf.vpkt.hdr.rpt2[7] == 'B') || (rptrbuf.vpkt.hdr.rpt2[7] == 'C')) && /* mod of rpt1 is A,B,C */
(rptrbuf.vpkt.hdr.rpt2[7] == 'C')) && /* mod of rpt1 is A,B,C */ ((rptrbuf.vpkt.hdr.rpt1[7] == 'A') ||
((rptrbuf.vpkt.hdr.rpt1[7] == 'A') || (rptrbuf.vpkt.hdr.rpt1[7] == 'B') ||
(rptrbuf.vpkt.hdr.rpt1[7] == 'B') || (rptrbuf.vpkt.hdr.rpt1[7] == 'C')) && /* !!! usually a G of rpt2, but we see A,B,C */
(rptrbuf.vpkt.hdr.rpt1[7] == 'C')) && /* !!! usually a G of rpt2, but we see A,B,C */ (rptrbuf.vpkt.hdr.rpt1[7] != rptrbuf.vpkt.hdr.rpt2[7])) { /* cross-banding? make sure NOT the same */
(rptrbuf.vpkt.hdr.rpt1[7] != rptrbuf.vpkt.hdr.rpt2[7])) { /* cross-banding? make sure NOT the same */ i = rptrbuf.vpkt.hdr.rpt2[7] - 'A';
i = rptrbuf.vpkt.hdr.rpt2[7] - 'A';
if (i>=0 && i<3) {
if (i>=0 && i<3) { // The remote repeater has been set, lets fill in the dest_rptr
// The remote repeater has been set, lets fill in the dest_rptr // so that later we can send that to the LIVE web site
// so that later we can send that to the LIVE web site memcpy(band_txt[i].dest_rptr, rptrbuf.vpkt.hdr.rpt1, 8);
memcpy(band_txt[i].dest_rptr, rptrbuf.vpkt.hdr.rpt1, 8); band_txt[i].dest_rptr[8] = '\0';
band_txt[i].dest_rptr[8] = '\0'; }
}
i = rptrbuf.vpkt.hdr.rpt1[7] - 'A'; i = rptrbuf.vpkt.hdr.rpt1[7] - 'A';
/* valid destination repeater module? */ /* valid destination repeater module? */
if (i>=0 && i<3) { if (i>=0 && i<3) {
// toRptr[i] : receiving from a remote system or cross-band // toRptr[i] : receiving from a remote system or cross-band
// band_txt[i] : local RF is talking. // band_txt[i] : local RF is talking.
if ((toRptr[i].last_time == 0) && (band_txt[i].last_time == 0)) { if ((toRptr[i].last_time == 0) && (band_txt[i].last_time == 0)) {
traceit("ZONEmode cross-banding from mod %c to %c\n", rptrbuf.vpkt.hdr.rpt2[7], rptrbuf.vpkt.hdr.rpt1[7]); traceit("ZONEmode cross-banding from mod %c to %c\n", rptrbuf.vpkt.hdr.rpt2[7], rptrbuf.vpkt.hdr.rpt1[7]);
rptrbuf.vpkt.hdr.rpt2[7] = 'G'; rptrbuf.vpkt.hdr.rpt2[7] = 'G';
calcPFCS(rptrbuf.pkt_id, 58); calcPFCS(rptrbuf.pkt_id, 58);
sendto(srv_sock, rptrbuf.pkt_id, 58, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in)); sendto(srv_sock, rptrbuf.pkt_id, 58, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in));
/* This is the active streamid */ /* This is the active streamid */
toRptr[i].streamid = rptrbuf.vpkt.streamid; toRptr[i].streamid = rptrbuf.vpkt.streamid;
toRptr[i].adr = fromRptr.sin_addr.s_addr; toRptr[i].adr = fromRptr.sin_addr.s_addr;
/* time it, in case stream times out */ /* time it, in case stream times out */
time(&toRptr[i].last_time); time(&toRptr[i].last_time);
/* bump the G2 counter */ /* bump the G2 counter */
toRptr[i].G2_COUNTER ++; toRptr[i].G2_COUNTER ++;
toRptr[i].sequence = rptrbuf.vpkt.ctrl; toRptr[i].sequence = rptrbuf.vpkt.ctrl;
}
} }
} }
}
} else { } else {
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (band_txt[i].streamID == rptrbuf.vpkt.streamid) { if (band_txt[i].streamID == rptrbuf.vpkt.streamid) {

@ -162,8 +162,6 @@ static struct {
static int xrf_g2_sock = -1; static int xrf_g2_sock = -1;
static int ref_g2_sock = -1; static int ref_g2_sock = -1;
static int dcs_g2_sock = -1; static int dcs_g2_sock = -1;
static unsigned char dcs_buf[1000];
static unsigned char readBuffer2[1024];
static struct sockaddr_in fromDst4; static struct sockaddr_in fromDst4;
// After we receive it from remote g2, // After we receive it from remote g2,
@ -172,7 +170,6 @@ static struct sockaddr_in toLocalg2;
// input from our own local repeater // input from our own local repeater
static int rptr_sock = -1; static int rptr_sock = -1;
static unsigned char readBuffer[100]; // 58 or 29 or 32, max is 58
static struct sockaddr_in fromRptr; static struct sockaddr_in fromRptr;
static fd_set fdset; static fd_set fdset;
@ -1272,6 +1269,9 @@ static void runit()
char tmp1[CALL_SIZE + 1]; char tmp1[CALL_SIZE + 1];
char tmp2[36]; // 8 for rpt1 + 24 for time_t in std::string format char tmp2[36]; // 8 for rpt1 + 24 for time_t in std::string format
unsigned char readBuffer[100]; // 58 or 29 or 32, max is 58
unsigned char readBuffer2[1024];
unsigned char dcs_buf[1000];
dt_lh_type::iterator dt_lh_pos; dt_lh_type::iterator dt_lh_pos;
dt_lh_type::reverse_iterator r_dt_lh_pos; dt_lh_type::reverse_iterator r_dt_lh_pos;
@ -2140,8 +2140,7 @@ static void runit()
if (FD_ISSET(ref_g2_sock, &fdset)) { if (FD_ISSET(ref_g2_sock, &fdset)) {
fromlen = sizeof(struct sockaddr_in); fromlen = sizeof(struct sockaddr_in);
recvlen2 = recvfrom(ref_g2_sock,(char *)readBuffer2,100, recvlen2 = recvfrom(ref_g2_sock, (char *)readBuffer2, 100, 0, (struct sockaddr *)&fromDst4,&fromlen);
0,(struct sockaddr *)&fromDst4,&fromlen);
strncpy(ip, inet_ntoa(fromDst4.sin_addr),IP_SIZE); strncpy(ip, inet_ntoa(fromDst4.sin_addr),IP_SIZE);
ip[IP_SIZE] = '\0'; ip[IP_SIZE] = '\0';
@ -3277,20 +3276,15 @@ static void runit()
if (FD_ISSET(rptr_sock, &fdset)) { if (FD_ISSET(rptr_sock, &fdset)) {
fromlen = sizeof(struct sockaddr_in); fromlen = sizeof(struct sockaddr_in);
recvlen = recvfrom(rptr_sock,(char *)readBuffer,100, recvlen = recvfrom(rptr_sock, (char *)readBuffer, 100, 0, (struct sockaddr *)&fromRptr,&fromlen);
0,(struct sockaddr *)&fromRptr,&fromlen);
if ( ((recvlen == 58) || if ( ((recvlen == 58) || (recvlen == 29) || (recvlen == 32)) &&
(recvlen == 29) ||
(recvlen == 32)) &&
(readBuffer[6] == 0x73) && (readBuffer[6] == 0x73) &&
(readBuffer[7] == 0x12) && (readBuffer[7] == 0x12) &&
((memcmp(readBuffer,"DSTR", 4) == 0) || (memcmp(readBuffer,"CCS_", 4) == 0)) && ((memcmp(readBuffer,"DSTR", 4) == 0) || (memcmp(readBuffer,"CCS_", 4) == 0)) &&
(readBuffer[10] == 0x20) && (readBuffer[10] == 0x20) &&
(readBuffer[8] == 0x00) && (readBuffer[8] == 0x00) &&
((readBuffer[9] == 0x30) || ((readBuffer[9] == 0x30) || (readBuffer[9] == 0x13) || (readBuffer[9] == 0x16)) ) {
(readBuffer[9] == 0x13) ||
(readBuffer[9] == 0x16)) ) {
if (recvlen == 58) { if (recvlen == 58) {
if (qso_details) if (qso_details)

Loading…
Cancel
Save

Powered by TurnKey Linux.