PTLib
Version 2.14.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
enum.h
Go to the documentation of this file.
1
/*
2
* pdns.h
3
*
4
* PWLib library for ENUM lookup
5
*
6
* Portable Windows Library
7
*
8
* Copyright (C) 2004 Post Increment
9
*
10
* The contents of this file are subject to the Mozilla Public License
11
* Version 1.0 (the "License"); you may not use this file except in
12
* compliance with the License. You may obtain a copy of the License at
13
* http://www.mozilla.org/MPL/
14
*
15
* Software distributed under the License is distributed on an "AS IS"
16
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17
* the License for the specific language governing rights and limitations
18
* under the License.
19
*
20
* The Original Code is Portable Windows Library.
21
*
22
* The Initial Developer of the Original Code is Post Increment
23
*
24
* Contributor(s): ______________________________________.
25
*
26
* $Revision: 28207 $
27
* $Author: rjongbloed $
28
* $Date: 2012-08-17 10:09:54 +1000 (Fri, 17 Aug 2012) $
29
*/
30
31
#ifndef PTLIB_ENUM_H
32
#define PTLIB_ENUM_H
33
34
#ifdef P_USE_PRAGMA
35
#pragma interface
36
#endif
37
38
#include <
ptclib/pdns.h
>
39
40
#if P_DNS_RESOLVER && P_URL
41
42
namespace
PDNS {
43
44
#ifndef NAPTR_SRV
45
#define NAPTR_SRV 35
46
#endif
47
49
50
class
NAPTRRecord
:
public
PObject
51
{
52
PCLASSINFO(
NAPTRRecord
,
PObject
);
53
public
:
54
Comparison
Compare
(
const
PObject
& obj)
const
;
55
void
PrintOn
(ostream & strm)
const
;
56
57
WORD
order
;
58
WORD
preference
;
59
PString
flags
;
60
PString
service
;
61
PString
regex
;
62
PString
replacement
;
63
};
64
65
PDECLARE_SORTED_LIST
(NAPTRRecordList,
PDNS::NAPTRRecord
)
66
public:
67
void
PrintOn
(ostream & strm) const;
68
69
NAPTRRecord
*
GetFirst
(const
char
* service = NULL);
70
NAPTRRecord
*
GetNext
(const
char
* service = NULL);
71
72
PDNS::
NAPTRRecord
*
HandleDNSRecord
(
PDNS_RECORD
dnsRecord,
PDNS_RECORD
results);
73
74
void
UnlockOrder
()
75
{
orderLocked
=
false
; }
76
77
protected
:
78
PINDEX
currentPos
;
79
int
lastOrder
;
80
PBoolean
orderLocked
;
81
};
82
83
inline
PBoolean
GetRecords
(
const
PString
& domain, NAPTRRecordList & recordList)
84
{
return
Lookup<NAPTR_SRV, NAPTRRecordList, NAPTRRecord>(domain, recordList); }
85
89
void
SetENUMServers
(
const
PStringArray
& serverlist);
90
97
PBoolean
ENUMLookup
(
98
const
PString
& dn,
99
const
PString
& service,
100
const
PStringArray
& domains,
101
PString
& URL
102
);
103
112
PBoolean
ENUMLookup
(
const
PString
& dn,
113
const
PString
& service,
114
PString
& URL
115
);
116
117
119
/* Uniform Resource Name Resolver Discovery System URN RDS
120
This can be used to Host URI domains on hosting servers.
121
This implementation follows RFC 2915 sect 7.1 Example 2:
122
Example
123
Question: find h323:me@a.com by looking up mydomain.com
124
Query the top most NAPTR record of mydomain.com for h323:me@a.com
125
IN NAPTR 100 10 "" "" ^h323:(.+)@([a-z0-9\-\.]*);*(.*)$/\2.subs.mydomain.com/i
126
this converts a.com to a.com.subs.mydomain.com
127
Query H323+D2U NAPTR record for a.com.subs.mydomain.com
128
IN NAPTR 100 50 "s" "H323+D2U" "" _h323ls._udp.host.com
129
Query SRV records for host.com
130
_h323ls._udp.host.com 172800 IN SRV 0 0 1719 gk.host.com
131
132
Answer: find h323:me@a.com by LRQ to gk.host.com:1719
133
*/
134
138
void
SetRDSServers
(
const
PStringArray
& servers);
139
149
PBoolean
RDSLookup
(
const
PURL
& url,
150
const
PString
& service,
151
PStringList
& dn
152
);
153
162
PBoolean
RDSLookup
(
const
PURL
& url,
163
const
PString
& service,
164
const
PStringArray
& naptrSpaces,
165
PStringList
& returnStr
166
);
167
168
};
// namespace PDNS
169
170
#endif // P_DNS_RESOLVER && P_URL
171
172
#endif // PTLIB_ENUM_H
173
174
175
// End Of File ///////////////////////////////////////////////////////////////
include
ptclib
enum.h
Generated on Fri Oct 10 2014 21:15:12 for PTLib by
1.8.3.1