00001 /* AsyncResolver.h - simple asynchronous DNS resolver stub 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 00040 #ifndef OW32_AsyncResolverHostsDB_h 00041 #define OW32_AsyncResolverHostsDB_h 00042 00043 #include <OW32/windows.h> 00044 #include <OW32/RefCounted.h> 00045 00046 #include <OW32/AsyncResolverError.h> 00047 00048 namespace OW32 00049 { 00050 00051 #ifdef _MSC_VER 00052 #pragma warning(disable: 4251) 00053 #endif 00054 00058 class OW32_LIB_EXPORT CAsyncResolverHostsDB : public CRefCounted 00059 { 00060 public: 00064 CAsyncResolverHostsDB(); 00065 00069 ~CAsyncResolverHostsDB(); 00070 00077 AsyncResolverError read(const TCHAR *hostsPath); 00078 00086 AsyncResolverError nameQuery(const char *name, struct hostent **host) const; 00087 00095 AsyncResolverError addrQuery(const struct in_addr *addr, struct hostent **host) const; 00096 00097 private: 00098 // prohibit copy and assignment 00099 CAsyncResolverHostsDB(const CAsyncResolverHostsDB &); 00100 CAsyncResolverHostsDB& operator=(const CAsyncResolverHostsDB &); 00101 00103 struct impl; 00105 impl *m_impl; 00106 }; 00107 00111 typedef CAutoRefCountedPtr<const CAsyncResolverHostsDB> CAsyncResolverHostsDBPtr; 00112 00113 #ifdef _MSC_VER 00114 #pragma warning(default: 4251) 00115 #endif 00116 00117 }; // namespace OW32 00118 00119 #endif // OW32_AsyncResolverHostsDB_h