TServerSocket.h

Go to the documentation of this file.
00001 // @(#)root/net:$Id: TServerSocket.h 23091 2008-04-09 15:04:27Z rdm $
00002 // Author: Fons Rademakers   18/12/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TServerSocket
00013 #define ROOT_TServerSocket
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TServerSocket                                                        //
00019 //                                                                      //
00020 // This class implements server sockets. A server socket waits for      //
00021 // requests to come in over the network. It performs some operation     //
00022 // based on that request and then possibly returns a full duplex socket //
00023 // to the requester. The actual work is done via the TSystem class      //
00024 // (either TUnixSystem or TWinNTSystem).                                //
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 // These mask are globally available to manipulate the option to Accept
00041 const UChar_t kSrvAuth   = 0x1;            // Require client authentication
00042 const UChar_t kSrvNoAuth = (kSrvAuth<<4);  // Force no client authentication
00043 
00044 class TServerSocket : public TSocket {
00045 
00046 private:
00047    TSeqCollection  *fSecContexts; // List of TSecContext with cleanup info
00048    static SrvAuth_t fgSrvAuthHook;
00049    static SrvClup_t fgSrvAuthClupHook;
00050    static UChar_t fgAcceptOpt;     // Default accept options
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)  //This class implements server sockets
00098 };
00099 
00100 #endif

Generated on Tue Jul 5 14:28:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1