annotate rvinterf/libg23/fmtfunc.c @ 733:d01d6b3ac2a9

rr_attp.c compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 05 Oct 2014 03:12:20 +0000
parents 42c91c51ca7f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
331
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This libg23 module exports functions for formatting 3 different kinds
627
42c91c51ca7f rvinterf: display GPF packets as "GPF" rather than "G23"
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 331
diff changeset
3 * of GPF packets into human-readable form: traces, system primitives
331
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * and protocol stack primitives.
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 *
627
42c91c51ca7f rvinterf: display GPF packets as "GPF" rather than "G23"
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 331
diff changeset
6 * GPF packets passed to these functions for decoding MUST have already
331
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * been verified to be well-formed for their respective type.
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 */
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <sys/types.h>
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include <ctype.h>
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include <stdio.h>
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include <string.h>
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include <strings.h>
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 static int
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 entity_name_well_formed(p)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 char *p;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 int i, len;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 if (!isupper(p[0]))
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 return(0);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 for (i = 0; i < 4; i++)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 if (!isalnum(p[i]))
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 break;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 len = i;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 for (; i < 4; i++)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if (p[i] != ' ')
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 return(0);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 return(len);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 static void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 print_entity_name(raw, outp)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 char *raw, **outp;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 int len;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 len = entity_name_well_formed(raw);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 if (len) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 sprintf(*outp, "%.*s", len, raw);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 *outp += len;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 } else {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 sprintf(*outp, "\"%.4s\"", raw);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 *outp += 6;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 static void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 print_common_hdr(rxpkt, outp, typestr)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 char **outp, *typestr;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 {
627
42c91c51ca7f rvinterf: display GPF packets as "GPF" rather than "G23"
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 331
diff changeset
55 sprintf(*outp, "GPF %s id=%02X ts=%02X%02X%02X%02X ", typestr,
331
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 rxpkt[1], rxpkt[7], rxpkt[6], rxpkt[5], rxpkt[4]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 *outp = index(*outp, '\0');
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 print_entity_name(rxpkt + 8, outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 *(*outp)++ = '-';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 *(*outp)++ = '>';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 print_entity_name(rxpkt + 12, outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 *(*outp)++ = ' ';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 static void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 format_text(rxpkt, rxpkt_len, start_off, outp)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 char *outp;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 int i, c;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 *outp++ = '\"';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 for (i = start_off; i < rxpkt_len; i++) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 c = rxpkt[i];
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 if (c & 0x80) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 *outp++ = 'M';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 *outp++ = '-';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 c &= 0x7F;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 if (c < 0x20) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 *outp++ = '^';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 *outp++ = c + '@';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 } else if (c == 0x7F) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 *outp++ = '^';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 *outp++ = '?';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 } else
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 *outp++ = c;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 *outp++ = '\"';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 *outp = '\0';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 static void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 format_compressed_trace(rxpkt, rxpkt_len, start_off, outp)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 char *outp;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 int i;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 i = start_off + 1;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 sprintf(outp, "%d", rxpkt[i+1] << 8 | rxpkt[i]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 outp = index(outp, '\0');
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 i += 4;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 for (; i < rxpkt_len; i++) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 sprintf(outp, " %02X", rxpkt[i]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 outp += 3;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 *outp = '\0';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 format_g23_trace(rxpkt, rxpkt_len, outbuf)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 char *outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 char *outp = outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 int i;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 print_common_hdr(rxpkt, &outp, "trace");
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 i = 16;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 if (rxpkt[i] < 0x20) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 sprintf(outp, "tc=%02X ", rxpkt[i]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 outp += 6;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 i++;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 if (rxpkt_len - i >= 5 && rxpkt[i] == '%' &&
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 !rxpkt[i+3] && !rxpkt[i+4])
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 format_compressed_trace(rxpkt, rxpkt_len, i, outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 else
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 format_text(rxpkt, rxpkt_len, i, outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 format_g23_sysprim(rxpkt, rxpkt_len, outbuf)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 char *outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 char *outp = outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 int i;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 print_common_hdr(rxpkt, &outp, "sysprim");
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 format_text(rxpkt, rxpkt_len, 16, outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 void
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 format_g23_psprim(rxpkt, rxpkt_len, outbuf)
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 u_char *rxpkt;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 char *outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 char *outp = outbuf;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 int i;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 print_common_hdr(rxpkt, &outp, "PSprim");
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 /* original destination */
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 *outp++ = '(';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 print_entity_name(rxpkt + 16, &outp);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 *outp++ = ')';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 /* opcode */
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 sprintf(outp, " %02X%02X%02X%02X",
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 rxpkt[23], rxpkt[22], rxpkt[21], rxpkt[20]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 outp += 9;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 for (i = 24; i < rxpkt_len; i++) {
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 sprintf(outp, " %02X", rxpkt[i]);
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 outp += 3;
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 }
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 *outp = '\0';
91ea7a4a0b4d rvinterf/libg23: started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 }