I'm interrested by Diameter Protocol, specially by the way AVP of type IPAddress are encoded: Example: 10.50.54.38 will be (hex) 0a 32 36 26 and octetstring representation will be .26& I would like to know to to convert from xxxx.xxxx.xxxx.xxxx to the octetstring. (I know that the representation must have 12 or 24 long length).
Thank for your share.
asked 25 Feb '14, 07:18
The "octetstring" is just the binary values as displayed in ASCII, with a '.' period used when it's not a printable ASCII character. So the number 10 in the IP address is the hex byte 0x0a on the wire, and that's not a display-able ASCII character so it shows a period; whereas the number 50 is hex 0x32, which happens to be the ASCII character "2", 0x36 is "6", and 0x26 is "&". But basically those octetstring displays are meaningless for binary data such as an IP Address.
I don't know what you mean by "12 or 24 length" - an IPv4 address is 4 octets big, which is 8 hex characters, or 4 "octetstring" characters; IPv6 is 16 octets, 32 hex chars, and 16 octetstring chars.
answered 25 Feb '14, 09:33