- bugfixes for ftp server to work on windows, silly M$ compiler has issues with mixing C / C++ code so I had to make these changes
This commit is contained in:
parent
9b3e921888
commit
1f29685803
|
@ -251,38 +251,110 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpAccount.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpAccount.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpCmds.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpCmds.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpLib.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpLib.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpMessages.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpMessages.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpRuntime.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpRuntime.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpServer.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpServer.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpSession.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpSession.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpTargetPosix.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpTargetPosix.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpTargetWin32.c"
|
RelativePath="..\..\source\shared_lib\sources\feathery_ftp\ftpTargetWin32.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
CompileAs="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\sdl\gl_wrap.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\sdl\gl_wrap.cpp"
|
||||||
|
@ -634,6 +706,26 @@
|
||||||
RelativePath="..\..\source\shared_lib\include\streflop\FPUSettings.h"
|
RelativePath="..\..\source\shared_lib\include\streflop\FPUSettings.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\feathery_ftp\ftp.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\feathery_ftp\ftpConfig.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\feathery_ftp\ftpIfc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\feathery_ftp\ftpMessages.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\feathery_ftp\ftpTypes.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\streflop\IntegerTypes.h"
|
RelativePath="..\..\source\shared_lib\include\streflop\IntegerTypes.h"
|
||||||
>
|
>
|
||||||
|
@ -921,10 +1013,22 @@
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\posix\ircclient.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\posix\ircclient.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\platform\posix\ircclient.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\common\math_wrapper.h"
|
RelativePath="..\..\source\shared_lib\include\platform\common\math_wrapper.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\platform\posix\miniftpclient.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\platform\posix\miniftpserver.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\miniupnpc\miniupnpcstrings.h"
|
RelativePath="..\..\source\shared_lib\include\platform\miniupnpc\miniupnpcstrings.h"
|
||||||
>
|
>
|
||||||
|
@ -957,10 +1061,6 @@
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\sdl\thread.h"
|
RelativePath="..\..\source\shared_lib\include\platform\sdl\thread.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\miniupnpc\updateminiupnpcstrings.sh"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\sdl\window.h"
|
RelativePath="..\..\source\shared_lib\include\platform\sdl\window.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void ftpInit(ftpFindExternalFTPServerIpType cb1, ftpAddUPNPPortForwardType cb2, ftpRemoveUPNPPortForwardType cb3);
|
||||||
int ftpCreateAccount(const char* name, const char* passw, const char* root, int accRights);
|
int ftpCreateAccount(const char* name, const char* passw, const char* root, int accRights);
|
||||||
int ftpStart(int portNumber);
|
int ftpStart(int portNumber);
|
||||||
int ftpShutdown(void);
|
int ftpShutdown(void);
|
||||||
|
|
|
@ -60,9 +60,22 @@ typedef uint16_t port_t;
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ip_t (*ftpFindExternalFTPServerIp)(ip_t clientIp);
|
#ifdef __cplusplus
|
||||||
void (*ftpAddUPNPPortForward)(int internalPort, int externalPort);
|
extern "C" {
|
||||||
void (*ftpRemoveUPNPPortForward)(int internalPort, int externalPort);
|
#endif
|
||||||
|
|
||||||
int VERBOSE_MODE_ENABLED;
|
int VERBOSE_MODE_ENABLED;
|
||||||
|
|
||||||
|
typedef ip_t (*ftpFindExternalFTPServerIpType)(ip_t clientIp);
|
||||||
|
typedef void (*ftpAddUPNPPortForwardType)(int internalPort, int externalPort);
|
||||||
|
typedef void (*ftpRemoveUPNPPortForwardType)(int internalPort, int externalPort);
|
||||||
|
|
||||||
|
ftpFindExternalFTPServerIpType ftpFindExternalFTPServerIp;
|
||||||
|
ftpAddUPNPPortForwardType ftpAddUPNPPortForward;
|
||||||
|
ftpRemoveUPNPPortForwardType ftpRemoveUPNPPortForward;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,6 @@ namespace Shared { namespace PlatformCommon {
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class FTPServerThread
|
// class FTPServerThread
|
||||||
// =====================================================
|
// =====================================================
|
||||||
uint32 FindExternalFTPServerIp(uint32 clientIp);
|
|
||||||
|
|
||||||
class FTPServerThread : public BaseThread
|
class FTPServerThread : public BaseThread
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
*/
|
*/
|
||||||
LOCAL socket_t server;
|
LOCAL socket_t server;
|
||||||
|
|
||||||
|
void ftpInit(ftpFindExternalFTPServerIpType cb1, ftpAddUPNPPortForwardType cb2, ftpRemoveUPNPPortForwardType cb3) {
|
||||||
|
ftpFindExternalFTPServerIp = cb1;
|
||||||
|
ftpAddUPNPPortForward = cb2;
|
||||||
|
ftpRemoveUPNPPortForward = cb3;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes and starts the server
|
* @brief Initializes and starts the server
|
||||||
|
@ -48,7 +53,6 @@ int ftpStart(int portNumber)
|
||||||
{
|
{
|
||||||
server = -1; // set server socket to invalid value
|
server = -1; // set server socket to invalid value
|
||||||
|
|
||||||
|
|
||||||
if(VERBOSE_MODE_ENABLED) printf("Feathery FTP-Server\n");
|
if(VERBOSE_MODE_ENABLED) printf("Feathery FTP-Server\n");
|
||||||
|
|
||||||
ftpArchInit();
|
ftpArchInit();
|
||||||
|
|
|
@ -28,8 +28,8 @@ namespace Shared { namespace PlatformCommon {
|
||||||
|
|
||||||
static std::map<uint32,uint32> clientToFTPServerList;
|
static std::map<uint32,uint32> clientToFTPServerList;
|
||||||
|
|
||||||
uint32 FindExternalFTPServerIp(uint32 clientIp) {
|
ip_t FindExternalFTPServerIp(ip_t clientIp) {
|
||||||
uint32 result = clientToFTPServerList[clientIp];
|
ip_t result = clientToFTPServerList[clientIp];
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
||||||
|
|
||||||
|
@ -40,9 +40,7 @@ FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,int portNumbe
|
||||||
this->mapsPath = mapsPath;
|
this->mapsPath = mapsPath;
|
||||||
this->portNumber = portNumber;
|
this->portNumber = portNumber;
|
||||||
|
|
||||||
ftpAddUPNPPortForward = &UPNP_Tools::AddUPNPPortForward;
|
ftpInit(&FindExternalFTPServerIp,&UPNP_Tools::AddUPNPPortForward,&UPNP_Tools::RemoveUPNPPortForward);
|
||||||
ftpRemoveUPNPPortForward = &UPNP_Tools::RemoveUPNPPortForward;
|
|
||||||
ftpFindExternalFTPServerIp = &FindExternalFTPServerIp;
|
|
||||||
VERBOSE_MODE_ENABLED = SystemFlags::VERBOSE_MODE_ENABLED;
|
VERBOSE_MODE_ENABLED = SystemFlags::VERBOSE_MODE_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue