00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TServerSocket
00013 #define ROOT_TServerSocket
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROOT_TSocket
00029 #include "TSocket.h"
00030 #endif
00031 #include <string>
00032
00033 class TSeqCollection;
00034
00035 typedef Int_t (*SrvAuth_t)(TSocket *sock, const char *, const char *,
00036 std::string&, Int_t &, Int_t &, std::string &,
00037 TSeqCollection *);
00038 typedef Int_t (*SrvClup_t)(TSeqCollection *);
00039
00040
00041 const UChar_t kSrvAuth = 0x1;
00042 const UChar_t kSrvNoAuth = (kSrvAuth<<4);
00043
00044 class TServerSocket : public TSocket {
00045
00046 private:
00047 TSeqCollection *fSecContexts;
00048 static SrvAuth_t fgSrvAuthHook;
00049 static SrvClup_t fgSrvAuthClupHook;
00050 static UChar_t fgAcceptOpt;
00051
00052 TServerSocket() : fSecContexts(0) { }
00053 TServerSocket(const TServerSocket &);
00054 void operator=(const TServerSocket &);
00055 Bool_t Authenticate(TSocket *);
00056
00057 public:
00058 enum { kDefaultBacklog = 10 };
00059
00060 TServerSocket(Int_t port, Bool_t reuse = kFALSE, Int_t backlog = kDefaultBacklog,
00061 Int_t tcpwindowsize = -1);
00062 TServerSocket(const char *service, Bool_t reuse = kFALSE,
00063 Int_t backlog = kDefaultBacklog, Int_t tcpwindowsize = -1);
00064 virtual ~TServerSocket();
00065
00066 virtual TSocket *Accept(UChar_t Opt = 0);
00067 virtual TInetAddress GetLocalInetAddress();
00068 virtual Int_t GetLocalPort();
00069
00070 Int_t Send(const TMessage &)
00071 { MayNotUse("Send(const TMessage &)"); return 0; }
00072 Int_t Send(Int_t)
00073 { MayNotUse("Send(Int_t)"); return 0; }
00074 Int_t Send(Int_t, Int_t)
00075 { MayNotUse("Send(Int_t, Int_t)"); return 0; }
00076 Int_t Send(const char *, Int_t = kMESS_STRING)
00077 { MayNotUse("Send(const char *, Int_t)"); return 0; }
00078 Int_t SendObject(const TObject *, Int_t = kMESS_OBJECT)
00079 { MayNotUse("SendObject(const TObject *, Int_t)"); return 0; }
00080 Int_t SendRaw(const void *, Int_t, ESendRecvOptions = kDefault)
00081 { MayNotUse("SendRaw(const void *, Int_t, ESendRecvOptions)"); return 0; }
00082 Int_t Recv(TMessage *&)
00083 { MayNotUse("Recv(TMessage *&)"); return 0; }
00084 Int_t Recv(Int_t &, Int_t &)
00085 { MayNotUse("Recv(Int_t &, Int_t &)"); return 0; }
00086 Int_t Recv(char *, Int_t)
00087 { MayNotUse("Recv(char *, Int_t)"); return 0; }
00088 Int_t Recv(char *, Int_t, Int_t &)
00089 { MayNotUse("Recv(char *, Int_t, Int_t &)"); return 0; }
00090 Int_t RecvRaw(void *, Int_t, ESendRecvOptions = kDefault)
00091 { MayNotUse("RecvRaw(void *, Int_t, ESendRecvOptions)"); return 0; }
00092
00093 static UChar_t GetAcceptOptions();
00094 static void SetAcceptOptions(UChar_t Opt);
00095 static void ShowAcceptOptions();
00096
00097 ClassDef(TServerSocket,1)
00098 };
00099
00100 #endif