version 1.7, 2019/08/14 14:40:23 |
version 1.8, 2019/09/18 09:44:38 |
|
|
int snmpc_walk(int, char *[]); |
int snmpc_walk(int, char *[]); |
int snmpc_trap(int, char *[]); |
int snmpc_trap(int, char *[]); |
int snmpc_mibtree(int, char *[]); |
int snmpc_mibtree(int, char *[]); |
|
struct snmp_agent *snmpc_connect(char *, char *); |
int snmpc_parseagent(char *, char *); |
int snmpc_parseagent(char *, char *); |
int snmpc_print(struct ber_element *); |
int snmpc_print(struct ber_element *); |
__dead void snmpc_printerror(enum snmp_error, char *); |
__dead void snmpc_printerror(enum snmp_error, char *); |
|
|
if (argc < 2) |
if (argc < 2) |
usage(); |
usage(); |
|
|
agent = snmp_connect_v12(snmpc_parseagent(argv[0], "161"), version, |
if ((agent = snmpc_connect(argv[0], "161")) == NULL) |
community); |
|
if (agent == NULL) |
|
err(1, "%s", snmp_app->name); |
err(1, "%s", snmp_app->name); |
agent->timeout = timeout; |
agent->timeout = timeout; |
agent->retries = retries; |
agent->retries = retries; |
|
|
usage(); |
usage(); |
oids = argc == 1 ? mib : argv[1]; |
oids = argc == 1 ? mib : argv[1]; |
|
|
agent = snmp_connect_v12(snmpc_parseagent(argv[0], "161"), version, community); |
if ((agent = snmpc_connect(argv[0], "161"))== NULL) |
if (agent == NULL) |
|
err(1, "%s", snmp_app->name); |
err(1, "%s", snmp_app->name); |
agent->timeout = timeout; |
agent->timeout = timeout; |
agent->retries = retries; |
agent->retries = retries; |
|
|
if (version == SNMP_V1) |
if (version == SNMP_V1) |
errx(1, "trap is not supported for snmp v1"); |
errx(1, "trap is not supported for snmp v1"); |
|
|
agent = snmp_connect_v12(snmpc_parseagent(argv[0], "162"), |
if ((agent = snmpc_connect(argv[0], "162")) == NULL) |
version, community); |
|
if (agent == NULL) |
|
err(1, "%s", snmp_app->name); |
err(1, "%s", snmp_app->name); |
|
|
if (pledge("stdio", NULL) == -1) |
if (pledge("stdio", NULL) == -1) |
|
|
printf("%s\n", buf); |
printf("%s\n", buf); |
} |
} |
return 0; |
return 0; |
|
} |
|
|
|
struct snmp_agent * |
|
snmpc_connect(char *host, char *port) |
|
{ |
|
switch (version) { |
|
case SNMP_V1: |
|
case SNMP_V2C: |
|
return snmp_connect_v12(snmpc_parseagent(host, port), version, |
|
community); |
|
} |
|
return NULL; |
} |
} |
|
|
int |
int |