00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef header_dns_resolver
00030 #define header_dns_resolver
00031
00032 #include "dns_resource_record.h"
00033 #include <vector>
00034
00035 class CL_ByteArray;
00036
00037 class CL_DNSResolver
00038 {
00040 public:
00041 CL_DNSResolver();
00042
00043 ~CL_DNSResolver();
00044
00046 public:
00047
00049 public:
00050 enum Status
00051 {
00052 status_success,
00053 status_name_not_found,
00054 status_data_not_found,
00055 status_timeout,
00056 status_error
00057 };
00058
00059 Status lookup_resource(
00060 const CL_String &domain_name,
00061 const CL_String &resource_type,
00062 std::vector<CL_DNSResourceRecord> &out_records,
00063 int timeout = 10000);
00064
00066 private:
00067 Status perform_query(
00068 const CL_String &domain_name,
00069 const CL_String &resource_type,
00070 std::vector<CL_DNSResourceRecord> &out_answer,
00071 std::vector<CL_DNSResourceRecord> &out_authority,
00072 std::vector<CL_DNSResourceRecord> &out_additional,
00073 int timeout,
00074 const CL_String &dns_server_name);
00075
00076 bool read_record(CL_ByteArray &packet, int &pos, CL_DNSResourceRecord &out_record);
00077
00078 int next_query_id;
00079 };
00080
00081 #endif