This is a discussion on Fwd: Re: Re: RE: about mib2c - SNMP ; --0-401592663-1177368009=:74383 Content-Type: multipart/alternative; boundary="0-56966524-1177368009=:74383" --0-56966524-1177368009=:74383 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Thanks Dave. I did that modification but when I compile and run the code as subagent I am getting the Segmentation Fault Error. I just did very simple modification in ...
--0-401592663-1177368009=:74383
Content-Type: multipart/alternative; boundary="0-56966524-1177368009=:74383"
--0-56966524-1177368009=:74383
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Thanks Dave.
I did that modification but when I compile and run the code as subagent I am getting the
Segmentation Fault Error.
I just did very simple modification in the the data_set.c example. This error happens right before the netsnmp_table_set_multi_add_default_row() function.
At below you can see the code.
I appreciate if you can give me a hint on this problem.
I can successfully run and compile data_set.c
Regards,
Reza
* Note: this file originally auto-generated by mib2c using
* : mib2c.create-dataset.conf,v 5.4 2004/02/02 19:06:53 rstory Exp $
*/
#include
#include
#include
#include "dot3ChannelInfo1Table.h"
/** Initialize the dot3ChannelInfo1Table table by defining its contents and how it's structured */
void
initialize_table_dot3ChannelInfo1Table(void)
{
static oid dot3ChannelInfo1Table_oid[] =
{ 1, 3, 6, 1, 4, 1, 16735, 21, 4, 1 };
size_t dot3ChannelInfo1Table_oid_len =
OID_LENGTH(dot3ChannelInfo1Table_oid);
netsnmp_table_data_set *table_set;
netsnmp_table_row *row;
/*
* create the table structure itself
*/
table_set = netsnmp_create_table_data_set("dot3ChannelInfo1Table");
/*
* comment this out or delete if you don't support creation of new rows
*/
table_set->allow_creation = 1;
printf ("111111111111 \n");
/************************************************** *
* Adding indexes
*/
DEBUGMSGTL(("initialize_table_dot3ChannelInfo1Table",
"adding indexes to table dot3ChannelInfo1Table\n"));
netsnmp_table_set_add_indexes(table_set, /* index: dot3CitIndex */
ASN_INTEGER);
printf ("bbbbbbbbbbbbbbbbb \n");
DEBUGMSGTL(("initialize_table_dot3ChannelInfo1Table",
"adding column types to table dot3ChannelInfo1Table\n"));
netsnmp_table_set_multi_add_default_row(table_set,
COLUMN_DOT3CITINDEX, 0,
NULL, 0,
COLUMN_DOT3CITCHANNELNUMBER,
ASN_INTEGER, 0, NULL, 0,
COLUMN_DOT3CITDATARATE,
ASN_INTEGER, 0, NULL, 0,
COLUMN_DOT3CITTXPOWER,
ASN_INTEGER, 0, NULL, 0, 0);
/*
* registering the table with the master agent
*/
/*
* note: if you don't need a subhandler to deal with any aspects
* of the request, change dot3ChannelInfo1Table_handler to "NULL"
*/
printf ("2222222222222222 \n");
netsnmp_register_table_data_set(netsnmp_create_han dler_registration
("dot3ChannelInfo1Table",
dot3ChannelInfo1Table_handler,
dot3ChannelInfo1Table_oid,
dot3ChannelInfo1Table_oid_len,
HANDLER_CAN_RWRITE), table_set, NULL);
printf ("333333333333333 \n");
row = netsnmp_create_table_data_row();
/*
* set the index to the IETF WG name "snmpv3"
*/
long indx=1;
netsnmp_table_row_add_index(row, ASN_INTEGER,&indx,sizeof(indx));
printf ("44444444444444444 \n");
long ChNum=123;
long DataR=124;
long TxP=125;
/*
* set column 2 to be the WG chair name "Russ Mundy"
*/
netsnmp_set_row_column(row, 2, ASN_INTEGER,
&ChNum,sizeof(ChNum));
netsnmp_mark_row_column_writable(row, 2, 1); /* make writable via SETs */
printf ("5555555555555555\n");
/*
* set column 3 to be the WG chair name "David Harrington"
*/
netsnmp_set_row_column(row, 3, ASN_INTEGER, &DataR,
sizeof(DataR));
netsnmp_set_row_column(row, 4, ASN_INTEGER, &TxP,
sizeof(TxP));
netsnmp_mark_row_column_writable(row, 3, 1); /* make writable via SETs */
/*
* add the row to the table
*/
netsnmp_table_dataset_add_row(table_set, row);
printf ("66666666666666666666666 \n");
netsnmp_register_auto_data_table(table_set, NULL);
}
/** Initializes the dot3ChannelInfo1Table module */
void
init_dot3ChannelInfo1Table(void)
{
/*
* here we initialize all the tables we're planning on supporting
*/
initialize_table_dot3ChannelInfo1Table();
}
/** handles requests for the dot3ChannelInfo1Table table, if anything else needs to be done */
int
dot3ChannelInfo1Table_handler(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* perform anything here that you need to do. The requests have
* already been processed by the master table_dataset handler, but
* this gives you chance to act on the request in some other way
* if need be.
*/
return SNMP_ERR_NOERROR;
}
Note: forwarded message attached.
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
--0-56966524-1177368009=:74383
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Thanks Dave.I did that modification but when I compile and run the code as subagent I am getting theSegmentation Fault Error.I just did very simple modification in the the data_set.c example. This error happens right before the netsnmp_table_set_multi_add_default_row() function.At below you can see the code.I appreciate if you can give me a hint on this problem.I can successfully run and compile data_set.cRegards,Reza* Note: this file originally auto-generated by mib2c using* : mib2c.create-dataset.conf,v 5.4 2004/02/02 19:06:53 rstory Exp $*/#include size=2> <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include "dot3ChannelInfo1Table.h"/** Initialize the dot3ChannelInfo1Table table by defining its contents and how it's structured */voidinitialize_table_dot3ChannelInfo1Table(void){static oid dot3ChannelInfo1Table_oid[] ={ 1, 3, 6, 1, 4, 1, 16735, 21, 4, 1 };size_t dot3ChannelInfo1Table_oid_len =OID_LENGTH(dot3ChannelInfo1Table_oid);
netsnmp_table_data_set *table_set;netsnmp_table_row *row;/** create the table structure itself*/table_set = netsnmp_create_table_data_set("dot3ChannelInfo1Table");/** comment this out or delete if you don't support creation of new rows*/table_set->allow_creation = 1;printf ("111111111111 \n");/************************************************** ** Adding indexes*/DEBUGMSGTL(("initialize_table_dot3ChannelInfo1Table","adding indexes to table dot3ChannelInfo1Table\n"));netsnmp_table_set_add_indexes(table_set, /* index: dot3CitIndex
*/ASN_INTEGER);printf ("bbbbbbbbbbbbbbbbb \n");DEBUGMSGTL(("initialize_table_dot3ChannelInfo1Table","adding column types to table dot3ChannelInfo1Table\n"));netsnmp_table_set_multi_add_default_row(table_set,COLUMN_DOT3CITINDEX, 0,NULL, 0,COLUMN_DOT3CITCHANNELNUMBER,ASN_INTEGER, 0, NULL, 0,COLUMN_DOT3CITDATARATE,ASN_INTEGER, 0, NULL, 0,COLUMN_DOT3CITTXPOWER,ASN_INTEGER, 0, NULL, 0, 0);/** registering the table with the master agent*/
/** note: if you don't need a subhandler to deal with any aspects* of the request, change dot3ChannelInfo1Table_handler to "NULL"*/printf ("2222222222222222 \n");netsnmp_register_table_data_set(netsnmp_create_han dler_registration("dot3ChannelInfo1Table",dot3ChannelInfo1Table_handler,dot3ChannelInfo1Table_oid,dot3ChannelInfo1Table_oid_len,HANDLER_CAN_RWRITE), table_set, NULL);printf ("333333333333333 \n");row = netsnmp_create_table_data_row();/** set the index to the IETF WG name "snmpv3"*/size=2>long indx=1;netsnmp_table_row_add_index(row, ASN_INTEGER,&indx,sizeof(indx));printf ("44444444444444444 \n");long ChNum=123;long DataR=124;long TxP=125;/** set column 2 to be the WG chair name "Russ Mundy"*/netsnmp_set_row_column(row, 2, ASN_INTEGER,&ChNum,sizeof(ChNum));netsnmp_mark_row_column_writable(row, 2, 1); /* make writable via SETs */
printf ("5555555555555555\n");/** set column 3 to be the WG chair name "David Harrington"*/netsnmp_set_row_column(row, 3, ASN_INTEGER, &DataR,sizeof(DataR));netsnmp_set_row_column(row, 4, ASN_INTEGER, &TxP,sizeof(TxP));netsnmp_mark_row_column_writable(row, 3, 1); /* make writable via SETs *//** add the row to the table*/netsnmp_table_dataset_add_row(table_set, row);printf ("66666666666666666666666 \n");netsnmp_register_auto_data_table(table_set, NULL);}color=#008000 size=2>/** Initializes the dot3ChannelInfo1Table module */voidinit_dot3ChannelInfo1Table(void){/** here we initialize all the tables we're planning on supporting*/initialize_table_dot3ChannelInfo1Table();}/** handles requests for the dot3ChannelInfo1Table table, if anything else needs to be done */intdot3ChannelInfo1Table_handler(netsnmp_mib_handler *handler,netsnmp_handler_registration *reginfo,netsnmp_agent_request_info *reqinfo,netsnmp_request_info *requests){size=2>/** perform anything here that you need to do. The requests have* already been processed by the master table_dataset handler, but* this gives you chance to act on the request in some other way* if need be.*/return SNMP_ERR_NOERROR;}
Note: forwarded message attached.
Ahhh...imagining that irresistible "new car" smell?
Check out
new cars at Yahoo! Autos.
--0-56966524-1177368009=:74383--
--0-401592663-1177368009=:74383
Content-Type: message/rfc822
X-Apparently-To: rezsalehi@yahoo.com via 206.190.49.77;
Sun, 22 Apr 2007 07:58:27 -0700
X-Originating-IP: [209.85.132.246]
Authentication-Results: mta242.mail.re3.yahoo.com from=googlemail.com;
domainkeys=pass (ok)
Received: from 209.85.132.246 (EHLO an-out-0708.google.com) (209.85.132.246)
by mta242.mail.re3.yahoo.com with SMTP;
Sun, 22 Apr 2007 07:58:27 -0700
Received: by an-out-0708.google.com with SMTP id d17so1557025and
for; Sun, 22 Apr 2007 07:58:27 -0700 (PDT)
DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta;
h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth;
b=Kh20tWW1k3L6odazy7bOiJRyv3Q02qX3fcGwn44tb02HKaUp ye7sBqgQxf23UngYHJbfd/IcJ51kdjIanAiON+cTEttgFnCIHfGC/iKMNra5OlLGh//PRIJk/uKSsPlIKzhCZULjeRd0n9em6XAaDCe7wEoOzmgYi9YPl14qYDg =
DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta;
h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth;
b=f70RW63Eqssk+tmX+yw9dsIHEdU8f0bOYsw8FKm4R9dutRxR QhpIqJoNDa7D8TVPzUuEZuA3N1nQs0aFC3VT7cEVL84TaUb6K7 JP3EfMUIL+LP7OxX/UzV65PLtDLdrlYWjStHUZqaAuWW0R+mzwn11r++ZuwwVKlaOVx NXkyCk=
Received: by 10.100.227.5 with SMTP id z5mr299605ang.1177253907376;
Sun, 22 Apr 2007 07:58:27 -0700 (PDT)
Received: by 10.100.3.12 with HTTP; Sun, 22 Apr 2007 07:58:27 -0700 (PDT)
Date: Sun, 22 Apr 2007 15:58:27 +0100
From: "Dave Shield"
Sender: dave.shield@googlemail.com
To: "Reza Salehi"
Subject: Re: Re: RE: about mib2c
Cc: net-snmp-users@lists.sourceforge.net
In-Reply-To: <847314.12220.qm@web53204.mail.re2.yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <847314.12220.qm@web53204.mail.re2.yahoo.com>
X-Google-Sender-Auth: 41db08c4cd271769
On 22/04/07, Reza Salehiwrote:
> I used mib2c.create-dataset.conf to create a C file. I want to register
> Integers in each column .In example data-set.c it used
> net_snmp_set_row_column(row,column,type, char* value,
> size_t length) function for setting the column for each row
long myInt = 12345;
net_snmp_set_row_column( row, col, ASN_INTEGER, &myInt, sizeof(myInt));
Dave
--0-401592663-1177368009=:74383
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--0-401592663-1177368009=:74383
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users
--0-401592663-1177368009=:74383--