mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-13 00:24:33 +00:00
Fixed issues with "Developer - release" configuration; implementation of AvHTunnelToServer.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@26 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
f812ccf0c2
commit
43a20ad0c5
14 changed files with 145 additions and 35 deletions
Binary file not shown.
Binary file not shown.
BIN
main/dlls/ns.dll
BIN
main/dlls/ns.dll
Binary file not shown.
BIN
main/dlls/ns.pdb
BIN
main/dlls/ns.pdb
Binary file not shown.
|
@ -26,7 +26,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
OptimizeForProcessor="0"
|
OptimizeForProcessor="0"
|
||||||
AdditionalIncludeDirectories=""$(SolutionDir)";U:\inlcude\stlport;U:\include\vgui;U:\include\libpng;U:\include\fmod;U:\include\lua;U:\include\particle;U:\include\zlib"
|
AdditionalIncludeDirectories=""$(SolutionDir)";U:\inlcude\stlport;U:\include\vgui;U:\include\nexus;U:\include\libpng;U:\include\fmod;U:\include\lua;U:\include\particle;U:\include\zlib"
|
||||||
PreprocessorDefinitions="_DEBUG;_MBCS;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NoInherit)"
|
PreprocessorDefinitions="_DEBUG;_MBCS;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NoInherit)"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@ -65,8 +65,8 @@
|
||||||
OptimizeReferences="1"
|
OptimizeReferences="1"
|
||||||
EnableCOMDATFolding="1"
|
EnableCOMDATFolding="1"
|
||||||
OptimizeForWindows98="1"
|
OptimizeForWindows98="1"
|
||||||
BaseAddress="0x01900000"
|
BaseAddress=""
|
||||||
ImportLibrary="$(IntDir)/cl_dll.lib"
|
ImportLibrary="$(IntDir)cl_dll.lib"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
|
@ -99,28 +99,29 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Developer - release|Win32"
|
Name="Developer - release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)"
|
OutputDirectory="V:\temp\$(ProjectName)\$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)"
|
IntermediateDirectory="V:\temp\$(ProjectName)\$(ConfigurationName)"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
DeleteExtensionsOnClean="$(TargetPath);*.obj;*.ilk;*.pdb;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.bat">
|
DeleteExtensionsOnClean="$(TargetPath);*.obj;*.ilk;*.pdb;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.bat">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="3"
|
||||||
|
GlobalOptimizations="TRUE"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="2"
|
||||||
|
EnableIntrinsicFunctions="TRUE"
|
||||||
OptimizeForProcessor="0"
|
OptimizeForProcessor="0"
|
||||||
AdditionalIncludeDirectories="$(SolutionDir);$(SolutionDir)engine;$(SolutionDir)common;$(SolutionDir)pm_shared;$(SolutionDir)dlls;$(SolutionDir)game_shared;$(SolutionDir)fmod\inc;$(SolutionDir)utils\vgui\include"
|
AdditionalIncludeDirectories=""$(SolutionDir)";U:\inlcude\stlport;U:\include\vgui;U:\include\nexus;U:\include\libpng;U:\include\fmod;U:\include\lua;U:\include\particle;U:\include\zlib"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NOINHERIT)"
|
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NOINHERIT)"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
|
||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile=""
|
PrecompiledHeaderFile=""
|
||||||
AssemblerListingLocation="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
AssemblerListingLocation="$(IntDir)/"
|
||||||
ObjectFile="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
ObjectFile="$(IntDir)/"
|
||||||
ProgramDataBaseFileName="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
ProgramDataBaseFileName="$(IntDir)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="TRUE"
|
WarnAsError="TRUE"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
|
@ -130,18 +131,15 @@
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="winmm.lib ws2_32.lib particles.lib textrep.lib util.lib $(SolutionDir)\utils\vgui\lib\win32_vc6\vgui.lib"
|
AdditionalDependencies="winmm.lib ws2_32.lib particles.lib vgui.lib liblua.lib liblualib.lib libpng.lib zlib.lib"
|
||||||
OutputFile="$(SolutionDir)..\cl_dlls\client.dll"
|
OutputFile="$(SolutionDir)..\cl_dlls\client.dll"
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="$(SolutionDir)lib\$(ConfigurationName)"
|
AdditionalLibraryDirectories="U:\release"
|
||||||
IgnoreDefaultLibraryNames=""
|
IgnoreDefaultLibraryNames=""
|
||||||
GenerateDebugInformation="FALSE"
|
|
||||||
ProgramDatabaseFile=""
|
ProgramDatabaseFile=""
|
||||||
GenerateMapFile="FALSE"
|
|
||||||
MapFileName=""
|
MapFileName=""
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
ImportLibrary="$(SolutionDir)\temp\$(ProjectName)\$(ConfigurationName)/cl_dll.lib"
|
ImportLibrary="$(IntDir)cl_dll.lib"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
|
|
|
@ -15,26 +15,29 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Developer - release|Win32"
|
Name="Developer - release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
OutputDirectory="V:\temp\$(ProjectName)\$(ConfigurationName)/"
|
||||||
IntermediateDirectory="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
IntermediateDirectory="V:\temp\$(ProjectName)\$(ConfigurationName)/"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="3"
|
||||||
|
GlobalOptimizations="TRUE"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="2"
|
||||||
AdditionalIncludeDirectories="$(SolutionDir);$(SolutionDir)\dlls;$(SolutionDir)\engine;$(SolutionDir)\common;$(SolutionDir)\pm_shared;$(SolutionDir)\game_shared;$(SolutionDir)\lua\include"
|
EnableIntrinsicFunctions="TRUE"
|
||||||
|
AdditionalIncludeDirectories=""$(SolutionDir)";U:\include\stlport;U:\include\nexus;U:\include\lua;U:\include\particle"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;$(NOINHERIT)"
|
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;$(NOINHERIT)"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
|
MinimalRebuild="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile=".\Releasehl/hl.pch"
|
PrecompiledHeaderFile=".\Releasehl/hl.pch"
|
||||||
AssemblerListingLocation="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
AssemblerListingLocation="$(IntDir)/"
|
||||||
ObjectFile="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
ObjectFile="$(IntDir)/"
|
||||||
ProgramDataBaseFileName="$(SolutionDir)temp\$(ProjectName)\$(ConfigurationName)/"
|
ProgramDataBaseFileName="$(IntDir)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
@ -43,17 +46,16 @@
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="winmm.lib ws2_32.lib curl.lib particles.lib textrep.lib util.lib"
|
AdditionalDependencies="winmm.lib ws2_32.lib particles.lib liblua.lib liblualib.lib nexus_server.lib ssleay32.lib libeay32.lib"
|
||||||
OutputFile="$(SolutionDir)\..\dlls\ns.dll"
|
OutputFile="$(SolutionDir)\..\dlls\ns.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="$(SolutionDir)\lib\$(ConfigurationName)"
|
AdditionalLibraryDirectories="U:\release"
|
||||||
IgnoreDefaultLibraryNames=""
|
IgnoreDefaultLibraryNames="gdi32.lib user32.lib"
|
||||||
ModuleDefinitionFile=".\hl.def"
|
ModuleDefinitionFile=".\hl.def"
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
ProgramDatabaseFile=""
|
ProgramDatabaseFile=""
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
ImportLibrary="$(SolutionDir)\temp\$(ProjectName)\$(ConfigurationName)/ns.lib"
|
ImportLibrary="$(OutDir)ns.lib"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
|
@ -127,7 +129,9 @@
|
||||||
MapFileName="$(OutDir)/ns.map"
|
MapFileName="$(OutDir)/ns.map"
|
||||||
MapExports="TRUE"
|
MapExports="TRUE"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
ImportLibrary="$(OutDir)\ns.lib"
|
OptimizeReferences="1"
|
||||||
|
EnableCOMDATFolding="1"
|
||||||
|
ImportLibrary="$(OutDir)ns.lib"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#include <NexusClientInterface.h>
|
||||||
|
#include "AvHNexusClient.h"
|
||||||
|
|
||||||
|
bool AvHNexus::send(const unsigned char* data, const size_t length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef AVHNEXUSCLIENT_H
|
||||||
|
#define AVHNEXUSCLIENT_H
|
||||||
|
|
||||||
|
namespace AvHNexus
|
||||||
|
{
|
||||||
|
bool send(const unsigned char* data, const size_t length);
|
||||||
|
bool recv(const char* data, const size_t length);
|
||||||
|
|
||||||
|
void startup(void);
|
||||||
|
void shutdown(void);
|
||||||
|
|
||||||
|
bool login(const string& name, const string& password);
|
||||||
|
bool logout(void);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -8,7 +8,7 @@ extern int g_msgNexusBytes;
|
||||||
byte_string BASE64Decode(const string& input);
|
byte_string BASE64Decode(const string& input);
|
||||||
Nexus::ServerInfo createServerInfo(void);
|
Nexus::ServerInfo createServerInfo(void);
|
||||||
|
|
||||||
//note: we place this here so that we have the possibility of giving out AvHNetworkMessages.
|
//note: we place this here so that we have the possibility of giving out AvHNetworkMessages.cpp
|
||||||
bool AvHNexus::send(entvars_t* const pev, const unsigned char* data, const unsigned int length)
|
bool AvHNexus::send(entvars_t* const pev, const unsigned char* data, const unsigned int length)
|
||||||
{
|
{
|
||||||
if( !pev ) { return false; }
|
if( !pev ) { return false; }
|
||||||
|
|
|
@ -8,8 +8,8 @@ typedef struct entvars_s entvars_t;
|
||||||
|
|
||||||
namespace AvHNexus
|
namespace AvHNexus
|
||||||
{
|
{
|
||||||
bool send(entvars_t* const pev, const unsigned char* data, const unsigned int length);
|
bool send(entvars_t* const pev, const unsigned char* data, const size_t length);
|
||||||
bool recv(entvars_t* const pev, const char* data, const unsigned int length);
|
bool recv(entvars_t* const pev, const char* data, const size_t length);
|
||||||
|
|
||||||
void handleUnauthorizedJoinTeamAttempt(const edict_t* edict, const unsigned char team_index);
|
void handleUnauthorizedJoinTeamAttempt(const edict_t* edict, const unsigned char team_index);
|
||||||
string getNetworkID(const edict_t* edict);
|
string getNetworkID(const edict_t* edict);
|
||||||
|
|
|
@ -4,16 +4,22 @@
|
||||||
#include "dlls/extdll.h"
|
#include "dlls/extdll.h"
|
||||||
#include "dlls/util.h"
|
#include "dlls/util.h"
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
AvHNexus::TunnelToClient::TunnelToClient(void) {}
|
AvHNexus::TunnelToClient::TunnelToClient(void) {}
|
||||||
AvHNexus::TunnelToClient::~TunnelToClient(void) {}
|
AvHNexus::TunnelToClient::~TunnelToClient(void) {}
|
||||||
Nexus::TunnelToClient* AvHNexus::TunnelToClient::clone(void) const { return new TunnelToClient(); }
|
Nexus::TunnelToClient* AvHNexus::TunnelToClient::clone(void) const { return new TunnelToClient(); }
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
AvHNexus::TunnelToClient* AvHNexus::TunnelToClient::getInstance(void)
|
AvHNexus::TunnelToClient* AvHNexus::TunnelToClient::getInstance(void)
|
||||||
{
|
{
|
||||||
static std::auto_ptr<AvHNexus::TunnelToClient> ptr(new AvHNexus::TunnelToClient());
|
static std::auto_ptr<AvHNexus::TunnelToClient> ptr(new AvHNexus::TunnelToClient());
|
||||||
return ptr.get();
|
return ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
bool AvHNexus::TunnelToClient::insertMessage(const Nexus::ClientID local_id, const byte_string& message)
|
bool AvHNexus::TunnelToClient::insertMessage(const Nexus::ClientID local_id, const byte_string& message)
|
||||||
{
|
{
|
||||||
std::pair<const Nexus::ClientID,const byte_string> item(local_id,message);
|
std::pair<const Nexus::ClientID,const byte_string> item(local_id,message);
|
||||||
|
@ -21,6 +27,8 @@ bool AvHNexus::TunnelToClient::insertMessage(const Nexus::ClientID local_id, con
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
const Nexus::ClientID AvHNexus::TunnelToClient::poll(void) const
|
const Nexus::ClientID AvHNexus::TunnelToClient::poll(void) const
|
||||||
{
|
{
|
||||||
Nexus::ClientID result = 0;
|
Nexus::ClientID result = 0;
|
||||||
|
@ -29,6 +37,8 @@ const Nexus::ClientID AvHNexus::TunnelToClient::poll(void) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
bool AvHNexus::TunnelToClient::recv(const Nexus::ClientID local_id, byte_string& data)
|
bool AvHNexus::TunnelToClient::recv(const Nexus::ClientID local_id, byte_string& data)
|
||||||
{
|
{
|
||||||
std::pair<const Nexus::ClientID,const byte_string> item = messages.front();
|
std::pair<const Nexus::ClientID,const byte_string> item = messages.front();
|
||||||
|
@ -39,7 +49,11 @@ bool AvHNexus::TunnelToClient::recv(const Nexus::ClientID local_id, byte_string&
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
bool AvHNexus::TunnelToClient::send(const Nexus::ClientID local_id, const byte_string& data)
|
bool AvHNexus::TunnelToClient::send(const Nexus::ClientID local_id, const byte_string& data)
|
||||||
{
|
{
|
||||||
return AvHNexus::send( VARS(local_id), data.c_str(), data.length() );
|
return AvHNexus::send( VARS(local_id), data.c_str(), data.length() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace AvHNexus
|
||||||
virtual bool send(const Nexus::ClientID local_id, const byte_string& data);
|
virtual bool send(const Nexus::ClientID local_id, const byte_string& data);
|
||||||
virtual bool recv(const Nexus::ClientID local_id, byte_string& data);
|
virtual bool recv(const Nexus::ClientID local_id, byte_string& data);
|
||||||
|
|
||||||
virtual bool insertMessage(const Nexus::ClientID local_id, const byte_string& message);
|
virtual bool insertMessage(const Nexus::ClientID local_id, const byte_string& message); //inserted into queue of messages from clients
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TunnelToClient(void);
|
TunnelToClient(void);
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#include <NexusClientInterface.h>
|
||||||
|
#include "AvHNexusClient.h"
|
||||||
|
#include "AvHNexusTunnelToServer.h"
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
AvHNexus::TunnelToServer::TunnelToServer(void) {}
|
||||||
|
AvHNexus::TunnelToServer::~TunnelToServer(void) {}
|
||||||
|
Nexus::TunnelToServer* AvHNexus::TunnelToServer::clone(void) const { return new TunnelToServer(); }
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
AvHNexus::TunnelToServer* AvHNexus::TunnelToServer::getInstance(void)
|
||||||
|
{
|
||||||
|
static std::auto_ptr<AvHNexus::TunnelToServer> ptr(new AvHNexus::TunnelToServer());
|
||||||
|
return ptr.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
bool AvHNexus::TunnelToServer::insertMessage(const byte_string& message)
|
||||||
|
{
|
||||||
|
messages.push_back(message);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
bool AvHNexus::TunnelToServer::recv(byte_string& data)
|
||||||
|
{
|
||||||
|
if( messages.empty() )
|
||||||
|
{ return false; }
|
||||||
|
data.assign(messages.front());
|
||||||
|
messages.pop_front();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
bool AvHNexus::TunnelToServer::send(const byte_string& data)
|
||||||
|
{
|
||||||
|
return AvHNexus::send( data.c_str(), data.length() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef AVHNEXUSTUNNELTOSERVER_H
|
||||||
|
#define AVHNEXUSTUNNELTOSERVER_H
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
|
namespace AvHNexus
|
||||||
|
{
|
||||||
|
class TunnelToServer : public Nexus::TunnelToServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static TunnelToServer* getInstance(void);
|
||||||
|
virtual ~TunnelToServer(void);
|
||||||
|
|
||||||
|
virtual Nexus::TunnelToServer* clone(void) const;
|
||||||
|
virtual bool send(const byte_string& data);
|
||||||
|
virtual bool recv(byte_string& data);
|
||||||
|
|
||||||
|
virtual bool insertMessage(const byte_string& message); //inserted into queue of messages from server
|
||||||
|
|
||||||
|
private:
|
||||||
|
TunnelToServer(void);
|
||||||
|
std::deque<const byte_string> messages;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue