Hello all,
I need help accessing an especific row column value using for that
a given row. For example, please consider the following code:
-------------------- CODE -----------------------
int index;
netsnmp_table_data_set *table_set;
netsnmp_table_row *row;
oid my_registration_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 2, 2, 1 };
table_set = netsnmp_create_table_data_set("TestTable");
table_set->allow_creation = 1;
netsnmp_table_dataset_add_index(table_set, ASN_INTEGER);
netsnmp_table_set_multi_add_default_row(table_set,
/*
* column 2 = OCTET STRING,
* writable = 1,
* default value = NULL,
* default value len = 0
*/
1, ASN_INTEGER, 1, NULL, 0,
2, ASN_OCTET_STR, 1, NULL, 0,
3, ASN_OCTET_STR, 1, NULL, 0,
0 /* done */ );
netsnmp_register_table_data_set(netsnmp_create_handler_registration
("TestTable", NULL,
my_registration_oid,
OID_LENGTH(my_registration_oid),
HANDLER_CAN_RWRITE), table_set, NULL);
row = netsnmp_create_table_data_row();
index = 1;
netsnmp_table_row_add_index(row, ASN_INTEGER, &index, sizeof(index));
netsnmp_set_row_column(row, 1, ASN_INTEGER,&index, sizeof(index));
netsnmp_mark_row_column_writable(row, 1, 1); /* make writable via SETs */
netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "Russ Mundy",
strlen("Russ Mundy"));
netsnmp_mark_row_column_writable(row, 2, 1); /* make writable via SETs */
netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "David Harrington",
strlen("David Harrington"));
netsnmp_mark_row_column_writable(row, 3, 1); /* make writable via SETs */
netsnmp_table_dataset_add_row(table_set, row);
row = netsnmp_table_data_set_get_first_row (table_set);
-------------------- CODE -----------------------
Now, I want to be able to, using the row obtained from last line of
the code, access any given column value.
Something like:
value = row->column[2];
Is it possible?
I really dont want to get that value using a snmpget command because
that would decrease my agent's performance.
I'd really appreciate any help,
Thanks,
Vinicius M. Pacheco
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders