FreeCalypso > hg > freecalypso-sw
comparison rvinterf/asyncshell/pktsort.c @ 1011:820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 21:10:21 +0000 |
parents | 4661b84260a0 |
children | f511bbac0efa |
comparison
equal
deleted
inserted
replaced
1010:658fe6f1880f | 1011:820d34f3f3d7 |
---|---|
37 useid); | 37 useid); |
38 exit(1); | 38 exit(1); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 void | 42 static void |
43 gpf_packet_rx() | 43 gpf_packet_rx() |
44 { | 44 { |
45 char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ | 45 char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ |
46 | 46 |
47 format_g23_packet(rvi_msg + 1, rvi_msg_len - 1, fmtbuf); | 47 format_g23_packet(rvi_msg + 1, rvi_msg_len - 1, fmtbuf); |
48 async_msg_output(fmtbuf); | 48 async_msg_output(fmtbuf); |
49 } | 49 } |
50 | 50 |
51 void | 51 static void |
52 response_from_ati() | 52 response_from_ati() |
53 { | 53 { |
54 char buf[MAX_PKT_FROM_TARGET*4+2]; | 54 char buf[MAX_PKT_FROM_TARGET*4+2]; |
55 | 55 |
56 strcpy(buf, "ATI: "); | 56 strcpy(buf, "ATI: "); |
57 safe_print_trace(rvi_msg + 2, rvi_msg_len - 2, buf + 5); | 57 safe_print_trace(rvi_msg + 2, rvi_msg_len - 2, buf + 5); |
58 async_msg_output(buf); | |
59 } | |
60 | |
61 static void | |
62 dump_tch() | |
63 { | |
64 char buf[MAX_PKT_FROM_TARGET*3+5], *dp; | |
65 u_char *cp, *endp; | |
66 | |
67 cp = rvi_msg + 2; | |
68 endp = rvi_msg + rvi_msg_len; | |
69 strcpy(buf, "TCH:"); | |
70 dp = buf + 4; | |
71 while (cp < endp) { | |
72 sprintf(dp, " %02X", *cp++); | |
73 dp += 3; | |
74 } | |
75 *dp = '\0'; | |
58 async_msg_output(buf); | 76 async_msg_output(buf); |
59 } | 77 } |
60 | 78 |
61 void | 79 void |
62 process_pkt_from_target() | 80 process_pkt_from_target() |
69 gpf_packet_rx(); | 87 gpf_packet_rx(); |
70 return; | 88 return; |
71 case RVT_AT_HEADER: | 89 case RVT_AT_HEADER: |
72 response_from_ati(); | 90 response_from_ati(); |
73 return; | 91 return; |
92 case RVT_TCH_HEADER: | |
93 dump_tch(); | |
94 return; | |
74 default: | 95 default: |
75 tty_cleanup(); | 96 tty_cleanup(); |
76 fprintf(stderr, "unexpected fwd of MUX %02X from rvinterf\n", | 97 fprintf(stderr, "unexpected fwd of MUX %02X from rvinterf\n", |
77 rvi_msg[1]); | 98 rvi_msg[1]); |
78 exit(1); | 99 exit(1); |