Re: HEX- String instead of Octet - String - incase of inetAddress

Niels Baggesen via Net-snmp-coders <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
On Tue, Dec 03, 2019 at 04:45:30PM +0000, Bek, Anshul wrote:
> 
> For 9.9.156.1.1.2.1.7.1 and 9.9.156.1.1.2.1.7.2, its basically an InetAddress.
> 
> I have 2 queries:
> 
> 
>   1.  Is there any way to get only these 2 InetAddress as Hex-string. I can see that  in sprint_realloc_octet_string() in snmplib/mib.c involves in sprinting OCTET STRINGS for snmpgets and walks. Is there any value to check ? Also  hints, enums and units passed in NULL.
>   2.  Why is the IP display in this manner ie. each octet in ascii . Is it by default ?
> 
> Note:- I don't want to use -Ox option as this will display all the strings value in Hex.

They are display that way because Cisco intended this to be a host name
and then it makes sense that it is a string.

They are defined like this

$ snmptranslate -Td -m ALL SNMPv2-SMI::enterprises.9.9.156.1.1.2.1.2.1
CISCO-CCM-MIB::ccmName.1
ccmName OBJECT-TYPE
  -- FROM	CISCO-CCM-MIB
  -- TEXTUAL CONVENTION SnmpAdminString
  SYNTAX	OCTET STRING (0..128) 
  DISPLAY-HINT	"255t"
  MAX-ACCESS	read-only
  STATUS	current
  DESCRIPTION	"The host name of the CallManager."
::= { iso(1) org(3) dod(6) internet(1) private(4)
      enterprises(1) cisco(9) ciscoMgmt(9) ciscoCcmMIB(156)
      ciscoCcmMIBObjects(1) ccmGeneralInfo(1) ccmTable(2)
      ccmEntry(1) ccmName(2) 1 }
	      
/Niels

-- 
Niels Baggesen - @home - Århus - Denmark - [email protected]
The purpose of computing is insight, not numbers   ---   R W Hamming
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.