1 /*
2 
3                           Firewall Builder
4 
5                  Copyright (C) 2001 NetCitadel, LLC
6 
7   Author:  Vadim Zaliva lord@crocodile.org
8 
9   $Id$
10 
11 
12   This program is free software which we release under the GNU General Public
13   License. You may redistribute and/or modify this program under the terms
14   of that license as published by the Free Software Foundation; either
15   version 2 of the License, or (at your option) any later version.
16 
17   This program is distributed in the hope that it will be useful,
18   but WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20   GNU General Public License for more details.
21 
22   To get a copy of the GNU General Public License, write to the Free Software
23   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 
25 */
26 
27 
28 #ifndef __MANAGEMENT_HH_FLAG__
29 #define __MANAGEMENT_HH_FLAG__
30 
31 #include "fwbuilder/InetAddr.h"
32 #include "fwbuilder/FWObject.h"
33 
34 namespace libfwbuilder
35 {
36 
37     class PolicyInstallScript : public FWObject
38     {
39         public:
40 
41         PolicyInstallScript();
42 
43         DECLARE_FWOBJECT_SUBTYPE(PolicyInstallScript);
44 
45         DECLARE_DISPATCH_METHODS(PolicyInstallScript);
46 
47         virtual void fromXML(xmlNodePtr parent) throw(FWException);
48         virtual xmlNodePtr toXML(xmlNodePtr parent) throw(FWException);
49         virtual FWObject& shallowDuplicate(
50             const FWObject *obj, bool preserve_id = true) throw(FWException);
51         virtual bool cmp(const FWObject *obj, bool recursive=false) throw(FWException);
52 
53         const std::string& getCommand () const;
54         void          setCommand (const std::string& );
55 
56         const std::string& getArguments() const;
57         void          setArguments(const std::string& );
58 
59         bool isEmpty() const;
60         bool isEnabled() const;
61 
62         void setEnabled(bool v);
63 
64         private:
65 
66         bool   enabled;
67         std::string command;
68         std::string arguments;
69     };
70 
71     class SNMPManagement : public FWObject
72     {
73         public:
74 
75         SNMPManagement();
76 
77         DECLARE_FWOBJECT_SUBTYPE(SNMPManagement);
78 
79         DECLARE_DISPATCH_METHODS(SNMPManagement);
80 
81         virtual void fromXML(xmlNodePtr parent) throw(FWException);
82         virtual xmlNodePtr toXML(xmlNodePtr parent) throw(FWException);
83         virtual FWObject& shallowDuplicate(
84             const FWObject *obj, bool preserve_id = true) throw(FWException);
85         virtual bool cmp(const FWObject *obj, bool recursive=false) throw(FWException);
86 
87         const std::string& getReadCommunity () const;
88         void          setReadCommunity (const std::string& );
89 
90         const std::string& getWriteCommunity() const;
91         void          setWriteCommunity(const std::string& );
92 
93         bool isEmpty() const;
94         bool isEnabled() const;
95 
96         void setEnabled(bool v);
97 
98         private:
99 
100         bool   enabled;
101         std::string read_community;
102         std::string write_community;
103     };
104 
105     class FWBDManagement : public FWObject
106     {
107         public:
108 
109         FWBDManagement();
110         virtual ~FWBDManagement();
111 
112         DECLARE_FWOBJECT_SUBTYPE(FWBDManagement);
113 
114         DECLARE_DISPATCH_METHODS(FWBDManagement);
115 
116         virtual FWObject& shallowDuplicate(
117             const FWObject *obj, bool preserve_id = true) throw(FWException);
118         virtual bool cmp(const FWObject *obj, bool recursive=false) throw(FWException);
119 
120         virtual void fromXML(xmlNodePtr parent) throw(FWException);
121         virtual xmlNodePtr toXML(xmlNodePtr parent) throw(FWException);
122 
123         int           getPort()       const;
124         void          setPort(int);
125 
126         const std::string &getIdentityId() const;
127         void          setIdentityId(const std::string &);
128 
129         bool isEmpty() const;
130         bool isEnabled() const;
131 
132         void setEnabled(bool v);
133 
134         private:
135 
136         bool   enabled     ;
137         int    port        ;
138         std::string identity_id ;
139     };
140 
141     class Management : public FWObject
142     {
143         public:
144 
145         Management();
146 
147         DECLARE_FWOBJECT_SUBTYPE(Management);
148 
149         DECLARE_DISPATCH_METHODS(Management);
150 
151         virtual void fromXML(xmlNodePtr parent) throw(FWException);
152         virtual xmlNodePtr toXML(xmlNodePtr parent) throw(FWException);
153         virtual FWObject& shallowDuplicate(
154             const FWObject *obj, bool preserve_id = true) throw(FWException);
155         virtual bool  cmp(const FWObject *obj, bool recursive=false) throw(FWException);
156 	virtual bool  validateChild(FWObject *o);
157 
getAddress()158         const InetAddr& getAddress() const { return addr; }
setAddress(const InetAddr & a)159         void setAddress(const InetAddr& a) { addr = a; }
160 
161         PolicyInstallScript *getPolicyInstallScript();
162         SNMPManagement      *getSNMPManagement();
163         FWBDManagement      *getFWBDManagement();
164 
165         bool isEmpty() const;
166 
167         private:
168 
169         InetAddr addr;
170     };
171 }
172 
173 #endif //__MANAGEMENT_HH_FLAG__
174