24 #include "Compression.h"
78 :
TNamed(addr.GetHostName(), service)
87 if (fService.Contains(
"root"))
89 if (fService.Contains(
"proof"))
96 fTcpWindowSize = tcpwindowsize;
101 if (fAddress.GetPort() != -1) {
107 gROOT->GetListOfSockets()->Add(
this);
125 :
TNamed(addr.GetHostName(),
"")
155 gROOT->GetListOfSockets()->Add(
this);
198 gROOT->GetListOfSockets()->Add(
this);
250 gROOT->GetListOfSockets()->Add(
this);
286 gROOT->GetListOfSockets()->Add(
this);
315 gROOT->GetListOfSockets()->Add(
this);
350 gROOT->GetListOfSockets()->Add(
this);
378 gROOT->GetListOfSockets()->Add(
this);
395 gROOT->GetListOfSockets()->Remove(
this);
466 if ((nsent =
Send(mess)) < 0)
485 if ((nsent =
Send(mess)) < 0)
504 if ((nsent =
Send(mess)) < 0)
507 return nsent -
sizeof(
Int_t);
527 Error(
"Send",
"cannot send a message used for reading");
540 const_cast<TMessage&>(mess).SetCompressionSettings(
fCompress);
543 const_cast<TMessage&>(mess).Compress();
545 char *mbuf = mess.
Buffer();
581 if (strncmp(buf,
"ok", 2)) {
582 Error(
"Send",
"bad acknowledgement");
591 return nsent -
sizeof(
UInt_t);
608 if ((nsent =
Send(mess)) < 0)
662 minilist =
new TList();
664 Info(
"SendStreamerInfos",
"sending TStreamerInfo: %s, version = %d",
674 if (
Send(messinfo) < 0)
675 Warning(
"SendStreamerInfos",
"problems sending TStreamerInfo's ...");
692 for (
Int_t ipid = 0; ipid < npids; ipid++) {
706 minilist =
new TList();
708 Info(
"SendProcessIDs",
"sending TProcessID: %s", pid->
GetTitle());
715 if (
Send(messpid) < 0)
716 Warning(
"SendProcessIDs",
"problems sending TProcessID's ...");
733 if ((n =
Recv(str, max, kind)) <= 0) {
742 Error(
"Recv",
"got message of wrong kind (expected %d, got %d)",
762 if ((n =
Recv(mess)) <= 0) {
795 if ((n =
Recv(mess)) <= 0) {
832 if (n == 0 || n == -5) {
843 char *buf =
new char[len+
sizeof(
UInt_t)];
845 if (n == 0 || n == -5) {
870 char ok[2] = {
'o',
'k' };
882 mess->SetWhat(mess->What() & ~
kMESS_ACK);
906 if (length == 0)
return 0;
911 if (n == 0 || n == -5) {
943 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
947 Info(
"RecvStreamerInfos",
"importing TStreamerInfo: %s, version = %d",
957 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
961 Info(
"RecvStreamerInfos",
"importing TStreamerInfo: %s, version = %d",
988 TIter nextpid(pidslist);
999 Info(
"RecvProcessIDs",
"importing TProcessID: %s", pid->
GetTitle());
1052 if (algorithm < 0 || algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
1067 if (level < 0) level = 0;
1068 if (level > 99) level = 99;
1074 if (algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
1119 }
else if (sproto.
Contains(
"rootd")) {
1121 }
else if (sproto.
Contains(
"proofd")) {
1126 if (!strncasecmp(opt,
"S", 1)) {
1127 if (
Send(
"slave") < 0)
return rc;
1128 }
else if (!strncasecmp(opt,
"M", 1)) {
1129 if (
Send(
"master") < 0)
return rc;
1132 "called by TSlave: unknown option '%c' %s",
1133 opt[0],
" - assuming Slave");
1134 if (
Send(
"slave") < 0)
return rc;
1138 Info(
"Authenticate",
"Local protocol: %s",sproto.
Data());
1184 gROOT->GetPluginManager()->FindHandler(
"TVirtualAuth", alib);
1186 Error(
"Authenticate",
1187 "could not load properly %s authentication plugin", alib.
Data());
1194 Error(
"Authenticate",
"could not instantiate the interface class");
1198 Info(
"Authenticate",
"class for '%s' authentication loaded", alib.
Data());
1202 Error(
"Authenticate",
1203 "authentication attempt failed for %s@%s", user, host.
Data());
1213 Warning(
"Authenticate",
"problem sending kROOTD_USER (%s,%s)", u->
fUser.
Data(), user);
1217 Warning(
"Authenticate",
"problem sending kROOTD_USER (-1,%s)", user);
1223 if (
Recv(stat, kind) > 0) {
1234 Info(
"Authenticate",
"no authentication required remotely");
1240 Info(
"Authenticate",
"expected message type %d, received %d",
1245 Info(
"Authenticate",
"error receiving message");
1332 if (((proto.
EndsWith(
"p") || size > 1) &&
1357 if (opensock && opensock->
IsValid())
1363 if (sock && sock->
IsValid()) {
1386 if (opensock && opensock->
IsValid())
1467 if (
TString(
TUrl(url).GetProtocol()).Length() > 0) {
1472 if (!user || strlen(user) > 0) {
1480 eurl += (port > 0 ? port : 0);
1505 err = (err < kErrError) ? ((err > -1) ? err : 0) :
kErrError;
Describe Streamer information for one class version.
virtual Int_t GetEntries() const
virtual const char * GetTitle() const
Returns title of object.
virtual void WriteString(const char *s)
Write string to I/O buffer.
Bool_t RecvStreamerInfos(TMessage *mess)
Receive a message containing streamer infos.
const char * GetHostName() const
R__EXTERN const char * gRootdErrStr[]
void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm: settings = 100 * algorithm + level...
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
virtual Bool_t IsValid() const
Bool_t RecvProcessIDs(TMessage *mess)
Receive a message containing process ids.
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Option_t * GetOption() const
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
static Int_t fgClientProtocol
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
virtual void SetName(const char *name)
Change (i.e.
virtual TSecContext * Authenticate(TSocket *, const char *host, const char *user, Option_t *options)=0
const char * GetProtocol() const
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
char * CompBuffer() const
This class represents an Internet Protocol (IP) address.
virtual void CloseConnection(int sock, Bool_t force=kFALSE)
Close socket connection.
This class implements a mutex interface.
static ULong64_t GetSocketBytesRecv()
Get total number of bytes received via all sockets.
Int_t LoadPlugin()
Load the plugin library for this handler.
void SendStreamerInfos(const TMessage &mess)
Check if TStreamerInfo must be sent.
ClassImp(TSocket) TSocket
Create a socket.
R__EXTERN TVirtualMutex * gROOTMutex
Int_t GetCompressionLevel() const
virtual Int_t SendObject(const TObject *obj, Int_t kind=kMESS_OBJECT)
Send an object.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Long_t ExecPlugin(int nargs, const T &...params)
virtual TInetAddress GetPeerName(int sock)
Get Internet Protocol (IP) address of remote host and port #.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TInetAddress fLocalAddress
virtual int SendRaw(int sock, const void *buffer, int length, int flag)
Send exactly length bytes from buffer.
virtual char * GetServiceByPort(int port)
Get name of internet service.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
const char * Data() const
virtual TObject * ReadObject(const TClass *cl)
Read object from I/O buffer.
static TObjArray * GetPIDs()
static: returns array of TProcessIDs
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
TVirtualMutex * fLastUsageMtx
UShort_t net2host(UShort_t x)
The TNamed class is the base class for all named ROOT classes.
virtual char * ReadString(char *s, Int_t max)
Read string from I/O buffer.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
static TSocket * CreateAuthSocket(const char *user, const char *host, Int_t port, Int_t size=0, Int_t tcpwindowsize=-1, TSocket *s=0, Int_t *err=0)
Creates a socket or a parallel socket and authenticates to the remote server specified in 'url' on re...
virtual Bool_t IsAuthenticated() const
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual int RecvRaw(int sock, void *buffer, int length, int flag)
Receive exactly length bytes into buffer.
A TProcessID identifies a ROOT job in a unique way in time and space.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
void SetCompressionLevel(Int_t level=1)
See comments for function SetCompressionSettings.
Int_t GetClassVersion() const
virtual Int_t GetLocalPort()
Return the local port # to which the socket is bound.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
TObject * UncheckedAt(Int_t i) const
virtual void Close(Option_t *opt="")
Close the socket.
Int_t IndexOf(const TObject *obj) const
virtual Int_t Select(Int_t interest=kRead, Long_t timeout=-1)
Waits for this socket to change status.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Double_t length(const TVector2 &v)
TObjArray * GetElements() const
R__EXTERN TSystem * gSystem
static void NetError(const char *where, Int_t error)
Print error string depending on error code.
TObject * GetObject() const
static ULong64_t GetSocketBytesSent()
Get total number of bytes sent via all sockets.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Int_t IncrementCount()
Increase the reference count to this object.
Bool_t TestBit(UInt_t f) const
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
void SetCompressionAlgorithm(Int_t algorithm=0)
See comments for function SetCompressionSettings.
virtual TObjLink * FirstLink() const
Int_t GetCompressionLevel() const
virtual int OpenConnection(const char *server, int port, int tcpwindowsize=-1, const char *protocol="tcp")
Open a connection to another host.
virtual int SetSockOpt(int sock, int kind, int val)
Set socket option.
virtual Int_t Select(TList *active, Long_t timeout)
Select on active file descriptors (called by TMonitor).
virtual TInetAddress GetLocalInetAddress()
Return internet address of local host to which the socket is bound.
TString & Remove(Ssiz_t pos)
virtual const char * GetName() const
Returns name of object.
Wrapper around a TObject so it can be stored in a TList.
unsigned long long ULong64_t
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual TInetAddress GetSockName(int sock)
Get Internet Protocol (IP) address of host and port #.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Int_t GetErrorCode() const
Returns error code.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
virtual UInt_t GetUniqueID() const
Return the unique object id.
Mother of all ROOT objects.
static ULong64_t fgBytesSent
void BuildCheck(TFile *file=0)
Check if built and consistent with the class dictionary.
virtual int GetServiceByName(const char *service)
Get port # of internet service.
void SendProcessIDs(const TMessage &mess)
Check if TProcessIDs must be sent.
Bool_t TestBitNumber(UInt_t bitnumber) const
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void WriteObject(const TObject *obj)
Write object to message buffer.
static ULong64_t fgBytesRecv
static Int_t GetClientProtocol()
Static method returning supported client protocol.
static void ResetErrno()
Static function resetting system error number.
Bool_t TestBitNumber(UInt_t bitnumber) const
TObject * At(Int_t idx) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual int GetSockOpt(int sock, int kind, int *val)
Get socket option.
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
TInetAddress GetInetAddress() const
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
void SetBitNumber(UInt_t bitnumber, Bool_t value=kTRUE)
TSecContext * fSecContext
Bool_t Authenticate(const char *user)
Authenticated the socket with specified user.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
void SetLength() const
Set the message length at the beginning of the message buffer.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.