annotate rvinterf/lowlevel/tchhide.c @ 963:b515a97e5dff

sms-pdu-decode family: fix VP-Relative header spacing When VP-Relative is small enough to be reckoned in 5 min or 30 min units, it was printed incorrectly, with a cosmetic defect of one extra space. Fix this bug.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Aug 2023 03:52:53 +0000
parents a1065c17429c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
899
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * One of several FreeCalypso extensions to RVTMUX is TCH bit access
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * logical channel, and we would like to handle it specially in rvinterf
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * because it's extremely chatty, sending a frame every 20 ms. If we
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * were to output every TCH frame in our regular log, that log output
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * becomes useless as everything else is drowned out. Therefore, we
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * implement a hiding mode by default: we only count how many TCH packets
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 * were exchanged in between other messages of interest, and report these
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 * counts.
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 */
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdio.h>
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern void (*output_hook)();
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 unsigned tch_rx_count, tch_tx_count;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 static void
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 tch_report_hook()
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 char msgbuf[80];
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 output_hook = 0;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (tch_rx_count) {
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 sprintf(msgbuf, "TCH: received %u packet%s", tch_rx_count,
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 tch_rx_count != 1 ? "s" : "");
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 output_line(msgbuf);
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 tch_rx_count = 0;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 if (tch_tx_count) {
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 sprintf(msgbuf, "TCH: sent %u packet%s", tch_tx_count,
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 tch_tx_count != 1 ? "s" : "");
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 output_line(msgbuf);
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 tch_tx_count = 0;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 void
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 tch_inc_count_rx()
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 {
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 tch_rx_count++;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 output_hook = tch_report_hook;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 void
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 tch_inc_count_tx()
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 {
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 tch_tx_count++;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 output_hook = tch_report_hook;
a1065c17429c rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 }