FreeCalypso > hg > freecalypso-tools
annotate rvinterf/lowlevel/logsent.c @ 937:06f96627ac9a
rvinterf TM log: decode TMFFS2 commands
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 24 May 2023 04:25:47 +0000 |
parents | bd6dd6120180 |
children | 8fc3b72eb2c6 |
rev | line source |
---|---|
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements the logging of sent packets |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include "../include/pktmux.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "../include/limits.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
12 extern int no_output, verbose; |
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
13 extern FILE *logF; |
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
14 |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
15 extern void output_cont(); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
16 |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 static void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 log_sent_ati(pkt, pktlen) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 u_char *pkt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 char buf[MAX_PKT_TO_TARGET*4+10]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 strcpy(buf, "Sent to ATI: "); |
927
4e243402f453
rvinterf/lowlevel: use libprint for backslash-escape output
Mychaela Falconia <falcon@freecalypso.org>
parents:
899
diff
changeset
|
24 safe_print_trace(pkt + 1, pktlen - 1, buf + 13); |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 output_line(buf); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 static void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 log_sent_gpf(pkt, pktlen) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 u_char *pkt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 char buf[MAX_PKT_TO_TARGET*4+30]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 strcpy(buf, "Sent "); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 format_g23_packet(pkt, pktlen, buf + 5); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 output_line(buf); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
932
3d1abb9f05ef
rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
928
diff
changeset
|
39 void |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 log_sent_packet(pkt, pktlen) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 u_char *pkt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 { |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
43 if (no_output && !logF) |
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
44 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 switch (pkt[0]) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 case RVT_L23_HEADER: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 log_sent_gpf(pkt, pktlen); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 return; |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
49 case RVT_TM_HEADER: |
932
3d1abb9f05ef
rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
928
diff
changeset
|
50 log_sent_tm(pkt, pktlen); |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
51 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 case RVT_AT_HEADER: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 log_sent_ati(pkt, pktlen); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 return; |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
55 case RVT_TCH_HEADER: |
933
bd6dd6120180
rvinterf: -v enables TM hex dump, -vv enables TCH hex dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
932
diff
changeset
|
56 if (verbose >= 2) { |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
57 output_line("Sent TCH packet"); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
58 packet_hex_dump(pkt, pktlen, output_cont); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
59 } else { |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
60 tch_inc_count_tx(); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
61 } |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
62 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 default: |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
64 output_line("Sent misc packet"); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
65 packet_hex_dump(pkt, pktlen, output_cont); |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 } |