123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef NewsServer_H
- #define NewsServer_H
- #include <Server.h>
- #include <Thread.h>
- #include <Datei.h>
- #include <Text.h>
- #include <InitDatei.h>
- #include "Datenbank.h"
- using namespace Framework;
- using namespace Network;
- class NSKlient;
- class NewsServer : public Thread
- {
- private:
- Server *server;
- Server *aServer;
- InitDatei *ini;
- NSDatenbank *db;
- CRITICAL_SECTION cs;
- RCArray< NSKlient > *klients;
- Text *fehler;
- int klientAnzahl;
- int id;
- bool nichtPausiert;
- int empfangen;
- int gesendet;
- bool end;
- int ref;
- public:
- // Konstruktor
- NewsServer( InitDatei *zIni );
- // Destruktor
- virtual ~NewsServer();
- // nicht constant
- void runn();
- void thread();
- void close();
- bool serverStarten();
- bool serverPause();
- bool serverFortsetzen();
- bool serverBeenden();
- bool setMaxKlients( int mc );
- bool absturzKlient( int klientId );
- bool removeKlient( NSKlient *zKlient );
- void addGesendet( int bytes );
- void addEmpfangen( int bytes );
- // conatant
- bool istAn() const;
- Server *zServer() const;
- NSDatenbank *zDB() const;
- bool hatClients() const;
- int getId() const;
- char *getLetzterFehler() const;
- // Reference Counting
- NewsServer *getThis();
- NewsServer *release();
- };
- class NSAKlient : public Thread
- {
- private:
- SKlient *klient;
- Text *name;
- Text *passwort;
- int adminId;
- NewsServer *ns;
- public:
- // Konstruktor
- NSAKlient( SKlient *klient, NewsServer *ns );
- // Destruktor
- virtual ~NSAKlient();
- // nicht constant
- void thread();
- void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
- };
- class NSKlient : public Thread
- {
- private:
- SKlient *klient;
- unsigned int klientNummer;
- NewsServer *ns;
- int ref;
- public:
- // Konstruktor
- NSKlient( SKlient *klient, NewsServer *ns );
- // Destruktor
- virtual ~NSKlient();
- // nicht constant
- void absturz();
- void thread();
- // constant
- void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
- int getKlientNummer() const;
- // Reference Counting
- NSKlient *getThis();
- NSKlient *release();
- };
- #endif
|