摘要
系统从32位平台移植到64位平台的开发过程中,基于SNMP协议实现的系统网络监控功能出现问题。SNMP++是用于SNMP编程的C++开源库,提供了简单易用的接口。该项目使用了SNMP++2.8版本,但SNMP++2.8版本不支持64位。通过打印信息定位调试的方式,发现源代码中的ASN.1编码和解码时使用的long类型变量因移植导致字节数变动的问题。将long类型改成int类型,保证ASN.1编码及解码正确。SNMP++2.8就可以同时在32位和64位两种平台下使用。
During the development process of the system from 32-bit platform to 64-bit platform, the system network monitoring function based on SNMP protocol has problems. SNMP++ is a C++ open source library for SNMP programming that provides an easy to use interface. The project uses SNMP++ version 2.8, but SNMP++2.8 does not support 64-bit. Through the way of printing information positioning and debugging, it is found that the long type variable used in ASN.1 encoding and decoding in the source code is caused by the number of bytes changed by the migration. Change the long type to the int type to ensure that the ASN.1 encoding and decoding are correct. SNMP++2.8 can be used on both 32-bit and 64-bit platforms.
作者
刘一波
胡术
LIU Yi-bo;HU Shu
出处
《信息技术与信息化》
2019年第12期151-154,共4页
Information Technology and Informatization