File: miniftpserver.h

package info (click to toggle)
megaglest 3.13.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 13,416 kB
  • sloc: cpp: 144,271; ansic: 11,861; sh: 3,233; perl: 1,904; python: 1,751; objc: 142; asm: 42; makefile: 22
file content (73 lines) | stat: -rw-r--r-- 2,281 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// ==============================================================
//	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_

#ifdef WIN32
  #include <winsock2.h>
  #include <winsock.h>
#endif

#include "base_thread.h"
#include <vector>
#include <string>
#include "data_types.h"
#include "socket.h"

#include "leak_dumper.h"

using namespace std;

namespace Shared { namespace PlatformCommon {

// =====================================================
//	class FTPServerThread
// =====================================================

class FTPServerThread : public BaseThread
{
protected:
    std::pair<string,string> mapsPath;
    std::pair<string,string> tilesetsPath;
    std::pair<string,string> techtreesPath;
    string tempFilesPath;

    int portNumber;
    int maxPlayers;
    static FTPClientValidationInterface *ftpValidationIntf;

    bool internetEnabled;
    bool allowInternetTilesetFileTransfers;
    bool allowInternetTechtreeFileTransfers;

public:

    FTPServerThread(std::pair<string,string> mapsPath,
    		std::pair<string,string> tilesetsPath, std::pair<string,string> techtreesPath,
    		bool internetEnabledFlag,
    		bool allowInternetTilesetFileTransfers, bool allowInternetTechtreeFileTransfers,
    		int portNumber,int maxPlayers, FTPClientValidationInterface *ftpValidationIntf,
    		string tempFilesPath);
    ~FTPServerThread();
    virtual void execute();
    virtual void signalQuit();
    virtual bool shutdownAndWait();

    void setInternetEnabled(bool value, bool forceChange=false);
    static void addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp);
    static FTPClientValidationInterface * getFtpValidationIntf() { return ftpValidationIntf; }

};

}}//end namespace

#endif