FreeCalypso > hg > freecalypso-sw
comparison rvinterf/libasync/rvtrace.c @ 335:40b8557b9d04
rvinterf suite: libasync factored out of fc-tmsh
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 22 Apr 2014 06:51:09 +0000 |
parents | rvinterf/tmsh/pktsort.c@c146f38d2b5f |
children |
comparison
equal
deleted
inserted
replaced
334:73a2b359b3cd | 335:40b8557b9d04 |
---|---|
1 /* | |
2 * Here we detect and handle "Lost Message" packets. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 #include <strings.h> | |
9 #include <stdlib.h> | |
10 #include "pktmux.h" | |
11 #include "limits.h" | |
12 #include "localsock.h" | |
13 | |
14 extern u_char rvi_msg[]; | |
15 extern int rvi_msg_len; | |
16 | |
17 void | |
18 safe_print_trace(src, srclen, dest) | |
19 u_char *src; | |
20 char *dest; | |
21 { | |
22 int i, c; | |
23 char *dp; | |
24 | |
25 dp = dest; | |
26 for (i = 0; i < srclen; i++) { | |
27 c = src[i]; | |
28 if (c & 0x80) { | |
29 *dp++ = 'M'; | |
30 *dp++ = '-'; | |
31 c &= 0x7F; | |
32 } | |
33 if (c < 0x20) { | |
34 *dp++ = '^'; | |
35 *dp++ = c + '@'; | |
36 } else if (c == 0x7F) { | |
37 *dp++ = '^'; | |
38 *dp++ = '?'; | |
39 } else | |
40 *dp++ = c; | |
41 } | |
42 *dp = '\0'; | |
43 } | |
44 | |
45 void | |
46 handle_useid_0() | |
47 { | |
48 char buf[MAX_PKT_FROM_TARGET*4]; | |
49 | |
50 if (strncmp(rvi_msg + 7, "RVT: Lost Message", 17)) | |
51 return; | |
52 safe_print_trace(rvi_msg + 7, rvi_msg_len - 7, buf); | |
53 async_msg_output(buf); | |
54 } |