Hmmm... the names you're using don't actually match the MIB fragment you gave! -snip-
Hm... I'm new at this, so I'm really not sure, but please bear with me :) I've made a new test MIB, it's attached (I hope it's ok)
This is snapshot by snmptranslate:
+--alterbox(9184)
|
+--alterboxProducts(1)
|
+--alterboxTest(2)
|
+--alterTestTable(3)
|
+--alterTableEntry(1)
| Index: alterIndex
|
+-- -RW- String alterIndex(1)
| Textual Convention: DisplayString
+-- -RW- INTEGER alterField1(2)
+-- -RW- INTEGER alterField2(3)
+-- -RW- EnumVal alterRowStatus(4)
Textual Convention: RowStatus
Values: active(1), notInService(2), notReady(3),
createAndGo(4), createAndWait(5), destroy(6)
Here's what I get running snmpset (from bash):
snmpset -Ir localhost alterField1.\"ab\" = 1 ALTERBOX-TEST::alterField1."ab" = INTEGER: 1
OID (sniffed by ethereal): 1.3.6.1.4.1.9184.1.2.3.1.2.2.97.98
however, if I run it without -Ir switch, I get: alterField1."ab": Unknown Object Identifier (Index out of range: "ab (alterIndex))
and no packets are sent to snmpd (again, notice the missing end quote in the error report) Why is this happening?
Now, when I try to set the value from my client, even stranger things happen. Here's the code snippet I use (strOid is std::string):
oid anOID[MAX_OID_LEN]; size_t anOIDLen = MAX_OID_LEN; snmp_pdu* pRequestPdu = snmp_pdu_create(SNMP_MSG_SET); snmp_pdu* pResponsePdu= NULL;
memset(anOID, 0, sizeof(anOID)); snmp_parse_oid(strOid.c_str(), anOID, &anOIDLen); // or: get_node(strOid.c_str(), anOID, &anOIDLen);
I'm using gdb to inspect anOID after snmp_parse_oid/get_node return:
When I set strOid to "alterField1.\"ab\"", both functions return:
{1, 3, 6, 1, 4, 1, 9184, 1, 2, 3, 1, 2, 0, 97, 98, 0 <repeats 101 times>, 1, 3, 6, 1, 4, 1, 9184, 1, 2, 3, 1, 2}
Since C string "alterField1.\"ab\"" is actually 'alterField1."ab"', I tried setting it to 'alterField1.\"ab\"', so I set strOid to "alterField1.\\\"ab\\\""
snmp_parse_oid/get_node return:
{1, 3, 6, 1, 4, 1, 9184, 1, 2, 3, 1, 2, 0 <repeats 104 times>, 1, 3, 6, 1, 4, 1, 9184, 1, 2, 3, 1, 2}
And, of course, fails.
I hope I've given you enough details. Thanks for all the help you can provide. -- Marko ICQ: 5990814
Him: "Your skin is so soft. Are you a model?"
Her: "No," [blush] "I'm a cosmetologist."
Him: "Really? That's incredible... It must be very tough to handle
weightlessness."
-- "The Jerk"
--****************************************************************************
-- Alterbox MIB
-- Version 1.0
-- Copyright � Alterbox, 2004. All rights reserved.
ALTERBOX-TEST DEFINITIONS ::= BEGIN
IMPORTS
alterbox, alterboxProducts
FROM ALTERBOX-MAIN
enterprises, OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString
FROM RFC1158-MIB
RowStatus
FROM SNMPv2-TC;
-- sub-tree for Test
alterboxTest OBJECT IDENTIFIER ::= { alterboxProducts 2 }
alterTestTable OBJECT-TYPE
SYNTAX SEQUENCE OF AlterTableEntry
ACCESS read-write
STATUS mandatory
DESCRIPTION "AlterTableEntry"
::= { alterboxTest 3 }
alterTableEntry OBJECT-TYPE
SYNTAX AlterTableEntry
ACCESS read-write
STATUS mandatory
DESCRIPTION "AlterTableEntry"
INDEX { alterIndex }
::= { alterTestTable 1 }
AlterTableEntry ::= SEQUENCE {
alterIndex DisplayString,
alterField1 INTEGER,
alterField2 INTEGER,
alterRowStatus RowStatus
}
alterIndex OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-write
STATUS mandatory
DESCRIPTION "alterIndex"
::= { alterTableEntry 1 }
alterField1 OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION "alterField1"
::= { alterTableEntry 2 }
alterField2 OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION "alterField2"
::= { alterTableEntry 3 }
alterRowStatus OBJECT-TYPE
SYNTAX RowStatus
ACCESS read-write
STATUS mandatory
DESCRIPTION "alterRowStatus"
::= { alterTableEntry 4 }
END
