最近做snmp,用的就是net-snmp。 做个记录以备后用。当然记录的有点乱。
1. snmp_agent.c
snmpd收到包后,会调用
handle_snmp_packet()
|
|
netsnmp_handle_request() <--貌似response是从这里发出去的,我注释掉这个后,就收不到response了。
2. snmpd.c
* Infinite while-loop which monitors incoming messges for the agent.
* Invoke the established message handlers for incoming messages on a per
* port basis. Handle timeouts.
表明整个snmpd最后就用这个无限循环来接受request。
3. REGISTER_MIB
用这个宏来注册需要处理的mib。这样可以增加自己的mib。