Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rr.h
Go to the documentation of this file.
1 /*
2  Posadis - A DNS Server
3  Resource Records
4  Meilof Veeningen <meilof@users.sourceforge.net>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef __POSLIB_RR_H
22 #define __POSLIB_RR_H
23 
24 #include "dnsmessage.h"
25 
40 enum _rr_flags {
41  R_NONE = 0,
42  R_ASP = 1,
44  R_COMPRESS = 2,
48 };
49 
57 struct rr_type {
64  char name[9];
65 
73 
94  char properties[9];
95 
104 };
105 
113 extern const int n_rr_types;
114 
124 extern const rr_type rr_types[];
125 
126 /* low-level RR information */
127 
138 
147 rr_type *rrtype_getinfo(const char *name);
148 
158 
169 uint16_t qtype_getcode(const char *name, bool allow_qtype = true);
170 
182 bool answers_qtype(uint16_t rrtype, uint16_t qtype);
183 
193 bool is_common_rr(uint16_t rrtype);
194 
208 void rr_read(u_int16 RRTYPE, unsigned char*& RDATA, uint16_t &RDLEN, message_buff &buff, int ix, int len);
209 
221 void rr_write(u_int16 RRTYPE, unsigned char *RDATA, uint16_t RDLEN, stl_string &dnsmessage, stl_slist(dom_compr_info) *comprinfo);
222 
234 stl_string rr_tostring(u_int16 RRTYPE, const unsigned char *RDATA, int RDLENGTH);
235 
245 stl_string rr_property_to_string(char type, const unsigned char*& RDATA, int RDLENGTH, domainname& zone);
246 
259 stl_string rr_torelstring(u_int16 RRTYPE, const unsigned char *RDATA, int RDLENGTH, domainname zone);
260 
279 stl_string rr_fromstring(u_int16 rrtype, const char *data, _domain origin = (unsigned char*)"");
280 
299 stl_string rr_fromstring(u_int16 RRTYPE, const char *data, domainname origin);
300 
314 _domain rr_getbindomain(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
315 
321 domainname rr_getdomain(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
322 
328 _domain rr_getbinmail(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
329 
335 domainname rr_getmail(const char *RDATA, u_int16 RRTYPE, int ix = 0);
336 
342 u_int16 rr_getshort(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
343 
349 u_int32 rr_getlong(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
350 
356 u_int48 rr_getuint48(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
357 
363 unsigned char *rr_getip4(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
364 
370 unsigned char *rr_getip6(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
371 
377 unsigned char *rr_getdata(const unsigned char *RDATA, u_int16 RRTYPE, int ix = 0);
378 
392 stl_string read_entry(char*& data);
393 
422 void read_line(char *buff, FILE *f, int *linenum = NULL, int *linenum2 = NULL,
423  int buffsz = 1024);
424 
425 #endif /* __POSLIB_RR_H */
426