annotate rvinterf/libg23/fmtdispatch.c @ 988:0654212e5c53

doc/Compal-unlock: documented safe flashing of newer fw versions and cisversion unlocking
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 12 Dec 2015 18:40:56 +0000
parents ca65f5adf1af
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
332
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This libg23 module exports the format_g23_packet() function, which
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * validates the packet, then dispatches it to format_g23_trace(),
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * format_g23_sysprim() or format_g23_psprim() as appropriate, or
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * prints it in raw hex if malformed.
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <sys/types.h>
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <stdio.h>
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <string.h>
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include <strings.h>
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 static int
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 basic_checks(rxpkt, rxpkt_len)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 u_char *rxpkt;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 int i, c;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 if (rxpkt_len < 17)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 /* check version bits in the header byte */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 if ((rxpkt[1] & 0xC0) != 0x80)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 /* check the length */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 c = rxpkt[2] | rxpkt[3] << 8;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 if (c + 4 != rxpkt_len)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 /* ensure that the "from" and "to" are printable ASCII */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 for (i = 8; i < 16; i++) {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 c = rxpkt[i];
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 if (c < ' ' || c > '~')
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 /* basic checks pass */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 return(1);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 static int
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 psprim_extra_checks(rxpkt, rxpkt_len)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 u_char *rxpkt;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 int i, c;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 if (rxpkt_len < 24)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 /* "original rcvr" field needs to be printable ASCII */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 for (i = 16; i < 20; i++) {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 c = rxpkt[i];
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 if (c < ' ' || c > '~')
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 return(0);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 /* checks pass */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 return(1);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 static void
976
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
57 print_unknown_bin(rxpkt, rxpkt_len, outbuf)
332
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 u_char *rxpkt;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 char *outbuf;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 int i;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 char *dp;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 dp = outbuf;
627
42c91c51ca7f rvinterf: display GPF packets as "GPF" rather than "G23"
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 332
diff changeset
65 strcpy(dp, "GPF UNK:");
332
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 dp += 8;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 for (i = 1; i < rxpkt_len; i++) {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 sprintf(dp, " %02X", rxpkt[i]);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 dp += 3;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 *dp = '\0';
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
976
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
74 static void
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
75 print_old_ascii(rxpkt, rxpkt_len, outbuf)
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
76 u_char *rxpkt;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
77 char *outbuf;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
78 {
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
79 char *dp;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
80 int txtlen = rxpkt_len - 1;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
81
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
82 dp = outbuf;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
83 strcpy(dp, "GPF ASC: ");
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
84 dp += 9;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
85 bcopy(rxpkt + 1, dp, txtlen);
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
86 dp += txtlen;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
87 *dp = '\0';
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
88 }
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
89
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
90 static int
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
91 is_old_ascii(rxpkt, rxpkt_len)
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
92 u_char *rxpkt;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
93 {
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
94 int i, c;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
95
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
96 for (i = 1; i < rxpkt_len; i++) {
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
97 c = rxpkt[i];
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
98 if (c < ' ' || c > '~')
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
99 return(0);
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
100 }
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
101 return(1);
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
102 }
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
103
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
104 static void
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
105 print_malformed(rxpkt, rxpkt_len, outbuf)
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
106 u_char *rxpkt;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
107 char *outbuf;
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
108 {
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
109 if (is_old_ascii(rxpkt, rxpkt_len))
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
110 print_old_ascii(rxpkt, rxpkt_len, outbuf);
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
111 else
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
112 print_unknown_bin(rxpkt, rxpkt_len, outbuf);
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
113 }
ca65f5adf1af rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 627
diff changeset
114
332
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 void
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 format_g23_packet(rxpkt, rxpkt_len, outbuf)
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 u_char *rxpkt;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 char *outbuf;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 if (!basic_checks(rxpkt, rxpkt_len)) {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 print_malformed(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 return;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 /* dispatch by type */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 switch (rxpkt[1] & 0x30) {
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 case 0x10:
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 /* PS primitive */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 if (psprim_extra_checks(rxpkt, rxpkt_len))
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 format_g23_psprim(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 else
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 print_malformed(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 return;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 case 0x20:
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 /* trace */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 format_g23_trace(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 return;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 case 0x30:
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 /* system primitive */
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 format_g23_sysprim(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 return;
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 default:
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 print_malformed(rxpkt, rxpkt_len, outbuf);
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 }
28b4d3c9e85d rvinterf/libg23: complete for now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 }