1 /*
2 
3                           Firewall Builder
4 
5                  Copyright (C) 2000 NetCitadel, LLC
6 
7   Author:  Vadim Kurland     vadim@fwbuilder.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 __INTERVAL_HH_FLAG__
29 #define __INTERVAL_HH_FLAG__
30 
31 #include "fwbuilder/FWObject.h"
32 
33 namespace libfwbuilder
34 {
35 
36 class Interval : public FWObject
37 {
38 
39     std::string constructDaysOfWeek(int from_dayofweek, int to_dayofweek);
40 
41 public:
42 
43     Interval();
44 
45     void setStartTime(int min,int hour,int day,int month,int year,int dayofweek);
46     void setEndTime(int min,int hour,int day,int month,int year,int dayofweek);
47 
48     void setStartTime(int min,int hour,int day,int month,int year);
49     void setEndTime(int min,int hour,int day,int month,int year);
50     void setDaysOfWeek(const std::string &days_of_week);
51 
52     void getStartTime(int *min,int *hour,int *day,int *month,int *year,int *dayofweek) const;
53     void getEndTime(int *min,int *hour,int *day,int *month,int *year,int *dayofweek) const;
54 
55     std::string getDaysOfWeek();
56 
57     virtual void fromXML(xmlNodePtr parent) throw(FWException);
58     virtual xmlNodePtr toXML(xmlNodePtr xml_parent_node) throw(FWException);
59 
60     DECLARE_FWOBJECT_SUBTYPE(Interval);
61 
62     DECLARE_DISPATCH_METHODS(Interval);
63 
64     virtual FWReference* createRef();
65 
66     bool isAny() const;
67 
isPrimaryObject()68     virtual bool isPrimaryObject() const { return true; }
69 };
70 
71 }
72 
73 #endif
74 
75 
76 
77 
78 
79