FreeCalypso > hg > freecalypso-sw
annotate rvinterf/lowlevel/logsent.c @ 681:461ab5b255f5
alr_nc.c compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 29 Sep 2014 19:57:11 +0000 |
parents | c2f2f7d78451 |
children | da9a36515da6 |
rev | line source |
---|---|
134
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
174
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
2 * This module implements the logging of sent packets |
134
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <stdio.h> |
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <string.h> |
e0d56e9be8a2
rvtdump: time-stamped logging implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <strings.h> |
628
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
9 #include "../include/pktmux.h" |
256
2f285f20d617
rvinterf: *.h moved into include subdir
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
174
diff
changeset
|
10 #include "../include/limits.h" |
171
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
11 |
628
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
12 static void |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
13 log_sent_gpf(pkt, pktlen) |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
14 u_char *pkt; |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
15 { |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
16 char buf[MAX_PKT_TO_TARGET*4+30]; |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
17 |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
18 strcpy(buf, "Sent "); |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
19 format_g23_packet(pkt, pktlen, buf + 5); |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
20 output_line(buf); |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
21 } |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
22 |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
23 static void |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
24 log_sent_other(pkt, pktlen) |
171
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
25 u_char *pkt; |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
26 { |
174
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
27 char buf[MAX_PKT_TO_TARGET*3+5]; |
171
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
28 int i; |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
29 char *dp; |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
30 |
174
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
31 dp = buf; |
171
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
32 strcpy(dp, "Sent"); |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
33 dp += 4; |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
34 for (i = 0; i < pktlen; i++) { |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
35 sprintf(dp, " %02X", pkt[i]); |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
36 dp += 3; |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
37 } |
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
38 *dp = '\0'; |
174
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
39 output_line(buf); |
171
4d8e4c58df71
rvtdump: implemented Tx extension hack, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
134
diff
changeset
|
40 } |
628
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
41 |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
42 log_sent_packet(pkt, pktlen) |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
43 u_char *pkt; |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
44 { |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
45 if (pkt[0] == RVT_L23_HEADER) |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
46 log_sent_gpf(pkt, pktlen); |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
47 else |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
48 log_sent_other(pkt, pktlen); |
c2f2f7d78451
rvinterf: log sent GPF packets with the same decoding as received ones
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
49 } |