2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * In addition, for the avoidance of any doubt, permission is granted to
10 * link this program with OpenSSL and to (re)distribute the binaries
11 * produced as the result of such linking.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef PDNS_ZONEPARSER_TNG
23 #define PDNS_ZONEPARSER_TNG
29 #include "namespaces.hh"
34 ZoneParserTNG(const string& fname, const DNSName& zname=DNSName("."), const string& reldir="");
35 ZoneParserTNG(const vector<string> zonedata, const DNSName& zname);
38 bool get(DNSResourceRecord& rr, std::string* comment=0);
39 typedef runtime_error exception;
40 typedef deque<pair<string::size_type, string::size_type> > parts_t;
41 DNSName getZoneName();
42 string getLineOfFile(); // for error reporting purposes
43 pair<string,int> getLineNumAndFile(); // idem
46 bool getTemplateLine();
47 void stackFile(const std::string& fname);
48 unsigned makeTTLFromZone(const std::string& str);
51 filestate(FILE* fp, string filename) : d_fp(fp), d_filename(filename), d_lineno(0){}
61 string d_templateline;
62 vector<string> d_zonedata;
63 vector<string>::iterator d_zonedataline;
64 std::stack<filestate> d_filestates;
65 parts_t d_templateparts;
67 uint32_t d_templatecounter, d_templatestop, d_templatestep;