webserver.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 2005 by Tobias Nadler                                         */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
00019 /*                                                                              */
00020 /********************************************************************************/
00021 
00022 #ifndef WEBSERVER_H
00023 #define WEBSERVER_H
00024 
00025 #include "SDL/WebSrv.h"
00026 #include <list>
00027 #include "basiclog.h"
00028 
00029 using namespace std;
00030 
00031 class WebPage;
00032 class WebThread;
00033 class TiXmlElement;
00034 class TiXmlNode;
00035 
00074 class DECLSPEC WebServer : public BasicLog
00075 {
00076 public:
00077     DECLSPEC WebServer(const char *name, BasicObject *p);
00094     DECLSPEC WebServer(TiXmlElement *el, BasicObject *p);
00095     DECLSPEC ~WebServer();
00096 
00097     virtual const char *getClassName()  { return "WebServer"; }
00107     virtual DECLSPEC bool init( Uint16 port = 80 );
00111     virtual DECLSPEC void destroy();
00112 
00119     virtual DECLSPEC bool poll( Uint16 tWait = 0 );
00124     DECLSPEC void closeOutTimedThreads();
00125 
00153     DECLSPEC void parseXMLNode( TiXmlNode *node );
00164     DECLSPEC int addPageDirectory( const char *dir, const char *basic_uri = "/", const char *fn_index = 0, bool subdirs = true );
00165 /*  DECLSPEC WebPage *getFirstPage();
00166     DECLSPEC WebPage *getNextPage();*/
00170     list<WebPage*>::iterator beginPage()    { return lPages.begin(); }
00174     list<WebPage*>::iterator endPage()  { return lPages.end(); }
00175 
00179     static WebServer *the;
00187     DECLSPEC static WebServer *getThe();
00188 protected:
00189     virtual DECLSPEC void onInit();
00190     virtual DECLSPEC void onDestroy();
00192     TCPsocket socket;
00193     
00195     list<WebPage*> lPages;
00197     list<WebThread*> lThreads;
00198     
00199 //  list<WebPage*>::iterator itPage;
00200     
00201 private:
00202     void logIntro();
00203     WebSrv *webServer;
00204     
00205     friend class WebPage;
00206     friend class WebThread;
00207 };
00208 
00209 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1