00001 // @(#)root/krb5auth:$Id: TKSocket.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Maarten Ballintijn 27/10/2003 00003 00004 #ifndef ROOT_TKSocket 00005 #define ROOT_TKSocket 00006 00007 #if !defined(__CINT__) 00008 00009 #ifndef ROOT_Krb5Auth 00010 #include "Krb5Auth.h" 00011 #endif 00012 00013 #else 00014 00015 typedef void* krb5_principal; 00016 typedef void* krb5_auth_context; 00017 typedef void* krb5_context; 00018 typedef void* krb5_ccache; 00019 typedef void* krb5_principal; 00020 00021 #endif 00022 00023 #ifndef ROOT_TObject 00024 #include "TObject.h" 00025 #endif 00026 00027 00028 class TSocket; 00029 00030 00031 class TKSocket : public TObject { 00032 00033 private: 00034 TSocket *fSocket; //underlying socket 00035 krb5_principal fServer; //server principal 00036 krb5_auth_context fAuthContext; //per connection kerberos authentication context 00037 00038 static krb5_context fgContext; //shared kerberos context 00039 static krb5_ccache fgCCDef; //shared default credential cache 00040 static krb5_principal fgClient; //client principal 00041 00042 TKSocket(TSocket *s = 0); 00043 00044 public: 00045 ~TKSocket(); 00046 00047 enum EEncoding { kNone = 0, kSafe = 1, kPriv = 2 }; 00048 00049 struct Desc_t { 00050 Short_t fLength; 00051 Short_t fType; 00052 }; 00053 00054 Int_t BlockRead(char *&buf, EEncoding &type); 00055 Int_t BlockWrite(const char *buf, Int_t len, EEncoding type); 00056 00057 static TKSocket *Connect(const char *server, Int_t port); 00058 00059 ClassDef(TKSocket,0) // General kerberized socket 00060 }; 00061 00062 #endif