1 | /* |
---|
2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
3 | * |
---|
4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation; either version 2 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | */ |
---|
20 | |
---|
21 | /// \addtogroup Trinityd |
---|
22 | /// @{ |
---|
23 | /// \file |
---|
24 | |
---|
25 | #ifndef _RASOCKET_H |
---|
26 | #define _RASOCKET_H |
---|
27 | |
---|
28 | #include "Common.h" |
---|
29 | #include "sockets/TcpSocket.h" |
---|
30 | |
---|
31 | #define RA_BUFF_SIZE 1024 |
---|
32 | |
---|
33 | class ISocketHandler; |
---|
34 | |
---|
35 | /// Remote Administration socket |
---|
36 | class RASocket: public TcpSocket |
---|
37 | { |
---|
38 | public: |
---|
39 | |
---|
40 | RASocket(ISocketHandler& h); |
---|
41 | ~RASocket(); |
---|
42 | |
---|
43 | void OnAccept(); |
---|
44 | void OnRead(); |
---|
45 | |
---|
46 | private: |
---|
47 | |
---|
48 | char * buff; |
---|
49 | std::string szLogin; |
---|
50 | uint32 iSess; |
---|
51 | unsigned int iInputLength; |
---|
52 | bool bLog; |
---|
53 | bool bSecure; //kick on wrong pass, non exist. user, user with no priv |
---|
54 | //will protect from DOS, bruteforce attacks |
---|
55 | //some 'smart' protection must be added for more scurity |
---|
56 | uint8 iMinLevel; |
---|
57 | enum |
---|
58 | { |
---|
59 | NONE, //initial value |
---|
60 | LG, //only login was entered |
---|
61 | OK, //both login and pass were given, and they are correct and user have enough priv. |
---|
62 | }stage; |
---|
63 | |
---|
64 | static int zprintf( const char * szText, ... ); |
---|
65 | }; |
---|
66 | #endif |
---|
67 | /// @} |
---|