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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Manuel Mausz (manuel@mausz.at)
* Christian Raschko (c.raschko@netcore.at)
*/
// Header
#include "tsserver.h"
//Libraries
#include <wx/txtstrm.h>
IMPLEMENT_CLASS(TSServer, wxObject)
//------------------------------------------------------------------------------
//Default CTor, Initializes the object.
TSServer::TSServer()
{
m_Id = 0;
m_Type = 0;
m_Port = 0;
m_HostAddress = _T("localhost");
}
//------------------------------------------------------------------------------
//Default DTor.
TSServer::~TSServer()
{
}
//------------------------------------------------------------------------------
// Sets the server message.
bool TSServer::SetServerMessage(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_ServerMessage = str;
return true;
}
//------------------------------------------------------------------------------
// Sets the welcome message.
bool TSServer::SetWelcomeMessage(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_WelcomeMessage = str;
return true;
}
//------------------------------------------------------------------------------
// Sets the server message.
bool TSServer::SetVersionNumber(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_VersionNumber = str;
return true;
}
//------------------------------------------------------------------------------
// Sets the host address, bindes the client to an address.
bool TSServer::SetHostAddress(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_HostAddress = str;
return true;
}
//------------------------------------------------------------------------------
// Sets the server address.
bool TSServer::SetServerAddress(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_ServerAddress = str;
return true;
}
//------------------------------------------------------------------------------
// Sets the server Id.
bool TSServer::SetId(wxUint32 const &id)
{
m_Id = id;
return true;
}
//------------------------------------------------------------------------------
// Sets the connection port.
bool TSServer::SetPort(wxUint16 const &port)
{
if(port == 0)
{
SetLastError(_T("empty port"));
return false;
}
m_Port = port;
return true;
}
//------------------------------------------------------------------------------
// Sets the server type.
bool TSServer::SetServerType(wxUint16 const &type)
{
m_ServerType = type;
return true;
}
//------------------------------------------------------------------------------
// Sets the platform string.
bool TSServer::SetPlatform(wxString const &str)
{
if(str.Length() == 0)
{
SetLastError(_T("empty string"));
return false;
}
m_Platform = str;
return true;
}
//------------------------------------------------------------------------------
// Dumps object.
void TSServer::Dump(wxOutputStream &ostrm) const
{
wxTextOutputStream out(ostrm);
out << _T("Object: TSServer (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl;
out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl;
out << _T("-wxString m_VersionNumber: ") << m_VersionNumber << endl;
out << _T("-wxString m_WelcomeMessage: ") << m_WelcomeMessage << endl;
out << _T("-wxString m_ServerMessage: ") << m_ServerMessage << endl;
out << _T("-wxString m_Platform: ") << m_Platform << endl;
out << _T("-wxUint32 m_Type: ") << wxString::Format(_T("0x%X"), m_Type) << endl;
out << _T("-wxString m_ISPLinkURL: ") << m_ISPLinkURL << endl;
out << _T("-wxString m_ServerAddress: ") << m_ServerAddress << endl;
out << _T("-wxString m_HostAddress: ") << m_HostAddress << endl;
out << _T("-wxUint16 m_Port: ") << wxString::Format(_T("0x%X"), m_Port) << endl;
out << _T("-wxUint16 m_ServerType: ") << wxString::Format(_T("0x%X"), m_ServerType) << endl;
out << _T("-wxString m_LastError: ") << m_LastError << endl;
}
|