1
0
Fork 0

Replace plib/net.h by SimGear

This commit is contained in:
Frederic Bouvier 2011-01-05 17:18:12 +01:00
parent 6c777745db
commit 65301bf84e
8 changed files with 44 additions and 33 deletions

View file

@ -46,7 +46,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -126,7 +126,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -204,7 +204,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
@ -282,7 +282,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"

View file

@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -126,7 +126,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -205,7 +205,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@ -284,7 +284,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"

View file

@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include;..\..\..\..\boost_1_44_0" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include;..\..\..\..\boost_1_44_0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -126,7 +126,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include;..\..\..\..\boost_1_44_0" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include;..\..\..\..\boost_1_44_0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -205,7 +205,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include;..\..\..\..\boost_1_44_0" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include;..\..\..\..\boost_1_44_0"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@ -284,7 +284,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include;..\..\..\..\boost_1_44_0" AdditionalIncludeDirectories="..\..\..\src;..\..\..\..\SimGear;..\..\..\..\install\msvc90-64\OpenSceneGraph\include;..\..\..\..\3rdParty.x64\include;..\..\..\..\boost_1_44_0"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_WINDOWS_H"
RuntimeLibrary="2" RuntimeLibrary="2"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"

View file

@ -2,16 +2,20 @@
# include <config.h> # include <config.h>
#endif #endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <plib/net.h>
#include <plib/sg.h> #include <plib/sg.h>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/io/lowlevel.hxx> // endian tests #include <simgear/io/lowlevel.hxx> // endian tests
#include <simgear/io/sg_file.hxx> #include <simgear/io/sg_file.hxx>
#include <simgear/io/sg_serial.hxx> #include <simgear/io/sg_serial.hxx>
#include <simgear/io/raw_socket.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/timing/timestamp.hxx> #include <simgear/timing/timestamp.hxx>
@ -27,7 +31,7 @@ using std::string;
// Network channels // Network channels
static netSocket fdm_sock, ctrls_sock; static simgear::Socket fdm_sock, ctrls_sock;
// midg data // midg data
MIDGTrack track; MIDGTrack track;
@ -394,7 +398,7 @@ int main( int argc, char **argv ) {
// Setup up outgoing network connections // Setup up outgoing network connections
netInit( &argc,argv ); // We must call this before any other net stuff simgear::Socket::initSockets(); // We must call this before any other net stuff
if ( ! fdm_sock.open( false ) ) { // open a UDP socket if ( ! fdm_sock.open( false ) ) { // open a UDP socket
cout << "error opening fdm output socket" << endl; cout << "error opening fdm output socket" << endl;

View file

@ -2,6 +2,10 @@
# include <config.h> # include <config.h>
#endif #endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifndef _WIN32 #ifndef _WIN32
# include <strings.h> // for bzero() # include <strings.h> // for bzero()
#else #else
@ -10,12 +14,12 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <plib/net.h>
#include <plib/sg.h> #include <plib/sg.h>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/io/lowlevel.hxx> // endian tests #include <simgear/io/lowlevel.hxx> // endian tests
#include <simgear/io/sg_file.hxx> #include <simgear/io/sg_file.hxx>
#include <simgear/io/raw_socket.hxx>
#include <simgear/serial/serial.hxx> #include <simgear/serial/serial.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/timing/timestamp.hxx> #include <simgear/timing/timestamp.hxx>
@ -35,7 +39,7 @@ using std::string;
// Network channels // Network channels
static netSocket fdm_sock, ctrls_sock, opengc_sock; static simgear::Socket fdm_sock, ctrls_sock, opengc_sock;
// ugear data // ugear data
UGTrack track; UGTrack track;
@ -658,7 +662,7 @@ int main( int argc, char **argv ) {
// Setup up outgoing network connections // Setup up outgoing network connections
netInit( &argc,argv ); // We must call this before any other net stuff simgear::Socket::initSockets(); // We must call this before any other net stuff
if ( ! opengc_sock.open( false ) ) { // open a UDP socket if ( ! opengc_sock.open( false ) ) { // open a UDP socket
cout << "error opening opengc output socket" << endl; cout << "error opening opengc output socket" << endl;

View file

@ -23,14 +23,13 @@
// $Id$ // $Id$
#include <simgear/io/sg_netChat.hxx>
#include <simgear/structure/commands.hxx> #include <simgear/structure/commands.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <sstream> #include <sstream>
#include <plib/netChat.h>
#include "UGear_command.hxx" #include "UGear_command.hxx"
#include "UGear_telnet.hxx" #include "UGear_telnet.hxx"
@ -41,9 +40,9 @@ using std::ends;
* Props connection class. * Props connection class.
* This class represents a connection to props client. * This class represents a connection to props client.
*/ */
class PropsChannel : public netChat class PropsChannel : public simgear::NetChat
{ {
netBuffer buffer; simgear::NetBuffer buffer;
/** /**
* Current property node name. * Current property node name.
@ -188,9 +187,9 @@ UGTelnet::open()
return false; return false;
} }
netChannel::open(); simgear::NetChannel::open();
netChannel::bind( "", port ); simgear::NetChannel::bind( "", port );
netChannel::listen( 5 ); simgear::NetChannel::listen( 5 );
printf("Telnet server started on port %d\n", port ); printf("Telnet server started on port %d\n", port );
enabled = true; enabled = true;
@ -214,7 +213,7 @@ UGTelnet::close()
bool bool
UGTelnet::process() UGTelnet::process()
{ {
netChannel::poll(); simgear::NetChannel::poll();
return true; return true;
} }
@ -224,8 +223,8 @@ UGTelnet::process()
void void
UGTelnet::handleAccept() UGTelnet::handleAccept()
{ {
netAddress addr; simgear::IPAddress addr;
int handle = netChannel::accept( &addr ); int handle = simgear::NetChannel::accept( &addr );
printf("Telent server accepted connection from %s:%d\n", printf("Telent server accepted connection from %s:%d\n",
addr.getHost(), addr.getPort() ); addr.getHost(), addr.getPort() );
PropsChannel* channel = new PropsChannel(); PropsChannel* channel = new PropsChannel();

View file

@ -33,7 +33,7 @@
using std::string; using std::string;
using std::vector; using std::vector;
#include <plib/netChannel.h> #include <simgear/io/sg_netChannel.hxx>
/** /**
@ -41,7 +41,7 @@ using std::vector;
* This class provides a telnet-like server for remote access to * This class provides a telnet-like server for remote access to
* FlightGear properties. * FlightGear properties.
*/ */
class UGTelnet: netChannel class UGTelnet: simgear::NetChannel
{ {
private: private:

View file

@ -2,13 +2,17 @@
# include <config.h> # include <config.h>
#endif #endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <plib/net.h>
#include <plib/sg.h> #include <plib/sg.h>
#include <simgear/io/lowlevel.hxx> // endian tests #include <simgear/io/lowlevel.hxx> // endian tests
#include <simgear/io/raw_socket.hxx>
#include <simgear/timing/timestamp.hxx> #include <simgear/timing/timestamp.hxx>
#include <Network/net_ctrls.hxx> #include <Network/net_ctrls.hxx>
@ -23,7 +27,7 @@ using std::string;
// Network channels // Network channels
static netSocket fdm_sock, ctrls_sock; static simgear::Socket fdm_sock, ctrls_sock;
// gps data // gps data
GPSTrack track; GPSTrack track;
@ -369,7 +373,7 @@ int main( int argc, char **argv ) {
// Setup up outgoing network connections // Setup up outgoing network connections
netInit( &argc,argv ); // We must call this before any other net stuff simgear::Socket::initSockets(); // We must call this before any other net stuff
if ( ! fdm_sock.open( false ) ) { // open a UDP socket if ( ! fdm_sock.open( false ) ) { // open a UDP socket
cout << "error opening fdm output socket" << endl; cout << "error opening fdm output socket" << endl;