ClanLib  2.3.7
dns_resource_record.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_network.h"
35 #include "../../Core/System/sharedptr.h"
36 
37 class CL_DataBuffer;
38 class CL_DNSPacket;
39 class CL_DNSResourceRecord_Impl;
40 
45 {
48 
49 public:
51 
53 
57 
58 public:
59 
63  CL_String get_name() const;
64 
68  CL_String get_type() const;
69 
73  CL_String get_class() const;
74 
78  int get_ttl() const;
79 
80  const CL_DNSPacket &get_packet() const;
81 
85  int get_record_offset() const;
86 
90  int get_rdata_offset() const;
91 
95  int get_rdata_length() const;
96 
100  CL_String get_cname_cname() const;
101 
105  int get_mx_preference() const;
106 
110  CL_String get_mx_exchange() const;
111 
115  CL_String get_ns_nsdname() const;
116 
120  CL_String get_ptr_ptrdname() const;
121 
125  CL_String get_soa_mname() const;
126 
130  CL_String get_soa_rname() const;
131 
132  unsigned int get_soa_serial() const;
133 
137  int get_soa_refresh() const;
138 
142  int get_soa_retry() const;
143 
147  int get_soa_expire() const;
148 
149  unsigned int get_soa_minimum() const;
150 
151  unsigned int get_a_address() const;
152 
156  CL_String get_a_address_str() const;
157 
158  unsigned int get_wks_address() const;
159 
163  CL_String get_wks_address_str() const;
164 
165  unsigned char get_wks_protocol() const;
166 
170  CL_DataBuffer get_wks_bit_map() const;
171 
175 
176 public:
177 
182  void set_record(CL_DNSPacket packet, int record_offset);
183 
189  static int type_to_int(const CL_String &qtype);
190 
196  static CL_String type_from_int(int qtype);
197 
203  static CL_String type_description(const CL_String &qtype);
204 
210  static CL_String type_description(int qtype);
211 
217  static int class_to_int(const CL_String &qclass);
218 
224  static CL_String class_from_int(int qclass);
225 
231  static CL_String class_description(const CL_String &qclass);
232 
238  static CL_String class_description(int qclass);
239 
246  static int find_domain_name_end(const CL_DataBuffer &packet, int offset);
247 
254  static CL_String read_domain_name(const CL_DataBuffer &packet, int offset);
255 
259 
260 private:
261  CL_SharedPtr<CL_DNSResourceRecord_Impl> impl;
263 };
264