#include <XrdNetIF.hh>
|
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
} |
|
|
void | Display (const char *pfx="=====> ") |
|
int | GetDest (char *dest, int dlen, ifType ifT=PublicV6, bool prefn=false) |
|
int | GetName (const char *&name, ifType ifT=PublicV6) |
|
int | GetName (char *nbuff, int &nport, ifType ifT=PublicV6) |
|
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) |
|
| XrdNetIF () |
| Constructor and Destructor.
|
|
| ~XrdNetIF () |
|
|
static const int | haveNoGI = 0 |
| ifList == 0 && getifaddrs() is not supported
|
|
static const int | haveIPv4 = 1 |
| ifList == 0 && non-local ipv4 i/f found (or'd)
|
|
static const int | haveIPv6 = 2 |
| ifList == 0 && non-local ipv6 i/f found (or'd)
|
|
static const int | havePrv4 = 4 |
| ifList == 0 && private ipv4 i/f found (or'd)
|
|
static const int | havePrv6 = 8 |
| ifList == 0 && private ipv6 i/f found (or'd)
|
|
static const int | havePub4 =16 |
| ifList == 0 && public ipv4 i/f found (or'd)
|
|
static const int | havePub6 =32 |
| ifList == 0 && public ipv6 i/f found (or'd)
|
|
◆ 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 | |
◆ 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 | |
◆ XrdNetIF()
Constructor and Destructor.
◆ ~XrdNetIF()
◆ Display()
void XrdNetIF::Display |
( |
const char * |
pfx = "=====> " | ) |
|
Display the final interface configuration.
- Parameters
-
pfx | The desired message prefix (default is as shown). |
Referenced by XrdCmsNode::ShowIF().
◆ GenAddrs() [1/2]
bool XrdNetIF::GenAddrs |
( |
ifAddrs & |
ifTab, |
|
|
const char * |
hName, |
|
|
bool |
wantV6 |
|
) |
| |
|
private |
◆ GenAddrs() [2/2]
◆ GenIF()
bool XrdNetIF::GenIF |
( |
XrdNetAddrInfo ** |
src, |
|
|
int |
srcnum, |
|
|
const char * |
xName = 0 |
|
) |
| |
|
private |
◆ GetDest()
int XrdNetIF::GetDest |
( |
char * |
dest, |
|
|
int |
dlen, |
|
|
ifType |
ifT = PublicV6 , |
|
|
bool |
prefn = false |
|
) |
| |
Get the interface address with a port number.
- Parameters
-
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 |
- Returns
- The length of the name whose pointer is placed in name. A value of zero indicates that no such interface exists or the buffer was too small.
◆ GetDomain()
static const char * XrdNetIF::GetDomain |
( |
| ) |
|
|
staticprivate |
◆ GetIF() [1/3]
static int XrdNetIF::GetIF |
( |
char *& |
ifline, |
|
|
const char ** |
eText = 0 , |
|
|
bool |
show = false |
|
) |
| |
|
static |
Obtain an easily transmittable IP routable interfaces to this machine.
- Parameters
-
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. |
- Returns
- Success: Number of bytes in the returned string ecluding the null. The caller is responsible for unallocating it via free(). Failure: Zero is returned. If eText is supplied, the error message, in persistent storage, is returned. *ifline is set to 0.
◆ GetIF() [2/3]
static int XrdNetIF::GetIF |
( |
char * |
buff, |
|
|
int |
blen, |
|
|
const char ** |
eText = 0 , |
|
|
bool |
show = false |
|
) |
| |
|
static |
Obtain an easily transmittable IP routable interfaces to this machine.
- Parameters
-
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. |
- Returns
- Success: Number of bytes placed in buff, excluding the null. Failure: Zero is returned. If eText is supplied, the error message, in persistent storage, is returned.
◆ GetIF() [3/3]
static int XrdNetIF::GetIF |
( |
XrdOucTList ** |
ifList, |
|
|
const char ** |
eText = 0 |
|
) |
| |
|
static |
◆ GetIFType()
static ifType XrdNetIF::GetIFType |
( |
bool |
conIPv4, |
|
|
bool |
hasIP64, |
|
|
bool |
pvtIP |
|
) |
| |
|
inlinestatic |
Get the ifType for client connection.
- Parameters
-
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. |
- Returns
- The ifType correspodning to the passed arguments.
References Privatize(), Public46, Public64, PublicV4, and PublicV6.
◆ GetName() [1/2]
int XrdNetIF::GetName |
( |
char * |
nbuff, |
|
|
int & |
nport, |
|
|
ifType |
ifT = PublicV6 |
|
) |
| |
|
inline |
Copy the interface name and return port number.
- Parameters
-
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) |
- Returns
- The length of the name copied into the buffer. A value of zero indicates that no such interface exists.
References ifAny, ifAvail, ifName, ifPort, and XrdNetIF::ifData::iLen.
◆ GetName() [2/2]
Get the interface name without a port number.
- Parameters
-
name | Reference to where a pointer to the name will be placed |
ifT | Desired ifType (PublicV6 is the default) |
- Returns
- The length of the name whose pointer is placed in name. A value of zero indicates that no such interface exists.
References ifAny, ifAvail, ifName, XrdNetIF::ifData::iLen, and XrdNetIF::ifData::iVal.
◆ HasDest()
Determine whether or not an interface exists.
- Parameters
-
ifT | -> Desired ifType (PublicV6 is the default) |
- Returns
- true -> desired dest exists. false -> desired dest does not exist.
References ifAny, ifDest, and XrdNetIF::ifData::iLen.
◆ InDomain()
Determine if an endpoint is this domain based on hostname.
- Parameters
-
epaddr | Pointer to the endpoint NetAddrInfo object. |
- Returns
- true The endpoint is in this domain.
-
false Either the endpoint is not in this domain, is a private address, or is not registered in DNS.
Referenced by XrdCmsNode::inDomain().
◆ IsOkName()
static bool XrdNetIF::IsOkName |
( |
const char * |
ifn, |
|
|
short & |
ifIdx |
|
) |
| |
|
staticprivate |
◆ Mask() [1/2]
Get the ifType selection mask for this object.
- Returns
- A single char that represents the selection mask.
References ifMask.
◆ Mask() [2/2]
static char XrdNetIF::Mask |
( |
ifType |
ifT | ) |
|
|
inlinestatic |
Convert an ifType to its corresponding selection mask.
- Parameters
-
ifT | The ifType to convert. |
- Returns
- A single char that represents the selection mask.
References ifAny, and ifMaskVec.
◆ Name()
static const char * XrdNetIF::Name |
( |
ifType |
ifT | ) |
|
|
inlinestatic |
Get the human readable for for an ifType.
- Parameters
-
ifT | The ifType to convert. |
- Returns
- A pointer to the human readable name. The string resides in static storage and is always valid.
References ifAny, and ifTName.
◆ Port() [1/2]
◆ Port() [2/2]
int XrdNetIF::Port |
( |
int |
pnum | ) |
|
Set the assigned port number. This method is not thread safe!
- Parameters
-
- Returns
- The previous port number.
◆ PortDefault()
static void XrdNetIF::PortDefault |
( |
int |
pnum = 1094 | ) |
|
|
static |
Set the default assigned port number.
- Parameters
-
◆ Privatize()
static void XrdNetIF::Privatize |
( |
ifType & |
x | ) |
|
|
inlinestatic |
Make an iofType refer to the private network.
- Parameters
-
x | The iftype variable that will have the private bit set. |
References PrivateIF.
Referenced by GetIFType().
◆ Routing()
static void XrdNetIF::Routing |
( |
netType |
nettype | ) |
|
|
static |
Set default interface network routing.
- Parameters
-
nettype | Network routing (see netType definition). |
◆ SetIF()
Set the ifData structure based on the interface string generated by GetIF().
- Parameters
-
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. |
- Returns
- Success: True. Failure: False and if eText is supplied, the error message, in persistent storage, is returned.
◆ SetIF64()
bool XrdNetIF::SetIF64 |
( |
bool |
retVal | ) |
|
|
private |
◆ SetIFNames()
static bool XrdNetIF::SetIFNames |
( |
char * |
ifnames | ) |
|
|
static |
Set the public and private network interface names.
- Parameters
-
ifnames | Pointer to the comma seperated interface names. This string is modified. |
- Returns
- true Names have been set.
-
false Invalid interface name list.
◆ SetIFPP()
void XrdNetIF::SetIFPP |
( |
| ) |
|
|
private |
◆ SetMsgs()
Specify where messages are to be sent.
- Parameters
-
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. |
◆ SetRPIPA()
static void XrdNetIF::SetRPIPA |
( |
bool |
rval | ) |
|
|
static |
Specify wheter or not private IP addresses should be resolved.
- Parameters
-
rval | When true, private IP addresses are resolved. Otherwise, the IP addresses is used as the hostname. |
◆ V4LinkLocal()
static bool XrdNetIF::V4LinkLocal |
( |
struct sockaddr * |
saP | ) |
|
|
staticprivate |
◆ dfPort
◆ eDest
◆ haveIPv4
const int XrdNetIF::haveIPv4 = 1 |
|
static |
ifList == 0 && non-local ipv4 i/f found (or'd)
◆ haveIPv6
const int XrdNetIF::haveIPv6 = 2 |
|
static |
ifList == 0 && non-local ipv6 i/f found (or'd)
◆ haveNoGI
const int XrdNetIF::haveNoGI = 0 |
|
static |
ifList == 0 && getifaddrs() is not supported
Obtain an easily digestable list of IP routable interfaces to this machine.
- Parameters
-
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. |
- Returns
- Success: ifList != 0: returns the count of interfaces in the list. *ifList->sval[0] strlen(ifList->text) *ifList->sval[1] when != 0 the address is private. *ifList->text the interface address is standard format. The list of objects belongs to the caller and must be deleted when no longer needed.
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.
◆ havePrv4
const int XrdNetIF::havePrv4 = 4 |
|
static |
ifList == 0 && private ipv4 i/f found (or'd)
◆ havePrv6
const int XrdNetIF::havePrv6 = 8 |
|
static |
ifList == 0 && private ipv6 i/f found (or'd)
◆ havePub4
const int XrdNetIF::havePub4 =16 |
|
static |
ifList == 0 && public ipv4 i/f found (or'd)
◆ havePub6
const int XrdNetIF::havePub6 =32 |
|
static |
ifList == 0 && public ipv6 i/f found (or'd)
◆ ifAvail
◆ ifBuff
◆ ifCfg
◆ ifDest
◆ ifMask
◆ ifMaskVec
const char* XrdNetIF::ifMaskVec |
|
staticprivate |
◆ ifName
◆ ifNull
◆ ifPort
◆ ifRoute
◆ ifTName
const char* XrdNetIF::ifTName[ifMax] |
|
staticprivate |
◆ ifxDNS
bool XrdNetIF::ifxDNS[ifMax] |
|
private |
◆ myDomain
const char* XrdNetIF::myDomain |
|
staticprivate |
◆ netRoutes
◆ portSfx
◆ rPIPA
The documentation for this class was generated from the following file: