cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1773
Views
1
Helpful
1
Replies

CDR origIpAddr format

droberts
Level 1
Level 1

Hi I've been trying to figure out the format for this field in the CDR origIpAddr.  The documentation just says Integer but represents an IP v4 address.  Example values include

352737802  and -1759442934

1 Reply 1

dstaudt
Cisco Employee
Cisco Employee

An IP address by definition is a 32-bit value, and a 32-bit integer can represent.  If you want to convert this integer representation into something else, like the more familiar 'dotted octet' xxx.xxx.xxx.xxx, that will depend on what language you are using.  For example Java:

int ip  = ... ;
String ipStr =
 
String.format("%d.%d.%d.%d",
  
(ip & 0xff),  
  
(ip >> 8 & 0xff),  
  
(ip >> 16 & 0xff),  
  
(ip >> 24 & 0xff));

From this thread: Java: convert int to InetAddress - Stack Overflow

This is an online decimal to dotted notation converter:

IP Converter: IP Conversion | IP Converters Hex, Binary, Decimal