XRootD
XrdNetUtils Class Reference

#include <XrdNetUtils.hh>

+ Collaboration diagram for XrdNetUtils:

Public Types

enum  AddrOpts {
  allIPMap = 0 ,
  allIPv64 = 1 ,
  allV4Map = 2 ,
  onlyIPv6 = 3 ,
  onlyIPv4 = 4 ,
  prefIPv6 = 8 ,
  prefAuto = 16 ,
  order46 = 32 ,
  order64 = 64 ,
  onlyUDP =128
}
 
enum  IPComp {
  IPSame = 0 ,
  IPDFam ,
  IPDiff ,
  IPNSup
}
 
enum  NetProt {
  hasNone = 0 ,
  hasIPv4 = 1 ,
  hasIPv6 = 2 ,
  hasIP64 = 3 ,
  hasPub4 = 4 ,
  hasPub6 = 8
}
 
enum  NetType {
  qryINET = 0 ,
  qryINIF = 1
}
 

Public Member Functions

 XrdNetUtils ()
 Constructor. More...
 
 ~XrdNetUtils ()
 Destructor. More...
 

Static Public Member Functions

static IPComp Compare (XrdNetSockAddr &ip1, XrdNetSockAddr &ip2, bool *psame=0)
 
static bool ConnectWithTimeout (int sockfd, const struct sockaddr *clientAddr, size_t clientAddrLen, uint32_t timeout_sec, std::stringstream &errMsg)
 
static int Decode (XrdNetSockAddr *sadr, const char *buff, int blen)
 
static int Encode (const XrdNetSockAddr *sadr, char *buff, int blen, int port=-1)
 
static const char * GetAddrs (const char *hSpec, XrdNetAddr *aListP[], int &aListN, AddrOpts opts=allIPMap, int pNum=PortInSpec)
 
static const char * GetAddrs (const std::string &hSpec, std::vector< XrdNetAddr > &aVec, int *ordn=0, AddrOpts opts=allIPMap, int pNum=PortInSpec)
 
static const char * GetAddrs (std::vector< std::string > &hSVec, std::vector< XrdNetAddr > &aVec, int *ordn=0, AddrOpts opts=allIPMap, unsigned int rotNum=0, bool force=false)
 
static int GetSokInfo (int fd, char *theAddr, int theALen, char &theType)
 
static XrdOucTListHosts (const char *hSpec, int hPort=-1, int hWant=8, int *sPort=0, const char **eText=0)
 
static int IPFormat (const struct sockaddr *sAddr, char *bP, int bL, int opts=0)
 
static int IPFormat (int fd, char *bP, int bL, int opts=0)
 
static bool Match (const char *hName, const char *pattern)
 
static char * MyHostName (const char *eName="*unknown*", const char **eText=0)
 
static NetProt NetConfig (NetType netquery=qryINET, const char **eText=0)
 
static bool Parse (const char *hSpec, const char **hName, const char **hNend, const char **hPort, const char **hPend)
 
static int Port (int fd, const char **eText=0)
 
static int ProtoID (const char *pName)
 
static int ServPort (const char *sName, bool isUDP=false, const char **eText=0)
 
static int SetAuto (AddrOpts aOpts=allIPMap)
 
static bool Singleton (const char *hSpec, const char **eText=0)
 

Static Public Attributes

static const int noPort = 1
 
static const int NoPortRaw = (int)0xC0000000
 
static const int oldFmt = 2
 
static const int PortInSpec = (int)0x80000000
 

Detailed Description

Definition at line 46 of file XrdNetUtils.hh.

Member Enumeration Documentation

◆ AddrOpts

Version 1: Return multiple addresses associated with a host or IP address.

Parameters
hSpec-> convert specification to addresses. Valid formats: IP.v4: nnn.nnn.nnn.nnn[:<port>] IP.v6: [ipv6_addr][:<port>] IP.xx: name[:port] xx is determined by getaddrinfo()
aListPplace where the pointer to the returned array of XrdNetAddr objects is to be placed. Set to zero if none returned. The caller must delete this array when no longer needed.
aListNplace where the number of elements in aListP are to be returned.
optsOptions on what to return. Choose one of: allIPMap - all IPv6 and mapped IPv4 addrs (default) allIPv64 - all IPv6 and unmapped IPv4 addrs allV4Map - all mapped IPV4 addrs. onlyIPv6 - only IPv6 addrs onlyIPv4 - only unmapped IPv4 addrs prefIPv6 - only IPv6 addrs; if none, mapped IPv4 addrs prefAuto - Returns addresses based on configured non-local interfaces. The returned addresses will be normally useable on this host and may be IPv4, IPv6, mapped IPv4, or a mixture. The above may be or'd with one or more of the following: onlyUDP - only addrs valid for UDP connections else TCP order46 - List IPv4 addresses (mapped or native) first. order64 - List IPv6 addresses first.
pNum>= 0 uses the value as the port number regardless of what is in hSpec, should it be supplied. However, if is present, it must be a valid port number. < 0 uses the positive value as the port number if the port number has not been specified in hSpec. **** When set to PortInSpec(the default, see below) the port number/name must be specified in hSpec. If it is not, an error is returned. **** When set to NoPortRaw then hSpec does not contain a port number and is a host name, IPv4 address, or an IPv6 address without surrounding brackets.
Returns
Success: 0 with aListN set to the number of elements in aListP. Failure: the error message text describing the error and aListP and aListN is set to zero.
Enumerator
allIPMap 
allIPv64 
allV4Map 
onlyIPv6 
onlyIPv4 
prefIPv6 
prefAuto 
order46 
order64 
onlyUDP 

Definition at line 143 of file XrdNetUtils.hh.

143  {allIPMap= 0, allIPv64= 1, allV4Map= 2,
144  onlyIPv6= 3, onlyIPv4= 4, prefIPv6= 8,
145  prefAuto= 16, order46 = 32, order64 = 64,
146  onlyUDP =128
147  };

◆ IPComp

Compare two IP addresses and indicate differe\nces, if any.

Parameters
ip1The first address.
ip2The second addres.
psameIf not zero set to true if ports are the same, o/w false.
Returns
IPSame The addresses are the same. IPDFam The addresses differ in address family. IPDiff The addresses have different destination, same family. IPNSuf The address family of one or both addresses not supported.
Enumerator
IPSame 
IPDFam 
IPDiff 
IPNSup 

Definition at line 63 of file XrdNetUtils.hh.

◆ NetProt

Get the supported network protocols.

Parameters
netqryAn NetType enum specifying the protocol to inspect.
eTextWhen not nil, is where to place error message text.
Returns
One the the NetProt enums (see below). When hasNone is returned and eText is not nill it will point to a static string that gives the reason. If the reason is a null string, the query was successful but returned no matching protocols.
Enumerator
hasNone 

Unable to determine available protocols.

hasIPv4 
hasIPv6 
hasIP64 
hasPub4 
hasPub6 

Definition at line 351 of file XrdNetUtils.hh.

351  {hasNone = 0,
352  hasIPv4 = 1, //<! Has only IPv4 capability
353  hasIPv6 = 2, //<! Has only IPv6 capability
354  hasIP64 = 3, //<! Has IPv4 IPv6 capability (dual stack)
355  hasPub4 = 4, //<! Has IPv4 public address (or'd with above)
356  hasPub6 = 8 //<! Has IPv6 public address (or'd with above)
357  };
@ hasNone
Unable to determine available protocols.
Definition: XrdNetUtils.hh:351

◆ NetType

Enumerator
qryINET 

Only consider internet protocols via DNS.

qryINIF 

Only consider internet protocols via ifconfig.

Definition at line 359 of file XrdNetUtils.hh.

359  {qryINET = 0,
360  qryINIF = 1
361  };
@ qryINET
Only consider internet protocols via DNS.
Definition: XrdNetUtils.hh:359
@ qryINIF
Only consider internet protocols via ifconfig.
Definition: XrdNetUtils.hh:360

Constructor & Destructor Documentation

◆ XrdNetUtils()

XrdNetUtils::XrdNetUtils ( )
inline

Constructor.

Definition at line 454 of file XrdNetUtils.hh.

454 {}

◆ ~XrdNetUtils()

XrdNetUtils::~XrdNetUtils ( )
inline

Destructor.

Definition at line 460 of file XrdNetUtils.hh.

460 {}

Member Function Documentation

◆ Compare()

XrdNetUtils::IPComp XrdNetUtils::Compare ( XrdNetSockAddr ip1,
XrdNetSockAddr ip2,
bool *  psame = 0 
)
static

Definition at line 70 of file XrdNetUtils.cc.

72 {
73 // The family code is always in the same place so trivially check equivalence
74 //
75  if (ip1.Addr.sa_family != ip2.Addr.sa_family) return IPDFam;
76 
77 // Since the mailies are te same we need to check if he actual ip addess is
78 // same, What we check depends on the address family. Start with IPv6.
79 //
80  if (ip1.Addr.sa_family == AF_INET6)
81  {if (memcmp(&ip1.v6.sin6_addr,&ip2.v6.sin6_addr,sizeof(struct in6_addr)))
82  return IPDiff;
83  if (psame) *psame = (ip1.v6.sin6_port == ip2.v6.sin6_port);
84  return IPSame;
85  }
86 
87 // Try IPv4
88 //
89  if (ip1.Addr.sa_family == AF_INET)
90  {if (memcmp(&ip1.v4.sin_addr,&ip2.v4.sin_addr, sizeof(struct in_addr)))
91  return IPDiff;
92  if (psame) *psame = (ip1.v4.sin_port == ip2.v4.sin_port);
93  return IPSame;
94  }
95 
96 // We don't support the address family
97 //
98  return IPNSup;
99 }
struct sockaddr_in6 v6
struct sockaddr Addr
struct sockaddr_in v4

References XrdNetSockAddr::Addr, IPDFam, IPDiff, IPNSup, IPSame, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.

◆ ConnectWithTimeout()

bool XrdNetUtils::ConnectWithTimeout ( int  sockfd,
const struct sockaddr *  clientAddr,
size_t  clientAddrLen,
uint32_t  timeout_sec,
std::stringstream &  errMsg 
)
static

Definition at line 981 of file XrdNetUtils.cc.

981  {
982 
983  if (!SetSockBlocking(sockfd, false, errMsg)) { // Set to non-blocking
984  close(sockfd);
985  return false;
986  }
987 
988  int result = connect(sockfd, clientAddr, clientAddrLen);
989  if (result == 0) {
990  //We've managed to connect immediately
991  // Set the socket back to blocking
992  if(!SetSockBlocking(sockfd, true, errMsg)) {
993  ::close(sockfd);
994  return false;
995  }
996  return true;
997  } else if (errno != EINPROGRESS) {
998  errMsg << "Connection failed: " << strerror(errno);
999  ::close(sockfd);
1000  return false;
1001  }
1002 
1003  struct pollfd fds;
1004  fds.fd = sockfd;
1005  fds.events = POLLOUT; // Wait for the socket to be ready to write
1006 
1007  result = poll(&fds, 1, timeout_sec * 1000); //Timeout in milliseconds
1008 
1009  if (result < 0) {
1010  errMsg << "Poll error: " << strerror(errno);
1011  ::close(sockfd);
1012  return false;
1013  } else if (result == 0) {
1014  errMsg << "Connection timed out";
1015  ::close(sockfd);
1016  return false;
1017  }
1018  // Polling succeeded
1019  if (!(fds.revents & POLLOUT)) {
1020  // We should normally not reach this code
1021  errMsg << "Poll returned without error but the corresponding socket (" << sockfd << ") is not ready to write";
1022  ::close(sockfd);
1023  return false;
1024  }
1025  // Check for potential errors on the socket after polling
1026  int so_error;
1027  socklen_t len = sizeof(so_error);
1028  getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len);
1029  if (so_error != 0) {
1030  errMsg << "Connection failed after poll: " << strerror(so_error);
1031  ::close(sockfd);
1032  return false;
1033  }
1034  // Everything succeeded, set the socket back to blocking
1035  if(!SetSockBlocking(sockfd, true, errMsg)) {
1036  ::close(sockfd);
1037  return false;
1038  }
1039  return true;
1040 }
#define close(a)
Definition: XrdPosix.hh:48

References close.

Referenced by XrdHttpTpc::PMarkManager::connect().

+ Here is the caller graph for this function:

◆ Decode()

int XrdNetUtils::Decode ( XrdNetSockAddr sadr,
const char *  buff,
int  blen 
)
static

Decode an "encoded" ipv6/4 address and place it "sockaddr" type structure.

Parameters
sadraddress of the union that will hold the results.
buffaddress of buffer that holds the encoding.
blenlength of the string (it need not be null terminated).
Returns
> 0 the port number in host byte order. = 0 the port number was not set. < 0 the encoding was not correct.

Definition at line 105 of file XrdNetUtils.cc.

106 {
107  static const int ipv4Sz = sizeof(struct in_addr)*2+4;
108  static const int ipv6Sz = sizeof(struct in6_addr)*2+4;
109  char bval[sizeof(struct in6_addr)+2];
110  int isv6, n, i = 0, Odd = 0;
111 
112 // Determine if this will be IPV4 or IPV6 (only ones allowed)
113 //
114  if (blen == ipv6Sz) isv6 = 1;
115  else if (blen == ipv4Sz) isv6 = 0;
116  else return -1;
117 
118 // Convert the whole string to a temporary
119 //
120  while(blen--)
121  { if (*buff >= '0' && *buff <= '9') n = *buff-48;
122  else if (*buff >= 'a' && *buff <= 'f') n = *buff-87;
123  else if (*buff >= 'A' && *buff <= 'F') n = *buff-55;
124  else return -1;
125  if (Odd) bval[i++] |= n;
126  else bval[i ] = n << 4;
127  buff++; Odd = ~Odd;
128  }
129 
130 // Clear the address
131 //
132  memset(sadr, 0, sizeof(XrdNetSockAddr));
133 
134 // Copy out the data, as needed
135 //
136  if (isv6)
137  {sadr->v6.sin6_family = AF_INET6;
138  memcpy(&(sadr->v6.sin6_port), bval, 2);
139  memcpy(&(sadr->v6.sin6_addr), &bval[2], sizeof(struct in6_addr));
140  } else {
141  sadr->v4.sin_family = AF_INET;
142  memcpy(&(sadr->v4.sin_port), bval, 2);
143  memcpy(&(sadr->v4.sin_addr), &bval[2], sizeof(struct in_addr));
144  }
145 
146 // Return the converted port (it's the same for v4/v6)
147 //
148  return static_cast<int>(ntohs(sadr->v6.sin6_port));
149 }

References XrdNetSockAddr::v4, and XrdNetSockAddr::v6.

Referenced by XrdOucReqID::isMine().

+ Here is the caller graph for this function:

◆ Encode()

int XrdNetUtils::Encode ( const XrdNetSockAddr sadr,
char *  buff,
int  blen,
int  port = -1 
)
static

Encode the address and return it in a supplied buffer.

Parameters
sadraddress of the union that holds the IPV4/6 address.
buffaddress of buffer to hold the null terminated encoding.
blenlength of the buffer. It6 should be at least 40 bytes.
portoptional port value to use as opposed to the one present in sockaddr sadr. The port must be in host order.
Returns
> 0 the length of the encoding less the null byte. = 0 current address format not supported for encoding. < 0 buffer is too small; abs(retval) bytes needed.

Definition at line 155 of file XrdNetUtils.cc.

157 {
158  static const char *hv = "0123456789abcdef";
159  char *src, bval[sizeof(struct in6_addr)+2];
160  int asz, i, j = 0;
161 
162 // Compute the size we need for the buffer (note we only support IP4/6)
163 //
164  if (sadr->Addr.sa_family == AF_INET6)
165  {src = (char *)&(sadr->v6.sin6_addr); asz = sizeof(struct in6_addr);}
166  else if (sadr->Addr.sa_family == AF_INET)
167  {src = (char *)&(sadr->v4.sin_addr); asz = sizeof(struct in_addr); }
168  else return 0;
169  if (blen < (asz*2)+5) return -((asz*2)+5);
170 
171 // Get the port value in the first two bytes followed by the address.
172 //
173  if (port < 0) memcpy(bval, &(sadr->v6.sin6_port), 2);
174  else {short sPort = htons(static_cast<short>(port));
175  memcpy(bval, &sPort, 2);
176  }
177  memcpy(&bval[2], src, asz);
178  asz += 2;
179 
180 // Now convert to hex
181 //
182  for (i = 0; i < asz; i++)
183  {buff[j++] = hv[(bval[i] >> 4) & 0x0f];
184  buff[j++] = hv[ bval[i] & 0x0f];
185  }
186  buff[j] = '\0';
187 
188 // All done
189 //
190  return asz*2;
191 }

References XrdNetSockAddr::Addr, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.

Referenced by XrdOucReqID::XrdOucReqID(), and XrdOssPath::InitPrefix().

+ Here is the caller graph for this function:

◆ GetAddrs() [1/3]

const char * XrdNetUtils::GetAddrs ( const char *  hSpec,
XrdNetAddr aListP[],
int &  aListN,
XrdNetUtils::AddrOpts  opts = allIPMap,
int  pNum = PortInSpec 
)
static

Definition at line 274 of file XrdNetUtils.cc.

277 {
278  const char *eText;
279  hpSpec aInfo(opts);
280 
281 // Prep the returned fields
282 //
283  *aVec = 0;
284  aVsz = 0;
285 
286 // Parse the options
287 //
288  GetHints(aInfo, opts);
289 
290 // Parse the host specification and get addresses
291 //
292  if ((eText = GetHostPort(aInfo, hSpec, pNum))
293  || (eText = GetAInfo(aInfo))) return eText;
294 
295 // If we have any addresses, resize the vector with that many netaddr objects
296 // and then initialze each one of them.
297 //
298  if (aInfo.aNum4 || aInfo.aNum6)
299  {aVsz = aInfo.aNum4 + aInfo.aNum6;
300  *aVec = new XrdNetAddr[(unsigned int)aVsz];
301  FillAddr(aInfo, *aVec);
302  }
303 
304 // All done
305 //
306  return 0;
307 }
struct myOpts opts

References XrdNetSpace::hpSpec::aNum4, XrdNetSpace::hpSpec::aNum6, and opts.

Referenced by XrdNetRegistry::GetAddrs(), XrdCl::Utils::GetHostAddresses(), XrdNetAddr::Register(), and XrdNetIF::SetIF().

+ Here is the caller graph for this function:

◆ GetAddrs() [2/3]

const char * XrdNetUtils::GetAddrs ( const std::string &  hSpec,
std::vector< XrdNetAddr > &  aVec,
int *  ordn = 0,
AddrOpts  opts = allIPMap,
int  pNum = PortInSpec 
)
static

Version 2: Return multiple addresses associated with a host or IP address.

Parameters
hSpecReference to address specification (see version 1).
aVecReference to the vector to contain addresses.
ordnPointer to where the partition ordinal is to be stored.
optsOptions on what to return (see version 1).
pNumPort number argument (see version 1).
Returns
Success: 0 is returned. When ordn is not nil, the number of IPv4 entries (for order46) or IPv6 (for order64) entries that appear in the front of the vector. If ordering is not specified, the value is set to the size of the vector. Failure: the error message text describing the error and aVec is cleared (i.e. has no elements).

Definition at line 311 of file XrdNetUtils.cc.

314 {
315 // If this references a registered name, process it as such.
316 //
317  if (*(hSpec.c_str()) == XrdNetRegistry::pfx)
318  return XrdNetRegistry::GetAddrs(hSpec, aVec, ordn, opts, pNum);
319 
320 // Start up!
321 //
322  const char *eText;
323  hpSpec aInfo(opts);
324 
325 // Clear the result vector
326 //
327  aVec.clear();
328  if (ordn) *ordn = 0;
329 
330 // Parse the options
331 //
332  GetHints(aInfo, opts);
333 
334 // Parse the host specification and get address info
335 //
336  if ((eText = GetHostPort(aInfo, hSpec.c_str(), pNum))
337  || (eText = GetAInfo(aInfo))) return eText;
338 
339 // If we have any addresses, resize the vector with that many netaddr objects
340 // and then initialze each one of them.
341 //
342  if (aInfo.aNum4 || aInfo.aNum6)
343  {aVec.resize(aInfo.aNum4 + aInfo.aNum6);
344  FillAddr(aInfo, aVec.data(), ordn);
345  }
346 
347 // All done
348 //
349  return 0;
350 }
static const char * GetAddrs(const std::string &hSpec, std::vector< XrdNetAddr > &aVec, int *ordn=0, XrdNetUtils::AddrOpts opts=XrdNetUtils::allIPMap, int pNum=XrdNetUtils::PortInSpec)
static const char pfx
Registry names must start with this character.

References XrdNetSpace::hpSpec::aNum4, XrdNetSpace::hpSpec::aNum6, XrdNetRegistry::GetAddrs(), opts, and XrdNetRegistry::pfx.

+ Here is the call graph for this function:

◆ GetAddrs() [3/3]

const char * XrdNetUtils::GetAddrs ( std::vector< std::string > &  hSVec,
std::vector< XrdNetAddr > &  aVec,
int *  ordn = 0,
AddrOpts  opts = allIPMap,
unsigned int  rotNum = 0,
bool  force = false 
)
static

Version 3: Return multiple addresses associated with a list of host or IP addresses.

Parameters
hSVecvector of address specification (see version 1). Note that this version requires hSVec entries to have a port number.
aVecReference to the vector to contain addresses.
ordnPointer to where the partition ordinal is to be stored.
optsOptions on what to return (see version 1).
rotNumThe rotation factor to order addresses in the result.
forceWhen true resolution errors are ignored.
Returns
Success: 0 is returned. When ordn is not nil, the number of IPv4 entries (for order46) or IPv6 (for order64) entries that appear in the front of the vector. If ordering is not specified, the value is set to the size of the vector. Failure: the error message text describing the error and aVec is cleared (i.e. has no elements).

Definition at line 354 of file XrdNetUtils.cc.

358 {
359  const char *eText;
360  hpSpec aInfo(opts);
361 
362 // Clear the result vector and make sure we have something to do
363 //
364  aVec.clear();
365  if (ordn) *ordn = 0;
366  if (!hSVec.size()) return 0;
367 
368 // Parse the options
369 //
370  GetHints(aInfo, opts);
371 
372 // Process each specification
373 //
374  for (int i = 0; i < (int)hSVec.size(); i++)
375  {if (((eText = GetHostPort(aInfo, hSVec[i].c_str(), PortInSpec))
376  || (eText = GetAInfo(aInfo))) && !force) return eText;
377  }
378 
379 // Size the vector and fill it in
380 //
381  if (aInfo.aNum4 || aInfo.aNum6)
382  {aVec.resize(aInfo.aNum4 + aInfo.aNum6);
383  FillAddr(aInfo, aVec.data(), ordn, rotNum);
384  }
385 
386 // All done
387 //
388  return 0;
389 }
static const int PortInSpec
Definition: XrdNetUtils.hh:149

References XrdNetSpace::hpSpec::aNum4, XrdNetSpace::hpSpec::aNum6, and opts.

◆ GetSokInfo()

int XrdNetUtils::GetSokInfo ( int  fd,
char *  theAddr,
int  theALen,
char &  theType 
)
static

Obtain connection information from a socket.

Parameters
fdThe file descriptor of the socket whose address is to be converted. The sign of the fd indicates which address: fd > 0 the peer address is used (i.e. getpeername) fd < 0 the local address is used (i.e. getsockname)
theAddrpointer to a buffer of theAlen bytes where the text version of the IP address is to be returned. The text uses the actual native address format. If theAddr is nil or theAlen is not positive, only the port and address type are returned.
theALenlength of the theAddr buffer.
theTypeeither the character 4 (IPv4) or 6 (IPv6) is returned. corrresponding to the address family. Note that should be AF_INET6 but the address is mapped, '4' is returned.
Returns
Success: >= 0 corresponding to the port number.
Failure: < 0 corresponding to -errno.

Definition at line 533 of file XrdNetUtils.cc.

534 {
535  XrdNetSockAddr theIP;
536  XrdNetAddr ipAddr;
537  static const int fmtopts = XrdNetAddrInfo::noPortRaw
539  SOCKLEN_t addrSize = sizeof(theIP);
540  int rc;
541  unsigned short thePort;
542 
543 // The the address wanted
544 //
545  rc = (fd > 0 ? getpeername( fd, &theIP.Addr, &addrSize)
546  : getsockname(-fd, &theIP.Addr, &addrSize));
547  if (rc) return -errno;
548 
549 // Set the address
550 //
551  if (ipAddr.Set(&theIP.Addr)) return -EAFNOSUPPORT;
552 
553 // Establis the type of address we have
554 //
555  if (ipAddr.isIPType(XrdNetAddrInfo::IPv4) || ipAddr.isMapped()) theType='4';
556  else theType = '6';
557 
558 // Now format the address
559 //
560  if (theAddr && theALen > 0
561  && !ipAddr.Format(theAddr, theALen, XrdNetAddrInfo::fmtAddr, fmtopts))
562  return -EINVAL;
563 
564 // Get the port number and return it.
565 //
566  thePort = htons((theIP.Addr.sa_family == AF_INET
567  ? theIP.v4.sin_port : theIP.v6.sin6_port));
568  return static_cast<int>(thePort);
569 }
#define SOCKLEN_t
bool isMapped() const
static const int noPortRaw
Use raw address format (no port)
static const int prefipv4
Use if mapped IPV4 actual format.
bool isIPType(IPType ipType) const
int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
@ fmtAddr
Address using suitable ipv4 or ipv6 format.
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition: XrdNetAddr.cc:216

References XrdNetSockAddr::Addr, XrdNetAddrInfo::fmtAddr, XrdNetAddrInfo::Format(), XrdNetAddrInfo::IPv4, XrdNetAddrInfo::isIPType(), XrdNetAddrInfo::isMapped(), XrdNetAddrInfo::noPortRaw, XrdNetAddrInfo::prefipv4, XrdNetAddr::Set(), SOCKLEN_t, XrdNetSockAddr::v4, and XrdNetSockAddr::v6.

Referenced by XrdNetPMarkFF::Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Hosts()

XrdOucTList * XrdNetUtils::Hosts ( const char *  hSpec,
int  hPort = -1,
int  hWant = 8,
int *  sPort = 0,
const char **  eText = 0 
)
static

Obtain an easily digestable list of hosts. This is the list of up to eight unique aliases (i.e. with different addresses) assigned to a base hostname.

Parameters
hSpecthe host specification suitable for XrdNetAddr.Set().
hPortWhen >= 0 specified the port to use regardless of hSpec. When < 0 the port must be present in hSpec.
hWantMaximum number of list entries wanted. If hWant is greater that eight it is set eigth.
sPortIf not nil, the *sPort will be set to hPort if and only if the IP address in one of the entries matches the host address. Otherwise, the value is unchanged.
eTextWhen not nil, is where to place error message text.
Returns
Success: Pointer to a list of XrdOucTList objects where p->val is the port number p->text is the host name. The list of objects belongs to the caller. Failure: A nil pointer is returned. If eText is supplied, the error message, in persistent storage, is returned.

Definition at line 576 of file XrdNetUtils.cc.

578 {
579  static const int hMax = 8;
580  XrdNetAddr myAddr(0), aList[hMax];
581  XrdOucTList *tList = 0;
582  const char *etext, *hName;
583  int numIP, i, k;
584 
585 // Check if the port must be in the spec and set maximum
586 //
587  if (hPort < 0) hPort = XrdNetAddr::PortInSpec;
588  if (hWant > hMax) hWant = hMax;
589  else if (hWant < 1) hWant = 1;
590 
591 // Initialze the list of addresses
592 //
593  if ((etext = aList[0].Set(hSpec, numIP, hWant, hPort)))
594  {if (eText) *eText = etext;
595  return 0;
596  }
597 
598 // Create the tlist object list without duplicates. We may have duplicates as
599 // this may be a multi-homed node and we don't want to show that here.
600 //
601  for (i = 0; i < numIP; i++)
602  {if (sPort && myAddr.Same(&aList[i]))
603  {*sPort = aList[i].Port(); sPort = 0;}
604  hName = aList[i].Name("");
605  for (k = 0; k < i; k++) {if (!strcmp(hName, aList[k].Name(""))) break;}
606  if (k >= i) tList = new XrdOucTList(hName, aList[i].Port(), tList);
607  }
608 
609 // All done, return the result
610 //
611  if (eText) *eText = (tList ? 0 : "unknown processing error");
612  return tList;
613 }
const char * Name(const char *eName=0, const char **eText=0)
int Port(int pNum=-1)
Definition: XrdNetAddr.cc:156
static const int PortInSpec
Definition: XrdNetAddr.hh:112
static int Port(int fd, const char **eText=0)
Definition: XrdNetUtils.cc:815

References XrdNetAddrInfo::Name(), XrdNetAddr::Port(), and XrdNetAddr::PortInSpec.

Referenced by XrdCmsUtils::ParseMan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IPFormat() [1/2]

int XrdNetUtils::IPFormat ( const struct sockaddr *  sAddr,
char *  bP,
int  bL,
int  opts = 0 
)
static

Definition at line 619 of file XrdNetUtils.cc.

621 {
622  XrdNetAddr theAddr;
623  int fmtopts = (opts & oldFmt ? XrdNetAddrInfo::old6Map4 : 0);
624 
625 // Set the address
626 //
627  if (theAddr.Set(sAddr)) return 0;
628 
629 // Now format the address
630 //
631  if (opts & noPort) fmtopts |= XrdNetAddrInfo::noPort;
632  return theAddr.Format(bP, bL, XrdNetAddrInfo::fmtAdv6, fmtopts);
633 }
static const int noPort
Do not add port number.
static const int old6Map4
Use deprecated IPV6 mapped format.
static const int oldFmt
Definition: XrdNetUtils.hh:274
static const int noPort
Definition: XrdNetUtils.hh:273

References XrdNetAddrInfo::fmtAdv6, XrdNetAddrInfo::Format(), XrdNetAddrInfo::noPort, XrdNetAddrInfo::old6Map4, opts, and XrdNetAddr::Set().

Referenced by XrdSecProtocolsss::getCredentials(), XrdCl::Socket::GetPeerName(), and XrdCl::Socket::GetSockName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IPFormat() [2/2]

int XrdNetUtils::IPFormat ( int  fd,
char *  bP,
int  bL,
int  opts = 0 
)
static

Convert an IP socket address/port (V4 or V6) into the standard V6 RFC ASCII representation: "[address]:port".

Parameters
fdThe file descriptor of the socket whose address is to be converted. The sign of the fd indicates which address: fd > 0 the peer address is used (i.e. getpeername) fd < 0 the local address is used (i.e. getsockname)
bPpoints to a buffer large enough to hold the result. A buffer 64 characters long will always be big enough.
bLthe actual size of the buffer.
optsFormating options: noPort - does not suffix the port number with ":port". oldFmt - use the deprecated format for an IPV4 mapped address: [::d.d.d.d] vs [::ffff:d.d.d.d].
Returns
Success: The length of the formatted address is returned.
Failure: Zero is returned and the buffer state is undefined. Failure occurs when the buffer is too small or the file descriptor does not refer to an open socket.

Definition at line 637 of file XrdNetUtils.cc.

638 {
639  XrdNetSockAddr theIP;
640  SOCKLEN_t addrSize = sizeof(theIP);
641  int rc;
642 
643 // The the address wanted
644 //
645  rc = (fd > 0 ? getpeername( fd, &theIP.Addr, &addrSize)
646  : getsockname(-fd, &theIP.Addr, &addrSize));
647  if (rc) return 0;
648 
649 // Now format it
650 //
651  return IPFormat(&theIP.Addr, bP, bL, opts);
652 }
static int IPFormat(const struct sockaddr *sAddr, char *bP, int bL, int opts=0)
Definition: XrdNetUtils.cc:619

References XrdNetSockAddr::Addr, opts, and SOCKLEN_t.

◆ Match()

bool XrdNetUtils::Match ( const char *  hName,
const char *  pattern 
)
static

Determine if a hostname matches a pattern.

Parameters
hNamethe name of the host.
patternthe pattern to match against. The pattern may contain one If the pattern contains a single asterisk, then the prefix of hName is compared with the characters before the '*' and the suffix of hName is compared with the character after. If the pattern ends with a plus, the all then pattern is taken as a hostname (less '+') and expanded to all possible hostnames and each one is compared with hName. If the pattern contains both, the asterisk rule is used first. If it contains neither then strict equality is used.
Returns
Success: True, the pattern matches. Failure: False, no match found.

Definition at line 658 of file XrdNetUtils.cc.

659 {
660  static const int maxIP = 16;
661  const char *mval;
662  int i, j, k;
663 
664 // First check if this will match right away
665 //
666  if (!strcmp(HostPat, HostName)) return true;
667 
668 // Check for an asterisk do prefix/suffix match
669 //
670  if ((mval = index(HostPat, (int)'*')))
671  { i = mval - HostPat; mval++;
672  k = strlen(HostName); j = strlen(mval);
673  if ((i+j) > k
674  || strncmp(HostName, HostPat,i)
675  || strncmp((HostName+k-j),mval,j)) return false;
676  return 1;
677  }
678 
679 // Now check for host expansion
680 //
681  i = strlen(HostPat);
682  if (i && HostPat[i-1] == '+')
683  {XrdNetAddr InetAddr[maxIP];
684  char hBuff[264];
685  if (i >= (int)sizeof(hBuff)) return false;
686  memcpy(hBuff, HostPat, i-1);
687  hBuff[i-1] = 0;
688  if (InetAddr[0].Set(hBuff, i, maxIP, 0)) return false;
689  while(i--) if ((mval = InetAddr[i].Name()) && !strcmp(mval, HostName))
690  return true;
691  }
692 
693 // No matches
694 //
695  return false;
696 }

Referenced by XrdOucUtils::doIf().

+ Here is the caller graph for this function:

◆ MyHostName()

char * XrdNetUtils::MyHostName ( const char *  eName = "*unknown*",
const char **  eText = 0 
)
static

Get the fully qualified name of the current host.

Parameters
eNameThe name to be returned when the host name or its true address could not be returned. The pointer may be nil.
eTextWhen supplied will hold 0 if no errors occurred or error message text, in persistent storage, describing why the error-triggered alternate name was returned. If it contains neither then strict equality is used.
Returns
An strdup() copy of the host name, address , or eName; unless eName is nil, in which case a nil pointer is returned. The caller is responsible for freeing any returned string using free().

Definition at line 702 of file XrdNetUtils.cc.

703 {
704  const char *fqn = XrdNetIdentity::FQN(eText);
705 
706 // Return the appropriate result
707 //
708  if (!fqn) fqn = eName;
709  return (fqn ? strdup(fqn) : 0);
710 }
static const char * FQN(const char **etext=0)

References XrdNetIdentity::FQN().

Referenced by XrdNetPMarkCfg::Config(), XrdSecProtocolsss::Load_Client(), and XrdSecProtocolkrb5Init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NetConfig()

XrdNetUtils::NetProt XrdNetUtils::NetConfig ( XrdNetUtils::NetType  netquery = qryINET,
const char **  eText = 0 
)
static

Definition at line 716 of file XrdNetUtils.cc.

718 {
719  XrdNetAddr *myAddrs;
720  const char *eMsg;
721  char buff[1024];
722  NetProt hasProt = hasNone;
723  int aCnt, ifType;
724 
725 // Make sure we support this query
726 //
727  if (netquery != qryINET && netquery != qryINIF)
728  {if (eText) *eText = "unsupported NetType query";
729  return hasNone;
730  }
731 
732 // We base the nonfig of the interface addresses unless we can't query the if's
733 //
734  if (netquery == qryINIF && (ifType = XrdNetIF::GetIF((XrdOucTList **)0,0)))
735  {if (ifType & XrdNetIF::haveIPv4) hasProt = NetProt(hasProt | hasIPv4);
736  if (ifType & XrdNetIF::haveIPv6) hasProt = NetProt(hasProt | hasIPv6);
737  if (ifType & XrdNetIF::havePub4) hasProt = NetProt(hasProt | hasPub4);
738  if (ifType & XrdNetIF::havePub6) hasProt = NetProt(hasProt | hasPub6);
739  return hasProt;
740  }
741 
742 // Get our host name and initialize this object with it
743 //
744  gethostname(buff, sizeof(buff));
745  XrdOucUtils::toLower(buff);
746 
747 // Now get all of the addresses associated with this hostname
748 //
749  if ((eMsg = GetAddrs(buff, &myAddrs, aCnt, allIPv64, NoPortRaw)))
750  {if (eText) *eText = eMsg;
751  return hasNone;
752  }
753 
754 // Now run through all of the addresses to see what we have
755 //
756  for (int i = 0; i < aCnt && hasProt != hasIP64; i++)
757  { if (myAddrs[i].isIPType(XrdNetAddrInfo::IPv6))
758  {hasProt = NetProt(hasProt | hasIPv6);
759  if (!myAddrs[i].isPrivate())
760  hasProt = NetProt(hasProt | hasPub6);
761  }
762  else if (myAddrs[i].isIPType(XrdNetAddrInfo::IPv4))
763  {hasProt = NetProt(hasProt | hasIPv4);
764  if (!myAddrs[i].isPrivate())
765  hasProt = NetProt(hasProt | hasPub4);
766  }
767  }
768 
769 // Delete the array and return what we have
770 //
771  delete [] myAddrs;
772  if (hasProt == hasNone && eText) *eText = "";
773  return hasProt;
774 }
#define eMsg(x)
static const int haveIPv4
ifList == 0 && non-local ipv4 i/f found (or'd)
Definition: XrdNetIF.hh:150
static int GetIF(XrdOucTList **ifList, const char **eText=0)
Definition: XrdNetIF.cc:413
static const int havePub6
ifList == 0 && public ipv6 i/f found (or'd)
Definition: XrdNetIF.hh:160
static const int havePub4
ifList == 0 && public ipv4 i/f found (or'd)
Definition: XrdNetIF.hh:158
static const int haveIPv6
ifList == 0 && non-local ipv6 i/f found (or'd)
Definition: XrdNetIF.hh:152
static const int NoPortRaw
Definition: XrdNetUtils.hh:150
static const char * GetAddrs(const char *hSpec, XrdNetAddr *aListP[], int &aListN, AddrOpts opts=allIPMap, int pNum=PortInSpec)
Definition: XrdNetUtils.cc:274
static void toLower(char *str)

References eMsg, XrdNetIF::GetIF(), XrdNetIF::haveIPv4, XrdNetIF::haveIPv6, XrdNetIF::havePub4, XrdNetIF::havePub6, XrdNetAddrInfo::IPv4, XrdNetAddrInfo::IPv6, and XrdOucUtils::toLower().

Referenced by XrdCl::Stream::Stream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Parse()

bool XrdNetUtils::Parse ( const char *  hSpec,
const char **  hName,
const char **  hNend,
const char **  hPort,
const char **  hPend 
)
static

Parse an IP or host name specification.

Parameters
hSpecthe name or IP address of the host. As one of the following "[<ipv6>]:<port>", "<ipv4>:<port>", or "<name>:<port>".
hNameplace where the starting address of the host is placed.
hNendplace where the ending address+1 is placed. This will point to either ']', ':', or a null byte.
hPortplace where the starting address of the port is placed. If no ":port" was found, this will contain *hNend.
hPendplace where the ending address+1 is placed. If no port If no ":port" was found, this will contain *hNend.
Returns
Success: True. Failure: False, hSpec is not valid. Some output parameters may have been set but shlould be ignored.

Definition at line 780 of file XrdNetUtils.cc.

783 {
784  const char *asep = 0;
785 
786 // Parse the specification
787 //
788  if (*hSpec == '[')
789  {if (!(*hNend = index(hSpec+1, ']'))) return false;
790  *hName = hSpec+1; asep = (*hNend)+1;
791  } else {
792  *hName = hSpec;
793  if (!(*hNend = index(hSpec, ':'))) *hNend = hSpec + strlen(hSpec);
794  else asep = *hNend;
795  }
796 
797 // See if we have a port to parse. We stop on a non-alphameric.
798 //
799  if (asep && *asep == ':')
800  {*hPort = ++asep;
801  while(isalnum(*asep)) asep++;
802  if (*hPort == asep) return false;
803  *hPend = asep;
804  } else *hPort = *hPend = *hNend;
805 
806 // All done
807 //
808  return true;
809 }

Referenced by XrdOucUtils::isFWD(), XrdNetAddr::Set(), and XrdFfsMisc_get_list_of_data_servers().

+ Here is the caller graph for this function:

◆ Port()

int XrdNetUtils::Port ( int  fd,
const char **  eText = 0 
)
static

Obtain the numeric port associated with a file descriptor.

Parameters
fdthe file descriptor number.
eTextwhen not null, the reason for a failure is returned.
Returns
Success: The positive port number. Failure: 0 is returned and if eText is not null, the error message.

Definition at line 815 of file XrdNetUtils.cc.

816 {
817  XrdNetSockAddr Inet;
818  SOCKLEN_t slen = (socklen_t)sizeof(Inet);
819  int rc;
820 
821  if ((rc = getsockname(fd, &Inet.Addr, &slen)))
822  {rc = errno;
823  if (eText) setET(eText, errno);
824  return -rc;
825  }
826 
827  return static_cast<int>(ntohs(Inet.v6.sin6_port));
828 }

References XrdNetSockAddr::Addr, SOCKLEN_t, and XrdNetSockAddr::v6.

Referenced by XrdNet::Bind().

+ Here is the caller graph for this function:

◆ ProtoID()

int XrdNetUtils::ProtoID ( const char *  pName)
static

Obtain the protocol identifier.

Parameters
pNamethe name of the protocol (e.g. "tcp").
Returns
The protocol identifier.

Definition at line 838 of file XrdNetUtils.cc.

839 {
840 #ifdef HAVE_PROTOR
841  struct protoent pp;
842  char buff[1024];
843 #else
844  static XrdSysMutex protomutex;
845  struct protoent *pp;
846  int protoid;
847 #endif
848 
849 // Note that POSIX did include getprotobyname_r() in the last minute. Many
850 // platforms do not document this variant but just about all include it.
851 //
852 #ifdef __solaris__
853  if (!getprotobyname_r(pname, &pp, buff, sizeof(buff)))
854  return IPPROTO_TCP;
855  return pp.p_proto;
856 #elif !defined(HAVE_PROTOR)
857  protomutex.Lock();
858  if (!(pp = getprotobyname(pname))) protoid = IPPROTO_TCP;
859  else protoid = pp->p_proto;
860  protomutex.UnLock();
861  return protoid;
862 #else
863  struct protoent *ppp;
864  if (getprotobyname_r(pname, &pp, buff, sizeof(buff), &ppp))
865  return IPPROTO_TCP;
866  return pp.p_proto;
867 #endif
868 }
#define IPPROTO_TCP
Definition: XrdNetUtils.cc:835

References IPPROTO_TCP, XrdSysMutex::Lock(), and XrdSysMutex::UnLock().

Referenced by XrdNetSocket::setOpts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ServPort()

int XrdNetUtils::ServPort ( const char *  sName,
bool  isUDP = false,
const char **  eText = 0 
)
static

Obtain the numeric port corresponding to a symbolic name.

Parameters
sNamethe name of the service or a numeric port number.
isUDPif true, returns the UDP service port o/w the TCP service
eTextwhen not null, the reason for a failure is returned.
Returns
Success: The positive port number. Failure: 0 is returned and if eText is not null, the error message.

Definition at line 874 of file XrdNetUtils.cc.

875 {
876  struct addrinfo *rP = 0, myHints;
877  int rc, portnum = 0;
878 
879 // First check if this is a plain number
880 //
881  if (isdigit(*sName))
882  {char *send;
883  portnum = strtol(sName, &send, 10);
884  if (portnum > 0 && portnum < 65536 && *send == 0) return portnum;
885  if (eText) *eText = "invalid port number";
886  return 0;
887  }
888 
889 // Fill out the hints
890 //
891  memset(&myHints, 0, sizeof(myHints));
892  myHints.ai_socktype = (isUDP ? SOCK_DGRAM : SOCK_STREAM);
893 
894 // Try to find the port number
895 //
896  rc = getaddrinfo(0, sName, &myHints, &rP);
897  if (rc || !rP)
898  {if (eText) *eText = (rc ? gai_strerror(rc) : "service not found");
899  if (rP) freeaddrinfo(rP);
900  return 0;
901  }
902 
903 // Return the port number
904 //
905  portnum = int(ntohs(SIN_PORT(rP))) & 0x0000ffff;
906  freeaddrinfo(rP);
907  if (!portnum && eText) *eText = "service has no port";
908  return portnum;
909 }
#define SIN_PORT(x)
Definition: XrdNetUtils.cc:199

References SIN_PORT.

Referenced by XrdOuca2x::a2p(), XrdCmsUtils::ParseMan(), and XrdNetAddr::Set().

+ Here is the caller graph for this function:

◆ SetAuto()

int XrdNetUtils::SetAuto ( XrdNetUtils::AddrOpts  aOpts = allIPMap)
static

Set the family and hints to be used in GetAddrs() with prefAuto. This is used within this class and by XrdNetAddr when the IP mode changes. It is meant for internal use only.

Parameters
aOptsIs one of the following from the AddrOpts enum: allIPMap - Use IPv6 and mapped IPv4 addrs (default) onlyIPv4 - Use only IPv4 addresses. prefAuto - Determine proper options based on configuration.
Returns
The getaddrinfo() hints value that should be used.

Definition at line 915 of file XrdNetUtils.cc.

916 {
917 
918 // If a specific family is not specified, then determine which families to use
919 //
920  if (aOpts != onlyIPv4 && aOpts != allIPMap)
921  {int ifTypes = XrdNetIF::GetIF(0);
922  if (ifTypes & XrdNetIF::haveIPv6) aOpts = allIPMap;
923  else if (ifTypes & XrdNetIF::haveIPv4) aOpts = onlyIPv4;
924  else {autoFamily = AF_UNSPEC; autoHints = AI_V4MAPPED | AI_ADDRCONFIG;
925  return AI_V4MAPPED | AI_ADDRCONFIG;
926  }
927  }
928 
929 // If this is forced IPv4 then we know how to set the hints
930 //
931  if (aOpts == onlyIPv4)
932  {autoFamily = AF_INET; autoHints = 0; return 0;}
933 
934 // So, this is IPv6. Be as flexible as possible.
935 //
936  autoFamily = AF_INET6;
937  autoHints = AI_V4MAPPED | AI_ALL;
938  return AI_V4MAPPED | AI_ALL;
939 }

References XrdNetIF::GetIF(), XrdNetIF::haveIPv4, and XrdNetIF::haveIPv6.

Referenced by XrdNetAddr::SetIPV4(), and XrdNetAddr::SetIPV6().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Singleton()

bool XrdNetUtils::Singleton ( const char *  hSpec,
const char **  eText = 0 
)
static

Check if whether or not a host name represents more than one unique host.

Parameters
hSpecthe host specification suitable for XrdNetAddr.Set().
eTextWhen not nil, is where to place error message text.
Returns
True is this is a simple single host. False if the name represensts more than one single host.

Definition at line 956 of file XrdNetUtils.cc.

957 {
958  XrdOucTList *hList, *hNow;
959  bool isSingle;
960 
961 // Obtain a list of unique hostnames associated with this host
962 //
963  hList = Hosts(hSpec, 1234, 2, 0, eText);
964 
965 // If this is none or only one then this is a singleton
966 //
967  isSingle = !hList || hList->next == 0;
968 
969 // Free up the list of hosts
970 //
971  while((hNow = hList))
972  {hList = hList->next;
973  delete hNow;
974  };
975 
976 // All done
977 //
978  return isSingle;
979 }
static XrdOucTList * Hosts(const char *hSpec, int hPort=-1, int hWant=8, int *sPort=0, const char **eText=0)
Definition: XrdNetUtils.cc:576
XrdOucTList * next
Definition: XrdOucTList.hh:45

References XrdOucTList::next.

Referenced by XrdSsiClientProvider::GetService().

+ Here is the caller graph for this function:

Member Data Documentation

◆ noPort

const int XrdNetUtils::noPort = 1
static

Convert an IP address/port (V4 or V6) into the standard V6 RFC ASCII representation: "[address]:port".

Parameters
sAddrAddress to convert. This is either sockaddr_in or sockaddr_in6 cast to struct sockaddr.
bPpoints to a buffer large enough to hold the result. A buffer 64 characters long will always be big enough.
bLthe actual size of the buffer.
optsFormating options: noPort - does not suffix the port number with ":port". oldFmt - use the deprecated format for an IPV4 mapped address: [::d.d.d.d] vs [::ffff:d.d.d.d].
Returns
Success: The length of the formatted address is returned.
Failure: Zero is returned and the buffer state is undefined. Failure occurs when the buffer is too small or the address family (sAddr->sa_family) is neither AF_INET nor AF_INET6.

Definition at line 273 of file XrdNetUtils.hh.

◆ NoPortRaw

const int XrdNetUtils::NoPortRaw = (int)0xC0000000
static

Definition at line 150 of file XrdNetUtils.hh.

Referenced by XrdNetAddr::Register().

◆ oldFmt

const int XrdNetUtils::oldFmt = 2
static

Definition at line 274 of file XrdNetUtils.hh.

Referenced by XrdSecProtocolsss::getCredentials().

◆ PortInSpec

const int XrdNetUtils::PortInSpec = (int)0x80000000
static

Definition at line 149 of file XrdNetUtils.hh.


The documentation for this class was generated from the following files: