This tutorial explains how to send a SNMP TRAP calling send_v2trap() in C.
How do I send a SNMP INFORM instead? The manpage says I can send INFORMs, but it doesn't say how.
Figured out by myself :-)
send_v2trap(3) says:
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.
but doesn't say what is this configured list;
Instead, snmpd.conf(5) explains that I should edit /etc/snmp/snmpd.conf
and add lines telling which hosts will receive the INFORMs. For example, the following makes send_v2trap() send INFORM to host1 and host2:
informsink host1 public 162
informsink host2 public 162