|
xrootd
|
A network socket. More...
#include <XrdClSocket.hh>

Public Types | |
| enum | SocketStatus { Disconnected = 1, Connected = 2, Connecting = 3 } |
| Status of the socket. More... | |
Public Member Functions | |
| Socket (int socket=-1, SocketStatus status=Disconnected) | |
| virtual | ~Socket () |
| Desctuctor. More... | |
| XRootDStatus | Initialize (int family=AF_INET) |
| Initialize the socket. More... | |
| XRootDStatus | SetFlags (int flags) |
| Set the socket flags (man fcntl) More... | |
| XRootDStatus | GetFlags (int &flags) |
| Get the socket flags (man fcntl) More... | |
| XRootDStatus | GetSockOpt (int level, int optname, void *optval, socklen_t *optlen) |
| Get socket options. More... | |
| XRootDStatus | SetSockOpt (int level, int optname, const void *optval, socklen_t optlen) |
| Set socket options. More... | |
| XRootDStatus | Connect (const std::string &host, uint16_t port, uint16_t timout=10) |
| XRootDStatus | ConnectToAddress (const XrdNetAddr &addr, uint16_t timout=10) |
| void | Close () |
| Disconnect. More... | |
| SocketStatus | GetStatus () const |
| Get the socket status. More... | |
| void | SetStatus (SocketStatus status) |
| Set socket status - do not use unless you know what you're doing. More... | |
| XRootDStatus | ReadRaw (void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesRead) |
| XRootDStatus | WriteRaw (void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesWritten) |
| virtual XRootDStatus | Send (const char *buffer, size_t size, int &bytesWritten) |
| XRootDStatus | Send (XrdSys::KernelBuffer &kbuff, int &bytesWritten) |
| XRootDStatus | Send (Message &msg, const std::string &strmname) |
| virtual XRootDStatus | Read (char *buffer, size_t size, int &bytesRead) |
| XRootDStatus | ReadV (iovec *iov, int iocnt, int &bytesRead) |
| int | GetFD () |
| Get the file descriptor. More... | |
| std::string | GetSockName () const |
| Get the name of the socket. More... | |
| std::string | GetPeerName () const |
| Get the name of the remote peer. More... | |
| std::string | GetName () const |
| Get the string representation of the socket. More... | |
| const XrdNetAddr * | GetServerAddress () const |
| Get the server address. More... | |
| void | SetChannelID (AnyObject *channelID) |
| const AnyObject * | GetChannelID () const |
| XRootDStatus | Cork () |
| XRootDStatus | Uncork () |
| XRootDStatus | Flash () |
| bool | IsCorked () const |
| uint8_t | MapEvent (uint8_t event) |
| XRootDStatus | TlsHandShake (AsyncSocketHandler *socketHandler, const std::string &thehost=std::string()) |
| bool | IsEncrypted () |
Static Public Member Functions | |
| static XRootDStatus | ClassifyErrno (int error) |
Protected Member Functions | |
| XRootDStatus | Poll (bool readyForReading, bool readyForWriting, int32_t timeout) |
Protected Attributes | |
| int | pSocket |
| SocketStatus | pStatus |
| std::unique_ptr< XrdNetAddr > | pServerAddr |
| std::string | pSockName |
| std::string | pPeerName |
| std::string | pName |
| int | pProtocolFamily |
| AnyObject * | pChannelID |
| bool | pCorked |
| std::unique_ptr< Tls > | pTls |
A network socket.
Status of the socket.
| Enumerator | |
|---|---|
| Disconnected |
The socket is disconnected. |
| Connected |
The socket is connected. |
| Connecting |
The connection process is in progress. |
| XrdCl::Socket::Socket | ( | int | socket = -1, |
| SocketStatus | status = Disconnected |
||
| ) |
Constructor
| socket | already connected socket if available, -1 otherwise |
| status | status of a socket if available |
|
virtual |
Desctuctor.
|
static |
| void XrdCl::Socket::Close | ( | ) |
Disconnect.
| XRootDStatus XrdCl::Socket::Connect | ( | const std::string & | host, |
| uint16_t | port, | ||
| uint16_t | timout = 10 |
||
| ) |
Connect to the given host name
| host | name of the host to connect to |
| port | port to connect to |
| timout | timeout in seconds, 0 for no timeout handling (may be used for non blocking IO) |
| XRootDStatus XrdCl::Socket::ConnectToAddress | ( | const XrdNetAddr & | addr, |
| uint16_t | timout = 10 |
||
| ) |
Connect to the given host address
| addr | address of the host to connect to |
| timout | timeout in seconds, 0 for no timeout handling (may be used for non blocking IO) |
| XRootDStatus XrdCl::Socket::Cork | ( | ) |
| XRootDStatus XrdCl::Socket::Flash | ( | ) |
Referenced by XrdCl::AsyncMsgWriter::Write(), and XrdCl::AsyncHSWriter::Write().
|
inline |
Get Channel ID (an object that allows to identify all sockets corresponding to the same channel)
References pChannelID.
|
inline |
Get the file descriptor.
References pSocket.
| XRootDStatus XrdCl::Socket::GetFlags | ( | int & | flags | ) |
Get the socket flags (man fcntl)
| std::string XrdCl::Socket::GetName | ( | ) | const |
Get the string representation of the socket.
| std::string XrdCl::Socket::GetPeerName | ( | ) | const |
Get the name of the remote peer.
|
inline |
Get the server address.
References pServerAddr.
| std::string XrdCl::Socket::GetSockName | ( | ) | const |
Get the name of the socket.
| XRootDStatus XrdCl::Socket::GetSockOpt | ( | int | level, |
| int | optname, | ||
| void * | optval, | ||
| socklen_t * | optlen | ||
| ) |
Get socket options.
|
inline |
Get the socket status.
References pStatus.
| XRootDStatus XrdCl::Socket::Initialize | ( | int | family = AF_INET | ) |
Initialize the socket.
|
inline |
References pCorked.
| bool XrdCl::Socket::IsEncrypted | ( | ) |
| uint8_t XrdCl::Socket::MapEvent | ( | uint8_t | event | ) |
|
protected |
Poll the socket to see whether it is ready for IO
| readyForReading | poll for readiness to read |
| readyForWriting | poll for readiness to write |
| timeout | timeout in seconds, -1 to wait indefinitely |
|
virtual |
Read helper for raw socket
| buffer | : the sink for the data |
| size | : size of the sink |
| bytesRead | : number of bytes actually written into the sink |
Referenced by XrdCl::AsyncMsgReader::ReadAttnActnum(), and XrdCl::AsyncRawReaderIntfc::ReadBytesAsync().
| XRootDStatus XrdCl::Socket::ReadRaw | ( | void * | buffer, |
| uint32_t | size, | ||
| int32_t | timeout, | ||
| uint32_t & | bytesRead | ||
| ) |
Read raw bytes from the socket
| buffer | data to be sent |
| size | size of the data buffer |
| timeout | timout value in seconds, -1 to wait indefinitely |
| bytesRead | the amount of data actually read |
| XRootDStatus XrdCl::Socket::ReadV | ( | iovec * | iov, |
| int | iocnt, | ||
| int & | bytesRead | ||
| ) |
ReadV helper for raw socket
| iov | : the buffers for the data |
| iocnt | : number of buffers |
| bytesRead | : number of bytes actually written into the sink |
Referenced by XrdCl::AsyncPageReader::Read().
|
virtual |
Portable wrapper around SIGPIPE free send
| buffer | : data to be written |
| size | : size of the data buffer |
| bytesWritten | : the amount of data actually written |
Referenced by XrdCl::AsyncMsgWriter::Write(), and XrdCl::AsyncHSWriter::Write().
| XRootDStatus XrdCl::Socket::Send | ( | XrdSys::KernelBuffer & | kbuff, |
| int & | bytesWritten | ||
| ) |
Write data from a kernel buffer to the socket
| kbuff | : data to be written |
| bytesWritten | : the amount of data actually written |
| XRootDStatus XrdCl::Socket::Send | ( | Message & | msg, |
| const std::string & | strmname | ||
| ) |
Write message to the socket
| msg | : message (request) to be sent |
| strmname | : stream name (for logging purposes) |
|
inline |
Set Channel ID (an object that allows to identify all sockets corresponding to the same channel)
References pChannelID.
| XRootDStatus XrdCl::Socket::SetFlags | ( | int | flags | ) |
Set the socket flags (man fcntl)
| XRootDStatus XrdCl::Socket::SetSockOpt | ( | int | level, |
| int | optname, | ||
| const void * | optval, | ||
| socklen_t | optlen | ||
| ) |
Set socket options.
|
inline |
Set socket status - do not use unless you know what you're doing.
References pStatus.
| XRootDStatus XrdCl::Socket::TlsHandShake | ( | AsyncSocketHandler * | socketHandler, |
| const std::string & | thehost = std::string() |
||
| ) |
| XRootDStatus XrdCl::Socket::Uncork | ( | ) |
| XRootDStatus XrdCl::Socket::WriteRaw | ( | void * | buffer, |
| uint32_t | size, | ||
| int32_t | timeout, | ||
| uint32_t & | bytesWritten | ||
| ) |
Write raw bytes to the socket
| buffer | data to be written |
| size | size of the data buffer |
| timeout | timeout value in seconds, -1 to wait indefinitely |
| bytesWritten | the amount of data actually written |
|
protected |
Referenced by GetChannelID(), and SetChannelID().
|
protected |
Referenced by IsCorked().
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |
Referenced by GetServerAddress().
|
protected |
Referenced by GetFD().
|
mutableprotected |
|
protected |
Referenced by GetStatus(), and SetStatus().
|
protected |
1.8.5