XrdNetAddrInfo Class Reference

#include <XrdNetAddrInfo.hh>

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

List of all members.

Classes

struct  LocInfo

Public Types

enum  fmtUse { fmtAuto = 0, fmtName, fmtAddr, fmtAdv6 }
enum  IPType { IPv4 = AF_INET, IPv6 = AF_INET6, IPuX = AF_UNIX }

Public Member Functions

int Family () const
int Format (char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
bool isLoopback ()
bool isIPType (IPType ipType) const
bool isMapped () const
bool isPrivate ()
bool isRegistered ()
struct LocInfoLocation ()
const char * Name (const char *eName=0, const char **eText=0)
const XrdNetSockAddrNetAddr ()
int Port ()
int Protocol ()
int Same (const XrdNetAddrInfo *ipAddr, bool plusPort=false)
const sockaddr * SockAddr ()
SOCKLEN_t SockSize ()
int SockFD ()
XrdNetAddrInfooperator= (XrdNetAddrInfo const &rhs)
 Assignment operator.
 XrdNetAddrInfo (XrdNetAddrInfo const &oP)
 Copy constructor.
 XrdNetAddrInfo ()
 Constructor.
 XrdNetAddrInfo (const XrdNetAddrInfo *addr)
 ~XrdNetAddrInfo ()
 Destructor.

Static Public Member Functions

static bool isHostName (const char *name)

Static Public Attributes

static const int noPort = 0x0000001
 Do not add port number.
static const int noPortRaw = 0x0000002
 Use raw address format (no port).
static const int old6Map4 = 0x0000004
 Use deprecated IPV6 mapped format.
static const int prefipv4 = 0x0000008
 Use if mapped IPV4 actual format.

Protected Member Functions

char * LowCase (char *str)
int QFill (char *bAddr, int bLen)
int Resolve ()

Protected Attributes

XrdNetSockAddr IP
union {
   struct sockaddr *   sockAddr
   struct sockaddr_un *   unixPipe
}; 
char * hostName
LocInfo addrLoc
SOCKLEN_t addrSize
short protType
unsigned short sockNum

Static Protected Attributes

static XrdNetCachednsCache

Member Enumeration Documentation

Format our address into a supplied buffer with one of the following layouts (the ':<port>' or ':/path' can be omitted if desired, see fmtOpts param): IP.xx: host_name:<port> IP.v4: a.b.c.d:<port> IP.4to6: [ffff:a.b.c.d]:<port> | [a.b.c.d]:<port> IP.v6: [a:b:c:d:e:f:g:h]:<port> IP.Unix: localhost:/<path>

Parameters:
bAddr address of buffer for result
bLen length of buffer
fmtType specifies the type of format desired via fmtUse enum.
fmtOpts additional formatting options (can be or'd): noPort - do not append the port number to the address. noPortRaw - no port and no brackets for IPv6. old6Map4 - use deprecated IPV6 mapped format '[x.x.x.x]'
Returns:
Success: The number of characters (less null) in Buff.
Failure: 0 (buffer is too small or not a valid address). However, if bLen > 0 the buffer will contain a null terminated string of up to 8 question marks.
Enumerator:
fmtAuto 

Hostname if already resolved o/w use fmtAddr.

fmtName 

Hostname if it is resolvable o/w use fmtAddr.

fmtAddr 

Address using suitable ipv4 or ipv6 format.

fmtAdv6 

Indicate whether or not our address is if the desired type.

Parameters:
ipType The IP address version to test (see enum below).
Returns:
True: This is the address version of ipType.
False: This is not the address version of ipType.
Enumerator:
IPv4 
IPv6 
IPuX 

Constructor & Destructor Documentation

XrdNetAddrInfo::XrdNetAddrInfo ( XrdNetAddrInfo const &  oP  )  [inline]

Copy constructor.

References hostName, and unixPipe.

XrdNetAddrInfo::XrdNetAddrInfo (  )  [inline]

Constructor.

References XrdNetSockAddr::Addr, IP, and sockAddr.

XrdNetAddrInfo::XrdNetAddrInfo ( const XrdNetAddrInfo addr  )  [inline]
XrdNetAddrInfo::~XrdNetAddrInfo (  )  [inline]

Destructor.

References XrdNetSockAddr::Addr, hostName, IP, sockAddr, and unixPipe.


Member Function Documentation

int XrdNetAddrInfo::Family (  )  const [inline]

Provide our address family.

Returns:
Success: Returns AF_INET, AF_INET6, or AF_UNIX. Failure: Returns 0, address is not valid.

References XrdNetSockAddr::Addr, and IP.

int XrdNetAddrInfo::Format ( char *  bAddr,
int  bLen,
fmtUse  fmtType = fmtAuto,
int  fmtOpts = 0 
)
static bool XrdNetAddrInfo::isHostName ( const char *  name  )  [static]

Indicate whether or not a string is a possible hostname and not IP address. The return value does not aimply any kind of validity. For instance, a false return indicates this is not a valid hostname does not mean it is a valid IP address.

Parameters:
name The string to check.
Returns:
True: This is a possible hostname (i.e. not IP address).
False: This is not a possible hostname.
bool XrdNetAddrInfo::isIPType ( IPType  ipType  )  const [inline]

References XrdNetSockAddr::Addr, and IP.

bool XrdNetAddrInfo::isLoopback (  ) 

Indicate whether or not our address is the loopback address. Use this method to gaurd against UDP packet spoofing.

Returns:
True: This is the loopback address.
False: This is not the loopback address.
bool XrdNetAddrInfo::isMapped (  )  const [inline]

Indicate whether or not our address is an IPv4 mapped to IPv6 address.

Returns:
True: The address is a mapped IPv4 address. False: The address is not a mapped IPv4 address.

References XrdNetSockAddr::Addr, IP, and XrdNetSockAddr::v6.

bool XrdNetAddrInfo::isPrivate (  ) 

Indicate whether or not our address is private.

Returns:
True: This address is private. False: This address is not private.
bool XrdNetAddrInfo::isRegistered (  ) 

Indicate whether or not our address is registered in the DNS.

Returns:
True: This address is registered. False: This address is not registered.
struct LocInfo* XrdNetAddrInfo::Location (  )  [inline, read]
char* XrdNetAddrInfo::LowCase ( char *  str  )  [protected]
const char* XrdNetAddrInfo::Name ( const char *  eName = 0,
const char **  eText = 0 
)

Convert our IP address to the corresponding [host] name.

Parameters:
eName value to return when the name cannot be determined.
eText when not null, the reason for a failure is returned.
Returns:
Success: Pointer to the name or ip address with eText, if supplied, set to zero. The memory is owned by the object and is deleted when the object is deleted or Set() is called. Failure: eName param and if eText is not zero, returns a pointer to a message describing the reason for the failure. The message is in persistent storage and cannot be modified.
const XrdNetSockAddr* XrdNetAddrInfo::NetAddr (  )  [inline]

Provide a pointer to our socket address suitable for use in calls to methods that require our internal format of sock addr. A value is only returned for IPV6/4 addresses and is nill otherwise. The pointer refers to memory allocated by this object and becomes invalid should the object be deleted. Use SockSize() to get its logical length.

References IP, and sockAddr.

XrdNetAddrInfo& XrdNetAddrInfo::operator= ( XrdNetAddrInfo const &  rhs  )  [inline]

Assignment operator.

References XrdNetSockAddr::Addr, addrLoc, addrSize, hostName, IP, protType, sockAddr, sockNum, and unixPipe.

int XrdNetAddrInfo::Port (  ) 

Return the port number for our address.

Returns:
Success: The port number, which may be 0 if not set. Failure: -1 address is not an internet address or port is invalid.
int XrdNetAddrInfo::Protocol (  )  [inline]

Provide our protocol family.

Returns:
Success: Returns PF_INET, PF_INET6, or PF_UNIX. Failure: Returns 0, address is not valid.

References protType.

int XrdNetAddrInfo::QFill ( char *  bAddr,
int  bLen 
) [protected]
int XrdNetAddrInfo::Resolve (  )  [protected]
int XrdNetAddrInfo::Same ( const XrdNetAddrInfo ipAddr,
bool  plusPort = false 
)

Check if the IP address in this object is the same as the one passed.

Parameters:
ipAddr points to the network address object to compare.
plusPort when true, port values must also match. In any case, both addresses must be of the same address family.
Returns:
Success: True (addresses are the same). Failure: False (addresses are not the same).

Referenced by XrdCmsNode::isNode().

const sockaddr* XrdNetAddrInfo::SockAddr (  )  [inline]

Provide a pointer to our socket address suitable for use in calls to functions that require one (e.g. bind() etc). The pointer refers to memory allocated by this object and becomes invalid should the object be deleted or when Set() is called. Use SockSize() to get its length.

References sockAddr.

int XrdNetAddrInfo::SockFD (  )  [inline]

Get the associated file descriptor.

Returns:
The associated file descriptor. If negative, no association exists.

References sockNum.

SOCKLEN_t XrdNetAddrInfo::SockSize (  )  [inline]

Provide the length of our socket adress. Useful for system calls needing it.

Returns:
Success: Returns the length of the address returned by SockAddr(). Failure: Returns 0, address is not valid.

References addrSize.


Member Data Documentation

union { ... } [protected]
SOCKLEN_t XrdNetAddrInfo::addrSize [protected]

Referenced by operator=(), and SockSize().

XrdNetCache* XrdNetAddrInfo::dnsCache [static, protected]
char* XrdNetAddrInfo::hostName [protected]
const int XrdNetAddrInfo::noPort = 0x0000001 [static]

Do not add port number.

const int XrdNetAddrInfo::noPortRaw = 0x0000002 [static]

Use raw address format (no port).

const int XrdNetAddrInfo::old6Map4 = 0x0000004 [static]

Use deprecated IPV6 mapped format.

const int XrdNetAddrInfo::prefipv4 = 0x0000008 [static]

Use if mapped IPV4 actual format.

short XrdNetAddrInfo::protType [protected]

Referenced by operator=(), and Protocol().

struct sockaddr* XrdNetAddrInfo::sockAddr [read]
unsigned short XrdNetAddrInfo::sockNum [protected]

Referenced by operator=(), and SockFD().

struct sockaddr_un* XrdNetAddrInfo::unixPipe [read]

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

Generated on 17 Dec 2019 for xrootd by  doxygen 1.6.1