00001 #ifndef DDSPARENTSERVER_H
00002 #define DDSPARENTSERVER_H
00003
00005
00006
00007
00008
00009
00010
00011
00013 #include <iosfwd>
00014 using namespace std;
00015
00016 #include "TServerSocket.h"
00017 #include "TMessage.h"
00018 #include "MessageService/Msg.h"
00019 #include "Dispatcher/DDS.h"
00020 #include "Dispatcher/DDSPSStatus.h"
00021
00022 class DDSParentServer;
00023
00024 std::ostream& operator << (std::ostream& ms, DDSParentServer* ps);
00025
00026 class DDSParentServer {
00027
00028 public:
00029
00030
00031 enum { kMaxChild = 10 };
00032
00033
00034 DDSParentServer (UInt_t port = 0, UInt_t maxchild = kMaxChild,
00035 Int_t logLevel = Msg::kInfo, Int_t maxinactive = 21600,
00036 Int_t backlog = TServerSocket::kDefaultBacklog);
00037 virtual ~DDSParentServer ();
00038
00039
00040 bool IsValid () const {
00041 return (fTServerSocket != (TServerSocket*)0) ? true : false; }
00042 std::ostream& Print(std::ostream& ms) const;
00043
00044
00045 void Run();
00046
00047 private:
00048
00049
00050 bool Authorize() const;
00051 UInt_t CheckChildStatus();
00052 bool IsLocalClient() const;
00053 DDS::EMessageType SpawnChildServer();
00054 DDS::EMessageType Shutdown();
00055 DDS::EMessageType Status();
00056
00057
00058 TServerSocket* fTServerSocket;
00059 UInt_t fMaxChild;
00060 Int_t fLogLevel;
00061 Int_t fMaxInactive;
00062 UInt_t fNumChild;
00063 bool fShutdown;
00064 TSocket* fTSocket;
00065 TInetAddress fServerAddress;
00066 TInetAddress fClientAddress;
00067 TMessage* fMessageIn;
00068 TMessage fMessageOut;
00069 DDSPSStatus fPSStatus;
00070
00071 ClassDef(DDSParentServer,0)
00072 };
00073
00074 #endif // DDSPARENTSERVER_H
00075
00076
00077
00078
00079
00080