• R/O
  • HTTP
  • SSH
  • HTTPS

dxchange: Commit


Commit MetaInfo

Revision1d1b1c46b99b1edf6821f14115218b4eb52bd8a2 (tree)
Time2016-06-27 09:10:38
AuthorSatoshi Yasuda <7m3tjz@jk1z...>
CommiterSatoshi Yasuda

Log Message

modified: repeater.c

Change Summary

Incremental Difference

--- a/repeater.c
+++ b/repeater.c
@@ -43,6 +43,12 @@ union
4343 char gw_buffer[1024];
4444 } gw_buff;
4545
46+union
47+{
48+ struct dstar_packet d_packet;
49+ char mon_buffer[128];
50+} mon_buff;
51+
4652 void repeater_zr(void)
4753 {
4854 int zr_length;
@@ -65,10 +71,7 @@ void repeater_zr(void)
6571
6672 if (zr_length == 58)
6773 {
68- if (zr_port > 0)
69- {
70- memcpy (zr_frame_id, &zr_buff.zr_buffer[14], 2);
71- }
74+ memcpy (zr_frame_id, &zr_buff.zr_buffer[14], 2);
7275 }
7376
7477 if (!memcmp (zr_frame_id, &zr_buff.zr_buffer[14], 2))
@@ -223,27 +226,27 @@ int repeater_mon(void)
223226 struct timeval cur_time;
224227
225228 len_in_sock = sizeof (in_sock);
226- length = recvfrom(rpt_mon_sd, &zr_buff, sizeof(zr_buff), 0, (struct sockaddr *)&in_sock, &len_in_sock);
229+ length = recvfrom(rpt_mon_sd, &mon_buff, sizeof(mon_buff), 0, (struct sockaddr *)&in_sock, &len_in_sock);
227230 if (length < 0) {
228231 time(&atime);
229232 fprintf (log_file, "%24.24s Repeater data Reciv. error\n", ctime(&atime));
230233 return FALSE; // end
231234 }
232235
233- if (!memcmp(zr_buff.d_packet.id, "DSTR", 4) && (zr_buff.d_packet.sr == 0x73)
234- && (zr_buff.d_packet.c == 0x12) && (zr_buff.d_packet.trunk.FrameType == 0x20)
235- && ((zr_buff.d_packet.trunk.FrameSeq & 0x3f) < 21)) // check D-STAR packet (DSTR)
236+ if (!memcmp(mon_buff.d_packet.id, "DSTR", 4) && (mon_buff.d_packet.sr == 0x73)
237+ && (mon_buff.d_packet.c == 0x12) && (mon_buff.d_packet.trunk.FrameType == 0x20)
238+ && ((mon_buff.d_packet.trunk.FrameSeq & 0x3f) < 21)) // check D-STAR packet (DSTR)
236239 {
237240 if (length == 58)
238241 {
239- m_pnt = module_check(zr_buff.d_packet.body.header.rpt1, zr_buff.d_packet.body.header.rpt1);
242+ m_pnt = module_check(mon_buff.d_packet.body.header.rpt1, mon_buff.d_packet.body.header.rpt1);
240243 if (m_pnt)
241244 {
242- memcpy (&m_pnt->rpt_save, &zr_buff, 58);
245+ memcpy (&m_pnt->rpt_save, &mon_buff, 58);
243246 m_pnt->rpt_save_length = 58;
244247 rep_send (m_pnt);
245- m_pnt->FrameID[0] = zr_buff.d_packet.trunk.FrameID[0];
246- m_pnt->FrameID[1] = zr_buff.d_packet.trunk.FrameID[1];
248+ m_pnt->FrameID[0] = mon_buff.d_packet.trunk.FrameID[0];
249+ m_pnt->FrameID[1] = mon_buff.d_packet.trunk.FrameID[1];
247250 memcpy (&m_pnt->ipaddress, &in_sock.sin_addr.s_addr, 4);
248251 memcpy (&m_pnt->port, &in_sock.sin_port, 2);
249252 gettimeofday (&cur_time, NULL);
@@ -257,10 +260,10 @@ int repeater_mon(void)
257260 {
258261 memcpy (&ip_temp, &in_sock.sin_addr.s_addr, 4);
259262 memcpy (&port_temp, &in_sock.sin_port, 2);
260- m_pnt = module_check_ex (zr_buff.d_packet.trunk.FrameID, ip_temp, port_temp);
263+ m_pnt = module_check_ex (mon_buff.d_packet.trunk.FrameID, ip_temp, port_temp);
261264 if (m_pnt)
262265 {
263- memcpy (&m_pnt->rpt_save, &zr_buff, 29);
266+ memcpy (&m_pnt->rpt_save, &mon_buff, 29);
264267 m_pnt->rpt_save_length = 29;
265268 rep_send (m_pnt);
266269 gettimeofday (&cur_time, NULL);
@@ -274,10 +277,10 @@ int repeater_mon(void)
274277 {
275278 memcpy (&ip_temp, &in_sock.sin_addr.s_addr, 4);
276279 memcpy (&port_temp, &in_sock.sin_port, 2);
277- m_pnt = module_check_ex (zr_buff.d_packet.trunk.FrameID, ip_temp, port_temp);
280+ m_pnt = module_check_ex (mon_buff.d_packet.trunk.FrameID, ip_temp, port_temp);
278281 if (m_pnt)
279282 {
280- memcpy (&m_pnt->rpt_save, &zr_buff, 32);
283+ memcpy (&m_pnt->rpt_save, &mon_buff, 32);
281284 m_pnt->rpt_save_length = 32;
282285 rep_send (m_pnt);
283286 m_pnt->rpt_save_length = 0;
@@ -286,7 +289,10 @@ int repeater_mon(void)
286289
287290 }
288291 }
289- if (forward_pnt) forward (zr_buff.d_packet, length);
292+ if (forward_pnt)
293+ {
294+ forward (mon_buff.d_packet, length);
295+ }
290296 }
291297 return TRUE;
292298 }
Show on old repository browser