MCPcopy Create free account
hub / github.com/mininet/mininet / ipStr

Function ipStr

mininet/util.py:381–389  ·  view source on GitHub ↗

Generate IP address string from an unsigned int. ip: unsigned int of form w << 24 | x << 16 | y << 8 | z returns: ip address string w.x.y.z

( ip )

Source from the content-addressed store, hash-verified

379 return _colonHex( mac, 6 )
380
381def ipStr( ip ):
382 """Generate IP address string from an unsigned int.
383 ip: unsigned int of form w << 24 | x << 16 | y << 8 | z
384 returns: ip address string w.x.y.z"""
385 w = ( ip >> 24 ) & 0xff
386 x = ( ip >> 16 ) & 0xff
387 y = ( ip >> 8 ) & 0xff
388 z = ip & 0xff
389 return "%i.%i.%i.%i" % ( w, x, y, z )
390
391def ipNum( w, x, y, z ):
392 """Generate unsigned int from components of IP address

Callers 2

ipAddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected