Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSSLSocket.h
Go to the documentation of this file.
1// @(#)root/net:$Id: TSSLSocket.h
2// Author: Alejandro Alvarez 16/09/2011
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSSLSocket
13#define ROOT_TSSLSocket
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TSSLSocket //
18// //
19// A TSocket wrapped in by SSL. //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TSocket.h"
24
26
27typedef struct ssl_st SSL;
28typedef struct ssl_ctx_st SSL_CTX;
29
30class TSSLSocket : public TSocket {
31protected:
33
34private:
35 // CA, client cert/key... are class properties
36 static char fgSSLCAFile[];
37 static char fgSSLCAPath[];
38 static char fgSSLUCert[];
39 static char fgSSLUKey[];
40
41 // Object properties
44
45 void WrapWithSSL();
46
47public:
50 TSSLSocket(const char *host, const char *service, Int_t tcpwindowsize = -1);
51 TSSLSocket(const char *url, Int_t port, Int_t tcpwindowsize = -1);
52 TSSLSocket(const char *sockpath);
53 TSSLSocket(Int_t desc);
54 TSSLSocket(Int_t desc, const char *sockpath);
55 TSSLSocket(const TSSLSocket &s);
56 virtual ~TSSLSocket();
57
58 void Close(Option_t *option="") override;
59
60 // Set up the SSL environment for the next instantiation
61 static void SetUpSSL(const char *cafile, const char *capath,
62 const char *ucert, const char *ukey);
63
64 // The rest of the Send and Recv calls rely ultimately on these,
65 // so it is enough to overload them
66 Int_t Recv(TMessage *&mess) override;
67 Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;
68 Int_t Send(const TMessage &mess) override;
69 Int_t SendRaw(const void *buffer, Int_t length,
70 ESendRecvOptions opt = kDefault) override;
71
72 // Issue with hidden method :(
73 Int_t Send(Int_t kind) override { return TSocket::Send(kind); }
74 Int_t Send(Int_t status, Int_t kind) override { return TSocket::Send(status, kind); }
75 Int_t Send(const char *mess, Int_t kind = kMESS_STRING) override { return TSocket::Send(mess, kind); }
76 Int_t Recv(Int_t &status, Int_t &kind) override { return TSocket::Recv(status, kind); }
77 Int_t Recv(char *mess, Int_t max) override { return TSocket::Recv(mess, max); }
78 Int_t Recv(char *mess, Int_t max, Int_t &kind) override { return TSocket::Recv(mess, max, kind); }
79
80 ClassDefOverride(TSSLSocket,0) // SSL wrapped socket
81};
82
83} // namespace ROOT::Deprecated
84
85using TSSLSocket R__DEPRECATED(6, 42,
86 "ROOT is not providing an SSL socket API anymore. "
87 "Consider using SSH tunneling for secure channels.") = ROOT::Deprecated::TSSLSocket;
88
89#endif
@ kMESS_STRING
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:504
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
ESendRecvOptions
Definition TSystem.h:242
@ kDefault
Definition TSystem.h:243
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault) override
Send a raw buffer of specified length.
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault) override
Receive a raw buffer of specified length bytes.
void Close(Option_t *option="") override
Close the SSL connection.
Int_t Recv(TMessage *&mess) override
Receive a TMessage object.
void WrapWithSSL()
Wraps the socket with OpenSSL.
Int_t Recv(char *mess, Int_t max) override
Receive a character string message of maximum max length.
Definition TSSLSocket.h:77
Int_t Recv(char *mess, Int_t max, Int_t &kind) override
Receive a character string message of maximum max length.
Definition TSSLSocket.h:78
Int_t Recv(Int_t &status, Int_t &kind) override
Receives a status and a message type.
Definition TSSLSocket.h:76
virtual ~TSSLSocket()
Close gracefully the connection, and free SSL structures.
Int_t Send(const char *mess, Int_t kind=kMESS_STRING) override
Send a character string buffer.
Definition TSSLSocket.h:75
Int_t Send(const TMessage &mess) override
Send a TMessage object.
static void SetUpSSL(const char *cafile, const char *capath, const char *ucert, const char *ukey)
Set up the static configuration variables.
Int_t Send(Int_t kind) override
Send a single message opcode.
Definition TSSLSocket.h:73
Int_t Send(Int_t status, Int_t kind) override
Send a status and a single message opcode.
Definition TSSLSocket.h:74
This class represents an Internet Protocol (IP) address.
This class implements client sockets.
Definition TSocket.h:39
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition TSocket.cxx:807
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition TSocket.cxx:511
struct ssl_st SSL
Definition TSSLSocket.h:27
struct ssl_ctx_st SSL_CTX
Definition TSSLSocket.h:28