FreeCalypso > hg > freecalypso-sw
diff 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 |
line wrap: on
line diff
--- a/rvinterf/lowlevel/logsent.c Mon Jun 01 01:20:33 2015 +0000 +++ b/rvinterf/lowlevel/logsent.c Mon Jun 01 01:35:33 2015 +0000 @@ -10,6 +10,36 @@ #include "../include/limits.h" static void +log_sent_ati(pkt, pktlen) + u_char *pkt; +{ + char buf[MAX_PKT_TO_TARGET*4+10]; + int i, c; + char *dp; + + strcpy(buf, "Sent to ATI: "); + dp = buf + 13; + for (i = 1; i < pktlen; i++) { + c = pkt[i]; + if (c & 0x80) { + *dp++ = 'M'; + *dp++ = '-'; + c &= 0x7F; + } + if (c < 0x20) { + *dp++ = '^'; + *dp++ = c + '@'; + } else if (c == 0x7F) { + *dp++ = '^'; + *dp++ = '?'; + } else + *dp++ = c; + } + *dp = '\0'; + output_line(buf); +} + +static void log_sent_gpf(pkt, pktlen) u_char *pkt; { @@ -42,8 +72,14 @@ log_sent_packet(pkt, pktlen) u_char *pkt; { - if (pkt[0] == RVT_L23_HEADER) + switch (pkt[0]) { + case RVT_L23_HEADER: log_sent_gpf(pkt, pktlen); - else + return; + case RVT_AT_HEADER: + log_sent_ati(pkt, pktlen); + return; + default: log_sent_other(pkt, pktlen); + } }