PWLib
1.10.10
|
00001 /* 00002 * pdns.h 00003 * 00004 * PWLib library for ENUM lookup 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (C) 2004 Post Increment 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Post Increment 00023 * 00024 * Contributor(s): ______________________________________. 00025 * 00026 * $Log: enum.h,v $ 00027 * Revision 1.5 2005/11/30 12:47:37 csoutheren 00028 * Removed tabs, reformatted some code, and changed tags for Doxygen 00029 * 00030 * Revision 1.4 2005/08/31 23:55:48 csoutheren 00031 * Fixed typo 00032 * 00033 * Revision 1.3 2005/08/31 05:55:03 shorne 00034 * Reworked ENUM to craigs' exacting requirements 00035 * 00036 * Revision 1.2 2005/08/31 04:07:52 shorne 00037 * added ability to set ENUM Servers at runtime 00038 * 00039 * Revision 1.1 2004/05/31 13:56:37 csoutheren 00040 * Added implementation of ENUM resolution of E.164 numbers by DNS 00041 * 00042 */ 00043 00044 #if P_DNS 00045 00046 #ifndef _PENUM_H 00047 #define _PENUM_H 00048 00049 #ifdef P_USE_PRAGMA 00050 #pragma interface 00051 #endif 00052 00053 #include <ptclib/pdns.h> 00054 00055 namespace PDNS { 00056 00057 #ifndef NAPTR_SRV 00058 #define NAPTR_SRV 35 00059 #endif 00060 00062 00063 class NAPTRRecord : public PObject 00064 { 00065 PCLASSINFO(NAPTRRecord, PObject); 00066 public: 00067 Comparison Compare(const PObject & obj) const; 00068 void PrintOn(ostream & strm) const; 00069 00070 WORD order; 00071 WORD preference; 00072 PString flags; 00073 PString service; 00074 PString regex; 00075 PString replacement; 00076 }; 00077 00078 PDECLARE_SORTED_LIST(NAPTRRecordList, PDNS::NAPTRRecord) 00079 public: 00080 void PrintOn(ostream & strm) const; 00081 00082 NAPTRRecord * GetFirst(const char * service = NULL); 00083 NAPTRRecord * GetNext(const char * service = NULL); 00084 00085 PDNS::NAPTRRecord * HandleDNSRecord(PDNS_RECORD dnsRecord, PDNS_RECORD results); 00086 00087 void UnlockOrder() 00088 { orderLocked = FALSE; } 00089 00090 protected: 00091 PINDEX currentPos; 00092 int lastOrder; 00093 BOOL orderLocked; 00094 }; 00095 00096 inline BOOL GetRecords(const PString & domain, NAPTRRecordList & recordList) 00097 { return Lookup<NAPTR_SRV, NAPTRRecordList, NAPTRRecord>(domain, recordList); } 00098 00102 void SetENUMServers(const PStringArray & serverlist); 00103 00110 BOOL ENUMLookup( 00111 const PString & dn, 00112 const PString & service, 00113 const PStringArray & domains, 00114 PString & URL 00115 ); 00116 00125 BOOL ENUMLookup(const PString & dn, 00126 const PString & service, 00127 PString & URL 00128 ); 00129 00130 }; // namespace PDNS 00131 00132 #endif // _PENUM_H 00133 #endif // P_DNS 00134 00135 // End Of File ///////////////////////////////////////////////////////////////