Planeshift
authentclient.h
Go to the documentation of this file.
1
/*
2
* AuthentClient.h by Keith Fulton <keith@paqrat.com>
3
*
4
* Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5
*
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation (version 2 of the License)
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 General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*
18
*
19
* This class subscribes to "AUTH" messages and receives either
20
* a "Character ID" message, telling the client what to request
21
* to instantiate the player, or a "Not Authorized" message which rejects
22
* the client.
23
*
24
*/
25
#ifndef __AUTHENTICATIONCLIENT_H__
26
#define __AUTHENTICATIONCLIENT_H__
27
28
//=============================================================================
29
// Crystal Space Includes
30
//=============================================================================
31
#include <csutil/ref.h>
32
#include <csutil/csstring.h>
33
34
//=============================================================================
35
// Project Includes
36
//=============================================================================
37
#include "
net/cmdbase.h
"
// Subscriber class
38
39
//=============================================================================
40
// Local Includes
41
//=============================================================================
42
43
44
//=============================================================================
45
// FORWARD DECLARATIONS
46
//=============================================================================
47
class
MsgEntry
;
48
class
MsgHandler
;
49
54
// Possible response types for logging in.
57
#define NO_RESPONSE 0
58
#define APPROVED 1
59
#define REJECTED 2
60
61
80
class
psAuthenticationClient
:
public
psClientNetSubscriber
81
{
82
public
:
83
84
psAuthenticationClient
(
MsgHandler
*myMsgQueue);
85
virtual
~psAuthenticationClient
();
86
96
bool
Authenticate
(
const
csString & user,
const
csString & pwd,
const
csString & pwd256);
97
101
virtual
void
HandleMessage
(
MsgEntry
*mh);
102
106
const
char
*
GetRejectMessage
();
107
118
int
Status
(
void
)
119
{
120
return
iClientApproved
;
121
};
122
126
void
Reset
(
void
)
127
{
128
iClientApproved
=
NO_RESPONSE
;
129
};
130
131
protected
:
132
csRef<MsgHandler>
msghandler
;
133
csString
rejectmsg
;
134
int
iClientApproved
;
135
csString
password
;
136
csString
password256
;
137
csString
username
;
138
139
140
private
:
141
void
ShowError();
142
144
void
HandlePreAuth(
MsgEntry
* me );
145
147
void
HandleAuthApproved(
MsgEntry
* me );
148
150
void
HandleDisconnect(
MsgEntry
* me );
151
};
152
155
#endif
156
psAuthenticationClient::username
csString username
Definition:
authentclient.h:137
NO_RESPONSE
#define NO_RESPONSE
Definition:
authentclient.h:57
psAuthenticationClient::Status
int Status(void)
Get the current status of authentication.
Definition:
authentclient.h:118
psAuthenticationClient
Handles Authentication details from the client to the server.
Definition:
authentclient.h:80
psAuthenticationClient::psAuthenticationClient
psAuthenticationClient(MsgHandler *myMsgQueue)
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
psAuthenticationClient::Reset
void Reset(void)
Clear the status of the login attempt.
Definition:
authentclient.h:126
cmdbase.h
psAuthenticationClient::msghandler
csRef< MsgHandler > msghandler
Definition:
authentclient.h:129
psAuthenticationClient::password256
csString password256
Definition:
authentclient.h:136
psAuthenticationClient::rejectmsg
csString rejectmsg
Definition:
authentclient.h:133
psAuthenticationClient::password
csString password
Definition:
authentclient.h:135
psAuthenticationClient::Authenticate
bool Authenticate(const csString &user, const csString &pwd, const csString &pwd256)
Send a message to the server to login.
MsgHandler
This class is the client's and server's main interface for either sending network messages out or get...
Definition:
msghandler.h:106
psAuthenticationClient::~psAuthenticationClient
virtual ~psAuthenticationClient()
psAuthenticationClient::iClientApproved
int iClientApproved
Definition:
authentclient.h:134
psAuthenticationClient::HandleMessage
virtual void HandleMessage(MsgEntry *mh)
Handle incomming messages based on the subscribed types.
psAuthenticationClient::GetRejectMessage
const char * GetRejectMessage()
Return the reason ( if any ) for a client to be rejected.
psClientNetSubscriber
Definition:
cmdbase.h:67
client
authentclient.h
Generated on Sat Jun 19 2021 05:00:22 for Planeshift by
1.8.11