Exemple #1
0
def valid_str(addr):
    """
    @param addr: An IPv6 address in presentation (string) format.

    @return: C{True} if IPv6 address is valid, C{False} otherwise.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')

    try:
        _inet_pton(AF_INET6, addr)
    except:
        return False
    return True
Exemple #2
0
def valid_str(addr):
    """
    @param addr: An IPv6 address in presentation (string) format.

    @return: C{True} if IPv6 address is valid, C{False} otherwise.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')

    try:
        _inet_pton(AF_INET6, addr)
    except:
        return False
    return True
Exemple #3
0
def valid_str(addr, flags=0):
    """
    :param addr: An IPv6 address in presentation (string) format.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: ``True`` if IPv6 address is valid, ``False`` otherwise.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')

    try:
        _inet_pton(AF_INET6, addr)
    except:
        return False
    return True
Exemple #4
0
def valid_str(addr, flags=0):
    """
    :param addr: An IPv6 address in presentation (string) format.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: ``True`` if IPv6 address is valid, ``False`` otherwise.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')

    try:
        _inet_pton(AF_INET6, addr)
    except:
        return False
    return True
Exemple #5
0
def str_to_int(addr, flags=0):
    """
    :param addr: An IPv6 address in string form.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: The equivalent unsigned integer for a given IPv6 address.
    """
    try:
        packed_int = _inet_pton(AF_INET6, addr)
        return packed_to_int(packed_int)
    except Exception:
        raise AddrFormatError('%r is not a valid IPv6 address string!' % addr)
Exemple #6
0
def str_to_int(addr, flags=0):
    """
    :param addr: An IPv6 address in string form.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: The equivalent unsigned integer for a given IPv6 address.
    """
    try:
        packed_int = _inet_pton(AF_INET6, addr)
        return packed_to_int(packed_int)
    except Exception:
        raise AddrFormatError('%r is not a valid IPv6 address string!' % addr)
Exemple #7
0
def str_to_int(addr):
    """
    @param addr: An IPv6 address in string form.

    @return: The equivalent unsigned integer for a given IPv6 address.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')
    try:
        packed_int = _inet_pton(AF_INET6, addr)
        return packed_to_int(packed_int)
    except Exception:
        raise AddrFormatError('%r is not a valid IPv6 address string!' \
            % addr)
Exemple #8
0
def str_to_int(addr):
    """
    @param addr: An IPv6 address in string form.

    @return: The equivalent unsigned integer for a given IPv6 address.
    """
    if addr == '':
        raise AddrFormatError('Empty strings are not supported!')
    try:
        packed_int = _inet_pton(AF_INET6, addr)
        return packed_to_int(packed_int)
    except Exception:
        raise AddrFormatError('%r is not a valid IPv6 address string!' \
            % addr)