TraceRouteSocketReverseDNS.hGo to the documentation of this file.00001 /* 00002 * Copyright (c) 2000-2003 Barak Weichselbaum <barak@komodia.com> 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 00015 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00016 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00017 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00018 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00019 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00020 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00021 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00022 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00023 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00024 * SUCH DAMAGE. 00025 * 00026 * Contact info: 00027 * ------------- 00028 * 00029 * Site: http://www.komodia.com 00030 * Main contact: barak@komodia.com 00031 * For custom projects, 00032 * consulting, or other 00033 * paid services: sales@komodia.com 00034 */ 00035 00036 #if !defined(AFX_TRACEROUTESOCKETREVERSEDNS_H__55BEFFAA_FEFF_483E_90A7_B2F1D3A7A13F__INCLUDED_) 00037 #define AFX_TRACEROUTESOCKETREVERSEDNS_H__55BEFFAA_FEFF_483E_90A7_B2F1D3A7A13F__INCLUDED_ 00038 00039 #if _MSC_VER > 1000 00040 #pragma once 00041 #endif // _MSC_VER > 1000 00042 00043 #include "TraceRouteSocket.h" 00044 00045 namespace KomodiaDNS 00046 { 00047 class CDNSManager; 00048 } 00049 00050 KOMODIA_NAMESPACE_START 00051 00052 class CGenericThread; 00053 00054 class CTraceRouteSocketReverseDNS : public CTraceRouteSocket 00055 { 00056 public: 00057 //Our data 00058 typedef struct _DNSTraceRouteData : public CTraceRouteSocket::_TraceRouteData 00059 { 00060 std::string sReverseDNS; 00061 } DNSTraceRouteData; 00062 00063 //The data we pass back 00064 typedef std::vector<DNSTraceRouteData> DNSTraceRouteVector; 00065 public: 00066 //Are we initialized 00067 BOOL IsInitialized()const; 00068 00069 //Do the trace 00070 virtual BOOL TraceRoute(IP aDestinationAddress, 00071 DWORD dwTimeout, 00072 unsigned char ucTTL=30); 00073 00074 //Take the data 00075 void TakeDNSData(DNSTraceRouteVector& rVector); 00076 00077 //Get the data 00078 DNSTraceRouteVector& GetDNSData(); 00079 00080 //Is the traced done 00081 virtual BOOL IsTraceDone()const; 00082 00083 //Ctor and Dtor 00084 CTraceRouteSocketReverseDNS(const std::string& rDNSServer, 00085 BOOL bDNSTcp); 00086 virtual ~CTraceRouteSocketReverseDNS(); 00087 protected: 00088 //ctor 00089 CTraceRouteSocketReverseDNS(std::string sDNSServer, 00090 BOOL bDNSTcp, 00091 BOOL bAsync); 00092 00093 //Is the trace done 00094 virtual void DNSTraceDone(); 00095 private: 00096 //No copy Ctor 00097 CTraceRouteSocketReverseDNS(const CTraceRouteSocketReverseDNS& rTrace); 00098 00099 //No copy operator 00100 CTraceRouteSocketReverseDNS& operator=(const CTraceRouteSocketReverseDNS& rTrace); 00101 00102 //Event for user to overide 00103 virtual void TraceDone(); 00104 00105 //For user to overide, per TTL data 00106 virtual void TraceData(const TraceRouteData& rData); 00107 00108 //Thread for DNS 00109 static DWORD DNSResolving(LPVOID lpData); 00110 00111 //Our data 00112 DNSTraceRouteVector m_aData; 00113 00114 //Are we async 00115 BOOL m_bAsync; 00116 00117 //Our thread 00118 CGenericThread* m_pThread; 00119 00120 //Our DNS manager 00121 KomodiaDNS::CDNSManager* m_pDNSManager; 00122 00123 //Is the trace done ? 00124 BOOL m_bTraceDone; 00125 00126 //Are we initialized ? 00127 BOOL m_bInitialized; 00128 }; 00129 00130 KOMODIA_NAMESPACE_END 00131 00132 #endif // !defined(AFX_TRACEROUTESOCKETREVERSEDNS_H__55BEFFAA_FEFF_483E_90A7_B2F1D3A7A13F__INCLUDED_) |