FreeCalypso > hg > freecalypso-tools
annotate rvinterf/libprint/gpf_tst.c @ 957:e030327b6a9a
CHANGES: document -Petmoff addition
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Jun 2023 00:40:12 +0000 |
parents | 4d2e6a2dd1a1 |
children |
rev | line source |
---|---|
939
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This libprint module (one public function plus many internal subfunctions) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * implements printing/formatting of GPF TST interface packets, which can be |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * traces, sysprims, protocol stack primitives or unrecognized packet format. |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <sys/types.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <ctype.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <string.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <strings.h> |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 static int |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 basic_checks(rxpkt, rxpkt_len) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 int i, c; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (rxpkt_len < 17) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 /* check version bits in the header byte */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if ((rxpkt[1] & 0xC0) != 0x80) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 /* check the length */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 c = rxpkt[2] | rxpkt[3] << 8; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 if (c + 4 != rxpkt_len) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 /* ensure that the "from" and "to" are printable ASCII */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 for (i = 8; i < 16; i++) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 c = rxpkt[i]; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 if (c < ' ' || c > '~') |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 /* basic checks pass */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 return(1); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 static int |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 psprim_extra_checks(rxpkt, rxpkt_len) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 int i, c; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 if (rxpkt_len < 24) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 /* "original rcvr" field needs to be printable ASCII */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 for (i = 16; i < 20; i++) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 c = rxpkt[i]; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 if (c < ' ' || c > '~') |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 /* checks pass */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return(1); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 print_malformed(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 char headline[80]; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 sprintf(headline, "%sGPF unrecognized packet format", extra_prefix); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 outfunc_head(headline); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 packet_hex_dump(rxpkt, rxpkt_len, outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 print_malloc_fail(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 char headline[80]; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 sprintf(headline, "%sGPF packet, failed malloc in formatting", |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 extra_prefix); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 outfunc_head(headline); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 packet_hex_dump(rxpkt, rxpkt_len, outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 static int |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 entity_name_well_formed(p) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 char *p; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 int i, len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 if (!isupper(p[0])) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 for (i = 0; i < 4; i++) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 if (!isalnum(p[i])) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 break; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 len = i; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 for (; i < 4; i++) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 if (p[i] != ' ') |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 return(0); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 return(len); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 print_entity_name(raw, outp) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 char *raw, **outp; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 int len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 len = entity_name_well_formed(raw); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 if (len) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 sprintf(*outp, "%.*s", len, raw); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 *outp += len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 } else { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 sprintf(*outp, "\"%.4s\"", raw); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 *outp += 6; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 print_common_hdr(rxpkt, outp, typestr, extra_prefix) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 char **outp, *typestr, *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 sprintf(*outp, "%sGPF %s id=%02X ts=%02X%02X%02X%02X ", extra_prefix, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 typestr, rxpkt[1], rxpkt[7], rxpkt[6], rxpkt[5], rxpkt[4]); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 *outp = index(*outp, '\0'); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 print_entity_name(rxpkt + 8, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 *(*outp)++ = '-'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 *(*outp)++ = '>'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 print_entity_name(rxpkt + 12, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 *(*outp)++ = ' '; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 format_text(rxpkt, rxpkt_len, start_off, outp) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 unsigned rxpkt_len, start_off; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 char *outp; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 *outp++ = '\"'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 safe_print_trace(rxpkt + start_off, rxpkt_len - start_off, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 outp = index(outp, '\0'); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 *outp++ = '\"'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 *outp = '\0'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 format_compressed_trace(rxpkt, rxpkt_len, start_off, outp) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 unsigned rxpkt_len, start_off; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 char *outp; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 int i; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 i = start_off + 1; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 sprintf(outp, "%d", rxpkt[i+1] << 8 | rxpkt[i]); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 outp = index(outp, '\0'); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 i += 4; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 for (; i < rxpkt_len; i++) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 sprintf(outp, " %02X", rxpkt[i]); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 outp += 3; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 *outp = '\0'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 format_trace(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 char *outbuf, *outp; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 int i; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 outbuf = malloc(rxpkt_len * 4 + strlen(extra_prefix) + 1); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 if (!outbuf) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 print_malloc_fail(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 outp = outbuf; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 print_common_hdr(rxpkt, &outp, "trace", extra_prefix); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 i = 16; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 if (rxpkt[i] < 0x20) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 sprintf(outp, "tc=%02X ", rxpkt[i]); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 outp += 6; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 i++; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 if (rxpkt_len - i >= 5 && rxpkt[i] == '%' && |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 !rxpkt[i+3] && !rxpkt[i+4]) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 format_compressed_trace(rxpkt, rxpkt_len, i, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 else |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 format_text(rxpkt, rxpkt_len, i, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 outfunc_head(outbuf); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 free(outbuf); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 format_sysprim(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 char *outbuf, *outp; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 outbuf = malloc(rxpkt_len * 4 + strlen(extra_prefix) + 1); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 if (!outbuf) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 print_malloc_fail(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 outp = outbuf; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 print_common_hdr(rxpkt, &outp, "sysprim", extra_prefix); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 format_text(rxpkt, rxpkt_len, 16, outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 outfunc_head(outbuf); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 free(outbuf); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 static void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 format_psprim(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 char headline[80]; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 char *outp = headline; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 print_common_hdr(rxpkt, &outp, "PSprim", extra_prefix); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 /* original destination */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 *outp++ = '('; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 print_entity_name(rxpkt + 16, &outp); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 *outp++ = ')'; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 /* opcode and data length */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 sprintf(outp, " %02X%02X%02X%02X len=%u", |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 rxpkt[23], rxpkt[22], rxpkt[21], rxpkt[20], rxpkt_len - 24); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 outfunc_head(headline); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 packet_hex_dump(rxpkt + 24, rxpkt_len - 24, outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 void |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 format_gpf_packet(rxpkt, rxpkt_len, extra_prefix, outfunc_head, outfunc_cont) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 u_char *rxpkt; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 unsigned rxpkt_len; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 char *extra_prefix; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 void (*outfunc_head)(), (*outfunc_cont)(); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 if (!basic_checks(rxpkt, rxpkt_len)) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 print_malformed(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 /* dispatch by type */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 switch (rxpkt[1] & 0x30) { |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 case 0x10: |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 /* PS primitive */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 if (psprim_extra_checks(rxpkt, rxpkt_len)) |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 format_psprim(rxpkt, rxpkt_len, extra_prefix, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 outfunc_head, outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 else |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 print_malformed(rxpkt, rxpkt_len, extra_prefix, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 outfunc_head, outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 case 0x20: |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 /* trace */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 format_trace(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 case 0x30: |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 /* system primitive */ |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 format_sysprim(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 return; |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 default: |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 print_malformed(rxpkt, rxpkt_len, extra_prefix, outfunc_head, |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 outfunc_cont); |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 } |
4d2e6a2dd1a1
libprint: implement libg23 replacement
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 } |