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