1 #include <boost/lexical_cast.hpp>
2 #include <boost/format.hpp>
4 #include "snmp_pp/snmp_pp.h"
14 const std::string & mac,
20 _profileId(profileId),
26 port = 1 << (32 - port);
27 _port = (boost::format("%|08x|") % port).str();
30 ACL::ACL(const ACL & rvalue)
32 _profileId(rvalue._profileId),
35 _shape(rvalue._shape),
36 _burst(rvalue._burst),
37 _isUpload(rvalue._isUpload)
45 ACL & ACL::operator=(const ACL & rvalue)
48 _profileId = rvalue._profileId;
51 _shape = rvalue._shape;
52 _burst = rvalue._burst;
53 _isUpload = rvalue._isUpload;
58 void ACL::appendPdu(Pdu & pdu) const
63 oidValue = swACLEtherRuleSrcMacAddress;
64 oidValue += getSuffix();
66 oidValue = swACLEtherRuleDstMacAddress;
67 oidValue += getSuffix();
69 Vb vb(Oid(oidValue.c_str()));
70 vb.set_value(OctetStr::from_hex_string(_mac.c_str()));
74 oidValue = swACLEtherRulePermit;
75 oidValue += getSuffix();
76 vb.set_oid(Oid(oidValue.c_str()));
81 oidValue = swACLEtherRulePort;
82 oidValue += getSuffix();
83 vb.set_oid(Oid(oidValue.c_str()));
84 vb.set_value(OctetStr::from_hex_string(_port.c_str()));
88 oidValue = swACLEtherRuleRxRate;
89 oidValue += getSuffix();
90 vb.set_oid(Oid(oidValue.c_str()));
91 vb.set_value(int(_shape));
95 oidValue = swACLEtherRuleRowStatus;
96 oidValue += getSuffix();
97 vb.set_oid(Oid(oidValue.c_str()));
102 /*oidValue = swACLMeterBurstSize;
103 oidValue += getSuffix();
104 vb.set_oid(Oid(oidValue.c_str()));
105 vb.set_value(int(_burst));
109 std::ostream & GTS::operator<<(std::ostream & stream, const ACL & acl)
111 std::string oidValue;
114 oidValue = swACLEtherRuleSrcMacAddress;
115 oidValue += acl.getSuffix();
117 oidValue = swACLEtherRuleDstMacAddress;
118 oidValue += acl.getSuffix();
120 stream << oidValue << ":" << acl._mac << " ";
123 oidValue = swACLEtherRulePermit;
124 oidValue += acl.getSuffix();
125 stream << oidValue << ":" << 2 << " ";
128 oidValue = swACLEtherRulePort;
129 oidValue += acl.getSuffix();
130 stream << oidValue << ":" << acl._port << " ";
133 oidValue = swACLEtherRuleRxRate;
134 oidValue += acl.getSuffix();
135 stream << oidValue << ":" << acl._shape << " ";
138 oidValue = swACLEtherRuleRowStatus;
139 oidValue += acl.getSuffix();
140 stream << oidValue << ":" << 4;
146 std::string ACL::getSuffix() const
148 return std::string(".") +
149 boost::lexical_cast<std::string>(_profileId) +
151 boost::lexical_cast<std::string>(_id);