21#include <openssl/ssl.h>
41 if (!(
fSSLCtx = SSL_CTX_new(SSLv23_method()))) {
42 Error(
"WrapWithSSL",
"the context could not be created");
47 Error(
"WrapWithSSL",
"could not set the CA file and/or the CA path");
52 Error(
"WrapWithSSL",
"could not set the client certificate");
57 Error(
"WrapWithSSL",
"could not set the client private key");
63 Error(
"WrapWithSSL",
"cannot create the ssl struct");
69 Error(
"WrapWithSSL",
"cannot bind to the socket %d",
fSocket);
74 if (SSL_connect(
fSSL) != 1) {
75 Error(
"WrapWithSSL",
"cannot connect");
93 :
TSocket(addr, service, tcpwindowsize)
101 :
TSocket(addr, port, tcpwindowsize)
109 :
TSocket(host, service, tcpwindowsize)
117 :
TSocket(url, port, tcpwindowsize)
176 const char *ucert,
const char *ukey)
192 Error(
"Recv",
"not implemented");
204 if (
length == 0)
return 0;
215 n = SSL_peek(
fSSL, (
char*)buffer +
offset, (
int)remain);
217 n = SSL_read(
fSSL, (
char*)buffer +
offset, (
int)remain);
221 Error(
"RecvRaw",
"failed to read from the socket");
226 SSL_set_quiet_shutdown(
fSSL, 1);
239 if (opt ==
kPeek)
return n;
257 Error(
"Send",
"not implemented");
273 if ((nsent = SSL_write(
fSSL, buffer, (
int)
length)) <= 0) {
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 offset
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
This class represents an Internet Protocol (IP) address.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
A TSocket wrapped in by SSL.
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.
static char fgSSLCAPath[]
Int_t Recv(TMessage *&mess) override
Receive a TMessage object.
void WrapWithSSL()
Wraps the socket with OpenSSL.
static char fgSSLCAFile[]
virtual ~TSSLSocket()
Close gracefully the connection, and free SSL structures.
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.
static ULong64_t fgBytesRecv
virtual void Close(Option_t *opt="")
Close the socket.
static ULong64_t fgBytesSent
static void ResetErrno()
Static function resetting system error number.
#define SSL_ERROR_SYSCALL
#define SSL_ERROR_ZERO_RETURN