Hi!!
First of all I want to present my self to everybody. My name is Auritz and
I am from Spain, I recently discovered net-snmp, and i think it is a very
poweful tool, so I ask a little bit of patient.
I´m trying to compile this code with Eclipse or Codeblocks in Windows XP.
The problem is that I have many errors like: "MAX_OID_LEN undeclared (first
use in this function) or SMNP_MSG_GETundeclared (first use in this
function)" and I think it is because it does not recognise the information
that is inside the header files, but I don´t know how to fix it. Any idea?
#include <C:\Documents and Settings\arnaiz_auritz.EITB\Escritorio\Proyecto
SMNP\net-snmp-5.7.1\win32\net-snmp/net-snmp-config.h>
#include <C:\Documents and Settings\arnaiz_auritz.EITB\Escritorio\Proyecto
SMNP\net-snmp-5.7.1\include\net-snmp/net-snmp-includes.h>
#include <string.h>
int main(int argc, char ** argv)
{
struct snmp_session session;
struct snmp_session *sess_handle;
struct snmp_pdu *pdu;
struct snmp_pdu *response;
struct variable_list *vars;
oid id_oid[MAX_OID_LEN];
oid serial_oid[MAX_OID_LEN];
size_t id_len = MAX_OID_LEN;
size_t serial_len = MAX_OID_LEN;
int status;
struct tree * mib_tree;
/*********************/
if(argv[1] == NULL){
printf("Please supply a hostname\n");
exit(1);
}
init_snmp("APC Check");
snmp_sess_init( &session );
session.version = 1;
session.community = "public";
session.community_len = strlen(session.community);
session.peername = "192.168.4.1";
sess_handle = snmp_open(&session);
add_mibdir(".");
mib_tree = read_mib("PowerNet-MIB.txt");
pdu = snmp_pdu_create(SNMP_MSG_GET);
read_objid("PowerNet-MIB::upsBasicIdentModel.0", id_oid, &id_len);
snmp_add_null_var(pdu, id_oid, id_len);
read_objid("PowerNet-MIB::upsAdvIdentSerialNumber.0", serial_oid,
&serial_len);
snmp_add_null_var(pdu, serial_oid, serial_len);
status = snmp_synch_response(sess_handle, pdu, &response);
for(vars = response->variables; vars; vars = vars->next_variable)
print_value(vars->name, vars->name_length, vars);
snmp_free_pdu(response);
snmp_close(sess_handle);
return (0);
}
I will be very grateful for any suggestion.
Auritz
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders