XrdNetIF Class Reference

#include <XrdNetIF.hh>

Collaboration diagram for XrdNetIF:
Collaboration graph
[legend]

List of all members.

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

ifDataifName [ifMax]
ifDataifDest [ifMax]
bool ifxDNS [ifMax]
char * ifBuff
struct XrdNetIF::pInfo portSfx
int ifPort
short ifRoute
char ifMask
char ifAvail

Static Private Attributes

static XrdSysErroreDest
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

Member Enumeration Documentation

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 

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 

Constructor & Destructor Documentation

XrdNetIF::XrdNetIF (  )  [inline]

Constructor and Destructor.

XrdNetIF::~XrdNetIF (  )  [inline]

References ifBuff.


Member Function Documentation

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().

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.

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.
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.
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.
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.

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.

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.

int XrdNetIF::GetName ( const char *&  name,
ifType  ifT = PublicV6 
) [inline]

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.

bool XrdNetIF::HasDest ( ifType  ifT = PublicV6  )  [inline]

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.

static bool XrdNetIF::InDomain ( XrdNetAddrInfo epaddr  )  [static]

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().

static bool XrdNetIF::IsOkName ( const char *  ifn,
short &  ifIdx 
) [static, private]
static char XrdNetIF::Mask ( ifType  ifT  )  [inline, static]

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.

char XrdNetIF::Mask (  )  [inline]

Get the ifType selection mask for this object.

Returns:
A single char that represents the selection mask.

References ifMask.

static const char* XrdNetIF::Name ( ifType  ifT  )  [inline, static]

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.

int XrdNetIF::Port ( int  pnum  ) 

Set the assigned port number. This method is not thread safe!

Parameters:
pnum The port number.
Returns:
The previous port number.
int XrdNetIF::Port (  )  [inline]

Get the assigned port number

Returns:
The port number.

References ifPort.

Referenced by XrdCmsNode::isNode().

static void XrdNetIF::PortDefault ( int  pnum = 1094  )  [static]

Set the default assigned port number.

Parameters:
pnum The port number.
Returns:
The previous port number.
static void XrdNetIF::Privatize ( ifType x  )  [inline, static]

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().

static void XrdNetIF::Routing ( netType  nettype  )  [static]

Set default interface network routing.

Parameters:
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().

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.
bool XrdNetIF::SetIF64 ( bool  retVal  )  [private]
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.
void XrdNetIF::SetIFPP (  )  [private]
static void XrdNetIF::SetMsgs ( XrdSysError erp  )  [static]

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.
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.
static bool XrdNetIF::V4LinkLocal ( struct sockaddr *  saP  )  [static, private]

Member Data Documentation

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.

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.

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]

Referenced by GetName(), and Port().

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]
bool XrdNetIF::rPIPA [static, private]

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

Generated on 7 Jul 2020 for xrootd by  doxygen 1.6.1