Template:FAQ:Coding 23

From Net-SNMP Wiki
Jump to: navigation, search

The two versions of the trap API calls are concerned with how the trap is represented when it is passed in to the API, not the version of the trap PDU that will actually be generated by the agent. That is determined by the configuration token used to set up the trap destination.

Remember that in general, all traps are sent to all destinations. This means that a trap specified using the SNMPv1 trap syntax needs to be converted to the SNMPv2 format before it can be sent to an SNMPv2 (or SNMPv3) destination. Similarly, a trap specified using the SNMPv2 syntax needs to be converted to the SNMPv1 format before it can be sent to an SNMPv1 sink.

Essentially, the API call to use depends on what you asking for, which is not necessarily what the recipients will actually get! See 'snmp_trap_api(3)' for a fuller explanation.