File indexing completed on 2025-01-18 10:12:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TSSLSocket
0013 #define ROOT_TSSLSocket
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include "TSocket.h"
0024
0025 typedef struct ssl_st SSL;
0026 typedef struct ssl_ctx_st SSL_CTX;
0027
0028 class TSSLSocket : public TSocket {
0029 protected:
0030 TSSLSocket() : TSocket() {}
0031
0032 private:
0033
0034 static char fgSSLCAFile[];
0035 static char fgSSLCAPath[];
0036 static char fgSSLUCert[];
0037 static char fgSSLUKey[];
0038
0039
0040 SSL_CTX *fSSLCtx;
0041 SSL *fSSL;
0042
0043 void WrapWithSSL();
0044
0045 public:
0046 TSSLSocket(TInetAddress addr, const char *service, Int_t tcpwindowsize = -1);
0047 TSSLSocket(TInetAddress addr, Int_t port, Int_t tcpwindowsize = -1);
0048 TSSLSocket(const char *host, const char *service, Int_t tcpwindowsize = -1);
0049 TSSLSocket(const char *url, Int_t port, Int_t tcpwindowsize = -1);
0050 TSSLSocket(const char *sockpath);
0051 TSSLSocket(Int_t desc);
0052 TSSLSocket(Int_t desc, const char *sockpath);
0053 TSSLSocket(const TSSLSocket &s);
0054 virtual ~TSSLSocket();
0055
0056 void Close(Option_t *option="") override;
0057
0058
0059 static void SetUpSSL(const char *cafile, const char *capath,
0060 const char *ucert, const char *ukey);
0061
0062
0063
0064 Int_t Recv(TMessage *&mess) override;
0065 Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;
0066 Int_t Send(const TMessage &mess) override;
0067 Int_t SendRaw(const void *buffer, Int_t length,
0068 ESendRecvOptions opt = kDefault) override;
0069
0070
0071 Int_t Send(Int_t kind) override { return TSocket::Send(kind); }
0072 Int_t Send(Int_t status, Int_t kind) override { return TSocket::Send(status, kind); }
0073 Int_t Send(const char *mess, Int_t kind = kMESS_STRING) override { return TSocket::Send(mess, kind); }
0074 Int_t Recv(Int_t &status, Int_t &kind) override { return TSocket::Recv(status, kind); }
0075 Int_t Recv(char *mess, Int_t max) override { return TSocket::Recv(mess, max); }
0076 Int_t Recv(char *mess, Int_t max, Int_t &kind) override { return TSocket::Recv(mess, max, kind); }
0077
0078 ClassDefOverride(TSSLSocket,0)
0079 };
0080
0081 #endif