FreeCalypso > hg > freecalypso-tools
view rvinterf/asyncshell/pktsort.c @ 964:a96cb97b66a2
ringtools/imy: fix duplicate definition of tdma_durations[]
The bug was reported by Vadim Yanitskiy <fixeria@osmocom.org>,
although the present fix is slightly different from the contributed
patch: because main.c doesn't need this tdma_durations[] array
at all, let's simply remove the reference to this array from main.c
rather than turn it into an extern.
I no longer remember my original thought flow that resulted (by mistake)
in tdma_durations[] being multiply defined in main.c and durations.c.
My intent might have been to define all globals in main.c and have
the reference in durations.c be an extern - and I missed that extern -
but without clear memory, I have no certainty. In any case, having
this data array defined in the same module that fills it (durations.c)
is sensible, so let's make it the new way.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 31 Aug 2023 19:38:18 +0000 |
parents | 31a36b400cdf |
children |
line wrap: on
line source
/* * Here we sort out incoming packets from the target relayed via rvinterf. */ #include <sys/types.h> #include <stdio.h> #include <string.h> #include <strings.h> #include <stdlib.h> #include "pktmux.h" #include "limits.h" #include "localsock.h" #include "localtypes.h" #include "exitcodes.h" extern u_char rvi_msg[]; extern int rvi_msg_len; extern int oneshot_mode; extern void async_msg_output(); static void process_rvt() { u32 useid; if (rvi_msg_len < 7) { tty_cleanup(); fprintf(stderr, "Error: rvinterf sent us an invalid RVT msg\n"); exit(ERROR_RVINTERF); } useid = rvi_msg[2] << 24 | rvi_msg[3] << 16 | rvi_msg[4] << 8 | rvi_msg[5]; switch (useid) { case 0: handle_useid_0(); return; default: tty_cleanup(); fprintf(stderr, "unexpected fwd of USEID %08X from rvinterf\n", useid); exit(ERROR_RVINTERF); } } static void discard_cont_out() { } static void gpf_packet_rx() { format_gpf_packet(rvi_msg + 1, rvi_msg_len - 1, "", async_msg_output, discard_cont_out); } static void response_from_ati() { char buf[MAX_PKT_FROM_TARGET*4+2]; strcpy(buf, "ATI: "); safe_print_trace(rvi_msg + 2, rvi_msg_len - 2, buf + 5); async_msg_output(buf); if (oneshot_mode) oneshot_at_check_response(); } void process_pkt_from_target() { switch (rvi_msg[1]) { case RVT_RV_HEADER: process_rvt(); return; case RVT_L23_HEADER: gpf_packet_rx(); return; case RVT_AT_HEADER: response_from_ati(); return; case RVT_TCH_HEADER: tch_packet_rx(); return; default: tty_cleanup(); fprintf(stderr, "unexpected fwd of MUX %02X from rvinterf\n", rvi_msg[1]); exit(ERROR_RVINTERF); } }