Re: Problem initializing table from mib2c data_set
niepa inter <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
________________________________ From: Dave Shield <[email protected]> To: niepa inter <[email protected]> Cc: [email protected] Sent: Monday, August 24, 2009 2:32:08 AM Subject: Re: Problem initializing table from mib2c data_set 2009/8/24 niepa inter <[email protected]>: > I modified the netsnmp_table_set_multi_add_default_row as shown below but it > does not work. > > netsnmp_table_set_multi_add_default_row(table_set, > 2, ASN_OCTET_STR, 1, mystring1, strlen(mystring1), > 3, ASN_OCTET_STR, 1, mystring2, strlen(mystring2), > 0 /* done */ ); OK - that sets the default configuration for a row. How are you actually trying to create the initial contents of the table? void initialize_table_prtConsoleDisplayBufferTable(MYPTR *pkt) { static oid prtConsoleDisplayBufferTable_oid[] = {1,3,6,1,2,1,43,16,5}; size_t prtConsoleDisplayBufferTable_oid_len = OID_LENGTH(prtConsoleDisplayBufferTable_oid); netsnmp_table_data_set *table_set; /* create the table structure itself */ table_set = netsnmp_create_table_data_set("prtConsoleDisplayBufferTable"); /* enable row creation */ table_set->allow_creation = 1; /*************************************************** * Adding indexes */ DEBUGMSGTL(("initialize_table_prtConsoleDisplayBufferTable", "adding indexes to table prtConsoleDisplayBufferTable\n")); netsnmp_table_set_add_indexes(table_set, ASN_INTEGER, /* index: hrDeviceIndex */ ASN_INTEGER, /* index: prtConsoleDisplayBufferIndex */ 0); DEBUGMSGTL(("initialize_table_prtConsoleDisplayBufferTable", "adding column types to table prtConsoleDisplayBufferTable\n")); netsnmp_table_set_multi_add_default_row(table_set, COLUMN_PRTCONSOLEDISPLAYBUFFERINDEX, ASN_INTEGER, 0, pkt->index, sizeof(pkt->index), COLUMN_PRTCONSOLEDISPLAYBUFFERTEXT, ASN_OCTET_STR, 1, pkt->consolebuf, strlen(consolebuf), 0); /* registering the table with the master agent */ netsnmp_register_table_data_set(netsnmp_create_handler_registration("prtConsoleDisplayBufferTable", prtConsoleDisplayBufferTable_handler, prtConsoleDisplayBufferTable_oid, prtConsoleDisplayBufferTable_oid_len, HANDLER_CAN_RWRITE), table_set, NULL); } What rows should it contain? My hope is that the row at COLUMN_PRTCONSOLEDISPLAYBUFFERTEXT , shows the initial stringpkt->consolebuf passed to the function netsnmp_table_set_multi_add_default_row during initialization. What does the code actually look like? I have a pointer that points to the data I need to store in my table built by the data_set method. However if I create an additional row(COLUMN_PRTCONSOLEDISPLAYBUFFERTEXT.1) and load some data into it ,it works. But I do not want to add another row, I would like to be able to initialize COLUMN_PRTCONSOLEDISPLAYBUFFERTEXT. Thanks ~Yan ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ 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