This is a static archive of our old Q&A Site. Please post any new questions and answers at

Diameter IPAddress type convert



I'm interrested by Diameter Protocol, specially by the way AVP of type IPAddress are encoded: Example: 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

Arkham's gravatar image

accept rate: 0%

One Answer:


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

Hadriel's gravatar image

accept rate: 18%