本文整理汇总了C++中Pdu::get_message_id方法的典型用法代码示例。如果您正苦于以下问题:C++ Pdu::get_message_id方法的具体用法?C++ Pdu::get_message_id怎么用?C++ Pdu::get_message_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pdu
的用法示例。
在下文中一共展示了Pdu::get_message_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPdu
int CSNMPMessage::SetPdu(const int reason, const Pdu &pdu,
const UdpAddress &fromaddress)
{
if (Pdu::match_type(m_pdu.get_type(), pdu.get_type()) == false)
{
LOG_BEGIN(INFO_LOG | 1);
LOG("MsgQueue: Response pdu type does not match, pdu is ignored: (id) (type1) (type2)");
LOG(m_uniqueId);
LOG(m_pdu.get_type());
LOG(pdu.get_type());
LOG_END;
return -1;
}
unsigned short orig_type = m_pdu.get_type();
if (m_received)
{
LOG_BEGIN(WARNING_LOG | 1);
LOG("MsgQueue: Message is already marked as received (id) (reason) (new reason)");
LOG(m_uniqueId);
LOG(reason);
LOG(m_reason);
LOG_END;
// TODO: better check based on error codes
if (reason || !m_reason)
{
LOG_BEGIN(WARNING_LOG | 1);
LOG("MsgQueue: ignoring the second pdu");
LOG_END;
return 0;
}
}
m_received = 1;
m_pdu = pdu;
m_reason = reason;
LOG_BEGIN(DEBUG_LOG | 10);
LOG("MsgQueue: Response received (req id) (status) (msg id)");
LOG(pdu.get_request_id());
LOG(reason);
#ifdef _SNMPv3
LOG(pdu.get_message_id());
#endif
LOG_END;
if ((orig_type == sNMP_PDU_INFORM) &&
(m_pdu.get_type() == sNMP_PDU_RESPONSE))
{
// remove the first two vbs of the pdu if sysUpTime and notify_id
if (m_pdu.get_vb_count() < 2)
return 0;
const Vb &vb1 = m_pdu.get_vb(0);
if (vb1.get_syntax() != sNMP_SYNTAX_TIMETICKS) return 0;
if (vb1.get_oid() != SNMP_MSG_OID_SYSUPTIME) return 0;
const Vb &vb2 = m_pdu.get_vb(1);
if (vb2.get_syntax() != sNMP_SYNTAX_OID) return 0;
if (vb2.get_oid() != SNMP_MSG_OID_TRAPID) return 0;
TimeTicks timeticks;
Oid oid;
vb1.get_value(timeticks);
m_pdu.set_notify_timestamp(timeticks);
vb2.get_value(oid);
m_pdu.set_notify_id(oid);
m_pdu.delete_vb(1);
m_pdu.delete_vb(0);
}
return 0;
}