Home | History | Annotate | Download | only in Lib

Lines Matching refs:netmask

24     """A Value Error related to the netmask."""
159 """Helper to split the netmask and raise AddressValueError if needed"""
435 """Turn the prefix length into a bitwise netmask
448 """Return prefix length from the bitwise netmask.
451 ip_int: An integer, the netmask in expanded bitwise format
467 msg = 'Netmask pattern %r mixes zeroes & ones'
473 msg = '%r is not a valid netmask' % netmask_str
487 NetmaskValueError: If the input is not a valid netmask
503 """Turn a netmask/hostmask string into a prefix length
506 ip_str: The netmask/hostmask to be converted
512 NetmaskValueError: If the input is not a valid netmask/hostmask
514 # Parse the netmask/hostmask like an IP address.
520 # Try matching a netmask (this would be /1*0*/ as a bitwise regexp).
655 if self.netmask != other.netmask:
656 return self.netmask < other.netmask
663 int(self.netmask) == int(other.netmask))
668 return hash(int(self.network_address) ^ int(self.netmask))
703 x = self._address_class(int(self.netmask) ^ self._ALL_ONES)
713 return '%s/%s' % (self.network_address, self.netmask)
856 if self.netmask < other.netmask:
858 if self.netmask > other.netmask:
866 netmask. This function is a suitable "key" argument for sorted()
870 return (self._version, self.network_address, self.netmask)
932 /21 netmask is returned.
962 int(self.network_address) & (int(self.netmask) << prefixlen_diff),
1077 """Make a (netmask, prefix_len) tuple from the given argument.
1082 - a string representing the prefix netmask (e.g. "255.255.255.0")
1089 # Check for a netmask in prefix length form
1092 # Check for a netmask or hostmask in dotted-quad form.
1095 netmask = IPv4Address(cls._ip_int_from_prefix(prefixlen))
1096 cls._netmask_cache[arg] = netmask, prefixlen
1175 def _is_valid_netmask(self, netmask):
1176 """Verify that the netmask is valid.
1179 netmask: A string, either a prefix or dotted decimal
1180 netmask.
1184 netmask.
1187 mask = netmask.split('.')
1201 netmask = int(netmask)
1204 return 0 <= netmask <= self._max_prefixlen
1207 """Test if the IP string is a hostmask (rather than a netmask).
1379 self.netmask = self.network.netmask
1389 self.netmask = self.network.netmask
1436 self.netmask)
1452 .netmask: IPv4Address('255.255.255.224')
1476 dotted quad form, it is treated as a netmask if it starts with a
1480 netmask == /0. If no mask is given, a default of /32 is used.
1490 NetmaskValueError: If the netmask isn't valid for
1501 self.netmask, self._prefixlen = self._make_netmask(self._max_prefixlen)
1512 self.netmask, self._prefixlen = self._make_netmask(arg)
1514 if packed & int(self.netmask) != packed:
1519 int(self.netmask))
1531 self.netmask, self._prefixlen = self._make_netmask(arg)
1534 if (IPv4Address(int(self.network_address) & int(self.netmask)) !=
1538 int(self.netmask))
1614 """Make a (netmask, prefix_len) tuple from the given argument.
1619 - a string representing the prefix netmask (e.g. "255.255.255.0")
1626 netmask = IPv6Address(cls._ip_int_from_prefix(prefixlen))
1627 cls._netmask_cache[arg] = netmask, prefixlen
2071 self.netmask = self.network.netmask
2078 self.netmask = self.network.netmask
2126 self.netmask)
2150 .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
2163 IP and prefix/netmask.
2184 NetmaskValueError: If the netmask isn't valid for
2195 self.netmask, self._prefixlen = self._make_netmask(self._max_prefixlen)
2203 self.netmask, self._prefixlen = self._make_netmask(arg)
2206 if packed & int(self.netmask) != packed:
2211 int(self.netmask))
2224 self.netmask, self._prefixlen = self._make_netmask(arg)
2227 if (IPv6Address(int(self.network_address) & int(self.netmask)) !=
2231 int(self.netmask))