static snmp_err_t sensor_table_get_cell_instance(const u32_t* column, const u32_t* row_oid, u8_t row_oid_len, struct snmp_node_instance* cell_instance); static snmp_err_t sensor_table_get_next_cell_instance(const u32_t* column, struct snmp_obj_id* row_oid, struct snmp_node_instance* cell_instance); static s16_t sensor_table_get_value(struct snmp_node_instance* instance, void* value); static snmp_err_t sensor_table_set_value(struct snmp_node_instance* instance, u16_t len, void *value); /* sensorentry .1.3.6.1.4.1.26381.1.1.1 (.level0.level1) where level 0 is the table column (temperature/file name) and level 1 the table row (sensor index) */ static const struct snmp_table_col_def sensor_table_columns[] = { { 1, SNMP_ASN1_TYPE_INTEGER, SNMP_NODE_INSTANCE_READ_WRITE }, { 2, SNMP_ASN1_TYPE_OCTET_STRING, SNMP_NODE_INSTANCE_READ_ONLY } }; /* sensortable .1.3.6.1.4.1.26381.1.1 */ static const struct snmp_table_node sensor_table = SNMP_TABLE_CREATE( 1, sensor_table_columns, sensor_table_get_cell_instance, sensor_table_get_next_cell_instance, sensor_table_get_value, snmp_set_test_ok, sensor_table_set_value); /* sensorcount .1.3.6.1.4.1.26381.1.2 */ static const struct snmp_scalar_node sensor_count = SNMP_SCALAR_CREATE_NODE_READONLY( 2, SNMP_ASN1_TYPE_INTEGER, sensor_count_get_value); /* example .1.3.6.1.4.1.26381.1 */ static const struct snmp_node* const example_nodes[] = { &sensor_table.node.node, &sensor_count.node.node }; static const struct snmp_tree_node example_node = SNMP_CREATE_TREE_NODE(1, example_nodes); static const u32_t prvmib_base_oid[] = { 1,3,6,1,4,1,26381,1 }; const struct snmp_mib mib_private = SNMP_MIB_CREATE(prvmib_base_oid, &example_node.node);
{ 12, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifInNUcastPkts */ { 13, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifInDiscarts */ { 14, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifInErrors */ { 15, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifInUnkownProtos */ { 16, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutOctets */ { 17, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutUcastPkts */ { 18, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutNUcastPkts */ { 19, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutDiscarts */ { 20, SNMP_ASN1_TYPE_COUNTER, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutErrors */ { 21, SNMP_ASN1_TYPE_GAUGE, SNMP_NODE_INSTANCE_READ_ONLY }, /* ifOutQLen */ { 22, SNMP_ASN1_TYPE_OBJECT_ID, SNMP_NODE_INSTANCE_READ_ONLY } /* ifSpecific */ }; #if !SNMP_SAFE_REQUESTS static const struct snmp_table_node interfaces_Table = SNMP_TABLE_CREATE( 2, interfaces_Table_columns, interfaces_Table_get_cell_instance, interfaces_Table_get_next_cell_instance, interfaces_Table_get_value, interfaces_Table_set_test, interfaces_Table_set_value); #else static const struct snmp_table_node interfaces_Table = SNMP_TABLE_CREATE( 2, interfaces_Table_columns, interfaces_Table_get_cell_instance, interfaces_Table_get_next_cell_instance, interfaces_Table_get_value, NULL, NULL); #endif /* the following nodes access variables in LWIP stack from SNMP worker thread and must therefore be synced to LWIP (TCPIP) thread */ CREATE_LWIP_SYNC_NODE(1, interfaces_Number) CREATE_LWIP_SYNC_NODE(2, interfaces_Table) static const struct snmp_node* const interface_nodes[] = { &SYNC_NODE_NAME(interfaces_Number).node.node, &SYNC_NODE_NAME(interfaces_Table).node.node