Re: to register instance of UNICODE string
Alexander Bubnov <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
I am sorry I did not point that I changed ABC to DEF to make sure snmpget returns the first character. In case of ABC snmpget returns 'A', and in case of DEF - 'D'. Below the output: f560-2k1 snmp/mibs# snmpget -v2c -c rwpublic -d localhost NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 Sending 50 bytes to UDP: [0.0.0.0]->[127.0.0.1]:161 0000: 30 30 02 01 01 04 08 72 77 70 75 62 6C 69 63 A0 00.....rwpublic. 0016: 21 02 04 72 A5 EF 4F 02 01 00 02 01 00 30 13 30 !..r..O......0.0 0032: 11 06 0D 2B 06 01 04 01 BF 08 02 04 01 01 02 00 ...+............ 0048: 05 00 .. Received 66 bytes from UDP: [0.0.0.0]->[127.0.0.1]:161 0000: 30 40 02 01 01 04 08 72 77 70 75 62 6C 69 63 A2 [email protected]. 0016: 31 02 04 72 A5 EF 4F 02 01 00 02 01 00 30 23 30 1..r..O......0#0 0032: 21 06 0D 2B 06 01 04 01 BF 08 02 04 01 01 02 00 !..+............ 0048: 04 10 44 00 00 00 45 00 00 00 46 00 00 00 00 00 ..D...E...F..... 0064: 00 00 .. NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = STRING: D 2009/2/24 Dave Shield <[email protected]> > 2009/2/24 Alexander Bubnov <[email protected]>: > > 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: > > # snmpget -v2c -c rwpublic -Ox localhost nstAgentSubagentObject.0 > > NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = STRING: A > > Eh? > The buffer holds "DEF", but the agent returns something starting "A". > Something is seriously wrong there. > > > I guess snmpget prints till zero terminator or agent sends till zero > terminator, > > Don't guess - check. > Run the command with the '-d' option to dump the raw packet. > You should see the octets of the value being returned at the > end of the packet dump. > (Unfortunately, it seems that the DISPLAY-HINTS clause in the MIB > file takes precedence over the -Ox flag. Sorry about that). > > > I'd expect the agent to be returning the full value, because it typically > works with strings as "length+data" rather than 0-terminated. > (Remember, binary strings are handled by SNMP in exactly the same > way as printable strings, and these might well include embedded NULs). > > > My suspicion is that it's probably the client that's not printing the > value correctly. But looking at the raw dump should confirm or > reject this. > > > > Can you please point to what is wrong, now? Is it possible to see whole > > string? > > It sounds as if we need someone more knowledgeable about > internationalisation > issues to look over the output processing, and suggest a more robust > approach. > Assuming that is indeed what is happening here. > > 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