![]() |
XRootD
|
#include <XrdNetAddrInfo.hh>
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 | |
XrdNetAddrInfo () | |
Constructor. More... | |
XrdNetAddrInfo (const XrdNetAddrInfo *addr) | |
XrdNetAddrInfo (XrdNetAddrInfo const &oP) | |
Copy constructor. More... | |
~XrdNetAddrInfo () | |
Destructor. More... | |
const char * | Dialect () |
int | Family () const |
int | Format (char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0) |
bool | isIPType (IPType ipType) const |
bool | isLoopback () |
bool | isMapped () const |
bool | isPrivate () |
bool | isRegistered () |
bool | isUsingTLS () |
const struct LocInfo * | Location () |
const char * | Name (const char *eName=0, const char **eText=0) |
const XrdNetSockAddr * | NetAddr () |
XrdNetAddrInfo & | operator= (XrdNetAddrInfo const &rhs) |
Assignment operator. More... | |
int | Port () |
int | Protocol () |
int | Same (const XrdNetAddrInfo *ipAddr, bool plusPort=false) |
const sockaddr * | SockAddr () |
int | SockFD () |
SOCKLEN_t | SockSize () |
Static Public Member Functions | |
static bool | isHostName (const char *name) |
Static Public Attributes | |
static const int | noPort = 0x0000001 |
Do not add port number. More... | |
static const int | noPortRaw = 0x0000002 |
Use raw address format (no port) More... | |
static const int | old6Map4 = 0x0000004 |
Use deprecated IPV6 mapped format. More... | |
static const int | prefipv4 = 0x0000008 |
Use if mapped IPV4 actual format. More... | |
Protected Member Functions | |
char * | LowCase (char *str) |
int | QFill (char *bAddr, int bLen) |
int | Resolve () |
Protected Attributes | |
union { | |
struct sockaddr * | sockAddr |
struct sockaddr_un * | unixPipe |
}; | |
LocInfo | addrLoc |
unsigned short | addrSize |
char * | hostName |
XrdNetSockAddr | IP |
unsigned char | protFlgs |
const char * | protName |
unsigned char | protType |
int | sockNum |
Static Protected Attributes | |
static XrdNetCache * | dnsCache = 0 |
static const char | isTLS = 0x01 |
Location using TLS. More... | |
Definition at line 53 of file XrdNetAddrInfo.hh.
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>
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]' |
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 |
Definition at line 99 of file XrdNetAddrInfo.hh.
Indicate whether or not our address is if the desired type.
ipType | The IP address version to test (see enum below). |
Enumerator | |
---|---|
IPv4 | |
IPv6 | |
IPuX |
Definition at line 144 of file XrdNetAddrInfo.hh.
|
inline |
|
inline |
Constructor.
Definition at line 336 of file XrdNetAddrInfo.hh.
References XrdNetSockAddr::Addr, and IP.
|
inline |
Definition at line 342 of file XrdNetAddrInfo.hh.
|
inline |
Destructor.
Definition at line 348 of file XrdNetAddrInfo.hh.
References XrdNetSockAddr::Addr, hostName, and IP.
|
inline |
Provide the protocol languag being spoken (e.g. xroot, http, etc).
Definition at line 65 of file XrdNetAddrInfo.hh.
References protName.
Referenced by XrdCmsRedirLocal::Locate().
|
inline |
Provide our address family.
Definition at line 74 of file XrdNetAddrInfo.hh.
References XrdNetSockAddr::Addr, and IP.
Referenced by XrdCl::AsyncSocketHandler::Connect().
Definition at line 81 of file XrdNetAddrInfo.cc.
References XrdNetSockAddr::Addr, dnsCache, XrdNetCache::Find(), fmtAddr, fmtAdv6, fmtAuto, fmtName, hostName, IP, noPort, noPortRaw, old6Map4, prefipv4, QFill(), Resolve(), XrdNetSockAddr::v4, and XrdNetSockAddr::v6.
Referenced by XrdBwm::XrdBwm(), XrdSecProtocolgsi::XrdSecProtocolgsi(), XrdInet::Accept(), XrdLinkCtl::Alloc(), XrdNetSecurity::Authorize(), XrdNetPMarkCfg::Config(), XrdCl::AsyncSocketHandler::Connect(), XrdNetIF::GetIF(), XrdCl::AsyncSocketHandler::GetIpAddr(), XrdSecServer::getParms(), XrdCmsManList::getRef(), XrdSsiClientProvider::GetService(), XrdNetUtils::GetSokInfo(), XrdNetUtils::IPFormat(), Resolve(), and XrdNetSocket::SockName().
|
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.
name | The string to check. |
Definition at line 278 of file XrdNetAddrInfo.cc.
Referenced by XrdSecProtocolgsi::XrdSecProtocolgsi(), XrdNetPMarkCfg::Begin(), isRegistered(), XrdNetAddr::Register(), and XrdNetAddr::Set().
|
inline |
Definition at line 146 of file XrdNetAddrInfo.hh.
References XrdNetSockAddr::Addr, and IP.
Referenced by XrdCl::AsyncSocketHandler::GetIpStack(), XrdNetUtils::GetSokInfo(), and XrdNetIF::SetIF().
bool XrdNetAddrInfo::isLoopback | ( | ) |
Indicate whether or not our address is the loopback address. Use this method to gaurd against UDP packet spoofing.
Definition at line 181 of file XrdNetAddrInfo.cc.
References XrdNetSockAddr::Addr, IP, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.
|
inline |
Indicate whether or not our address is an IPv4 mapped to IPv6 address.
Definition at line 155 of file XrdNetAddrInfo.hh.
References XrdNetSockAddr::Addr, IP, and XrdNetSockAddr::v6.
Referenced by XrdCl::AsyncSocketHandler::GetIpStack(), XrdNetUtils::GetSokInfo(), Same(), and XrdNetIF::SetIF().
bool XrdNetAddrInfo::isPrivate | ( | ) |
Indicate whether or not our address is private.
Definition at line 200 of file XrdNetAddrInfo.cc.
References XrdNetSockAddr::Addr, if(), IN6_IS_ADDR_UNIQLOCAL, IP, and XrdNetSockAddr::v6.
Referenced by XrdNetPMarkCfg::Begin(), XrdNetIF::GetIF(), XrdNetIF::InDomain(), XrdCmsRedirLocal::Locate(), XrdXrootdProtocol::Process2(), and XrdNetIF::SetIF().
bool XrdNetAddrInfo::isRegistered | ( | ) |
Indicate whether or not our address is registered in the DNS.
Definition at line 242 of file XrdNetAddrInfo.cc.
References isHostName(), and Name().
Referenced by XrdConfig::Configure(), and XrdNetIF::SetIF().
bool XrdNetAddrInfo::isUsingTLS | ( | ) |
Indicate whether or not the endpoint is using TLS for communications.
Definition at line 256 of file XrdNetAddrInfo.cc.
References isTLS, and protFlgs.
Referenced by XrdSecProtocolztnObject().
|
inline |
Definition at line 210 of file XrdNetAddrInfo.hh.
References addrLoc, and XrdNetAddrInfo::LocInfo::Country.
|
protected |
Definition at line 265 of file XrdNetAddrInfo.cc.
Referenced by Resolve(), and XrdNetAddr::Set().
const char * XrdNetAddrInfo::Name | ( | const char * | eName = 0 , |
const char ** | eText = 0 |
||
) |
Convert our IP address to the corresponding [host] name.
eName | value to return when the name cannot be determined. |
eText | when not null, the reason for a failure is returned. |
Definition at line 309 of file XrdNetAddrInfo.cc.
References XrdNetSockAddr::Addr, dnsCache, XrdNetCache::Find(), hostName, IP, and Resolve().
Referenced by XrdBwm::XrdBwm(), XrdSecProtocolgsi::XrdSecProtocolgsi(), XrdInet::Accept(), XrdDigAuth::Authorize(), XrdNetSecurity::Authorize(), XrdOfsTPC::Authorize(), XrdNetPMarkCfg::Begin(), XrdConfig::Configure(), XrdFrmConfig::Configure(), XrdInet::Connect(), XrdNet::Connect(), XrdPosixAdmin::FanOut(), XrdCl::AsyncSocketHandler::GetHostName(), XrdSecServer::getParms(), XrdNetUtils::Hosts(), XrdNetIF::InDomain(), XrdSsiFileResource::Init(), XrdOucReqID::isMine(), isRegistered(), main(), XrdNetSocket::Peername(), XrdCmsManager::Rerun(), XrdAccAccess::Resolve(), XrdNetMsg::retErr(), XrdMpxOut::Run(), XrdOfsTPCInfo::Set(), XrdNetIF::SetIF(), XrdTlsNotary::Validate(), XrdOfsTPC::Verify(), XrdFfsMisc_get_list_of_data_servers(), XrdFfsMisc_getNameByAddr(), and XrdSecProtocolsssObject().
|
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.
Definition at line 237 of file XrdNetAddrInfo.hh.
References IP.
Referenced by XrdOssPath::InitPrefix(), and XrdNetPMarkFF::Start().
|
inline |
int XrdNetAddrInfo::Port | ( | ) |
Return the port number for our address.
Definition at line 340 of file XrdNetAddrInfo.cc.
References XrdNetSockAddr::Addr, IP, and XrdNetSockAddr::v6.
Referenced by XrdNetAddr::Set().
|
inline |
Provide our protocol family.
Definition at line 255 of file XrdNetAddrInfo.hh.
References protType.
Referenced by XrdNetSocket::Open().
|
protected |
Definition at line 356 of file XrdNetAddrInfo.cc.
Referenced by Format().
|
protected |
Definition at line 373 of file XrdNetAddrInfo.cc.
References XrdNetCache::Add(), XrdNetSockAddr::Addr, dnsCache, ec, fmtAddr, Format(), hostName, IP, LowCase(), noPort, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.
Referenced by Format(), and Name().
int XrdNetAddrInfo::Same | ( | const XrdNetAddrInfo * | ipAddr, |
bool | plusPort = false |
||
) |
Check if the IP address in this object is the same as the one passed.
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. |
Note: implemented in terms of const version
Definition at line 432 of file XrdNetAddrInfo.cc.
References hostName, IP, IS_INET, isMapped(), MY_FAMILY, UR_FAMILY, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.
Referenced by XrdCmsNode::isNode(), and XrdNetAddr::Register().
|
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.
Definition at line 280 of file XrdNetAddrInfo.hh.
Referenced by XrdConfig::Configure(), XrdNetSocket::Open(), XrdNetSocket::Peername(), and XrdNetMsg::Send().
|
inline |
Get the associated file descriptor.
Definition at line 297 of file XrdNetAddrInfo.hh.
References sockNum.
Referenced by XrdInet::Accept(), XrdLinkCtl::Alloc(), XrdTpc::PMarkManager::beginPMarks(), XrdInet::Connect(), XrdSecProtocolsss::getCredentials(), XrdHttpProtocol::Process(), and XrdNetPMarkFF::Start().
|
inline |
Provide the length of our socket adress. Useful for system calls needing it.
Definition at line 289 of file XrdNetAddrInfo.hh.
References addrSize, and SOCKLEN_t.
Referenced by XrdNetSocket::Open(), XrdNetSocket::Peername(), and XrdNetMsg::Send().
union { ... } |
|
protected |
Definition at line 364 of file XrdNetAddrInfo.hh.
Referenced by Location(), operator=(), and XrdNetAddr::SetLocation().
|
protected |
Definition at line 365 of file XrdNetAddrInfo.hh.
Referenced by operator=(), XrdNetAddr::Set(), and SockSize().
|
staticprotected |
Definition at line 357 of file XrdNetAddrInfo.hh.
Referenced by Format(), Name(), Resolve(), and XrdNetAddr::SetCache().
|
protected |
Definition at line 363 of file XrdNetAddrInfo.hh.
Referenced by XrdNetAddr::XrdNetAddr(), XrdNetAddrInfo(), ~XrdNetAddrInfo(), Format(), Name(), operator=(), XrdNetAddr::Register(), Resolve(), Same(), and XrdNetAddr::Set().
|
protected |
Definition at line 359 of file XrdNetAddrInfo.hh.
Referenced by XrdNetAddrInfo(), ~XrdNetAddrInfo(), Family(), Format(), isIPType(), isLoopback(), isMapped(), isPrivate(), Name(), NetAddr(), operator=(), Port(), XrdNetAddr::Port(), Resolve(), Same(), and XrdNetAddr::Set().
|
staticprotected |
Location using TLS.
Definition at line 373 of file XrdNetAddrInfo.hh.
Referenced by isUsingTLS(), and XrdNetAddr::SetTLS().
|
static |
Do not add port number.
Definition at line 104 of file XrdNetAddrInfo.hh.
Referenced by XrdSecProtocolgsi::XrdSecProtocolgsi(), XrdInet::Accept(), XrdLinkCtl::Alloc(), XrdNetSecurity::Authorize(), Format(), XrdNetIF::GetIF(), XrdCl::AsyncSocketHandler::GetIpAddr(), XrdSecServer::getParms(), XrdNetUtils::IPFormat(), and Resolve().
|
static |
Use raw address format (no port)
Definition at line 105 of file XrdNetAddrInfo.hh.
Referenced by Format(), and XrdNetUtils::GetSokInfo().
|
static |
Use deprecated IPV6 mapped format.
Definition at line 106 of file XrdNetAddrInfo.hh.
Referenced by XrdBwm::XrdBwm(), XrdLinkCtl::Alloc(), XrdNetSecurity::Authorize(), Format(), XrdCmsManList::getRef(), and XrdNetUtils::IPFormat().
|
static |
Use if mapped IPV4 actual format.
Definition at line 107 of file XrdNetAddrInfo.hh.
Referenced by Format(), and XrdNetUtils::GetSokInfo().
|
protected |
Definition at line 367 of file XrdNetAddrInfo.hh.
Referenced by isUsingTLS(), operator=(), and XrdNetAddr::SetTLS().
|
protected |
Definition at line 369 of file XrdNetAddrInfo.hh.
Referenced by Dialect(), operator=(), and XrdNetAddr::SetDialect().
|
protected |
Definition at line 366 of file XrdNetAddrInfo.hh.
Referenced by operator=(), Protocol(), and XrdNetAddr::Set().
|
protected |
Definition at line 368 of file XrdNetAddrInfo.hh.
Referenced by operator=(), XrdNetAddr::Set(), and SockFD().