Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lexfn.h
Go to the documentation of this file.
1 /*
2  Posadis - A DNS Server
3  Lexical functions
4  Copyright (C) 2002 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_LEXFN_H
22 #define __POSLIB_LEXFN_H
23 
30 #include "types.h"
31 #include "socket.h"
32 #include "sysstl.h"
33 #include "dnsdefs.h"
34 
44 bool txt_to_bool(const char *buff);
45 
55 int txt_to_negint(const char *buff);
56 
66 int txt_to_int(const char *buff);
67 
79 int txt_to_ip(unsigned char ip[4], const char *buff, bool do_portion = false);
80 
86 #define sz_iprange 8
87 
95 void txt_to_iprange(unsigned char *iprange, const char *val);
96 
106 bool iprange_matches(const unsigned char *iprange, const unsigned char *ip);
107 
120 int txt_to_ipv6(unsigned char ipv6[16], const char *buff, bool do_portion = false);
121 
122 
128 #define sz_ip6range 32
129 
137 void txt_to_ip6range(const char *iprange, const char *val);
138 
148 bool ip6range_matches(const unsigned char *iprange, const unsigned char *ip);
149 
155 #define sz_addrrange 33
156 
164 void txt_to_addrrange(unsigned char *iprange, const char *val);
165 
175 bool addrrange_matches(const unsigned char *iprange, _addr *a);
176 
180 class addrrange { public: unsigned char range[sz_addrrange]; };
181 
192 
193 #ifdef HAVE_SLIST
194 
204 #endif
205 
216 bool in_addr_list(stl_list(_addr) &lst, _addr *a, bool match_port = false);
217 
218 #ifdef HAVE_SLIST
219 
229 bool in_addr_list(stl_slist(_addr) &lst, _addr *a, bool match_port = false);
230 #endif
231 
240 void txt_to_email(_domain target, const char *src, _cdomain origin = NULL);
241 
250 void txt_to_dname(_domain target, const char *src, _cdomain origin = NULL);
251 
252 void txt_to_addr(_addr *ret, const char *addr, int default_port = DNS_PORT,
253  bool is_client = true);
254 
264 void txt_to_loc(unsigned char *res, char *&src);
265 
278 uint16_t txt_to_qclass(const char *str, bool allow_q = true);
279 
283 stl_string str_qclass(u_int16 qctype);
284 stl_string str_opcode(u_int16 opcode);
285 stl_string str_rcode(int rcode);
287 stl_string str_loc(const unsigned char *rr);
290 #endif /* __POSLIB_LEXFN_H */
291