1.2.1.19.49 TCPIP_SNMP_TRAPv2Notify Function

C

bool TCPIP_SNMP_TRAPv2Notify(
    SNMP_ID var, 
    SNMP_VAL val, 
    SNMP_INDEX index, 
    SNMP_TRAP_IP_ADDRESS_TYPE eTrapMultiAddressType
);

Description

This function creates SNMP V2 Trap PDU and sends it to previously specified remoteHost.

SNMP V1 trap PDU: | PDU type | enterprise | agent addr | generic trap | specific trap | | time stamp | varbind list |

The v1 enterprise is mapped directly to SNMPv2TrapOID.0

SNMP V2 trap PDU: version (0 or 1) | community | SNMP PDU |PDU type | request id | error status |err index |varbinds

The first two variables (in varbind list) of snmpv2 are: sysUpTime.0 and SNMPv2TrapOID.0

Generic Trap OID is used as the varbind for authentication failure.

Preconditions

TCPIP_SNMP_NotifyIsReady() is already called and returned true.

Parameters

ParametersDescription
varSNMP var ID that is to be used in notification.
valValue of var. Only value of uint8_t, uint16_t or uint32_t can be sent.
indexIndex of var. If this var is a single,index would be 0, or else if this var Is a sequence, index could be any value from 0 to 127.
eTrapMultiAddressTypeTrap address type.

Remarks

This would fail if there were not UDP socket to open.