00001 /* AsyncResolverSearch.h - asynchronous DNS search encapsulation 00002 Copyright (C) 2004 Mark Weaver 00003 Written by Mark Weaver <mark@npsl.co.uk> 00004 00005 Part of the Open-Win32 library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the 00018 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 /* Copyright 1998 by the Massachusetts Institute of Technology. 00023 * 00024 * Permission to use, copy, modify, and distribute this 00025 * software and its documentation for any purpose and without 00026 * fee is hereby granted, provided that the above copyright 00027 * notice appear in all copies and that both that copyright 00028 * notice and this permission notice appear in supporting 00029 * documentation, and that the name of M.I.T. not be used in 00030 * advertising or publicity pertaining to distribution of the 00031 * software without specific, written prior permission. 00032 * M.I.T. makes no representations about the suitability of 00033 * this software for any purpose. It is provided "as is" 00034 * without express or implied warranty. 00035 */ 00036 00041 #ifndef OW32_AsyncResolverSearch_h 00042 #define OW32_AsyncResolverSearch_h 00043 00044 #include <OW32/AsyncResolverQuery.h> 00045 00046 namespace OW32 00047 { 00048 00052 class OW32_LIB_EXPORT CAsyncResolverSearch : 00053 public CAsyncResolverCallback 00054 { 00055 public: 00063 CAsyncResolverSearch(CAsyncResolver *pParent, CAsyncResolverCallback *pCallback, void *callbackContext = NULL) : 00064 m_pParent(pParent), 00065 m_pCallback(pCallback), 00066 m_callbackContext(callbackContext) 00067 { 00068 } 00069 00078 void search(const char *name, int dnsclass, int type); 00079 00088 virtual void OnAnswer(void *context, AsyncResolverError status, unsigned char *abuf, size_t alen); 00089 00090 private: 00092 CAsyncResolverSearch(const CAsyncResolverSearch &); 00093 CAsyncResolverSearch& operator=(const CAsyncResolverSearch &); 00094 00096 std::string m_name; 00098 int m_dnsclass; 00100 int m_type; 00102 AsyncResolverError m_status_as_is; 00104 size_t m_next_domain; 00106 int m_trying_as_is; 00108 CAsyncResolverCallback *m_pCallback; 00110 void *m_callbackContext; 00112 CAsyncResolver *m_pParent; 00113 00115 AsyncResolverError single_domain(const char *name, std::string &s); 00116 }; 00117 00118 } // namespace OW32 00119 00120 #endif // OW32_AsyncResolverSearch_h