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 const char * GetName() const
Returns name of object.
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual void WriteString(const char *s)
Write string to I/O buffer.
virtual Bool_t IsValid() const
Bool_t RecvStreamerInfos(TMessage *mess)
Receive a message containing streamer infos.
Int_t GetCompressionLevel() const
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
char * CompBuffer() const
R__EXTERN const char * gRootdErrStr[]
void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm: settings = 100 * algorithm + level...
Collectable string class.
const char * GetHostName() const
Bool_t RecvProcessIDs(TMessage *mess)
Receive a message containing process ids.
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
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
Bool_t TestBit(UInt_t f) const
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
const char * GetProtocol() const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual TSecContext * Authenticate(TSocket *, const char *host, const char *user, Option_t *options)=0
virtual Int_t GetEntries() 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.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Int_t LoadPlugin()
Load the plugin library for this handler.
void SendStreamerInfos(const TMessage &mess)
Check if TStreamerInfo must be sent.
R__EXTERN TVirtualMutex * gROOTMutex
virtual Int_t SendObject(const TObject *obj, Int_t kind=kMESS_OBJECT)
Send an object.
Option_t * GetOption() const
TObject * At(Int_t idx) const
virtual TInetAddress GetPeerName(int sock)
Get Internet Protocol (IP) address of remote host and port #.
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.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
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.
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...
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
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.
Bool_t TestBitNumber(UInt_t bitnumber) const
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
void SetCompressionLevel(Int_t level=1)
See comments for function SetCompressionSettings.
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.
virtual void Close(Option_t *opt="")
Close the socket.
virtual Int_t Select(Int_t interest=kRead, Long_t timeout=-1)
Waits for this socket to change status.
R__EXTERN TSystem * gSystem
Long_t ExecPlugin(int nargs, const T &... params)
static void NetError(const char *where, Int_t error)
Print error string depending on error code.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) 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.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
void SetCompressionAlgorithm(Int_t algorithm=0)
See comments for function SetCompressionSettings.
virtual TObjLink * FirstLink() const
#define R__LOCKGUARD2(mutex)
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)
TObject * UncheckedAt(Int_t i) const
Wrapper around a TObject so it can be stored in a TList.
Int_t IndexOf(const TObject *obj) const
unsigned long long ULong64_t
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t IsAuthenticated() const
virtual TInetAddress GetSockName(int sock)
Get Internet Protocol (IP) address of host and port #.
Int_t GetCompressionLevel() const
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Mother of all ROOT objects.
TObjArray * GetElements() const
static ULong64_t fgBytesSent
TObject * GetObject() const
Int_t GetClassVersion() const
void SetLength() const
Set the message length at the beginning of the message buffer.
void BuildCheck(TFile *file=0)
Check if built and consistent with the class dictionary.
Int_t GetErrorCode() const
Returns error code.
virtual int GetServiceByName(const char *service)
Get port # of internet service.
void SendProcessIDs(const TMessage &mess)
Check if TProcessIDs must be sent.
virtual void Add(TObject *obj)
void WriteObject(const TObject *obj)
Write object to message buffer.
static ULong64_t fgBytesRecv
Int_t GetEntries() const
Return the number of objects in array (i.e.
static Int_t GetClientProtocol()
Static method returning supported client protocol.
TInetAddress GetInetAddress() const
static void ResetErrno()
Static function resetting system error number.
Bool_t TestBitNumber(UInt_t bitnumber) const
virtual const char * GetName() const
Returns name of object.
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.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void SetBitNumber(UInt_t bitnumber, Bool_t value=kTRUE)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
TSecContext * fSecContext
Bool_t Authenticate(const char *user)
Authenticated the socket with specified user.
TVirtualMutex * gSocketAuthMutex
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const