2010-12-29 02:10:53 +01:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of MegaGlest Shared Library (www.glest.org)
|
|
|
|
//
|
|
|
|
// Copyright (C) 2009-2010 Titus Tscharntke (info@titusgames.de) and
|
|
|
|
// Mark Vejvoda (mark_vejvoda@hotmail.com)
|
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
#ifndef _SHARED_PLATFORMCOMMON_MINIFTPSERVERTHREAD_H_
|
|
|
|
#define _SHARED_PLATFORMCOMMON_MINIFTPSERVERTHREAD_H_
|
|
|
|
|
2012-04-20 03:04:05 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
#endif
|
|
|
|
|
2010-12-29 02:10:53 +01:00
|
|
|
#include "base_thread.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2012-04-20 03:04:05 +02:00
|
|
|
#include "data_types.h"
|
2011-01-07 07:21:23 +01:00
|
|
|
#include "socket.h"
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace Shared { namespace PlatformCommon {
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class FTPServerThread
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
class FTPServerThread : public BaseThread
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
std::pair<string,string> mapsPath;
|
2011-01-01 01:50:10 +01:00
|
|
|
std::pair<string,string> tilesetsPath;
|
2011-03-10 00:09:32 +01:00
|
|
|
std::pair<string,string> techtreesPath;
|
2013-02-15 19:25:10 +01:00
|
|
|
string tempFilesPath;
|
2011-03-10 00:09:32 +01:00
|
|
|
|
2010-12-29 21:28:25 +01:00
|
|
|
int portNumber;
|
2011-01-06 01:52:00 +01:00
|
|
|
int maxPlayers;
|
2011-01-07 07:21:23 +01:00
|
|
|
static FTPClientValidationInterface *ftpValidationIntf;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
2011-03-11 13:14:24 +01:00
|
|
|
bool internetEnabled;
|
|
|
|
bool allowInternetTilesetFileTransfers;
|
|
|
|
bool allowInternetTechtreeFileTransfers;
|
|
|
|
|
2010-12-29 02:10:53 +01:00
|
|
|
public:
|
|
|
|
|
2011-03-10 00:09:32 +01:00
|
|
|
FTPServerThread(std::pair<string,string> mapsPath,
|
|
|
|
std::pair<string,string> tilesetsPath, std::pair<string,string> techtreesPath,
|
2011-03-11 13:14:24 +01:00
|
|
|
bool internetEnabledFlag,
|
|
|
|
bool allowInternetTilesetFileTransfers, bool allowInternetTechtreeFileTransfers,
|
2013-02-15 19:25:10 +01:00
|
|
|
int portNumber,int maxPlayers, FTPClientValidationInterface *ftpValidationIntf,
|
|
|
|
string tempFilesPath);
|
2010-12-30 21:02:30 +01:00
|
|
|
~FTPServerThread();
|
2010-12-29 02:10:53 +01:00
|
|
|
virtual void execute();
|
|
|
|
virtual void signalQuit();
|
|
|
|
virtual bool shutdownAndWait();
|
2010-12-30 16:56:02 +01:00
|
|
|
|
2011-03-11 13:14:24 +01:00
|
|
|
void setInternetEnabled(bool value, bool forceChange=false);
|
2010-12-30 16:56:02 +01:00
|
|
|
static void addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp);
|
2011-01-07 07:21:23 +01:00
|
|
|
static FTPClientValidationInterface * getFtpValidationIntf() { return ftpValidationIntf; }
|
2010-12-30 16:56:02 +01:00
|
|
|
|
2010-12-29 02:10:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
#endif
|