xrootd
|
#include <XrdLink.hh>
Public Types | |
typedef XrdOucSFVec | sfVec |
Public Member Functions | |
bool | Activate () |
XrdNetAddrInfo * | AddrInfo () |
int | Backlog () |
int | Client (char *buff, int blen) |
int | Close (bool defer=false) |
void | Enable () |
Enable the link to field interrupts. | |
int | FDnum () |
int | getIOStats (long long &inbytes, long long &outbytes, int &numstall, int &numtardy) |
XrdTlsPeerCerts * | getPeerCerts () |
XrdProtocol * | getProtocol () |
Obtain current protocol object pointer. | |
void | Hold (bool lk) |
const char * | Host () const |
unsigned int | Inst () const |
bool | isFlawed () const |
bool | isInstance (unsigned int inst) const |
const char * | Name () const |
const XrdNetAddr * | NetAddr () const |
int | Peek (char *buff, int blen, int timeout=-1) |
int | Recv (char *buff, int blen) |
int | Recv (char *buff, int blen, int timeout) |
int | Recv (const struct iovec *iov, int iocnt, int timeout) |
int | RecvAll (char *buff, int blen, int timeout=-1) |
bool | Register (const char *hName) |
int | Send (const char *buff, int blen) |
int | Send (const struct iovec *iov, int iocnt, int bytes=0) |
int | Send (const sfVec *sdP, int sdn) |
void | Serialize () |
Wait for all outstanding requests to be completed on the link. | |
int | setEtext (const char *text) |
void | setID (const char *userid, int procid) |
void | setLocation (XrdNetAddrInfo::LocInfo &loc) |
bool | setNB () |
XrdProtocol * | setProtocol (XrdProtocol *pp, bool runit=false, bool push=false) |
void | setProtName (const char *name) |
void | setRef (int cnt) |
bool | setTLS (bool enable, XrdTlsContext *ctx=0) |
Enable or disable TLS on the link. | |
void | Shutdown (bool getLock) |
void | syncStats (int *ctime=0) |
int | Terminate (const char *owner, int fdnum, unsigned int inst) |
time_t | timeCon () const |
Return the time the link was made active (i.e. time of connection). | |
int | UseCnt () const |
Return link's reference count. | |
void | armBridge () |
Mark this link as an in-memory communications bridge (internal use only). | |
bool | hasBridge () const |
bool | hasTLS () const |
const char * | verTLS () |
XrdLink (XrdLinkXeq &lxq) | |
Public Member Functions inherited from XrdJob | |
XrdJob (const char *desc="") | |
virtual | ~XrdJob () |
Static Public Member Functions | |
static XrdLink * | Find (int &curr, XrdLinkMatch *who=0) |
static int | getName (int &curr, char *bname, int blen, XrdLinkMatch *who=0) |
static int | Stats (char *buff, int blen, bool do_sync=0) |
Public Attributes | |
char * | ID |
Pointer to the client's link identity. | |
Public Attributes inherited from XrdJob | |
XrdJob * | NextJob |
const char * | Comment |
Static Public Attributes | |
static bool | sfOK |
Protected Member Functions | |
~XrdLink () | |
void | DoIt () |
void | ResetLink () |
int | Wait4Data (int timeout) |
Protected Attributes | |
void * | rsvd1 [3] |
XrdLinkXeq & | linkXQ |
char * | HostName |
unsigned int | Instance |
bool | isBridged |
bool | isTLS |
char | rsvd2 [2] |
typedef XrdOucSFVec XrdLink::sfVec |
XrdLink::XrdLink | ( | XrdLinkXeq & | lxq | ) |
Constructor
lxq | Reference to the implementation. |
|
inlineprotected |
bool XrdLink::Activate | ( | ) |
Activate a link by attaching it to a poller object.
XrdNetAddrInfo * XrdLink::AddrInfo | ( | ) |
Obtain the address information for this link.
void XrdLink::armBridge | ( | ) |
Mark this link as an in-memory communications bridge (internal use only).
int XrdLink::Backlog | ( | ) |
Obtain the number of queued async requests.
int XrdLink::Client | ( | char * | buff, |
int | blen | ||
) |
Get a copy of the client's name as known by the link.
buff | Pointer to buffer to hold the name. |
blen | Length of the buffer. |
int XrdLink::Close | ( | bool | defer = false | ) |
Close the link.
defer | If true, the link is made unaccessible but the link object not the file descriptor is released. |
|
protectedvirtual |
Implements XrdJob.
Reimplemented in XrdLinkXeq.
void XrdLink::Enable | ( | ) |
Enable the link to field interrupts.
int XrdLink::FDnum | ( | ) |
Get the associated file descriptor.
|
static |
Find the next link matching certain attributes.
curr | Is an internal tracking value that allows repeated calls. It must be set to a value of 0 or less on the initial call and not touched therafter unless a null pointer is returned. |
who | If the object use to check if the link matches the wanted criterea (typically, client name and host name). If the pointer is nil, the next link is always returned. |
int XrdLink::getIOStats | ( | long long & | inbytes, |
long long & | outbytes, | ||
int & | numstall, | ||
int & | numtardy | ||
) |
Get I/O statistics.
inbytes | The number of bytes read. |
outbytes | The number of bytes written. |
numstall | The number of times the link was rescheduled due to unavailability. |
numtardy | The number of times the link was delayed due to unavailability. |
|
static |
Find the next client name matching certain attributes.
curr | Is an internal tracking value that allows repeated calls. It must be set to a value of 0 or less on the initial call and not touched therafter unless zero is returned. |
bname | Pointer to a buffer where the name is to be returned. |
blen | The length of the buffer. |
who | If the object use to check if the link matches the wanted criterea (typically, client name and host name). If the pointer is nil, a match always occurs. |
XrdTlsPeerCerts * XrdLink::getPeerCerts | ( | ) |
Get the x509 certificate information for this TLS enabled link.
XrdProtocol * XrdLink::getProtocol | ( | ) |
Obtain current protocol object pointer.
|
inline |
Determine if this link is a bridge.
References isBridged.
|
inline |
Determine if this link is using TLS.
References isTLS.
void XrdLink::Hold | ( | bool | lk | ) |
Lock or unlock the mutex used for control operations.
lk | When true, a lock is obtained. Otherwise it is released. The caller is responsible for consistency. |
|
inline |
Get the fully qualified name of the endpoint.
References HostName.
|
inline |
bool XrdLink::isFlawed | ( | ) | const |
Indicate whether or not the link has an outstanding error.
bool XrdLink::isInstance | ( | unsigned int | inst | ) | const |
Indicate whether or not this link is of a particular instance. only be used for display and not for security purposes.
inst | the expected instance number. |
const char * XrdLink::Name | ( | ) | const |
Obtain the domain trimmed name of the end-point. The returned value should only be used for display and not for security purposes.
const XrdNetAddr * XrdLink::NetAddr | ( | ) | const |
Obtain the network address object for this link. The returned value is valid as long as the end-point is connected. Otherwise, it may change.
Referenced by XrdCmsNode::isNode().
int XrdLink::Peek | ( | char * | buff, |
int | blen, | ||
int | timeout = -1 |
||
) |
Issue a socket peek() and return result (do not use for TLS connections).
buff | pointer to buffer to hold data. |
blen | length of buffer. |
timeout | milliseconds to wait for data. A negative value waits forever. |
int XrdLink::Recv | ( | char * | buff, |
int | blen | ||
) |
Read data from a link. Note that this call blocks until some data is available. Use Recv() with a timeout to avoid blocking.
buff | pointer to buffer to hold data. |
blen | length of buffer (implies the maximum bytes wanted). |
int XrdLink::Recv | ( | char * | buff, |
int | blen, | ||
int | timeout | ||
) |
Read data from a link. Note that this call either reads all the data wanted or no data if the passed timeout occurs before any data is present.
buff | pointer to buffer to hold data. |
blen | length of buffer (implies the actual bytes wanted). |
timeout | milliseconds to wait for data. A negative value waits forever. |
int XrdLink::Recv | ( | const struct iovec * | iov, |
int | iocnt, | ||
int | timeout | ||
) |
Read data on a link. Note that this call either reads all the data wanted or no data if the passed timeout occurs before any data is present.
iov | pointer to the message vector. |
iocnt | number of iov elements in the vector. |
timeout | milliseconds to wait for data. A negative value waits forever. |
int XrdLink::RecvAll | ( | char * | buff, |
int | blen, | ||
int | timeout = -1 |
||
) |
Read data from a link. Note that this call reads as much data as it can or until the passed timeout has occurred.
buff | pointer to buffer to hold data. |
blen | length of buffer (implies the maximum bytes wanted). |
timeout | milliseconds to wait for data. A negative value waits forever. |
bool XrdLink::Register | ( | const char * | hName | ) |
Register a host name with this IP address. This is not MT-safe!
hName | pointer to a true host name which should be fully qualified. One of the IP addresses registered to this name must match the IP address associated with this object. |
|
protected |
int XrdLink::Send | ( | const char * | buff, |
int | blen | ||
) |
Send data on a link. This calls may block unless the socket was marked nonblocking. If a block would occur, the data is copied for later sending.
buff | pointer to buffer to send. |
blen | length of buffer. |
Referenced by XrdCmsNode::Send(), and XrdCmsNode::Send().
int XrdLink::Send | ( | const sfVec * | sdP, |
int | sdn | ||
) |
int XrdLink::Send | ( | const struct iovec * | iov, |
int | iocnt, | ||
int | bytes = 0 |
||
) |
Send data on a link. This calls may block unless the socket was marked nonblocking. If a block would occur, the data is copied for later sending.
iov | pointer to the message vector. |
iocnt | number of iov elements in the vector. |
bytes | the sum of the sizes in the vector. |
void XrdLink::Serialize | ( | ) |
Wait for all outstanding requests to be completed on the link.
int XrdLink::setEtext | ( | const char * | text | ) |
Set an error indication on he link.
text | a message describing the error. |
void XrdLink::setID | ( | const char * | userid, |
int | procid | ||
) |
Set the client's link identity.
userid | pointer to the client's username. |
procid | the client's process id (i.e. pid). |
void XrdLink::setLocation | ( | XrdNetAddrInfo::LocInfo & | loc | ) |
Set the client's location.
loc | reference to the location information. |
bool XrdLink::setNB | ( | ) |
Set the link to be non-blocking.
void XrdLink::setProtName | ( | const char * | name | ) |
Set the link's protocol name.
name | name of he protocol being used. The storage must be valid for the duration of the program. |
XrdProtocol * XrdLink::setProtocol | ( | XrdProtocol * | pp, |
bool | runit = false , |
||
bool | push = false |
||
) |
Set the link's protocol.
pp | pointer to the protocol object. |
runit | if true, starts running the protocol. |
push | if true, pushes current protocol to be the alternate one. |
void XrdLink::setRef | ( | int | cnt | ) |
Set the link's parallel usage count.
cnt | should be 1 to increased the count and -1 to decrease it. |
bool XrdLink::setTLS | ( | bool | enable, |
XrdTlsContext * | ctx = 0 |
||
) |
Enable or disable TLS on the link.
enable | if true, TLS is enabled if not already enabled. Otherwise, TLS is disabled and the TLS logical connection torn down. statistics may be contradictory as they are collected async. |
ctx | The context to use when enabling TLS. When nil, the default context is used. |
void XrdLink::Shutdown | ( | bool | getLock | ) |
Shutdown the link but otherwise keep it intact.
getLock | if true, the operation is performed under a lock. |
|
static |
Obtain link statistics.
buff | pointer to the buffer for the xml statistics. |
blen | length of the buffer. |
do_sync | if true, the statistics self-consistent. Otherwise, the statistics may be contradictory as they are collected async. |
void XrdLink::syncStats | ( | int * | ctime = 0 | ) |
Add all local statistics to the global counters.
ctime | if not nil, return the total connect time in seconds. |
int XrdLink::Terminate | ( | const char * | owner, |
int | fdnum, | ||
unsigned int | inst | ||
) |
Terminate a connection.
owner | pointer to the link ID representing a client who made the connection to be terminated. If nil then this is a request for the link to terminate another link, if possible. |
fdnum | the file descriptor number of the link to be terminated. |
inst | the link's instance number. |
time_t XrdLink::timeCon | ( | ) | const |
Return the time the link was made active (i.e. time of connection).
int XrdLink::UseCnt | ( | ) | const |
Return link's reference count.
const char * XrdLink::verTLS | ( | ) |
Return TLS protocol version being used.
|
protected |
|
protected |
Referenced by Host().
char* XrdLink::ID |
Pointer to the client's link identity.
|
protected |
Referenced by XrdLinkCtl::fd2link(), and Inst().
|
protected |
Referenced by hasBridge().
|
protected |
Referenced by hasTLS().
|
protected |
|
protected |
|
protected |
|
static |
Send data on a link using sendfile(). This call always blocks until all data is sent. It should only be called if sfOK is true (see below).
sdP | pointer to the sendfile vector. |
sdn | number of elements in the vector. |