xrootd
Loading...
Searching...
No Matches
XrdNetAddr.hh
Go to the documentation of this file.
1#ifndef __XRDNETADDR_HH__
2#define __XRDNETADDR_HH__
3/******************************************************************************/
4/* */
5/* X r d N e t A d d r . h h */
6/* */
7/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34
35//------------------------------------------------------------------------------
37//------------------------------------------------------------------------------
38
39struct addrinfo;
40
42{
43public:
44
45//------------------------------------------------------------------------------
50//------------------------------------------------------------------------------
51
52static bool DynDNS() {return dynDNS;}
53
54//------------------------------------------------------------------------------
59//------------------------------------------------------------------------------
60
61static bool IPV4Set() {return useIPV4;}
62
63//------------------------------------------------------------------------------
71//------------------------------------------------------------------------------
72
73int Port(int pNum=-1);
74
75//------------------------------------------------------------------------------
84//------------------------------------------------------------------------------
85
86bool Register(const char *hName);
87
88//------------------------------------------------------------------------------
110//------------------------------------------------------------------------------
111
112static const int PortInSpec = (int)0x80000000;
113
114const char *Set(const char *hSpec, int pNum=PortInSpec);
115
116//------------------------------------------------------------------------------
144//------------------------------------------------------------------------------
145
146const char *Set(const char *hSpec, int &numIP, int maxIP,
147 int pNum=PortInSpec, bool forUDP=false);
148
149//------------------------------------------------------------------------------
159//------------------------------------------------------------------------------
160
161const char *Set(const struct sockaddr *sockP, int sockFD=-1);
162
163//------------------------------------------------------------------------------
174//------------------------------------------------------------------------------
175
176const char *Set(int sockFD, bool peer=true);
177
178//------------------------------------------------------------------------------
188//------------------------------------------------------------------------------
189
190const char *Set(struct addrinfo *rP, int port, bool mapit=false);
191
192//------------------------------------------------------------------------------
195//------------------------------------------------------------------------------
196
197static void SetCache(int keeptime);
198
199//------------------------------------------------------------------------------
203//------------------------------------------------------------------------------
204
205 void SetDialect(const char *dP) {protName = dP;}
206
207//------------------------------------------------------------------------------
212//------------------------------------------------------------------------------
213
214static void SetDynDNS(bool onoff);
215
216//------------------------------------------------------------------------------
221//------------------------------------------------------------------------------
222
223static void SetIPV4();
224
225//------------------------------------------------------------------------------
231//------------------------------------------------------------------------------
232
233static void SetIPV6();
234
235//------------------------------------------------------------------------------
240//------------------------------------------------------------------------------
241
243
244//------------------------------------------------------------------------------
248//------------------------------------------------------------------------------
249
250void SetTLS(bool val);
251
252//------------------------------------------------------------------------------
254//------------------------------------------------------------------------------
255
256//------------------------------------------------------------------------------
263//------------------------------------------------------------------------------
264
266
267 XrdNetAddr(const XrdNetAddr *addr) : XrdNetAddrInfo(addr) {}
268
269 XrdNetAddr(const sockaddr *addr) : XrdNetAddrInfo()
270 {Set(addr);}
271
272 XrdNetAddr(const sockaddr_in *addr) : XrdNetAddrInfo()
273 {Set((sockaddr *)addr);}
274
275 XrdNetAddr(const sockaddr_in6 *addr) : XrdNetAddrInfo()
276 {Set((sockaddr *)addr);}
277
278 XrdNetAddr(int port);
279
280//------------------------------------------------------------------------------
282//------------------------------------------------------------------------------
283
285private:
286static struct addrinfo *Hints(int htype, int stype);
287bool Map64();
288
289static struct addrinfo *hostHints;
290static struct addrinfo *huntHintsTCP;
291static struct addrinfo *huntHintsUDP;
292static bool useIPV4;
293static bool dynDNS;
294};
295#endif
Definition XrdNetAddrInfo.hh:54
const char * protName
Definition XrdNetAddrInfo.hh:369
Definition XrdNetAddr.hh:42
static bool useIPV4
Definition XrdNetAddr.hh:292
void SetDialect(const char *dP)
Definition XrdNetAddr.hh:205
~XrdNetAddr()
Destructor.
Definition XrdNetAddr.hh:284
XrdNetAddr()
Assignment operator and copy constructor are inherited, no need to define.
Definition XrdNetAddr.hh:265
const char * Set(struct addrinfo *rP, int port, bool mapit=false)
XrdNetAddr(const XrdNetAddr *addr)
Definition XrdNetAddr.hh:267
static void SetIPV4()
bool Register(const char *hName)
bool Map64()
XrdNetAddr(int port)
XrdNetAddr(const sockaddr_in6 *addr)
Definition XrdNetAddr.hh:275
static struct addrinfo * huntHintsUDP
Definition XrdNetAddr.hh:291
static void SetIPV6()
XrdNetAddr(const sockaddr_in *addr)
Definition XrdNetAddr.hh:272
void SetLocation(XrdNetAddrInfo::LocInfo &loc)
static bool DynDNS()
Definition XrdNetAddr.hh:52
static void SetCache(int keeptime)
const char * Set(const struct sockaddr *sockP, int sockFD=-1)
static struct addrinfo * Hints(int htype, int stype)
const char * Set(int sockFD, bool peer=true)
const char * Set(const char *hSpec, int &numIP, int maxIP, int pNum=PortInSpec, bool forUDP=false)
void SetTLS(bool val)
int Port(int pNum=-1)
XrdNetAddr(const sockaddr *addr)
Definition XrdNetAddr.hh:269
static struct addrinfo * huntHintsTCP
Definition XrdNetAddr.hh:290
static bool IPV4Set()
Definition XrdNetAddr.hh:61
static bool dynDNS
Definition XrdNetAddr.hh:293
static void SetDynDNS(bool onoff)
static const int PortInSpec
Definition XrdNetAddr.hh:112
const char * Set(const char *hSpec, int pNum=PortInSpec)
static struct addrinfo * hostHints
Definition XrdNetAddr.hh:289
Definition XrdNetAddrInfo.hh:195