Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

poslib/lexfn.h

Go to the documentation of this file.

  
00001 /* 00002 Posadis - A DNS Server 00003 Lexical functions 00004 Copyright (C) 2002 Meilof Veeningen <> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __POSLIB_LEXFN_H 00022 #define __POSLIB_LEXFN_H 00023 00030 #include "types.h" 00031 #include "socket.h" 00032 #include "sysstl.h" 00033 #include "dnsdefs.h" 00034 00044 bool txt_to_bool(const char *buff); 00045 00055 int txt_to_negint(const char *buff); 00056 00066 int txt_to_int(const char *buff); 00067 00079 int txt_to_ip(char ip[4], const char *buff, bool do_portion = false); 00080 00086 #define sz_iprange 8 00087 00095 void txt_to_iprange(char *iprange, const char *val); 00096 00106 bool iprange_matches(char *iprange, char *ip); 00107 00120 int txt_to_ipv6(char ipv6[16], const char *buff, bool do_portion = false); 00121 00122 00128 #define sz_ip6range 32 00129 00137 void txt_to_ip6range(char *iprange, const char *val); 00138 00148 bool ip6range_matches(char *iprange, char *ip); 00149 00155 #define sz_addrrange 33 00156 00164 void txt_to_addrrange(char *iprange, const char *val); 00165 00175 bool addrrange_matches(char *iprange, _addr *a); 00176 00180 class addrrange { public: char range[sz_addrrange]; }; 00181 00191 bool in_addrrange_list(stl_list(addrrange) &lst, _addr *a); 00192 00193 #ifdef HAVE_SLIST 00194 00203 bool in_addrrange_list(stl_slist(addrrange) &lst, _addr *a); 00204 #endif 00205 00216 bool in_addr_list(stl_list(_addr) &lst, _addr *a, bool match_port = false); 00217 00218 #ifdef HAVE_SLIST 00219 00229 bool in_addr_list(stl_slist(_addr) &lst, _addr *a, bool match_port = false); 00230 #endif 00231 00240 void txt_to_email(char *target, const char *src, const _domain origin = NULL); 00241 00250 void txt_to_dname(char *target, const char *src, const _domain origin = NULL); 00251 00266 void txt_to_addr(_addr *ret, const char *addr, int default_port = DNS_PORT, bool is_client = true); 00267 00277 void txt_to_loc(char *res, char *&src); 00278 00279 stl_string str_type(u_int16 type); 00280 stl_string str_qtype(u_int16 qtype); 00281 stl_string str_class(u_int16 ctype); 00282 stl_string str_qclass(u_int16 qctype); 00283 stl_string str_opcode(u_int16 opcode); 00284 stl_string str_rcode(int rcode); 00285 stl_string str_ttl(uint32_t ttl); 00286 stl_string str_loc(char *rr); 00288 #endif /* __POSLIB_LEXFN_H */

  
Generated on Fri Dec 24 19:55:14 2004 for Poslib by doxygen 1.3.7