#include <XrdNet.hh>
|
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.
|
|
◆ XrdNet()
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. |
◆ ~XrdNet()
virtual XrdNet::~XrdNet |
( |
| ) |
|
|
virtual |
◆ Accept() [1/2]
int XrdNet::Accept |
( |
XrdNetAddr & |
myAddr, |
|
|
int |
opts = 0 , |
|
|
int |
timeout = -1 |
|
) |
| |
Accept incoming 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.
◆ Accept() [2/2]
int XrdNet::Accept |
( |
XrdNetPeer & |
myPeer, |
|
|
int |
opts = 0 , |
|
|
int |
timeout = -1 |
|
) |
| |
Accept incoming 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 XRDNET_USETLS - ALL: enable TLS upon connection |
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.
◆ Bind() [1/2]
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.
◆ Bind() [2/2]
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.
◆ Connect() [1/2]
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.
◆ Connect() [2/2]
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.
◆ do_Accept_TCP() [1/2]
int XrdNet::do_Accept_TCP |
( |
XrdNetAddr & |
myAddr, |
|
|
int |
opts |
|
) |
| |
|
private |
◆ do_Accept_TCP() [2/2]
int XrdNet::do_Accept_TCP |
( |
XrdNetPeer & |
myPeer, |
|
|
int |
opts |
|
) |
| |
|
private |
◆ do_Accept_UDP()
int XrdNet::do_Accept_UDP |
( |
XrdNetPeer & |
myPeer, |
|
|
int |
opts |
|
) |
| |
|
private |
◆ Port()
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.
◆ Relay() [1/2]
int XrdNet::Relay |
( |
const char * |
dest | ) |
|
◆ Relay() [2/2]
int XrdNet::Relay |
( |
XrdNetPeer & |
Peer, |
|
|
const char * |
dest, |
|
|
int |
opts = 0 |
|
) |
| |
◆ Secure()
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. |
Reimplemented in XrdInet.
◆ setDefaults()
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.
◆ setDomain()
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.
◆ Trim()
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). |
◆ unBind()
Unbind the network from any bound resouces.
◆ 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.
◆ BuffQ
◆ BuffSize
◆ Domain
◆ Domlen
◆ eDest
◆ iofd
◆ netOpts
◆ Police
◆ Portnum
◆ PortType
◆ Windowsz
The documentation for this class was generated from the following file: