1 // ==============================================================
2 //	This file is part of Glest (www.glest.org)
3 //
4 //	Copyright (C) 2001-2008 Marti�o Figueroa
5 //
6 //	You can redistribute this code and/or modify it under
7 //	the terms of the GNU General Public License as published
8 //	by the Free Software Foundation; either version 2 of the
9 //	License, or (at your option) any later version
10 // ==============================================================
11 
12 #ifndef _GLEST_GAME_NETWORKMANAGER_H_
13 #define _GLEST_GAME_NETWORKMANAGER_H_
14 
15 #include <cassert>
16 
17 #include "socket.h"
18 #include "checksum.h"
19 #include "server_interface.h"
20 #include "client_interface.h"
21 
22 using Shared::Util::Checksum;
23 
24 namespace Glest{ namespace Game{
25 
26 // =====================================================
27 //	class NetworkManager
28 // =====================================================
29 
30 enum NetworkRole{
31 	nrServer,
32 	nrClient,
33 	nrIdle
34 };
35 
36 class NetworkManager{
37 private:
38 	GameNetworkInterface* gameNetworkInterface;
39 	NetworkRole networkRole;
40 
41 public:
42 	static NetworkManager &getInstance();
43 
44 	NetworkManager();
45 	void init(NetworkRole networkRole);
46 	void end();
47 	void update();
48 
49 	bool isNetworkGame();
50 	GameNetworkInterface* getGameNetworkInterface();
51 	ServerInterface* getServerInterface();
52 	ClientInterface* getClientInterface();
53 };
54 
55 }}//end namespace
56 
57 #endif
58