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));
110 std::string ACL::getSuffix() const
112 return std::string(".") +
113 boost::lexical_cast<std::string>(_profileId) +
115 boost::lexical_cast<std::string>(_id);