#include <XrdNetIF.hh>
Classes | |
struct | ifAddrs |
struct | ifData |
struct | pInfo |
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 | |
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 Public Member Functions | |
static int | GetIF (XrdOucTList **ifList, const char **eText=0) |
static int | GetIF (char *buff, int blen, const char **eText=0, bool show=false) |
static int | GetIF (char *&ifline, const char **eText=0, bool show=false) |
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 | Privatize (ifType &x) |
static void | PortDefault (int pnum=1094) |
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 | 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) | |
Private Member Functions | |
bool | GenAddrs (ifAddrs &ifTab, XrdNetAddrInfo *src) |
bool | GenAddrs (ifAddrs &ifTab, const char *hName, bool wantV6) |
bool | GenIF (XrdNetAddrInfo **src, int srcnum, const char *xName=0) |
void | SetIFPP () |
bool | SetIF64 (bool retVal) |
Static Private Member Functions | |
static bool | IsOkName (const char *ifn, short &ifIdx) |
static char * | SetDomain () |
static bool | V4LinkLocal (struct sockaddr *saP) |
Private Attributes | |
ifData * | ifName [ifMax] |
ifData * | ifDest [ifMax] |
bool | ifxDNS [ifMax] |
char * | ifBuff |
struct XrdNetIF::pInfo | portSfx |
int | ifPort |
short | ifRoute |
char | ifMask |
char | ifAvail |
Static Private Attributes | |
static XrdSysError * | eDest |
static char * | myDomain |
static char * | ifCfg [2] |
static const char * | ifTName [ifMax] |
static const char * | ifMaskVec |
static netType | netRoutes |
static int | dfPort |
static ifData | ifNull |
static bool | rPIPA |
enum XrdNetIF::ifType |
The enum that is used to index into ifData to get appropriate interface.
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.
XrdNetIF::XrdNetIF | ( | ) | [inline] |
Constructor and Destructor.
XrdNetIF::~XrdNetIF | ( | ) | [inline] |
References ifBuff.
void XrdNetIF::Display | ( | const char * | pfx = "=====> " |
) |
Display the final interface configuration.
pfx | The desired message prefix (default is as shown). |
Referenced by XrdCmsNode::ShowIF().
bool XrdNetIF::GenAddrs | ( | ifAddrs & | ifTab, | |
const char * | hName, | |||
bool | wantV6 | |||
) | [private] |
bool XrdNetIF::GenAddrs | ( | ifAddrs & | ifTab, | |
XrdNetAddrInfo * | src | |||
) | [private] |
bool XrdNetIF::GenIF | ( | XrdNetAddrInfo ** | src, | |
int | srcnum, | |||
const char * | xName = 0 | |||
) | [private] |
int XrdNetIF::GetDest | ( | char * | dest, | |
int | dlen, | |||
ifType | ifT = PublicV6 , |
|||
bool | prefn = false | |||
) |
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 |
static int XrdNetIF::GetIF | ( | char *& | ifline, | |
const char ** | eText = 0 , |
|||
bool | show = false | |||
) | [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. |
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.
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. |
static int XrdNetIF::GetIF | ( | XrdOucTList ** | ifList, | |
const char ** | eText = 0 | |||
) | [static] |
static ifType XrdNetIF::GetIFType | ( | bool | conIPv4, | |
bool | hasIP64, | |||
bool | pvtIP | |||
) | [inline, static] |
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. |
References Privatize(), Public46, Public64, PublicV4, and PublicV6.
int XrdNetIF::GetName | ( | char * | nbuff, | |
int & | nport, | |||
ifType | ifT = PublicV6 | |||
) | [inline] |
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) |
References ifAny, ifAvail, ifName, ifPort, and XrdNetIF::ifData::iLen.
int XrdNetIF::GetName | ( | const char *& | name, | |
ifType | ifT = PublicV6 | |||
) | [inline] |
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) |
References ifAny, ifAvail, ifName, XrdNetIF::ifData::iLen, and XrdNetIF::ifData::iVal.
bool XrdNetIF::HasDest | ( | ifType | ifT = PublicV6 |
) | [inline] |
Determine whether or not an interface exists.
ifT | -> Desired ifType (PublicV6 is the default) |
References ifAny, ifDest, and XrdNetIF::ifData::iLen.
static bool XrdNetIF::InDomain | ( | XrdNetAddrInfo * | epaddr | ) | [static] |
Determine if an endpoint is this domain based on hostname.
epAddr | Pointer to the endpoint NetAddrInfo object. |
Referenced by XrdCmsNode::inDomain().
static bool XrdNetIF::IsOkName | ( | const char * | ifn, | |
short & | ifIdx | |||
) | [static, private] |
static char XrdNetIF::Mask | ( | ifType | ifT | ) | [inline, static] |
char XrdNetIF::Mask | ( | ) | [inline] |
Get the ifType selection mask for this object.
References ifMask.
static const char* XrdNetIF::Name | ( | ifType | ifT | ) | [inline, static] |
int XrdNetIF::Port | ( | int | pnum | ) |
Set the assigned port number. This method is not thread safe!
pnum | The port number. |
int XrdNetIF::Port | ( | ) | [inline] |
Get the assigned port number
References ifPort.
Referenced by XrdCmsNode::isNode().
static void XrdNetIF::PortDefault | ( | int | pnum = 1094 |
) | [static] |
Set the default assigned port number.
pnum | The port number. |
static void XrdNetIF::Privatize | ( | ifType & | x | ) | [inline, static] |
Make an iofType refer to the private network.
x | The iftype variable that will have the private bit set. |
References PrivateIF.
Referenced by GetIFType().
static void XrdNetIF::Routing | ( | netType | nettype | ) | [static] |
Set default interface network routing.
nettype | Network routing (see netType definition). |
static char* XrdNetIF::SetDomain | ( | ) | [static, private] |
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. |
bool XrdNetIF::SetIF64 | ( | bool | retVal | ) | [private] |
static bool XrdNetIF::SetIFNames | ( | char * | ifnames | ) | [static] |
Set the public and private network interface names.
ifnames | Pointer to the comma seperated interface names. This string is modified. |
void XrdNetIF::SetIFPP | ( | ) | [private] |
static void XrdNetIF::SetMsgs | ( | XrdSysError * | erp | ) | [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. |
static void XrdNetIF::SetRPIPA | ( | bool | rval | ) | [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. |
static bool XrdNetIF::V4LinkLocal | ( | struct sockaddr * | saP | ) | [static, private] |
int XrdNetIF::dfPort [static, private] |
XrdSysError* XrdNetIF::eDest [static, private] |
const int XrdNetIF::haveIPv4 = 1 [static] |
ifList == 0 && non-local ipv4 i/f found (or'd)
const int XrdNetIF::haveIPv6 = 2 [static] |
ifList == 0 && non-local ipv6 i/f found (or'd)
const int XrdNetIF::haveNoGI = 0 [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.
const int XrdNetIF::havePrv4 = 4 [static] |
ifList == 0 && private ipv4 i/f found (or'd)
const int XrdNetIF::havePrv6 = 8 [static] |
ifList == 0 && private ipv6 i/f found (or'd)
const int XrdNetIF::havePub4 = 16 [static] |
ifList == 0 && public ipv4 i/f found (or'd)
const int XrdNetIF::havePub6 = 32 [static] |
ifList == 0 && public ipv6 i/f found (or'd)
char XrdNetIF::ifAvail [private] |
Referenced by GetName().
char* XrdNetIF::ifBuff [private] |
Referenced by ~XrdNetIF().
char* XrdNetIF::ifCfg[2] [static, private] |
ifData* XrdNetIF::ifDest[ifMax] [private] |
Referenced by HasDest().
char XrdNetIF::ifMask [private] |
Referenced by Mask().
const char* XrdNetIF::ifMaskVec [static, private] |
Referenced by Mask().
ifData* XrdNetIF::ifName[ifMax] [private] |
Referenced by GetName().
ifData XrdNetIF::ifNull [static, private] |
int XrdNetIF::ifPort [private] |
short XrdNetIF::ifRoute [private] |
const char* XrdNetIF::ifTName[ifMax] [static, private] |
Referenced by Name().
bool XrdNetIF::ifxDNS[ifMax] [private] |
char* XrdNetIF::myDomain [static, private] |
netType XrdNetIF::netRoutes [static, private] |
struct XrdNetIF::pInfo XrdNetIF::portSfx [private] |
bool XrdNetIF::rPIPA [static, private] |