Updated code to handle Borland 5.5 Compile.

This commit is contained in:
skarg
2009-07-29 17:53:32 +00:00
parent a503aca204
commit 6adf97553f
8 changed files with 68 additions and 13 deletions
+4 -6
View File
@@ -39,9 +39,6 @@
#include <string.h>
#include <errno.h>
#include <time.h>
#if defined(_WIN32)
#include <conio.h>
#endif
/* OS specific include*/
#include "net.h"
#include "timer.h"
@@ -203,7 +200,9 @@ static void packet_statistics_save(void)
"\tTusage\tTrpfm\tTder\tTpostpd");
fprintf(stdout, "\r\n");
for (i = 0; i < 256; i++) {
if (MSTP_Statistics[i].token_count) {
/* check for masters or slaves */
if ((MSTP_Statistics[i].token_count) ||
(MSTP_Statistics[i].der_reply)) {
fprintf(stdout, "%u\t%u", i,
(unsigned)MSTP_Statistics[i].max_master);
fprintf(stdout,
@@ -396,6 +395,7 @@ static BOOL WINAPI CtrlCHandler(DWORD dwCtrlType)
{
dwCtrlType = dwCtrlType;
exit(0);
return TRUE;
}
#else
static void sig_int(
@@ -505,6 +505,4 @@ int main(
packet_count = 0;
}
}
return 0;
}
+33
View File
@@ -0,0 +1,33 @@
MSTP Capture Tool
This tool captures MS/TP packets on an RS485 serial interface,
and saves the packets to a file in Wireshark PCAP format for
the MS/TP dissector to read. The filename has a date and time
code in it, and will contain up to 65535 packets. A new file
will be created at each 65535 packet interval.
Here is a sample of the tool running (use CTRL-C to quit).
D:\code\bacnet-stack\bin>mstpcap COM3 38400
Adjusted interface name to \\.\COM3
mstpcap: Using \\.\COM3 for capture at 38400 bps.
mstpcap: saving capture to mstp_20090729123548.cap
1400 packets
MAC MaxMstr Tokens Retries Treply Tusage Trpfm Tder Tpostpd
0 0 525 0 32 0 0 0 0
1 127 525 0 16 79 0 0 0
MS/TP capture tool also includes statistics which are listed for
any MAC addresses found passing a token,
or any MAC address replying to a DER message.
The statistics are emitted when CTRL-C is pressed, or when
65535 packets are captured and the new file is created.
The statistics are cleared when the new file is created.
MaxMstr = highest destination MAC during PFM
Tokens = number of tokens transmitted
Retries = number of second tokens sent to this MAC
Treply = max milliseconds it took to reply with a token after receiving a token
Tusage = max Tusage_delay in milliseconds based on PFM and subsequent token
Trpfm = max milliseconds to respond to PFM with RPFM.
Tder = max milliseconds to respond to DER request with DNER
Tpostpd = max milliseconds to respond to DER request with Reply Postponed.