Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

net/src/ServerInterface.h

00001 /* 
00002  * Version: GPL 2.0
00003  *
00004  * K-10 Distributed Processing - Lium, Le Mans
00005  * Copyright (C) 2006 Laurent MOUTEL
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  *
00021 */
00022 
00023 
00024 #ifndef SERVER_H
00025 #define SERVER_H
00026 
00027 #include "ResponseMessage.h"
00028 #include "QueryMessage.h"
00029 #include "Message.h"
00030 #include "Socket.h"
00031 #include "AccessList.h"
00032 
00033 #include <prthread.h>
00034 #include <prlog.h>
00035 
00036 namespace net
00037 {
00043         class ServerInterface
00044         {
00045         
00046         protected:
00047                 
00051                 Socket *mSock;
00055                 PRThread *mThread;
00059                 AccessList *mAccessList;
00060                 
00064                 string mIPAuthFile;
00065         public:
00066         
00070                 ServerInterface();
00071                 
00075                 virtual ~ServerInterface();
00076                 
00077                 
00078                 PRThread* createThread(PRThreadType type,
00079                                         void (*start)(void *arg),
00080                                         void *arg,
00081                                         PRThreadPriority priority,
00082                                         PRThreadScope scope,
00083                                         PRThreadState state,
00084                                         PRUint32 stackSize, PRInt32 index);
00085                 
00091                 virtual ResponseMessage ProcessQuery(QueryMessage) = 0;
00092                 
00096                 int Run();
00097                 
00101                 void Stop();
00102                 
00107                 void setSock(Socket *); 
00108                 
00114                 int setIPAuth(string);
00115                 
00120                 AccessList *getAccessList();
00121                 
00122                 friend void PR_CALLBACK net::thread(void *);
00123                         
00124                         
00125                 /* success cases */
00126                 static const int kCLIENT_QUIT_OK;
00127                 static const int kWAITING_FOR_DATA;
00128                 static const int kDESCRIPTOR_OK;
00129                 static const int kCLIENT_IP_OK;
00130                         
00131                 /* error cases */
00132                 static const int kCOMMAND_NOT_IMPLEMENTED;
00133                 static const int kDESCRIPTOR_FAILED;
00134                 static const int kINVALID_CLIENT_IP;
00135                 static const int kINTERNAL_ERROR;
00136                 static const int kBUSY;
00137         };
00138 }
00139 
00140 #endif

Generated on Fri May 19 23:12:37 2006 for common by  doxygen 1.4.4