@@ -154,118 +154,42 @@ class DnsMessage : public ProtocolMessage
154154
155155 int add_a_record (int section, const char *name,
156156 uint16_t rclass, uint32_t ttl,
157- const void *data)
158- {
159- struct list_head *list = get_section (section);
160-
161- if (!list)
162- return -1 ;
163-
164- return dns_add_raw_record (name, DNS_TYPE_A, rclass, ttl, 4 , data, list);
165- }
157+ const void *data);
166158
167159 int add_aaaa_record (int section, const char *name,
168160 uint16_t rclass, uint32_t ttl,
169- const void *data)
170- {
171- struct list_head *list = get_section (section);
172-
173- if (!list)
174- return -1 ;
175-
176- return dns_add_raw_record (name, DNS_TYPE_AAAA, rclass, ttl,
177- 16 , data, list);
178- }
161+ const void *data);
179162
180163 int add_ns_record (int section, const char *name,
181164 uint16_t rclass, uint32_t ttl,
182- const char *data)
183- {
184- struct list_head *list = get_section (section);
185-
186- if (!list)
187- return -1 ;
188-
189- return dns_add_str_record (name, DNS_TYPE_NS, rclass, ttl, data, list);
190- }
165+ const char *data);
191166
192167 int add_cname_record (int section, const char *name,
193168 uint16_t rclass, uint32_t ttl,
194- const char *data)
195- {
196- struct list_head *list = get_section (section);
197-
198- if (!list)
199- return -1 ;
200-
201- return dns_add_str_record (name, DNS_TYPE_CNAME, rclass, ttl,
202- data, list);
203- }
169+ const char *data);
204170
205171 int add_ptr_record (int section, const char *name,
206172 uint16_t rclass, uint32_t ttl,
207- const char *data)
208- {
209- struct list_head *list = get_section (section);
210-
211- if (!list)
212- return -1 ;
213-
214- return dns_add_str_record (name, DNS_TYPE_PTR, rclass, ttl, data, list);
215- }
173+ const char *data);
216174
217175 int add_soa_record (int section, const char *name,
218176 uint16_t rclass, uint32_t ttl,
219177 const char *mname, const char *rname,
220178 uint32_t serial, int32_t refresh,
221- int32_t retry, int32_t expire, uint32_t minimum)
222- {
223- struct list_head *list = get_section (section);
224-
225- if (!list)
226- return -1 ;
227-
228- return dns_add_soa_record (name, rclass, ttl, mname, rname, serial,
229- refresh, retry, expire, minimum, list);
230- }
179+ int32_t retry, int32_t expire, uint32_t minimum);
231180
232181 int add_srv_record (int section, const char *name,
233182 uint16_t rclass, uint32_t ttl,
234- uint16_t priority, uint16_t weight, uint16_t port,
235- const char *target)
236- {
237- struct list_head *list = get_section (section);
238-
239- if (!list)
240- return -1 ;
241-
242- return dns_add_srv_record (name, rclass, ttl,
243- priority, weight, port, target, list);
244- }
183+ uint16_t priority, uint16_t weight,
184+ uint16_t port, const char *target);
245185
246186 int add_mx_record (int section, const char *name,
247187 uint16_t rclass, uint32_t ttl,
248- int16_t preference, const char *exchange)
249- {
250- struct list_head *list = get_section (section);
251-
252- if (!list)
253- return -1 ;
254-
255- return dns_add_mx_record (name, rclass, ttl, preference, exchange, list);
256- }
188+ int16_t preference, const char *exchange);
257189
258190 int add_raw_record (int section, const char *name, uint16_t type,
259191 uint16_t rclass, uint32_t ttl,
260- const void *data, uint16_t dlen)
261- {
262- struct list_head *list = get_section (section);
263-
264- if (!list)
265- return -1 ;
266-
267- return dns_add_raw_record (name, type, rclass, ttl, dlen, data, list);
268- }
192+ const void *data, uint16_t dlen);
269193
270194 // Inner use only
271195 bool is_single_packet () const
@@ -305,22 +229,7 @@ class DnsMessage : public ProtocolMessage
305229private:
306230 int encode_reply ();
307231 int encode_truncation_reply ();
308-
309- struct list_head *get_section (int section)
310- {
311- switch (section)
312- {
313- case DNS_ANSWER_SECTION:
314- return &(parser->answer_list );
315- case DNS_AUTHORITY_SECTION:
316- return &(parser->authority_list );
317- case DNS_ADDITIONAL_SECTION:
318- return &(parser->additional_list );
319- default :
320- errno = EINVAL;
321- return NULL ;
322- }
323- }
232+ struct list_head *get_section (int section);
324233
325234 // size of msgbuf, but in network byte order
326235 uint16_t msgsize;
0 commit comments