本文介绍了SNMP类型Unsigned32的正确编码是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个SNMP代理,并且MIB定义包含一个Unsigned32类型的OID。

I'm writing an SNMP agent and the MIB definition includes an OID of type Unsigned32.

代理的Unix实现使用Net-SNMP并设置OID as type ASN_UNSIGNED,因为它没有ASN_UNSIGNED32。当我看到与Wireshark的GET响应,它解码为Gauge32值。这一点很有意义,因为根据RFC 1902 Unsigned32和Gauge32是一样的。

The Unix implementation of the agent uses Net-SNMP and sets the OID as type ASN_UNSIGNED, since it doesn't have an ASN_UNSIGNED32. When I look at the GET response with Wireshark, it decodes it as a "Gauge32" value. That makes sense at first sight, because according to RFC 1902 Unsigned32 and Gauge32 are the same.

Windows实现是基于Windows的SnmpAPI.lib并设置OID为ASN_UNSIGNED32,当我看到与Wireshark的GET响应,它解码为Unsigned32。

The Windows implementation is based on Windows' SnmpAPI.lib and sets the OID as ASN_UNSIGNED32 and when I look at the GET response with Wireshark, it decodes it as "Unsigned32". That looks even better to me.

这两个实现如何在线上产生不同的结果?

How come the 2 implementations produce different results on the wire ?

推荐答案

事实证明Net-SNMP正在使用当前RFC 1902编码,其中Unsigned32和Gauge32是相同的,而Windows使用过时的RFC 1442编码,其中Unsigned32和Gauge32有不同的编码。

It turns out Net-SNMP is using the current RFC 1902 encoding where Unsigned32 and Gauge32 are identical, while Windows uses the obsolete RFC 1442 encoding where Unsigned32 and Gauge32 had different encodings.

这篇关于SNMP类型Unsigned32的正确编码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 01:29