FreeCalypso > hg > freecalypso-sw
comparison rvinterf/lowlevel/logsent.c @ 881:da9a36515da6
rvinterf: log sent AT commands in ASCII form
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 01:35:33 +0000 |
parents | c2f2f7d78451 |
children |
comparison
equal
deleted
inserted
replaced
880:136fa1ccd591 | 881:da9a36515da6 |
---|---|
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <strings.h> | 8 #include <strings.h> |
9 #include "../include/pktmux.h" | 9 #include "../include/pktmux.h" |
10 #include "../include/limits.h" | 10 #include "../include/limits.h" |
11 | |
12 static void | |
13 log_sent_ati(pkt, pktlen) | |
14 u_char *pkt; | |
15 { | |
16 char buf[MAX_PKT_TO_TARGET*4+10]; | |
17 int i, c; | |
18 char *dp; | |
19 | |
20 strcpy(buf, "Sent to ATI: "); | |
21 dp = buf + 13; | |
22 for (i = 1; i < pktlen; i++) { | |
23 c = pkt[i]; | |
24 if (c & 0x80) { | |
25 *dp++ = 'M'; | |
26 *dp++ = '-'; | |
27 c &= 0x7F; | |
28 } | |
29 if (c < 0x20) { | |
30 *dp++ = '^'; | |
31 *dp++ = c + '@'; | |
32 } else if (c == 0x7F) { | |
33 *dp++ = '^'; | |
34 *dp++ = '?'; | |
35 } else | |
36 *dp++ = c; | |
37 } | |
38 *dp = '\0'; | |
39 output_line(buf); | |
40 } | |
11 | 41 |
12 static void | 42 static void |
13 log_sent_gpf(pkt, pktlen) | 43 log_sent_gpf(pkt, pktlen) |
14 u_char *pkt; | 44 u_char *pkt; |
15 { | 45 { |
40 } | 70 } |
41 | 71 |
42 log_sent_packet(pkt, pktlen) | 72 log_sent_packet(pkt, pktlen) |
43 u_char *pkt; | 73 u_char *pkt; |
44 { | 74 { |
45 if (pkt[0] == RVT_L23_HEADER) | 75 switch (pkt[0]) { |
76 case RVT_L23_HEADER: | |
46 log_sent_gpf(pkt, pktlen); | 77 log_sent_gpf(pkt, pktlen); |
47 else | 78 return; |
79 case RVT_AT_HEADER: | |
80 log_sent_ati(pkt, pktlen); | |
81 return; | |
82 default: | |
48 log_sent_other(pkt, pktlen); | 83 log_sent_other(pkt, pktlen); |
84 } | |
49 } | 85 } |