19 #ifndef __XRD_CL_SOCKET_HH__
20 #define __XRD_CL_SOCKET_HH__
24 #include <sys/socket.h>
36 class AsyncSocketHandler;
105 uint16_t timout = 10 );
115 uint16_t timout = 10 );
147 uint32_t &bytesRead );
158 uint32_t &bytesWritten );
167 virtual XRootDStatus Send(
const char *buffer,
size_t size,
int &bytesWritten );
303 const std::string &thehost = std::string() );
The message representation used throughout the system.
std::string GetSockName() const
Get the name of the socket.
std::string GetName() const
Get the string representation of the socket.
virtual XRootDStatus Send(const char *buffer, size_t size, int &bytesWritten)
XRootDStatus Initialize(int family=AF_INET)
Initialize the socket.
const AnyObject * GetChannelID() const
static XRootDStatus ClassifyErrno(int error)
Socket(int socket=-1, SocketStatus status=Disconnected)
SocketStatus
Status of the socket.
@ Disconnected
The socket is disconnected.
@ Connected
The socket is connected.
@ Connecting
The connection process is in progress.
void SetChannelID(AnyObject *channelID)
virtual XRootDStatus Read(char *buffer, size_t size, int &bytesRead)
std::unique_ptr< Tls > pTls
XRootDStatus ConnectToAddress(const XrdNetAddr &addr, uint16_t timout=10)
int GetFD()
Get the file descriptor.
XRootDStatus SetSockOpt(int level, int optname, const void *optval, socklen_t optlen)
Set socket options.
XRootDStatus ReadV(iovec *iov, int iocnt, int &bytesRead)
XRootDStatus TlsHandShake(AsyncSocketHandler *socketHandler, const std::string &thehost=std::string())
XRootDStatus GetFlags(int &flags)
Get the socket flags (man fcntl)
uint8_t MapEvent(uint8_t event)
const XrdNetAddr * GetServerAddress() const
Get the server address.
XRootDStatus Connect(const std::string &host, uint16_t port, uint16_t timout=10)
XRootDStatus GetSockOpt(int level, int optname, void *optval, socklen_t *optlen)
Get socket options.
XRootDStatus WriteRaw(void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesWritten)
XRootDStatus ReadRaw(void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesRead)
Read raw bytes from the socket.
SocketStatus GetStatus() const
Get the socket status.
XRootDStatus Poll(bool readyForReading, bool readyForWriting, int32_t timeout)
virtual ~Socket()
Desctuctor.
std::unique_ptr< XrdNetAddr > pServerAddr
void SetStatus(SocketStatus status)
Set socket status - do not use unless you know what you're doing.
XRootDStatus SetFlags(int flags)
Set the socket flags (man fcntl)
std::string GetPeerName() const
Get the name of the remote peer.