![]() |
XRootD
|
#include <XrdNetIF.hh>
Public Types | |
enum | ifType { PublicV4 = 0 , PrivateV4 = 1 , PublicV6 = 2 , PrivateV6 = 3 , PrivateIF = 1 , ifNum = 4 , Public46 = 4 , Private46 = 5 , Public64 = 6 , Private64 = 7 , ifMax = 8 , ifAny = 8 } |
The enum that is used to index into ifData to get appropriate interface. More... | |
enum | netType { netDefault = 0 , netSplit , netCommon , netLocal } |
Public Member Functions | |
XrdNetIF () | |
Constructor and Destructor. More... | |
~XrdNetIF () | |
void | Display (const char *pfx="=====> ") |
int | GetDest (char *dest, int dlen, ifType ifT=PublicV6, bool prefn=false) |
int | GetName (char *nbuff, int &nport, ifType ifT=PublicV6) |
int | GetName (const char *&name, ifType ifT=PublicV6) |
int | GetPublicDest (char *dest, size_t dlen) |
int | GetPublicName (char *nbuff, int &nport) |
bool | HasDest (ifType ifT=PublicV6) |
char | Mask () |
int | Port () |
int | Port (int pnum) |
bool | SetIF (XrdNetAddrInfo *src, const char *ifList, int port=0, netType nettype=netDefault, const char *xName=0) |
bool | SetPublicName (const std::string &name) |
Static Public Member Functions | |
static int | GetIF (char *&ifline, const char **eText=0, bool show=false) |
static int | GetIF (char *buff, int blen, const char **eText=0, bool show=false) |
static int | GetIF (XrdOucTList **ifList, const char **eText=0) |
static ifType | GetIFType (bool conIPv4, bool hasIP64, bool pvtIP) |
static bool | InDomain (XrdNetAddrInfo *epaddr) |
static char | Mask (ifType ifT) |
static const char * | Name (ifType ifT) |
static void | PortDefault (int pnum=1094) |
static void | Privatize (ifType &x) |
static void | Routing (netType nettype) |
static bool | SetIFNames (char *ifnames) |
static void | SetMsgs (XrdSysError *erp) |
static void | SetRPIPA (bool rval) |
Static Public Attributes | |
static const int | haveIPv4 = 1 |
ifList == 0 && non-local ipv4 i/f found (or'd) More... | |
static const int | haveIPv6 = 2 |
ifList == 0 && non-local ipv6 i/f found (or'd) More... | |
static const int | haveNoGI = 0 |
ifList == 0 && getifaddrs() is not supported More... | |
static const int | havePrv4 = 4 |
ifList == 0 && private ipv4 i/f found (or'd) More... | |
static const int | havePrv6 = 8 |
ifList == 0 && private ipv6 i/f found (or'd) More... | |
static const int | havePub4 =16 |
ifList == 0 && public ipv4 i/f found (or'd) More... | |
static const int | havePub6 =32 |
ifList == 0 && public ipv6 i/f found (or'd) More... | |
Definition at line 49 of file XrdNetIF.hh.
enum XrdNetIF::ifType |
The enum that is used to index into ifData to get appropriate interface.
Enumerator | |
---|---|
PublicV4 | |
PrivateV4 | |
PublicV6 | |
PrivateV6 | |
PrivateIF | |
ifNum | |
Public46 | |
Private46 | |
Public64 | |
Private64 | |
ifMax | |
ifAny |
Definition at line 65 of file XrdNetIF.hh.
enum XrdNetIF::netType |
Routing() and SetIF() parameter.
netDefault - netSplit for Routing() and Routing() value for SetIF(). netSplit - public and private addresses are routed separately so that substitution of one type of address for another is not allowed. netCommon - clients with private addresses also have public addresses. Source and target addresses should match but a public address may be used in the absence of a private address. netLocal - private addresses are registered and can be used by public clients within this domain. Clients with public addresses can be routed to private addresses.
Enumerator | |
---|---|
netDefault | |
netSplit | |
netCommon | |
netLocal |
Definition at line 364 of file XrdNetIF.hh.
|
inline |
Constructor and Destructor.
Definition at line 431 of file XrdNetIF.hh.
|
inline |
Definition at line 433 of file XrdNetIF.hh.
void XrdNetIF::Display | ( | const char * | pfx = "=====> " | ) |
Display the final interface configuration.
pfx | The desired message prefix (default is as shown). |
Definition at line 142 of file XrdNetIF.cc.
References ifNum, and XrdSysError::Say().
Referenced by XrdXrootdProtocol::Configure(), and XrdCmsNode::ShowIF().
Get the interface address with a port number.
dest | Pointer to the buffer where dest will be placed. |
dlen | The length of the buffer. |
ifT | Desired ifType (PublicV6 is the default) |
prefn | When true, a hostname:port is returned if possible |
Definition at line 389 of file XrdNetIF.cc.
References ifAny.
Referenced by XrdSsiSfs::fsctl(), and XrdOfs::fsctl().
|
static |
Obtain an easily transmittable IP routable interfaces to this machine.
ifline | Reference to a char * pointer that will get the result. |
eText | When not nil, is where to place error message text. |
show | When true configured interfaces are also displayed. |
Definition at line 589 of file XrdNetIF.cc.
References eDest, GetIF(), and XrdSysError::Say().
|
static |
Obtain an easily transmittable IP routable interfaces to this machine.
buff | Pointer to buffer to hold result which can be fed to SetIF. |
blen | The length of the buffer (4K is really sufficient). |
eText | When not nil, is where to place error message text. |
show | When true configured interfaces are also displayed. |
Definition at line 536 of file XrdNetIF.cc.
References eDest, GetIF(), XrdOucTList::next, XrdSysError::Say(), and XrdOucTList::text.
|
static |
Definition at line 429 of file XrdNetIF.cc.
References eDest, XrdSysError::Emsg(), XrdNetAddrInfo::fmtAddr, XrdNetAddrInfo::Format(), haveIPv4, haveIPv6, haveNoGI, havePrv4, havePrv6, havePub4, havePub6, XrdNetAddrInfo::isPrivate(), XrdNetAddrInfo::noPort, XrdNetAddr::Set(), and XrdSysE2T().
Referenced by XrdConfig::Configure(), GetIF(), XrdNetUtils::NetConfig(), and XrdNetUtils::SetAuto().
|
inlinestatic |
Get the ifType for client connection.
conIPv4 | True if connected via IPv4, false means IPv6. |
hasIP64 | True if the client has an IPv4 and IPv6 address. |
pvtIP | True if the ip address is private. |
Definition at line 250 of file XrdNetIF.hh.
References Privatize(), Public46, Public64, PublicV4, and PublicV6.
Referenced by XrdSsiSfs::fsctl(), and XrdOfs::fsctl().
Copy the interface name and return port number.
nbuff | Reference to buffer where the name will be placed. It must be atleast 256 bytes in length. |
nport | Place where the port number will be placed. |
ifT | Desired ifType (PublicV6 is the default) |
Definition at line 133 of file XrdNetIF.hh.
References ifAny.
Get the interface name without a port number.
name | Reference to where a pointer to the name will be placed |
ifT | Desired ifType (PublicV6 is the default) |
Definition at line 115 of file XrdNetIF.hh.
References ifAny.
int XrdNetIF::GetPublicDest | ( | char * | dest, |
size_t | dlen | ||
) |
Get the public interface name with a port number.
dest | Pointer to the buffer where dest will be placed. |
dlen | The length of the buffer. |
Definition at line 412 of file XrdNetIF.cc.
Referenced by XrdCmsCluster::List().
|
inline |
Get the interface public hostname, not relying on reverse DNS of the IP addresses.
nbuff | Reference to buffer where the name will be placed. It must be at least 256 bytes in length. |
nport | Place where the port number will be placed. |
Definition at line 150 of file XrdNetIF.hh.
Referenced by XrdCmsCluster::Select().
Determine whether or not an interface exists.
ifT | -> Desired ifType (PublicV6 is the default) |
Definition at line 267 of file XrdNetIF.hh.
References ifAny.
Referenced by XrdCmsCluster::List().
|
static |
Determine if an endpoint is this domain based on hostname.
epaddr | Pointer to the endpoint NetAddrInfo object. |
Definition at line 622 of file XrdNetIF.cc.
References XrdNetAddrInfo::isPrivate(), XrdNetPMarkConfig::myDomain, and XrdNetAddrInfo::Name().
Referenced by XrdCmsNode::inDomain(), XrdSecProtector::New4Server(), XrdXrootdProtocol::Process2(), and XrdSecProtector::ProtResp().
|
inline |
Get the ifType selection mask for this object.
Definition at line 288 of file XrdNetIF.hh.
Referenced by XrdCmsCluster::Select().
|
inlinestatic |
Convert an ifType to its corresponding selection mask.
ifT | The ifType to convert. |
Definition at line 298 of file XrdNetIF.hh.
References ifAny.
|
inlinestatic |
Get the human readable for for an ifType.
ifT | The ifType to convert. |
Definition at line 312 of file XrdNetIF.hh.
References ifAny.
Referenced by XrdCmsNode::do_Locate().
|
inline |
Get the assigned port number
Definition at line 322 of file XrdNetIF.hh.
Referenced by XrdXrootdProtocol::Configure(), XrdCmsNode::isNode(), XrdCmsCluster::List(), and SetIF().
int XrdNetIF::Port | ( | int | pnum | ) |
Set the assigned port number. This method is not thread safe!
pnum | The port number. |
Definition at line 657 of file XrdNetIF.cc.
|
static |
Set the default assigned port number.
pnum | The port number. |
Definition at line 680 of file XrdNetIF.cc.
|
inlinestatic |
Make an iofType refer to the private network.
x | The iftype variable that will have the private bit set. |
Definition at line 330 of file XrdNetIF.hh.
References PrivateIF.
Referenced by XrdCmsNode::do_Locate(), XrdCmsNode::do_Select(), and GetIFType().
|
static |
Set default interface network routing.
nettype | Network routing (see netType definition). |
Definition at line 686 of file XrdNetIF.cc.
References netDefault, netLocal, and netSplit.
bool XrdNetIF::SetIF | ( | XrdNetAddrInfo * | src, |
const char * | ifList, | ||
int | port = 0 , |
||
netType | nettype = netDefault , |
||
const char * | xName = 0 |
||
) |
Set the ifData structure based on the interface string generated by GetIF().
src | The network information of host supplying the if string. |
ifList | The interface string, it must be null terminated. |
port | The port associated with the interfaces; as follows: <0 -> Use previous setting if any. =0 -> use default port (the default). >0 -> Use the number passed. |
nettype | Determines how undefined interfaces are resolved. See the netType definition. |
xName | the known registered host name should ip address translation fail. |
Definition at line 704 of file XrdNetIF.cc.
References XrdNetUtils::allIPv64, eDest, XrdSysError::Emsg(), XrdNetUtils::GetAddrs(), XrdNetAddrInfo::IPv4, XrdNetAddrInfo::isIPType(), XrdNetAddrInfo::isMapped(), XrdNetAddrInfo::isPrivate(), XrdNetAddrInfo::isRegistered(), XrdNetAddrInfo::Name(), netDefault, and Port().
|
static |
Set the public and private network interface names.
ifnames | Pointer to the comma seperated interface names. This string is modified. |
Definition at line 779 of file XrdNetIF.cc.
References eDest, and XrdSysError::Say().
|
static |
Specify where messages are to be sent.
erp | Pointer to the error message object. By default, no error messages are printed. This is not a thread-safe call and the err disposition must be set at initialization time. |
Definition at line 886 of file XrdNetIF.cc.
References eDest.
Referenced by XrdConfig::Configure().
|
inline |
Sets the 'public name' to use associated with this interface.
name | New public name to utilize. |
Definition at line 164 of file XrdNetIF.hh.
|
static |
Specify wheter or not private IP addresses should be resolved.
rval | When true, private IP addresses are resolved. Otherwise, the IP addresses is used as the hostname. |
Definition at line 892 of file XrdNetIF.cc.
|
static |
ifList == 0 && non-local ipv4 i/f found (or'd)
Definition at line 196 of file XrdNetIF.hh.
Referenced by GetIF(), XrdNetUtils::NetConfig(), and XrdNetUtils::SetAuto().
|
static |
ifList == 0 && non-local ipv6 i/f found (or'd)
Definition at line 198 of file XrdNetIF.hh.
Referenced by GetIF(), XrdNetUtils::NetConfig(), and XrdNetUtils::SetAuto().
|
static |
ifList == 0 && getifaddrs() is not supported
Obtain an easily digestable list of IP routable interfaces to this machine.
ifList | Place where the list of interfaces will be placed. If ifList is null, returns configured interface types. |
eText | When not nil, is where to place error message text. |
ifList == 0: returns types of configured non-local i/f. This is or'd values of the static const ints haveXXXX.
Failure: Zero is returned. If eText is supplied, the error message, in persistent storage, is returned.
Definition at line 194 of file XrdNetIF.hh.
Referenced by GetIF().
|
static |
ifList == 0 && private ipv4 i/f found (or'd)
Definition at line 200 of file XrdNetIF.hh.
Referenced by GetIF().
|
static |
ifList == 0 && private ipv6 i/f found (or'd)
Definition at line 202 of file XrdNetIF.hh.
Referenced by GetIF().
|
static |
ifList == 0 && public ipv4 i/f found (or'd)
Definition at line 204 of file XrdNetIF.hh.
Referenced by GetIF(), and XrdNetUtils::NetConfig().
|
static |
ifList == 0 && public ipv6 i/f found (or'd)
Definition at line 206 of file XrdNetIF.hh.
Referenced by GetIF(), and XrdNetUtils::NetConfig().