]> git.stg.codes - ssmd.git/blob - include/switch.h
351d1626a33648f9ff4771dfe665af2a951f52e1
[ssmd.git] / include / switch.h
1 #ifndef __GTS_SWITCH_H__
2 #define __GTS_SWITCH_H__
3
4 #include <string>
5 #include <vector>
6
7 class Snmp;
8 class CTarget;
9
10 namespace GTS {
11
12 class Settings;
13 class Subscriber;
14 class ACL;
15 class SNMPTable;
16
17 class Switch {
18     public:
19         Switch(const Settings & settings,
20                Snmp & snmp,
21                const std::string & ip,
22                const std::string & readCommunity,
23                const std::string & writeCommunity,
24                unsigned uplinkPort);
25         Switch(const Switch & rvalue);
26         ~Switch();
27
28         Switch & operator=(const Switch & rvalue);
29
30         const std::string & getIP() const { return _ip; }
31         const std::string & getReadCommunity() const { return _readCommunity; }
32         const std::string & getWriteCommunity() const { return _writeCommunity; }
33         unsigned getUplinkPort() const { return _uplinkPort; }
34
35         void addSubscriber(const Subscriber & subscriber);
36
37         void sync();
38
39     private:
40         const Settings & _settings;
41         Snmp & _snmp;
42
43         std::string _ip;
44         std::string _readCommunity;
45         std::string _writeCommunity;
46         unsigned _uplinkPort;
47
48         unsigned _nextUpACL;
49         unsigned _nextDownACL;
50
51         std::vector<ACL> _acls;
52
53         bool _aclsCreated;
54
55         bool checkProfiles(const CTarget & target);
56         bool dropACLs(const CTarget & target);
57         bool dropACLsByTable(const CTarget & target, unsigned profileId, const SNMPTable & table);
58         bool createACLs(const CTarget & target);
59 };
60
61 }
62
63 #endif