Example #1
0
def itodq(addr):
    """itodq(int_address) (integer to dotted-quad)
Return a dotted-quad string given an integer. """
    intval = long(addr) # might get an IPv4 object
    s = "%c%c%c%c" % (((intval >> 24) & 0x000000ff), ((intval & 0x00ff0000) >> 16),
        ((intval & 0x0000ff00) >> 8), (intval & 0x000000ff))
    return socket.inet_ntoa(s)
Example #2
0
def itodq(addr):
    """Return a dotted-quad string given an integer. """
    intval = long(addr)  # might get an IPv4 object
    s = struct.pack(b"BBBB", (intval >> 24) & 0x000000ff,
                    (intval & 0x00ff0000) >> 16, (intval & 0x0000ff00) >> 8,
                    intval & 0x000000ff)
    return socket.inet_ntoa(s)
Example #3
0
    def _getaddr(self, ifname, func):
        ifreq = (ifname + '\0' * 32)[:32]
        try:
            result = self._fcntl(func, ifreq)
        except IOError:
            return None

        return socket.inet_ntoa(result[20:24])
Example #4
0
    def _getaddr(self, ifname, func):
        ifreq = (ifname + '\0'*32)[:32]
        try:
            result = self._fcntl(func, ifreq)
        except IOError:
            return None

        return socket.inet_ntoa(result[20:24])
Example #5
0
def itodq(addr):
    """Return a dotted-quad string given an integer. """
    intval = long(addr) # might get an IPv4 object
    s = struct.pack(b"BBBB", (intval >> 24) & 0x000000ff, (intval & 0x00ff0000) >> 16,
        (intval & 0x0000ff00) >> 8, intval & 0x000000ff)
    return socket.inet_ntoa(s)