📄 pdns_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>pdns.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>pdns.h</h1><a href="pdns_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * pdns.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * PWLib library for DNS lookup services</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 2003 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Contributor(s): ______________________________________.</span>00025 <span class="comment"> *</span>00026 <span class="comment"> * $Log: pdns.h,v $</span>00027 <span class="comment"> * Revision 1.8 2004/06/24 07:36:24 csoutheren</span>00028 <span class="comment"> * Added definitions of T_SRV and T_NAPTR for hosts that do not have these</span>00029 <span class="comment"> *</span>00030 <span class="comment"> * Revision 1.7 2004/05/31 12:49:47 csoutheren</span>00031 <span class="comment"> * Added handling of unknown DNS types</span>00032 <span class="comment"> *</span>00033 <span class="comment"> * Revision 1.6 2004/05/28 06:50:42 csoutheren</span>00034 <span class="comment"> * Reorganised DNS functions to use templates, and exposed more internals to allow new DNS lookup types to be added</span>00035 <span class="comment"> *</span>00036 <span class="comment"> * Revision 1.5 2003/07/22 23:52:20 dereksmithies</span>00037 <span class="comment"> * Fix from Fabrizio Ammollo to cope with when P_DNS is disabled. Thanks!</span>00038 <span class="comment"> *</span>00039 <span class="comment"> * Revision 1.4 2003/04/16 07:02:55 robertj</span>00040 <span class="comment"> * Cleaned up source.</span>00041 <span class="comment"> *</span>00042 <span class="comment"> * Revision 1.3 2003/04/15 08:14:06 craigs</span>00043 <span class="comment"> * Added single string form of GetSRVRecords</span>00044 <span class="comment"> *</span>00045 <span class="comment"> * Revision 1.2 2003/04/15 08:06:24 craigs</span>00046 <span class="comment"> * Added Unix implementation</span>00047 <span class="comment"> *</span>00048 <span class="comment"> * Revision 1.1 2003/04/15 04:06:56 craigs</span>00049 <span class="comment"> * Initial version</span>00050 <span class="comment"> *</span>00051 <span class="comment"> */</span>00052 00053 <span class="preprocessor">#if P_DNS</span>00054 <span class="preprocessor"></span><span class="preprocessor">#ifndef _PDNS_H</span>00055 <span class="preprocessor"></span><span class="preprocessor">#define _PDNS_H</span>00056 <span class="preprocessor"></span>00057 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00058 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00059 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00060 <span class="preprocessor"></span>00061 <span class="preprocessor">#include <<a class="code" href="sockets_8h.html">ptlib/sockets.h</a>></span>00062 00063 <span class="preprocessor">#include <<a class="code" href="random_8h.html">ptclib/random.h</a>></span>00064 00065 <span class="preprocessor">#if defined(_WIN32)</span>00066 <span class="preprocessor"></span>00067 <span class="preprocessor"># include <windns.h></span>00068 <span class="preprocessor"># pragma comment(lib, P_DNS_LIBRARY)</span>00069 <span class="preprocessor"></span>00070 <span class="preprocessor">#else</span>00071 <span class="preprocessor"></span>00072 <span class="preprocessor"># define P_HAS_RESOLVER 1 // set if using Unix-style DNS routines</span>00073 <span class="preprocessor"></span><span class="preprocessor"># include <arpa/nameser.h></span>00074 <span class="preprocessor"># include <resolv.h></span>00075 <span class="preprocessor"># if defined(P_MACOSX) && (P_MACOSX >= 700)</span>00076 <span class="preprocessor"></span><span class="preprocessor"># include <arpa/nameser_compat.h></span>00077 <span class="preprocessor"># endif</span>00078 <span class="preprocessor"></span>00079 <span class="preprocessor">#endif // _WIN32</span>00080 <span class="preprocessor"></span>00081 <span class="preprocessor">#ifdef P_HAS_RESOLVER</span>00082 <span class="preprocessor"></span>00084 <span class="comment">//</span>00085 <span class="comment">// these classes provide an emulation of the Microsoft DNS API </span>00086 <span class="comment">// on non-Window systems</span>00087 <span class="comment">//</span>00088 00089 <span class="preprocessor">#ifndef T_SRV</span>00090 <span class="preprocessor"></span><span class="preprocessor">#define T_SRV 33</span>00091 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00092 <span class="preprocessor"></span>00093 <span class="preprocessor">#ifndef T_NAPTR</span>00094 <span class="preprocessor"></span><span class="preprocessor">#define T_NAPTR 35</span>00095 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00096 <span class="preprocessor"></span>00097 00098 <span class="preprocessor">#define DNS_STATUS int</span>00099 <span class="preprocessor"></span><span class="preprocessor">#define DNS_TYPE_SRV T_SRV</span>00100 <span class="preprocessor"></span><span class="preprocessor">#define DNS_TYPE_MX T_MX</span>00101 <span class="preprocessor"></span><span class="preprocessor">#define DNS_TYPE_A T_A</span>00102 <span class="preprocessor"></span><span class="preprocessor">#define DNS_TYPE_NAPTR T_NAPTR</span>00103 <span class="preprocessor"></span><span class="preprocessor">#define DnsFreeRecordList 0</span>00104 <span class="preprocessor"></span><span class="preprocessor">#define DNS_QUERY_STANDARD 0</span>00105 <span class="preprocessor"></span><span class="preprocessor">#define DNS_QUERY_BYPASS_CACHE 0</span>00106 <span class="preprocessor"></span>00107 <span class="keyword">typedef</span> <span class="keyword">struct </span>_DnsAData {00108 DWORD IpAddress;00109 } DNS_A_DATA;00110 00111 <span class="keyword">typedef</span> <span class="keyword">struct </span>{00112 <span class="keywordtype">char</span> pNameExchange[MAXDNAME];00113 WORD wPreference;00114 } DNS_MX_DATA;00115 00116 <span class="keyword">typedef</span> <span class="keyword">struct </span>{00117 <span class="keywordtype">char</span> pNameHost[MAXDNAME];00118 } DNS_PTR_DATA;00119 00120 <span class="keyword">typedef</span> <span class="keyword">struct </span>_DnsSRVData {00121 <span class="keywordtype">char</span> pNameTarget[MAXDNAME];00122 WORD wPriority;00123 WORD wWeight;00124 WORD wPort;00125 } DNS_SRV_DATA;00126 00127 <span class="keyword">typedef</span> <span class="keyword">struct </span>_DnsNULLData {00128 DWORD dwByteCount;00129 <span class="keywordtype">char</span> data[1];00130 } DNS_NULL_DATA;00131 00132 <span class="keyword">typedef</span> <span class="keyword">struct </span>_DnsRecordFlags00133 {00134 <span class="keywordtype">unsigned</span> Section : 2;00135 <span class="keywordtype">unsigned</span> Delete : 1;00136 <span class="keywordtype">unsigned</span> CharSet : 2;00137 <span class="keywordtype">unsigned</span> Unused : 3;00138 <span class="keywordtype">unsigned</span> Reserved : 24;00139 } DNS_RECORD_FLAGS;00140 00141 <span class="keyword">typedef</span> <span class="keyword">enum</span> _DnsSection00142 {00143 DnsSectionQuestion,00144 DnsSectionAnswer,00145 DnsSectionAuthority,00146 DnsSectionAddtional,00147 } DNS_SECTION;00148 00149 00150 <span class="keyword">class </span>DnsRecord {00151 <span class="keyword">public</span>:00152 DnsRecord * pNext;00153 <span class="keywordtype">char</span> pName[MAXDNAME];00154 WORD wType;00155 WORD wDataLength;00156 00157 <span class="keyword">union </span>{00158 DWORD DW; <span class="comment">// flags as DWORD</span>00159 DNS_RECORD_FLAGS S; <span class="comment">// flags as structure</span>00160 } Flags;00161 00162 <span class="keyword">union </span>{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -