00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2005 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Magnus Norddahl 00027 */ 00028 00029 #ifndef header_dns_resource_record 00030 #define header_dns_resource_record 00031 00032 #include "bytearray.h" 00033 00034 class CL_DNSResourceRecord 00035 { 00037 public: 00038 CL_DNSResourceRecord(); 00039 00040 CL_DNSResourceRecord(const CL_DNSResourceRecord &other); 00041 00042 ~CL_DNSResourceRecord(); 00043 00045 public: 00046 CL_String get_name() const; 00047 00048 CL_String get_type() const; 00049 00050 CL_String get_class() const; 00051 00052 int get_ttl() const; 00053 00054 const CL_ByteArray &get_packet() const; 00055 00056 int get_record_offset() const; 00057 00058 int get_rdata_offset() const; 00059 00060 int get_rdata_length() const; 00061 00062 CL_String get_cname_cname() const; 00063 00064 int get_mx_preference() const; 00065 00066 CL_String get_mx_exchange() const; 00067 00068 CL_String get_ns_nsdname() const; 00069 00070 CL_String get_ptr_ptrdname() const; 00071 00072 CL_String get_soa_mname() const; 00073 00074 CL_String get_soa_rname() const; 00075 00076 unsigned int get_soa_serial() const; 00077 00078 int get_soa_refresh() const; 00079 00080 int get_soa_retry() const; 00081 00082 int get_soa_expire() const; 00083 00084 unsigned int get_soa_minimum() const; 00085 00086 unsigned int get_wks_address() const; 00087 00088 unsigned char get_wks_protocol() const; 00089 00090 CL_ByteArray get_wks_bit_map() const; 00091 00093 public: 00094 CL_DNSResourceRecord &operator =(const CL_DNSResourceRecord &other); 00095 00096 void set_record(const CL_ByteArray &packet, int record_offset); 00097 00098 static int type_to_int(const CL_String &qtype); 00099 00100 static CL_String type_from_int(int qtype); 00101 00102 static CL_String type_description(const CL_String &qtype); 00103 00104 static CL_String type_description(int qtype); 00105 00106 static int class_to_int(const CL_String &qclass); 00107 00108 static CL_String class_from_int(int qclass); 00109 00110 static CL_String class_description(const CL_String &qclass); 00111 00112 static CL_String class_description(int qclass); 00113 00114 static int find_domain_name_end(const CL_ByteArray &packet, int offset); 00115 00116 static CL_String read_domain_name(const CL_ByteArray &packet, int offset); 00117 00119 private: 00120 CL_ByteArray packet; 00121 00122 int record_offset; 00123 00124 int rdata_offset; 00125 00126 int rdata_length; 00127 }; 00128 00129 #endif
1.4.1