XrdNetAddr Class Reference

#include <XrdNetAddr.hh>

Inheritance diagram for XrdNetAddr:
Inheritance graph
[legend]
Collaboration diagram for XrdNetAddr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int Port (int pNum=-1)
const char * Set (const char *hSpec, int pNum=PortInSpec)
const char * Set (const char *hSpec, int &numIP, int maxIP, int pNum=PortInSpec, bool forUDP=false)
const char * Set (const struct sockaddr *sockP, int sockFD=-1)
const char * Set (int sockFD, bool peer=true)
const char * Set (struct addrinfo *rP, int port, bool mapit=false)
void SetLocation (XrdNetAddrInfo::LocInfo &loc)
 XrdNetAddr ()
 Assignment operator and copy constructor are inherited, no need to define.
 XrdNetAddr (const XrdNetAddr *addr)
 XrdNetAddr (const sockaddr *addr)
 XrdNetAddr (const sockaddr_in *addr)
 XrdNetAddr (const sockaddr_in6 *addr)
 XrdNetAddr (int port)
 ~XrdNetAddr ()
 Destructor.

Static Public Member Functions

static bool DynDNS ()
static bool IPV4Set ()
static void SetCache (int keeptime)
static void SetDynDNS (bool onoff)
static void SetIPV4 ()
static void SetIPV6 ()

Static Public Attributes

static const int PortInSpec = (int)0x80000000

Private Member Functions

bool Map64 ()

Static Private Member Functions

static struct addrinfo * Hints (int htype, int stype)

Static Private Attributes

static struct addrinfo * hostHints
static struct addrinfo * huntHintsTCP
static struct addrinfo * huntHintsUDP
static bool useIPV4
static bool dynDNS

Constructor & Destructor Documentation

XrdNetAddr::XrdNetAddr (  )  [inline]

Assignment operator and copy constructor are inherited, no need to define.

Constructor

Parameters:
addr A pointer to an initialized and valid sockaddr or sockaddr compatible structure used to initialize the address.
port Uses the address of the current host and the speoified port number to initilize the address.
XrdNetAddr::XrdNetAddr ( const XrdNetAddr addr  )  [inline]
XrdNetAddr::XrdNetAddr ( const sockaddr *  addr  )  [inline]

References Set().

XrdNetAddr::XrdNetAddr ( const sockaddr_in *  addr  )  [inline]

References Set().

XrdNetAddr::XrdNetAddr ( const sockaddr_in6 *  addr  )  [inline]

References Set().

XrdNetAddr::XrdNetAddr ( int  port  ) 
XrdNetAddr::~XrdNetAddr (  )  [inline]

Destructor.


Member Function Documentation

static bool XrdNetAddr::DynDNS (  )  [inline, static]

Determine if dynamic DNS has been set.

Returns:
True Dynamic DNS has been set. False Dynamic DNS has not been set.

References dynDNS.

static struct addrinfo* XrdNetAddr::Hints ( int  htype,
int  stype 
) [static, read, private]
static bool XrdNetAddr::IPV4Set (  )  [inline, static]

Determine if IPV4 mode has been set.

Returns:
True IPV4 mode has been set. False IPV4 mode has not been set.

References useIPV4.

bool XrdNetAddr::Map64 (  )  [private]
int XrdNetAddr::Port ( int  pNum = -1  ) 

Optionally set and also returns the port number for our address.

Parameters:
pNum when negative it only returns the current port. Otherwise, it is taken as the value to be set.
Returns:
Success: The port number, which may be 0 if not set. Failure: -1 address is not an internet address or port is invalid.
const char* XrdNetAddr::Set ( struct addrinfo *  rP,
int  port,
bool  mapit = false 
)

Set our address via and addrinfo structure and initialize the port.

Parameters:
rP pointer to an addrinfo structure.
port the port number to set.
mapit when true maps IPv4 addresses to IPv6. Otherwise, does not.
Returns:
Success: Returns 0. Failure: Returns the error message text describing the error. The message is in persistent storage and cannot be modified.
const char* XrdNetAddr::Set ( int  sockFD,
bool  peer = true 
)

Set our address from the supplied socket file descriptor.

Parameters:
sockFD a connected socket file descriptor. The value is also recorded as the associated file descriptor.
peer When true the address is set from getpeername() When false the address is set from getsockname()
Returns:
Success: Returns 0. Failure: Returns the error message text describing the error. The message is in persistent storage and cannot be modified.
const char* XrdNetAddr::Set ( const struct sockaddr *  sockP,
int  sockFD = -1 
)

Set our address via a sockaddr structure.

Parameters:
sockP a pointer to an initialized and valid sockaddr structure.
sockFD the associated file descriptor and can be used to record the file descriptor returned by accept().
Returns:
Success: Returns 0. Failure: Returns the error message text describing the error. The message is in persistent storage and cannot be modified.
const char* XrdNetAddr::Set ( const char *  hSpec,
int &  numIP,
int  maxIP,
int  pNum = PortInSpec,
bool  forUDP = false 
)

Return multiple addresses. This form can only be used on the first element of this object that has been allocated as an array. This method is useful for getting all of the aliases assigned to a dns entry. The file descriptor association is set to a negative value.

Parameters:
hSpec 0 -> address is set to in6addr_any for binding via bind() !0 -> convert specification to an address. Valid formats: IP.v4: nnn.nnn.nnn.nnn[:<port>] IP.v6: [ipv6_addr][:<port>] IP.xx: name[:port] xx is determined by getaddrinfo()
maxIP number of elements in the array.
numIP the number of IP addresses actually set (returned value).
pNum >= 0 uses the value as the port number regardless of what is in hSpec, should it be supplied. However, if is present, it must be a valid port number or name. < 0 uses the positive value as the port number if the port number has not been specified in hSpec. When set to PortInSpec(the default, see below) the port number/name must be specified in hSpec. If it is not, an error is returned.
forUDP when true addresses are usable for UDP connections. Otherwise, they are for TCP connections.
Returns:
Success: 0 with numIP set to the number of elements set. Failure: the error message text describing the error and numIP is set to zero. The message is in persistent storage and cannot be modified.
const char* XrdNetAddr::Set ( const char *  hSpec,
int  pNum = PortInSpec 
)

Referenced by XrdNetAddr().

static void XrdNetAddr::SetCache ( int  keeptime  )  [static]

Set the cache time for address to name resolutions. This method should only be called during initialization time. The default is to not use the cache.

static void XrdNetAddr::SetDynDNS ( bool  onoff  )  [static]

Indicate whether or not dynamic DNS is being used. This method should only be called during initialization time. The default is fixed DNS.

Parameters:
onoff True if dynamic DNS is being used, false otherwise.
static void XrdNetAddr::SetIPV4 (  )  [static]

Force this object to work in IPV4 mode only. This method permanently sets IPV4 mode which cannot be undone without a restart. It is meant to bypass broken IPV6 stacks on those unfortunate hosts that have one. It should be called before any other calls to this object (e.g. initialization time).

static void XrdNetAddr::SetIPV6 (  )  [static]

Force this object to work in IPV6 mode using IPV6 or mapped IPV4 addresses. This method permanently sets IPV6 mode which cannot be undone without a restart. It is meant to disable the default mode which determines which address to use based on which address types are configured on the host (i.e. getaddrinfo() with hints AI_ADDRCONFIG|AI_V4MAPPED).

void XrdNetAddr::SetLocation ( XrdNetAddrInfo::LocInfo loc  )  [inline]

Set the location for this address

Parameters:
loc pointer to the structure that describes the location. See XrdnetAddrInfo for the definition of the stucture.

References XrdNetAddrInfo::addrLoc.

Referenced by XrdLink::setLocation().


Member Data Documentation

bool XrdNetAddr::dynDNS [static, private]

Referenced by DynDNS().

struct addrinfo* XrdNetAddr::hostHints [static, read, private]
struct addrinfo* XrdNetAddr::huntHintsTCP [static, read, private]
struct addrinfo* XrdNetAddr::huntHintsUDP [static, read, private]
const int XrdNetAddr::PortInSpec = (int)0x80000000 [static]

Set the IP address and possibly the port number.

Parameters:
hSpec 0 -> address is set to in6addr_any for binding via bind() (INADDR_ANY in IPV4 mode). !0 -> convert specification to an address. Valid formats: IPv4: nnn.nnn.nnn.nnn[:<port>] IPv6: [ipv6_addr][:<port>] **addr brackets required** IPvx: name[:port] x is determined by getaddrinfo() Unix: /<path>
pNum >= 0 uses the value as the port number regardless of what is in hSpec, should it be supplied. However, if is present, it must be a valid port number or name. < 0 uses the positive value as the port number if the port number has not been specified in hSpec. When set to PortInSpec(the default, see below) the port number/name must be specified in hSpec. If it is not, an error is returned.
Returns:
Success: 0. Failure: Error message text describing the error. The message is in persistent storage and cannot be modified.
bool XrdNetAddr::useIPV4 [static, private]

Referenced by IPV4Set().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Jul 2019 for xrootd by  doxygen 1.6.1