Use xsl:element for document element to prevent ns
[yazproxy-moved-to-github.git] / src / p2_config.h
1 /* $Id: p2_config.h,v 1.1 2005-10-05 12:07:14 adam Exp $
2    Copyright (c) 1998-2005, Index Data.
3
4 This file is part of the yaz-proxy.
5
6 YAZ proxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 YAZ proxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with YAZ proxy; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #ifndef P2_CONFIG_INCLUDED
23 #define P2_CONFIG_INCLUDED
24
25 #include <string>
26 #include <list>
27
28 class P2_ConfigTarget {
29  public:
30     P2_ConfigTarget();
31     std::string m_virt_address;
32     std::string m_virt_database;
33     std::string m_target_address;
34     std::string m_target_database;
35     std::string m_type;
36     bool m_default;
37 };
38
39 class P2_ConfigModule {
40  public:
41     std::string m_fname;
42 };
43
44 class P2_Config {
45     class Rep;
46  public:
47     P2_Config::P2_Config();
48     P2_Config::~P2_Config();
49     bool P2_Config::parse_options(int argc, char **argv);
50     P2_ConfigTarget *find_target(std::string db);
51     void print();
52  private:
53     bool read_xml_config(const char *fname);
54     void parse_xml_element_proxy(void *xml_ptr);
55     void parse_xml_element_target(void *xml_ptr,
56                                              P2_ConfigTarget *t);
57     bool parse_xml_text(void *xml_ptr, std::string &val);
58     bool parse_xml_text(void *xml_ptr, bool &val);
59  public:
60     std::string m_apdu_log;
61     std::string m_default_target;
62     std::string m_listen_address;
63     std::string m_log_file;
64     std::string m_optimize_flags;
65     std::string m_pid_fname;
66     std::string m_uid;
67     std::string m_xml_fname;
68
69     int m_max_clients;
70     int m_client_idletime;
71     int m_debug_mode;
72     int m_no_limit_files;
73     int m_no_threads;
74     int m_target_idletime;
75
76     std::list<P2_ConfigTarget *> m_target_list;
77     std::list<P2_ConfigModule *> m_modules;
78  private:
79     Rep *m_rep;
80     int m_errors;
81 };
82
83 #endif
84 /*
85  * Local variables:
86  * c-basic-offset: 4
87  * indent-tabs-mode: nil
88  * End:
89  * vim: shiftwidth=4 tabstop=8 expandtab
90  */