FreeCalypso > hg > freecalypso-tools
annotate rvinterf/lowlevel/logsent.c @ 1013:bc4dc383ff4a default tip
doc/Loadtools-usage: list SE J110/120 pair properly
These two Chi-Mei phones are variants of the same design
with only minor diffs.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 23 Sep 2024 12:28:57 +0000 |
parents | fab04df64690 |
children |
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 |
942
fab04df64690
rvinterf/lowlevel: replace libg23 with libprint
Mychaela Falconia <falcon@freecalypso.org>
parents:
941
diff
changeset
|
15 extern void output_line(); |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
16 extern void output_cont(); |
941
8fc3b72eb2c6
rvinterf -vv TCH raw dump: write to log only if running with -l
Mychaela Falconia <falcon@freecalypso.org>
parents:
933
diff
changeset
|
17 extern void output_cont_logpref(); |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
18 |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 static void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 log_sent_ati(pkt, pktlen) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 u_char *pkt; |
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 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
|
24 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 strcpy(buf, "Sent to ATI: "); |
927
4e243402f453
rvinterf/lowlevel: use libprint for backslash-escape output
Mychaela Falconia <falcon@freecalypso.org>
parents:
899
diff
changeset
|
26 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
|
27 output_line(buf); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
932
3d1abb9f05ef
rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
928
diff
changeset
|
30 void |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 log_sent_packet(pkt, pktlen) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 u_char *pkt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 { |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
34 if (no_output && !logF) |
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
35 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 switch (pkt[0]) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 case RVT_L23_HEADER: |
942
fab04df64690
rvinterf/lowlevel: replace libg23 with libprint
Mychaela Falconia <falcon@freecalypso.org>
parents:
941
diff
changeset
|
38 format_gpf_packet(pkt, pktlen, "Sent ", output_line, |
fab04df64690
rvinterf/lowlevel: replace libg23 with libprint
Mychaela Falconia <falcon@freecalypso.org>
parents:
941
diff
changeset
|
39 output_cont_logpref); |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 return; |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
41 case RVT_TM_HEADER: |
932
3d1abb9f05ef
rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
928
diff
changeset
|
42 log_sent_tm(pkt, pktlen); |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
43 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 case RVT_AT_HEADER: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 log_sent_ati(pkt, pktlen); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 return; |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
47 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
|
48 if (verbose >= 2) { |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
49 output_line("Sent TCH packet"); |
941
8fc3b72eb2c6
rvinterf -vv TCH raw dump: write to log only if running with -l
Mychaela Falconia <falcon@freecalypso.org>
parents:
933
diff
changeset
|
50 packet_hex_dump(pkt, pktlen, output_cont_logpref); |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
51 } else { |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
52 tch_inc_count_tx(); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
53 } |
899
a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
54 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 default: |
928
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
56 output_line("Sent misc packet"); |
65953c172f24
rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents:
927
diff
changeset
|
57 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
|
58 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 } |