Re: Please, document byte order in org.freedesktop.NetworkManager.IP4Config





2009/10/22 Andrey Batyiev <batyiev gmail com>
Hello everyone

Am I right, that every IP address in org.freedesktop.NetworkManager.IP4Config
is in network byte order? Could you explicitly document this behaviour,
please?

implementation in Python:

import sockket
def convert_ip_to_int(ip):
    """
    Converts ``ip`` to its integer representation

    :param ip: The IP to convert
    :type ip: str
    :rtype: int
    """
    i = struct.unpack('i', socket.inet_pton(socket.AF_INET, ip))[0]
    if i < 0:
        i += 0xffffffff + 1
    return i


Thanks,
  Andrey
_______________________________________________
NetworkManager-list mailing list
NetworkManager-list gnome org
http://mail.gnome.org/mailman/listinfo/networkmanager-list



--
Pablo Martí
http://www.linkedin.com/in/pmarti || http://www.warp.es
python -c "print '706d6172746940776172702e6573'.decode('hex')"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]