replaced readBuffer2 with SDSVT struct and removed icm struct from SPKT

pull/1/head
Tom Early 9 years ago
parent 137a95e80f
commit b1cf272e36

@ -455,7 +455,7 @@ static void readFrom20000()
if ((memcmp(net_buf.pkt_id, "DSTR", 4) != 0) ||
(net_buf.flag[0] != 0x73) ||
(net_buf.flag[1] != 0x12) ||
(net_buf.vpkt.icm.icm_id != 0x20)) { /* voice type */
(net_buf.vpkt.icm_id != 0x20)) { /* voice type */
FD_CLR(insock, &readfd);
break;
}
@ -466,13 +466,13 @@ static void readFrom20000()
written_to_q = true;
traceit("Start G2: streamid=%04x, flags=%02x:%02x:%02x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s\n",
net_buf.vpkt.icm.streamid,
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.mycall, net_buf.vpkt.hdr.sfx, net_buf.vpkt.hdr.urcall,
net_buf.vpkt.hdr.rpt1, net_buf.vpkt.hdr.rpt2);
/* save the streamid that is winning */
streamid = net_buf.vpkt.icm.streamid;
streamid = net_buf.vpkt.streamid;
if (net_buf.vpkt.hdr.flag[0] != 0x01) {
@ -515,12 +515,12 @@ static void readFrom20000()
seq_no = 0;
} else if (len == 29) {
if (busy20000) {
if (net_buf.vpkt.icm.streamid == streamid) {
if (net_buf.vpkt.icm.ctrl == ctrl_in) {
if (net_buf.vpkt.streamid == streamid) {
if (net_buf.vpkt.ctrl == ctrl_in) {
/* do not update written_to_q, ctrl_in */
; // traceit("dup\n");
} else {
ctrl_in = net_buf.vpkt.icm.ctrl;
ctrl_in = net_buf.vpkt.ctrl;
written_to_q = true;
if (seq_no == 0) {
@ -546,7 +546,7 @@ static void readFrom20000()
frame_pos_to_dvap = 0;
dr.frame.streamid = stream_id_to_dvap;
dr.frame.framepos = frame_pos_to_dvap;
if ((net_buf.vpkt.icm.ctrl & 0x40) != 0)
if ((net_buf.vpkt.ctrl & 0x40) != 0)
dr.frame.framepos |= 0x40U;
dr.frame.seq = seq_to_dvap;
memcpy(&dr.frame.vad.voice, net_buf.vpkt.vasd.voice, 12);
@ -560,8 +560,8 @@ static void readFrom20000()
if (seq_no == 21)
seq_no = 0;
if ((net_buf.vpkt.icm.ctrl & 0x40) != 0) {
traceit("End G2: streamid=%04x\n", net_buf.vpkt.icm.streamid);
if ((net_buf.vpkt.ctrl & 0x40) != 0) {
traceit("End G2: streamid=%04x\n", net_buf.vpkt.streamid);
streamid = 0;
@ -1110,13 +1110,13 @@ static void ReadDVAPThread()
net_buf.flag[1] = 0x12;
net_buf.nothing2[0] = 0x00;
net_buf.nothing2[1] = 0x30;
net_buf.vpkt.icm.icm_id = 0x20;
net_buf.vpkt.icm.dst_rptr_id = 0x00;
net_buf.vpkt.icm.snd_rptr_id = 0x01;
net_buf.vpkt.icm.snd_term_id = SND_TERM_ID;
net_buf.vpkt.icm_id = 0x20;
net_buf.vpkt.dst_rptr_id = 0x00;
net_buf.vpkt.snd_rptr_id = 0x01;
net_buf.vpkt.snd_term_id = SND_TERM_ID;
streamid_raw = (rand_r(&aseed) % 65535U) + 1U;
net_buf.vpkt.icm.streamid = streamid_raw;
net_buf.vpkt.icm.ctrl = 0x80;
net_buf.vpkt.streamid = streamid_raw;
net_buf.vpkt.ctrl = 0x80;
sequence = 0;
calcPFCS((unsigned char *)&(net_buf.vpkt.hdr), net_buf.vpkt.hdr.pfcs);
sendto(insock, &net_buf, 58, 0, (struct sockaddr *)&outaddr, sizeof(outaddr));
@ -1137,9 +1137,9 @@ static void ReadDVAPThread()
net_buf.counter = C_COUNTER;
net_buf.nothing2[1] = 0x13;
net_buf.vpkt.icm.ctrl = sequence++;
net_buf.vpkt.ctrl = sequence++;
if (the_end)
net_buf.vpkt.icm.ctrl = sequence | 0x40;
net_buf.vpkt.ctrl = sequence | 0x40;
memcpy(&net_buf.vpkt.vasd, &dr.frame.vad.voice, 12);
sendto(insock, &net_buf, 29, 0, (struct sockaddr *)&outaddr, sizeof(outaddr));

@ -152,7 +152,6 @@ static STOREMOTEG2 to_remote_g2[3]; // 0=A, 1=B, 2=C
// input from remote G2 gateway
static int g2_sock = -1;
static unsigned char readBuffer2[2000]; // 56 or 27, max is 56
static struct sockaddr_in fromDst4;
// Incoming data from remote systems
@ -755,12 +754,13 @@ static void sigCatch(int signum)
/* run the main loop for g2_ircddb */
static void runit()
{
SDSVT g2buf;
fd_set fdset;
struct timeval tv;
socklen_t fromlen;
int recvlen;
int recvlen2;
int g2buflen;
short i,j;
@ -881,13 +881,13 @@ static void runit()
// Let the repeater re-initialize
end_of_audio.counter = toRptr[i].G2_COUNTER;
if (i == 0)
end_of_audio.vpkt.icm.snd_term_id = 0x03;
end_of_audio.vpkt.snd_term_id = 0x03;
else if (i == 1)
end_of_audio.vpkt.icm.snd_term_id = 0x01;
end_of_audio.vpkt.snd_term_id = 0x01;
else
end_of_audio.vpkt.icm.snd_term_id = 0x02;
end_of_audio.vpkt.icm.streamid = toRptr[i].streamid;
end_of_audio.vpkt.icm.ctrl = toRptr[i].sequence | 0x40;
end_of_audio.vpkt.snd_term_id = 0x02;
end_of_audio.vpkt.streamid = toRptr[i].streamid;
end_of_audio.vpkt.ctrl = toRptr[i].sequence | 0x40;
for (j = 0; j < 2; j++)
sendto(srv_sock, end_of_audio.pkt_id, 29, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in));
@ -954,39 +954,37 @@ static void runit()
/* process packets coming from remote G2 */
if (FD_ISSET(g2_sock, &fdset)) {
fromlen = sizeof(struct sockaddr_in);
recvlen2 = recvfrom(g2_sock, (char *)readBuffer2, 2000, 0, (struct sockaddr *)&fromDst4, &fromlen);
g2buflen = recvfrom(g2_sock, g2buf.title, 56, 0, (struct sockaddr *)&fromDst4, &fromlen);
if ( ((recvlen2 == 56) || (recvlen2 == 27)) &&
(memcmp(readBuffer2, "DSVT", 4) == 0) &&
((readBuffer2[4] == 0x10) || (readBuffer2[4] == 0x20)) && /* header or voiceframe */
(readBuffer2[8] == 0x20)) { /* voice type */
if (recvlen2 == 56) {
if ( ((g2buflen == 56) || (g2buflen == 27)) &&
(0==memcmp(g2buf.title, "DSVT", 4)) &&
((g2buf.config == 0x10) || (g2buf.config == 0x20)) && /* header or voiceframe */
(g2buf.id == 0x20)) { /* voice type */
if (g2buflen == 56) {
// Find out the local repeater module IP/port
// to send the data to
i = readBuffer2[25] - 'A';
i = g2buf.hdr.rpt1[7] - 'A';
/* valid repeater module? */
if (i>=0 && i<3) {
/*
toRptr[i] is active if a remote system is talking to it or
toRptr[i] is receiving data from a cross-band
*/
// toRptr[i] is active if a remote system is talking to it or
// toRptr[i] is receiving data from a cross-band
if ((toRptr[i].last_time == 0) && (band_txt[i].last_time == 0) &&
((readBuffer2[15] == 0x00) ||
(readBuffer2[15] == 0x01) || /* allow the announcements from g2_link */
(readBuffer2[15] == 0x08) ||
(readBuffer2[15] == 0x20) ||
(readBuffer2[15] == 0x28) ||
(readBuffer2[15] == 0x40))) {
((g2buf.hdr.flag[0] == 0x00) ||
(g2buf.hdr.flag[0] == 0x01) || /* allow the announcements from g2_link */
(g2buf.hdr.flag[0] == 0x08) ||
(g2buf.hdr.flag[0] == 0x20) ||
(g2buf.hdr.flag[0] == 0x28) ||
(g2buf.hdr.flag[0] == 0x40))) {
if (bool_qso_details)
traceit("START from g2: streamID=%d,%d, flags=%02x:%02x:%02x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes fromIP=%s\n",
readBuffer2[12],readBuffer2[13],
readBuffer2[15], readBuffer2[16], readBuffer2[17],
&readBuffer2[42],
&readBuffer2[50], &readBuffer2[34],
&readBuffer2[18], &readBuffer2[26],
recvlen2,inet_ntoa(fromDst4.sin_addr));
traceit("START from g2: streamID=%04x, flags=%02x:%02x:%02x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes fromIP=%s\n",
g2buf.streamid,
g2buf.hdr.flag[0], g2buf.hdr.flag[1], g2buf.hdr.flag[2],
g2buf.hdr.mycall,
g2buf.hdr.sfx, g2buf.hdr.urcall,
g2buf.hdr.rpt1, g2buf.hdr.rpt2,
g2buflen, inet_ntoa(fromDst4.sin_addr));
memcpy(readBuffer,"DSTR", 4);
readBuffer[5] = (unsigned char)(toRptr[i].G2_COUNTER & 0xff);
@ -996,7 +994,7 @@ static void runit()
readBuffer[8] = 0x00;
readBuffer[9] = 0x30;
readBuffer[10] = 0x20;
memcpy(readBuffer + 11, readBuffer2 + 9, 47);
memcpy(readBuffer + 11, g2buf.flagb, 47);
sendto(srv_sock, readBuffer, 58, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in));
/* save the header */
@ -1004,7 +1002,7 @@ static void runit()
toRptr[i].saved_adr = fromDst4.sin_addr.s_addr;
/* This is the active streamid */
toRptr[i].streamid = readBuffer2[12] + 256u * readBuffer2[13];
toRptr[i].streamid = g2buf.streamid;
toRptr[i].adr = fromDst4.sin_addr.s_addr;
/* time it, in case stream times out */
@ -1017,16 +1015,16 @@ static void runit()
}
}
} else {
if ((readBuffer2[14] & 0x40) != 0) {
if (g2buf.counter & 0x40) {
if (bool_qso_details)
traceit("END from g2: streamID=%d,%d, %d bytes from IP=%s\n",
readBuffer2[12], readBuffer2[13], recvlen2,inet_ntoa(fromDst4.sin_addr));
traceit("END from g2: streamID=%04x, %d bytes from IP=%s\n",
g2buf.streamid, g2buflen,inet_ntoa(fromDst4.sin_addr));
}
/* find out which repeater module to send the data to */
for (i = 0; i < 3; i++) {
/* streamid match ? */
if ((memcmp(&toRptr[i].streamid, readBuffer2 + 12, 2) == 0) &&
if ((toRptr[i].streamid==g2buf.streamid) &&
(toRptr[i].adr == fromDst4.sin_addr.s_addr)) {
memcpy(readBuffer,"DSTR", 4);
readBuffer[5] = (unsigned char)(toRptr[i].G2_COUNTER & 0xff);
@ -1036,7 +1034,7 @@ static void runit()
readBuffer[8] = 0x00;
readBuffer[9] = 0x13;
readBuffer[10] = 0x20;
memcpy(readBuffer+11, readBuffer2+9, 18);
memcpy(readBuffer+11, g2buf.flagb, 18);
sendto(srv_sock, readBuffer, 29, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in));
@ -1049,7 +1047,7 @@ static void runit()
toRptr[i].sequence = readBuffer[16];
/* End of stream ? */
if ((readBuffer2[14] & 0x40) != 0) {
if (g2buf.counter & 0x40) {
/* clear the saved header */
memset(toRptr[i].saved_hdr, 0, sizeof(toRptr[i].saved_hdr));
toRptr[i].saved_adr = 0;
@ -1066,17 +1064,17 @@ static void runit()
if ((i == 3) && bool_regen_header) {
/* check if this a continuation of audio that timed out */
if ((readBuffer2[14] & 0x40) != 0)
if (g2buf.counter & 0x40)
; /* we do not care about end-of-QSO */
else {
/* for which repeater this stream has timed out ? */
for (i = 0; i < 3; i++) {
/* match saved stream ? */
if ((memcmp(toRptr[i].saved_hdr + 14, readBuffer2 + 12, 2) == 0) &&
if ((memcmp(toRptr[i].saved_hdr + 14, &g2buf.streamid, 2) == 0) &&
(toRptr[i].saved_adr == fromDst4.sin_addr.s_addr)) {
/* repeater module is inactive ? */
if ((toRptr[i].last_time == 0) && (band_txt[i].last_time == 0)) {
traceit("Re-generating header for streamID=%d,%d\n", readBuffer2[12],readBuffer2[13]);
traceit("Re-generating header for streamID=%04x\n", g2buf.streamid);
toRptr[i].saved_hdr[5] = (unsigned char)(toRptr[i].G2_COUNTER & 0xff);
toRptr[i].saved_hdr[4] = (unsigned char)((toRptr[i].G2_COUNTER >> 8) & 0xff);
@ -1096,12 +1094,12 @@ static void runit()
readBuffer[8] = 0x00;
readBuffer[9] = 0x13;
readBuffer[10] = 0x20;
memcpy(readBuffer + 11, readBuffer2 + 9, 18);
memcpy(readBuffer + 11, g2buf.flagb, 18);
sendto(srv_sock, readBuffer, 29, 0, (struct sockaddr *)&toRptr[i].band_addr, sizeof(struct sockaddr_in));
/* make sure that any more audio arriving will be accepted */
toRptr[i].streamid = readBuffer2[12] + 256u * readBuffer2[13];
toRptr[i].streamid = g2buf.streamid;
toRptr[i].adr = fromDst4.sin_addr.s_addr;
/* time it, in case stream times out */
@ -1126,8 +1124,7 @@ static void runit()
/* process data coming from local repeater modules */
if (FD_ISSET(srv_sock, &fdset)) {
fromlen = sizeof(struct sockaddr_in);
recvlen = recvfrom(srv_sock,(char *)readBuffer,2000,
0,(struct sockaddr *)&fromRptr,&fromlen);
recvlen = recvfrom(srv_sock,(char *)readBuffer, 2000, 0, (struct sockaddr *)&fromRptr, &fromlen);
/* DV */
if ( ((recvlen == 58) || (recvlen == 29) || (recvlen == 32)) &&
@ -1287,46 +1284,44 @@ static void runit()
to_remote_g2[i].toDst4.sin_port = htons(g2_external.port);
to_remote_g2[i].toDst4.sin_addr.s_addr = inet_addr(ip);
memcpy(readBuffer2, "DSVT", 4);
readBuffer2[4] = 0x10;
readBuffer2[5] = 0x00;
readBuffer2[6] = 0x00;
readBuffer2[7] = 0x00;
readBuffer2[8] = readBuffer[10];
readBuffer2[9] = readBuffer[11];
readBuffer2[10] = readBuffer[12];
readBuffer2[11] = readBuffer[13];
memcpy(readBuffer2 + 12, readBuffer + 14, 44);
memcpy(g2buf.title, "DSVT", 4);
g2buf.config = 0x10;
g2buf.flaga[0] = g2buf.flaga[1] = g2buf.flaga[2] = 0x00;
g2buf.id = readBuffer[10];
g2buf.flagb[0] = readBuffer[11];
g2buf.flagb[1] = readBuffer[12];
g2buf.flagb[2] = readBuffer[13];
memcpy(&g2buf.streamid, readBuffer + 14, 44);
/* set rpt1 */
memset(readBuffer2 + 18, ' ', CALL_SIZE);
memcpy(readBuffer2 + 18, arearp_cs, strlen(arearp_cs));
readBuffer2[25] = temp_mod;
memset(g2buf.hdr.rpt1, ' ', CALL_SIZE);
memcpy(g2buf.hdr.rpt1, arearp_cs, strlen(arearp_cs));
g2buf.hdr.rpt1[7] = temp_mod;
/* set rpt2 */
memset(readBuffer2 + 26, ' ', CALL_SIZE);
memcpy(readBuffer2 + 26, zonerp_cs, strlen(zonerp_cs));
readBuffer2[33] = 'G';
memset(g2buf.hdr.rpt2, ' ', CALL_SIZE);
memcpy(g2buf.hdr.rpt2, zonerp_cs, strlen(zonerp_cs));
g2buf.hdr.rpt2[7] = 'G';
/* set yrcall, can NOT let it be slash and repeater + module */
memcpy(readBuffer2 + 34, "CQCQCQ ", 8);
memcpy(g2buf.hdr.urcall, "CQCQCQ ", 8);
/* set PFCS */
calcPFCS(readBuffer2, 56);
calcPFCS(g2buf.title, 56);
/*
The remote repeater has been set, lets fill in the dest_rptr
so that later we can send that to the LIVE web site
*/
memcpy(band_txt[i].dest_rptr, readBuffer2 + 18, CALL_SIZE);
memcpy(band_txt[i].dest_rptr, g2buf.hdr.rpt1, 8);
band_txt[i].dest_rptr[CALL_SIZE] = '\0';
/* send to remote gateway */
for (j = 0; j < 5; j++)
sendto(g2_sock, readBuffer2, 56, 0,(struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
sendto(g2_sock, g2buf.title, 56, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
traceit("Routing to IP=%s, streamID=%d,%d, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes\n",
traceit("Routing to IP=%s, streamID=%04x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes\n",
inet_ntoa(to_remote_g2[i].toDst4.sin_addr),
readBuffer2[12],readBuffer2[13],&readBuffer2[42],
&readBuffer2[50], &readBuffer2[34],
&readBuffer2[18], &readBuffer2[26],
g2buf.streamid, g2buf.hdr.mycall,
g2buf.hdr.sfx, g2buf.hdr.urcall,
g2buf.hdr.rpt1, &g2buf.hdr.rpt2,
56);
time(&(to_remote_g2[i].last_time));
@ -1368,41 +1363,39 @@ static void runit()
to_remote_g2[i].toDst4.sin_port = htons(g2_external.port);
to_remote_g2[i].toDst4.sin_addr.s_addr = inet_addr(ip);
memcpy(readBuffer2, "DSVT", 4);
readBuffer2[4] = 0x10;
readBuffer2[5] = 0x00;
readBuffer2[6] = 0x00;
readBuffer2[7] = 0x00;
readBuffer2[8] = readBuffer[10];
readBuffer2[9] = readBuffer[11];
readBuffer2[10] = readBuffer[12];
readBuffer2[11] = readBuffer[13];
memcpy(readBuffer2 + 12, readBuffer + 14, 44);
memcpy(g2buf.title, "DSVT", 4);
g2buf.config = 0x10;
g2buf.flaga[0] = g2buf.flaga[1] = g2buf.flaga[2] = 0x00;
g2buf.id = readBuffer[10];
g2buf.flagb[0] = readBuffer[11];
g2buf.flagb[1] = readBuffer[12];
g2buf.flagb[2] = readBuffer[13];
memcpy(&g2buf.streamid, readBuffer + 14, 44);
/* set rpt1 */
memset(readBuffer2 + 18, ' ', CALL_SIZE);
memcpy(readBuffer2 + 18, arearp_cs, strlen(arearp_cs));
readBuffer2[25] = temp_mod;
memset(g2buf.hdr.rpt1, ' ', CALL_SIZE);
memcpy(g2buf.hdr.rpt1, arearp_cs, strlen(arearp_cs));
g2buf.hdr.rpt1[7] = temp_mod;
/* set rpt2 */
memset(readBuffer2 + 26, ' ', CALL_SIZE);
memcpy(readBuffer2 + 26, zonerp_cs, strlen(zonerp_cs));
readBuffer2[33] = 'G';
memset(g2buf.hdr.rpt2, ' ', CALL_SIZE);
memcpy(g2buf.hdr.rpt2, zonerp_cs, strlen(zonerp_cs));
g2buf.hdr.rpt2[7] = 'G';
/* set PFCS */
calcPFCS(readBuffer2, 56);
calcPFCS(g2buf.title, 56);
// The remote repeater has been set, lets fill in the dest_rptr
// so that later we can send that to the LIVE web site
memcpy(band_txt[i].dest_rptr, readBuffer2 + 18, CALL_SIZE);
memcpy(band_txt[i].dest_rptr, g2buf.hdr.rpt1, 8);
band_txt[i].dest_rptr[CALL_SIZE] = '\0';
/* send to remote gateway */
for (j = 0; j < 5; j++)
sendto(g2_sock, readBuffer2, 56, 0,(struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
sendto(g2_sock, g2buf.title, 56, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
traceit("Routing to IP=%s, streamID=%d,%d, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes\n",
traceit("Routing to IP=%s, streamID=%04x, my=%.8s, sfx=%.4s, ur=%.8s, rpt1=%.8s, rpt2=%.8s, %d bytes\n",
inet_ntoa(to_remote_g2[i].toDst4.sin_addr),
readBuffer2[12],readBuffer2[13],&readBuffer2[42],
&readBuffer2[50], &readBuffer2[34],
&readBuffer2[18], &readBuffer2[26],
g2buf.streamid, g2buf.hdr.mycall,
g2buf.hdr.sfx, g2buf.hdr.urcall,
g2buf.hdr.rpt1, g2buf.hdr.rpt2,
56);
time(&(to_remote_g2[i].last_time));
@ -2086,21 +2079,21 @@ static void runit()
for (i = 0; i < 3; i++) {
/* find out if data must go to the remote G2 */
if (memcmp(&to_remote_g2[i].streamid, readBuffer + 14, 2) == 0) {
memcpy(readBuffer2, "DSVT", 4);
readBuffer2[4] = 0x20;
readBuffer2[5] = readBuffer2[6] = readBuffer2[7] = 0x00;
memcpy(readBuffer2 + 8, readBuffer + 10, 7);
memcpy(g2buf.title, "DSVT", 4);
g2buf.config = 0x20;
g2buf.flaga[0] = g2buf.flaga[1] = g2buf.flaga[2] = 0x00;
memcpy(&g2buf.id, readBuffer + 10, 7);
if (recvlen == 29)
memcpy(readBuffer2 + 15, readBuffer + 17, 12);
memcpy(g2buf.vasd.voice, readBuffer + 17, 12);
else
memcpy(readBuffer2 + 15, readBuffer + 20, 12);
memcpy(g2buf.vasd.voice, readBuffer + 20, 12);
sendto(g2_sock, readBuffer2, 27, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
sendto(g2_sock, g2buf.title, 27, 0, (struct sockaddr *)&(to_remote_g2[i].toDst4), sizeof(struct sockaddr_in));
time(&(to_remote_g2[i].last_time));
/* Is this the end-of-stream */
if ((readBuffer[16] & 0x40) != 0) {
if (readBuffer[16] & 0x40) {
memset(&to_remote_g2[i].toDst4,0,sizeof(struct sockaddr_in));
to_remote_g2[i].streamid = 0;
to_remote_g2[i].last_time = 0;
@ -2742,9 +2735,9 @@ int main(int argc, char **argv)
end_of_audio.flag[1] = 0x12;
end_of_audio.nothing2[0] = 0x00;
end_of_audio.nothing2[1] = 0x13;
end_of_audio.vpkt.icm.icm_id = 0x20;
end_of_audio.vpkt.icm.dst_rptr_id = 0x00;
end_of_audio.vpkt.icm.snd_rptr_id = 0x01;
end_of_audio.vpkt.icm_id = 0x20;
end_of_audio.vpkt.dst_rptr_id = 0x00;
end_of_audio.vpkt.snd_rptr_id = 0x01;
memset(end_of_audio.vpkt.vasd.voice, '\0', 9);
end_of_audio.vpkt.vasd.text[0] = 0x70;
end_of_audio.vpkt.vasd.text[1] = 0x4f;

@ -1510,8 +1510,7 @@ static void runit()
if (FD_ISSET(xrf_g2_sock, &fdset)) {
fromlen = sizeof(struct sockaddr_in);
recvlen2 = recvfrom(xrf_g2_sock,(char *)readBuffer2,100,
0,(struct sockaddr *)&fromDst4,&fromlen);
recvlen2 = recvfrom(xrf_g2_sock, (char *)readBuffer2, 100, 0, (struct sockaddr *)&fromDst4, &fromlen);
strncpy(ip, inet_ntoa(fromDst4.sin_addr),IP_SIZE);
ip[IP_SIZE] = '\0';
@ -2860,7 +2859,7 @@ static void runit()
&readBuffer2[44],
&readBuffer2[52], &readBuffer2[36],
&readBuffer2[20], &readBuffer2[28],
recvlen2,inet_ntoa(fromDst4.sin_addr), source_stn);
recvlen2, inet_ntoa(fromDst4.sin_addr), source_stn);
// put user into tmp1
memcpy(tmp1, readBuffer2 + 44, 8);

@ -21,38 +21,36 @@
#pragma pack(push, 1) // we need to be sure these structures don't have any dead space
typedef struct pkt_tag {
unsigned char pkt_id[4];
unsigned short counter;
unsigned char flag[2];
unsigned char nothing2[2];
unsigned char pkt_id[4]; // 0
unsigned short counter; // 4
unsigned char flag[2]; // 6
unsigned char nothing2[2]; // 8
union {
struct {
unsigned char mycall[8];
unsigned char rpt[8];
} spkt;
unsigned char mycall[8]; // 10
unsigned char rpt[8]; // 18
} spkt; // total 26
struct {
struct {
unsigned char icm_id;
unsigned char dst_rptr_id;
unsigned char snd_rptr_id;
unsigned char snd_term_id;
uint16_t streamid;
unsigned char ctrl;
} icm;
unsigned char icm_id; // 10
unsigned char dst_rptr_id; // 11
unsigned char snd_rptr_id; // 12
unsigned char snd_term_id; // 13
uint16_t streamid; // 14
unsigned char ctrl; // 16
union {
struct {
unsigned char flag[3];
unsigned char rpt1[8];
unsigned char rpt2[8];
unsigned char urcall[8];
unsigned char mycall[8];
unsigned char sfx[4];
unsigned char pfcs[2];
} hdr; // 41 byte header
unsigned char flag[3]; // 17
unsigned char rpt1[8]; // 20
unsigned char rpt2[8]; // 28
unsigned char urcall[8];// 36
unsigned char mycall[8];// 44
unsigned char sfx[4]; // 52
unsigned char pfcs[2]; // 56
} hdr; // total 58
struct {
unsigned char voice[9];
unsigned char text[3];
} vasd; // 12 byte voice and slow data
unsigned char voice[9]; // 17
unsigned char text[3]; // 26
} vasd; // total 29
};
} vpkt;
};
@ -61,26 +59,26 @@ typedef struct pkt_tag {
#pragma pack(push, 1)
typedef struct dsvt_tag {
unsigned char title[4]; // "DSVT"
unsigned char config; // 0x10 is hdr 0x20 is vasd
unsigned char flaga[3]; // zeros
unsigned char id; // 0x20
unsigned char flagb[3]; // 0x0 0x1 0x1
unsigned short streamid;
unsigned char counter; // hdr: 0x80 vsad: framecounter (mod 21)
unsigned char title[4]; // 0 "DSVT"
unsigned char config; // 4 0x10 is hdr 0x20 is vasd
unsigned char flaga[3]; // 5 zeros
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)
union {
struct {
unsigned char flag[3];
unsigned char rpt1[8];
unsigned char rpt2[8];
unsigned char urcall[8];
unsigned char mycall[8];
unsigned char sfx[4];
unsigned char pfcs[2];
struct { // index
unsigned char flag[3]; // 15
unsigned char rpt1[8]; // 18
unsigned char rpt2[8]; // 26
unsigned char urcall[8];// 34
unsigned char mycall[8];// 42
unsigned char sfx[4]; // 50
unsigned char pfcs[2]; // 54
} hdr;
struct {
unsigned char voice[9];
unsigned char text[3];
unsigned char voice[9]; // 15
unsigned char text[3]; // 24
} vasd;
};
} SDSVT;

Loading…
Cancel
Save

Powered by TurnKey Linux.