1 //----------------------------------------------------------------------------- 2 // 3 // DNS.h 4 // 5 // Cross-platform DNS Operations 6 // 7 // Copyright (c) 2015 Justin Hammond <justin@dynam.ac> 8 // All rights reserved. 9 // 10 // SOFTWARE NOTICE AND LICENSE 11 // 12 // This file is part of OpenZWave. 13 // 14 // OpenZWave is free software: you can redistribute it and/or modify 15 // it under the terms of the GNU Lesser General Public License as published 16 // by the Free Software Foundation, either version 3 of the License, 17 // or (at your option) any later version. 18 // 19 // OpenZWave is distributed in the hope that it will be useful, 20 // but WITHOUT ANY WARRANTY; without even the implied warranty of 21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 // GNU Lesser General Public License for more details. 23 // 24 // You should have received a copy of the GNU Lesser General Public License 25 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>. 26 // 27 //----------------------------------------------------------------------------- 28 #ifndef _DNS_H 29 #define _DNS_H 30 31 #include <stdarg.h> 32 #include <string> 33 #include "Defs.h" 34 #include "platform/Log.h" 35 36 namespace OpenZWave 37 { 38 namespace Internal 39 { 40 namespace Platform 41 { 42 class DNSImpl; 43 44 /** \brief Return codes for DNS lookups 45 * \ingroup Platform 46 */ 47 enum DNSError 48 { 49 DNSError_None = 0, 50 DNSError_NotFound, /**< No Record Exists - There for no Config File exists */ 51 DNSError_DomainError, /**< Domain didn't resolve etc */ 52 DNSError_InternalError /**< A Internal Error Occured */ 53 }; 54 55 /** \brief Implements platform-independent DNS lookup Operations. 56 * \ingroup Platform 57 */ 58 class DNS 59 { 60 public: 61 DNS(); 62 ~DNS(); 63 /** 64 * \brief Starts a DNS lookup for a TXT record 65 * 66 * This function will lookup the TXT record for a address 67 * 68 * \param lookup the DNS address to lookup 69 * \param result the result of the lookup request, or empty if the lookup failed. 70 * 71 * \return success/failure of the Lookup request 72 */ 73 bool LookupTxT(string lookup, string &result); 74 DNSError status; 75 private: 76 DNSImpl *m_pImpl; 77 }; 78 } // namespace Platform 79 } // namespace Internal 80 } // namespace OpenZWave 81 82 #endif 83