2015-05-04 116 views
0

我一直在環顧四周,似乎無法找到這個問題的答案。我正在從一個嵌入式項目的net-snmp中使用snmpd。我有額外的代碼寫入snmpd以支持GET和v2陷阱,但現在我可能需要切換到v3陷阱/通知。snmpv3通知/陷阱c代碼

所以,這裏是我的問題:

假設我已經設置了我的V3密碼,加密等,是有V3的模擬到send_v2trap()功能?我無法想象它像send_v3trap()一樣容易,但是這需要一個簡單的方法。

此外,我嚴格限制在C.我想這可能會更容易使用其他語言的net-snmp綁定,但這不是我的選擇。

回答

1

netsnmp_trap_api(3)

send_v2trap() uses the supplied list of variable bindings to form an 
    SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured 
    list. An equivalent INFORM is sent to the configuredq list of inform 
    sinks. Sinks that can only handle SNMPv1 traps are skipped. 

這似乎表明,同樣的功能應該能夠發送V3陷阱以及(因爲V3陷阱是相同的V2陷阱)。

此外,看代碼(特別是,agent/agent_trap.c),可以確實看到您的初始猜測是正確的,並且存在send_v3trap()函數。有一個評論上面的定義,說:

Similar to send_v2trap(), with the added ability to specify a context. If 
the last parameter is NULL, then this call is equivalent to send_v2trap(). 

希望這會有所幫助。