Command Line Calling Order
From Net-SNMP Wiki
Most of the Net-SNMP command line applications (like snmpget, snmpwalk, snmpset, ...) have similar internal code. This page describes the calling structure of these applications. If you're writing your own applications this should help you understand the process flow of the applications.
Comments are written in // style for simplicity, but obviously this isn't callable code anyway...
Code in blue is application code, and code in black is functions called by the library code.
main() netsnmp_session session, *ss; netsnmp_pdu *pdu; netsnmp_pdu *response; netsnmp_variable_list *vars; // the only thing you can do before snmp_parse_args is call the netsnmp_ds_set_(bool|int|string) functions
snmp_parse_args(argv, argc, &session, ...); // accepts argv, argc, a session to initialize and optional additional arguments SOCK_STARTUP; // a win32 specific required macro ss = snmp_open(&session); pdu = snmp_pdu_create(SNMP_MSG_(GET|SET|GETNEXT|...)); snmp_add_null_var(pdu, ...); // adding in variables you want to use