Windows Version of dump1090

Make the modifications necessary to compile dump1090 for WinXP, Win7 and
hopefully Win8.

The files can be compiled using M$ Visual Studio/C++ 6.0. Due to various
licensing issues, I haven't included the libraries or DLLs. You will
need to locate pthreadVC2.lib and rtlsdr.lib to link the file, install
the zadig drivers to support the dongle, and locate libusb-1.0.dll,
msvcr100.dll, pthreadVC2.dll and rtlsdr.dll.

dump1090.exe will not run on any Windows version prior to XP SP2,
because msvcr100.dll imports several functions from the Windows kernel
that are not available on earlier versions. This means dump1090 won't
work on Win2K.

The major change to the code relates to file handles. The original code
assumes Linux behaviour in that handles are allocated from 0
sequentially upwards. However Windows handles are allocated pseudo
randomly, and handle numbers greater than 1024 would break the code. The
code has therefore been modified to use a linked list of connection
structures, rather than a static array limited to 1024 entries.
This commit is contained in:
Malcolm Robb 2014-04-25 14:48:14 +01:00
parent f7843c1691
commit 30ae45ec2b
19 changed files with 2869 additions and 188 deletions

View file

@ -37,7 +37,7 @@
// MinorVer changes when additional features are added, but not for bug fixes (range 00-99)
// DayDate & Year changes for all changes, including for bug fixes. It represent the release date of the update
//
#define MODES_DUMP1090_VERSION "1.08.1003.14"
#define MODES_DUMP1090_VERSION "1.08.2504.14"
// ============================= Include files ==========================
@ -62,6 +62,7 @@
#else
#include "winstubs.h" //Put everything Windows specific in here
#include "rtl-sdr.h"
#include "anet.h"
#endif
// ============================= #defines ===============================
@ -166,7 +167,6 @@
#define MODES_NET_HEARTBEAT_RATE 900 // Each block is approx 65mS - default is > 1 min
#define MODES_NET_SERVICES_NUM 6
#define MODES_NET_MAX_FD 1024
#define MODES_NET_INPUT_RAW_PORT 30001
#define MODES_NET_OUTPUT_RAW_PORT 30002
#define MODES_NET_OUTPUT_SBS_PORT 30003
@ -186,10 +186,11 @@
// Structure used to describe a networking client
struct client {
int fd; // File descriptor
int service; // TCP port the client is connected to
int buflen; // Amount of data on buffer
char buf[MODES_CLIENT_BUF_SIZE+1]; // Read buffer
struct client* next; // Pointer to next client
int fd; // File descriptor
int service; // TCP port the client is connected to
int buflen; // Amount of data on buffer
char buf[MODES_CLIENT_BUF_SIZE+1]; // Read buffer
};
// Structure used to describe an aircraft in iteractive mode
@ -256,20 +257,19 @@ struct { // Internal state
// Networking
char aneterr[ANET_ERR_LEN];
struct client *clients[MODES_NET_MAX_FD]; // Our clients
int maxfd; // Greatest fd currently active
int sbsos; // SBS output listening socket
int ros; // Raw output listening socket
int ris; // Raw input listening socket
int bos; // Beast output listening socket
int bis; // Beast input listening socket
int https; // HTTP listening socket
char *rawOut; // Buffer for building raw output data
int rawOutUsed; // How much of the buffer is currently used
char *beastOut; // Buffer for building beast output data
int beastOutUsed; // How much if the buffer is currently used
struct client *clients; // Our clients
int sbsos; // SBS output listening socket
int ros; // Raw output listening socket
int ris; // Raw input listening socket
int bos; // Beast output listening socket
int bis; // Beast input listening socket
int https; // HTTP listening socket
char *rawOut; // Buffer for building raw output data
int rawOutUsed; // How much of the buffer is currently used
char *beastOut; // Buffer for building beast output data
int beastOutUsed; // How much if the buffer is currently used
#ifdef _WIN32
WSADATA wsaData; // Windows socket initialisation
WSADATA wsaData; // Windows socket initialisation
#endif
// Configuration