Thank you for replay.
I have corrected the code, below differences:
*static const wchar_t nstAgentSubagentObject[] = L"DEF"; <-- array*
and
*sizeof(nstAgentSubagentObject)*, instead of *
wcslen(nstAgentSubagentObject),*
run next commands:
*f**560-2k1 snmp/mibs#* *snmpget -v2c -c rwpublic -Ox localhost
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = STRING: A*
*f560-2k1 snmp/mibs#* *snmpget -v2c -c rwpublic localhost
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = STRING: A*
**
Both of them return only the first character. I guess snmpget prints till
zero terminator or agent sends till zero terminator, because wchar string
looks like A\0\0\0B\0\0\0C\0\0\0\0\0\0\0
Can you please point to what is wrong, now? Is it possible to see whole
string?
2009/2/24 Dave Shield <[email protected]>
> 2009/2/24 Alexander Bubnov <[email protected]>:
> > I tried to register an instance of UNICODE string:
> > static const wchar_t* nstAgentSubagentObject = L"ABC";
>
> [snip]
>
> > But snmpget prints strange set of characters:
>
> [snip]
>
> > Can you please help me to find out what is wrong?
>
> The first thing to check is whether the problem lies with the agent,
> or with snmpget? Is the wrong value being returned, or is the
> value OK but it's not being displayed correctly.
The val
>
>
> Try running
> snmpget -v2c -c rwpublic -Ox localhost
> NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
>
> to print the result as a series of octet values.
> Does this match what you would expect
> (in which case the problem is with how snmpget displays this value).
>
> Or is the value returned wrong
> (in which case the problem lies in the agent).
>
>
> One other thought:
> watcher_info = netsnmp_create_watcher_info(
> &nstAgentSubagentObject,
> wcslen(nstAgentSubagentObject), <====
> ASN_OCTET_STR, watcher_flags);
>
> I'm no expert in internationalisation, but the watcher is expecting to be
> told the size of the buffer in octets. Assuming the size of a wide
> character is greater than 8 bits, this code will only be watching the
> first bit of the nstAgentSubagentObject buffer - not the whole thing,
> and hence won't be reporting the complete value.
>
> (Because you've only told it about 3 bytes).
>
>
> > may by a special storage of UTF strings exist as for counter64?
>
> No - UTF strings are simply a sequence of octets.
> The only "string" type in SNMP is OCTET STRING.
>
> Dave
>
--
/BR, Alexander
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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