XrdNet Class Reference

#include <XrdNet.hh>

Collaboration diagram for XrdNet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int Accept (XrdNetAddr &myAddr, int opts=0, int timeout=-1)
int Accept (XrdNetPeer &myPeer, int opts=0, int timeout=-1)
int Bind (int port, const char *contype="tcp")
int Bind (char *path, const char *contype="stream")
int Connect (XrdNetAddr &myAddr, const char *dest, int port=-1, int opts=0, int timeout=-1)
int Connect (XrdNetPeer &myPeer, const char *dest, int port=-1, int opts=0, int timeout=-1)
int Port ()
int Relay (XrdNetPeer &Peer, const char *dest, int opts=0)
int Relay (const char *dest)
virtual void Secure (XrdNetSecurity *secp)
void setDefaults (int options, int buffsz=0)
void setDomain (const char *dname)
void Trim (char *hname)
void unBind ()
 Unbind the network from any bound resouces.
int WSize ()
 XrdNet (XrdSysError *erp, XrdNetSecurity *secp=0)
virtual ~XrdNet ()
 Destructor.

Protected Attributes

XrdSysErroreDest
XrdNetSecurity * Police
char * Domain
int Domlen
int iofd
int Portnum
int PortType
int Windowsz
int netOpts
int BuffSize
XrdNetBufferQ * BuffQ

Private Member Functions

int do_Accept_TCP (XrdNetAddr &myAddr, int opts)
int do_Accept_TCP (XrdNetPeer &myPeer, int opts)
int do_Accept_UDP (XrdNetPeer &myPeer, int opts)

Constructor & Destructor Documentation

XrdNet::XrdNet ( XrdSysError erp,
XrdNetSecurity *  secp = 0 
)

Constructor

Parameters:
erp The error object for printing error messages. It must be supplied.
secp The initial NetSecurity object. This secp object must not be deleted nor directly used after the call as this object assumes its ownership and may delete it at any time.
virtual XrdNet::~XrdNet (  )  [virtual]

Destructor.


Member Function Documentation

int XrdNet::Accept ( XrdNetPeer &  myPeer,
int  opts = 0,
int  timeout = -1 
)

Accept incomming TCP or UDP connection. This method should only be used for UDP-style networks. The previous method is preferred for TCP-style networks.

Parameters:
myPeer the peer object to contain connection information.
opts processing options: XRDNET_DELAY - TCP: do not set nodelay on socket. XRDNET_KEEPALIVE - TCP: use TCP keep alive on socket. XRDNET_NEWFD - UDP: obtain new file descriptor XRDNET_NOCLOSEX - ALL: keep socket across exec() calls XRDNET_NODNTRIM - ALL: don't trim domain name in myPeer XRDNET_NOEMSG - ALL: supress printing error messages XRDNET_NORLKUP - ALL: avoid doing reverse DNS look-up
timeout maximum seconds to wait for a conection. When negative, the default, no time limit applies.
Returns:
!0 Successful connection occurred, myPeer holds information.
=0 Failure, a timeout or permanent error occurred.
int XrdNet::Accept ( XrdNetAddr &  myAddr,
int  opts = 0,
int  timeout = -1 
)

Accept incomming TCP connection. This is the preferred method for TCP.

Parameters:
myAddr the address object to contain connection information.
opts processing options: XRDNET_DELAY - do not set nodelay on socket. XRDNET_KEEPALIVE - use TCP keep alive on socket. XRDNET_NOCLOSEX - do not allow socket to close on exec() XRDNET_NOEMSG - supress printing error messages XRDNET_NOLINGER - Do not linger when closing socket.
timeout maximum seconds to wait for a conection. When negative, the default, no time limit applies.
Returns:
!0 Successful connection occurred, myAddr holds information.
=0 Failure, a timeout or permanent error occurred.
int XrdNet::Bind ( char *  path,
const char *  contype = "stream" 
)

Bind a network object to a Unix named socket.

Parameters:
path the file system path to a named socket to bind with.
contype Either "stream" to use TCP-tyle streaming protocol or "datagram" to use UDP-style messaging.
Returns:
0 Successfully bound the port.
!0 Failure, return value is -errno describing the error.
int XrdNet::Bind ( int  port,
const char *  contype = "tcp" 
)

Bind a network object to a TCP or UDP port number.

Parameters:
port the port number to bind to. Use 0 for arbitrary port.
contype Either "tcp" for TCP networks or "udp" for UDP networks.
Returns:
0 Successfully bound the port.
!0 Failure, return value is -errno describing the error.
int XrdNet::Connect ( XrdNetPeer &  myPeer,
const char *  dest,
int  port = -1,
int  opts = 0,
int  timeout = -1 
)

Create a TCP or UDP socket and connect it to the given host and port. The previous method is preferred for creating TCP sockets.

Parameters:
myPeer peer object where connection information is returned.
dest destination hostname or IP address.
port the port number to connect to. If < 0 then the dest param must contain the port number preceeded by a colon.
opts processing options: XRDNET_NOCLOSEX - do not allow socket to close on exec() XRDNET_NODNTRIM - do not trim domain name in myPeer. XRDNET_NOEMSG - supress printing error messages XRDNET_NORLKUP - avoid doing reverse DNS look-up XRDNET_UDPSOCKET - create a UDP socket (o/w use TCP).
timeout the maximum number of seconds to wait for the connection to complete. A negative value waits forever. Values greater than 255 seconds are set to 255.
Returns:
true Connection completed, myPeer holds connection information.
false Connection failed.
int XrdNet::Connect ( XrdNetAddr &  myAddr,
const char *  dest,
int  port = -1,
int  opts = 0,
int  timeout = -1 
)

Create a TCP socket and connect it to the given host and port. This is the preferred method for making TCP based connections.

Parameters:
myAddr address object where connection information is returned.
dest destination hostname or IP address.
port the port number to connect to. If < 0 then the dest param must contain the port number preceeded by a colon.
opts processing options: XRDNET_NOCLOSEX - do not allow socket to close on exec() XRDNET_NOEMSG - supress printing error messages XRDNET_NORLKUP - avoid doing reverse DNS look-up
timeout the maximum number of seconds to wait for the connection to complete. A negative value waits forever. Values greater than 255 seconds are set to 255.
Returns:
true Connection completed, myAddr holds connection information.
false Connection failed.
int XrdNet::do_Accept_TCP ( XrdNetPeer &  myPeer,
int  opts 
) [private]
int XrdNet::do_Accept_TCP ( XrdNetAddr &  myAddr,
int  opts 
) [private]
int XrdNet::do_Accept_UDP ( XrdNetPeer &  myPeer,
int  opts 
) [private]
int XrdNet::Port (  )  [inline]

Get the port number, if any, bound to this network.

Returns:
>0 The bound port number.
<=0 The network is not bound to a port.

References Portnum.

int XrdNet::Relay ( const char *  dest  ) 
int XrdNet::Relay ( XrdNetPeer &  Peer,
const char *  dest,
int  opts = 0 
)
virtual void XrdNet::Secure ( XrdNetSecurity *  secp  )  [virtual]

Add a NetSecurity object to the existing accept() security constraints.

Parameters:
secp Pointer to the network security object. This object must not be deleted nor directly used after the call as this object assumes its ownership and may delete it at any time.
void XrdNet::setDefaults ( int  options,
int  buffsz = 0 
) [inline]

Set network defaults.

Parameters:
options The options to be added to Accept(), Bind() and Connect() calls. These options cannot be turned off, so be careful.
buffsz The UDP buffer size (the initial default is 32K) or the TCP window size (initial default is OS dependent).

References netOpts, and Windowsz.

void XrdNet::setDomain ( const char *  dname  )  [inline]

Set network domain name.

Parameters:
dname The domain name which indicates to Trim() what part of the host name is so common that it can be trimmed.

References Domain, and Domlen.

void XrdNet::Trim ( char *  hname  ) 

Trims off the domain name in a host name.

Parameters:
hname The host name to be trimmed (it is modified).
void XrdNet::unBind (  ) 

Unbind the network from any bound resouces.

int XrdNet::WSize (  ) 

Get the current TCP RCVBUF window size.

Returns:
>0 The current window size.
<=0 Either the network is not bound to a port or an error has occurred. Window size is unavailable.

Member Data Documentation

XrdNetBufferQ* XrdNet::BuffQ [protected]
int XrdNet::BuffSize [protected]
char* XrdNet::Domain [protected]

Referenced by setDomain().

int XrdNet::Domlen [protected]

Referenced by setDomain().

XrdSysError* XrdNet::eDest [protected]
int XrdNet::iofd [protected]
int XrdNet::netOpts [protected]

Referenced by setDefaults().

XrdNetSecurity* XrdNet::Police [protected]
int XrdNet::Portnum [protected]

Referenced by Port().

int XrdNet::PortType [protected]
int XrdNet::Windowsz [protected]

Referenced by setDefaults().


The documentation for this class was generated from the following file:

Generated on 26 Feb 2016 for xrootd by  doxygen 1.6.1