1 /*****************************************************************************
2  * PokerTH - The open source texas holdem engine                             *
3  * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May          *
4  *                                                                           *
5  * This program is free software: you can redistribute it and/or modify      *
6  * it under the terms of the GNU Affero General Public License as            *
7  * published by the Free Software Foundation, either version 3 of the        *
8  * License, or (at your option) any later version.                           *
9  *                                                                           *
10  * This program is distributed in the hope that it will be useful,           *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
13  * GNU Affero General Public License for more details.                       *
14  *                                                                           *
15  * You should have received a copy of the GNU Affero General Public License  *
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
17  *                                                                           *
18  *                                                                           *
19  * Additional permission under GNU AGPL version 3 section 7                  *
20  *                                                                           *
21  * If you modify this program, or any covered work, by linking or            *
22  * combining it with the OpenSSL project's OpenSSL library (or a             *
23  * modified version of that library), containing parts covered by the        *
24  * terms of the OpenSSL or SSLeay licenses, the authors of PokerTH           *
25  * (Felix Hammer, Florian Thauer, Lothar May) grant you additional           *
26  * permission to convey the resulting work.                                  *
27  * Corresponding Source for a non-source form of such a combination          *
28  * shall include the source code for the parts of OpenSSL used as well       *
29  * as that of the covered work.                                              *
30  *****************************************************************************/
31 /* Context of network client. */
32 
33 #ifndef _CLIENTCONTEXT_H_
34 #define _CLIENTCONTEXT_H_
35 
36 #include <boost/shared_ptr.hpp>
37 
38 #include <net/sessiondata.h>
39 #include <playerdata.h>
40 
41 
42 class ClientContext
43 {
44 public:
45 	ClientContext();
46 	virtual ~ClientContext();
47 
48 	boost::shared_ptr<SessionData> GetSessionData() const;
49 	void SetSessionData(boost::shared_ptr<SessionData> sessionData);
50 	boost::shared_ptr<boost::asio::ip::tcp::resolver> GetResolver() const;
51 	void SetResolver(boost::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
GetSctp()52 	bool GetSctp() const
53 	{
54 		return m_sctp;
55 	}
SetSctp(bool sctp)56 	void SetSctp(bool sctp)
57 	{
58 		m_sctp = sctp;
59 	}
GetAddrFamily()60 	int GetAddrFamily() const
61 	{
62 		return m_addrFamily;
63 	}
SetAddrFamily(int addrFamily)64 	void SetAddrFamily(int addrFamily)
65 	{
66 		m_addrFamily = addrFamily;
67 	}
GetServerAddr()68 	const std::string &GetServerAddr() const
69 	{
70 		return m_serverAddr;
71 	}
SetServerAddr(const std::string & serverAddr)72 	void SetServerAddr(const std::string &serverAddr)
73 	{
74 		m_serverAddr = serverAddr;
75 	}
GetServerPassword()76 	const std::string &GetServerPassword() const
77 	{
78 		return m_serverPassword;
79 	}
SetServerPassword(const std::string & serverPassword)80 	void SetServerPassword(const std::string &serverPassword)
81 	{
82 		m_serverPassword = serverPassword;
83 	}
GetServerListUrl()84 	const std::string &GetServerListUrl() const
85 	{
86 		return m_serverListUrl;
87 	}
SetServerListUrl(const std::string & serverListUrl)88 	void SetServerListUrl(const std::string &serverListUrl)
89 	{
90 		m_serverListUrl = serverListUrl;
91 	}
GetUseServerList()92 	bool GetUseServerList() const
93 	{
94 		return m_useServerList;
95 	}
SetUseServerList(bool use)96 	void SetUseServerList(bool use)
97 	{
98 		m_useServerList = use;
99 	}
GetServerPort()100 	unsigned GetServerPort() const
101 	{
102 		return m_serverPort;
103 	}
SetServerPort(unsigned serverPort)104 	void SetServerPort(unsigned serverPort)
105 	{
106 		m_serverPort = serverPort;
107 	}
GetAvatarServerAddr()108 	const std::string &GetAvatarServerAddr() const
109 	{
110 		return m_avatarServerAddr;
111 	}
SetAvatarServerAddr(const std::string & avatarServerAddr)112 	void SetAvatarServerAddr(const std::string &avatarServerAddr)
113 	{
114 		m_avatarServerAddr = avatarServerAddr;
115 	}
GetPassword()116 	const std::string &GetPassword() const
117 	{
118 		return m_password;
119 	}
SetPassword(const std::string & password)120 	void SetPassword(const std::string &password)
121 	{
122 		m_password = password;
123 	}
GetPlayerName()124 	const std::string &GetPlayerName() const
125 	{
126 		return m_playerName;
127 	}
SetPlayerName(const std::string & playerName)128 	void SetPlayerName(const std::string &playerName)
129 	{
130 		m_playerName = playerName;
131 	}
GetPlayerRights()132 	PlayerRights GetPlayerRights() const
133 	{
134 		return m_playerRights;
135 	}
SetPlayerRights(PlayerRights rights)136 	void SetPlayerRights(PlayerRights rights)
137 	{
138 		m_playerRights = rights;
139 	}
GetAvatarFile()140 	const std::string &GetAvatarFile() const
141 	{
142 		return m_avatarFile;
143 	}
SetAvatarFile(const std::string & avatarFile)144 	void SetAvatarFile(const std::string &avatarFile)
145 	{
146 		m_avatarFile = avatarFile;
147 	}
GetCacheDir()148 	const std::string &GetCacheDir() const
149 	{
150 		return m_cacheDir;
151 	}
SetCacheDir(const std::string & cacheDir)152 	void SetCacheDir(const std::string &cacheDir)
153 	{
154 		m_cacheDir = cacheDir;
155 	}
GetSubscribeLobbyMsg()156 	bool GetSubscribeLobbyMsg() const
157 	{
158 		return m_hasSubscribedLobbyMsg;
159 	}
SetSubscribeLobbyMsg(bool setSubscribe)160 	void SetSubscribeLobbyMsg(bool setSubscribe)
161 	{
162 		m_hasSubscribedLobbyMsg = setSubscribe;
163 	}
164 
GetSessionGuid()165 	const std::string &GetSessionGuid() const
166 	{
167 		return m_sessionGuid;
168 	}
169 
SetSessionGuid(const std::string & sessionGuid)170 	void SetSessionGuid(const std::string &sessionGuid)
171 	{
172 		m_sessionGuid = sessionGuid;
173 	}
174 
175 private:
176 	boost::shared_ptr<SessionData> m_sessionData;
177 	boost::shared_ptr<boost::asio::ip::tcp::resolver> m_resolver;
178 	bool				m_sctp;
179 	int					m_addrFamily;
180 	std::string			m_serverAddr;
181 	std::string			m_serverPassword;
182 	std::string			m_serverListUrl;
183 	bool				m_useServerList;
184 	unsigned			m_serverPort;
185 	std::string			m_avatarServerAddr;
186 	std::string			m_password;
187 	std::string			m_playerName;
188 	PlayerRights		m_playerRights;
189 	std::string			m_avatarFile;
190 	std::string			m_cacheDir;
191 	bool				m_hasSubscribedLobbyMsg;
192 	std::string			m_sessionGuid;
193 };
194 
195 #endif
196