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 <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 */
  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_handler_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.
--- Begin Message ---
On 22/04/07, Reza Salehi <[EMAIL PROTECTED]> wrote:

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

--- End Message ---
-------------------------------------------------------------------------
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/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to