Logo Search packages:      
Sourcecode: virt-manager version File versions  Download package

def virtManager::IPy::IPint::_printPrefix (   self,
  want 
) [private]

Prints Prefixlen/Netmask.

Not really. In fact it is our universal Netmask/Prefixlen printer.
This is considered an internel function.

want == 0 / None        don't return anything    1.2.3.0
want == 1               /prefix                  1.2.3.0/24
want == 2               /netmask                 1.2.3.0/255.255.255.0
want == 3               -lastip                  1.2.3.0-1.2.3.255

Definition at line 348 of file IPy.py.

00348                                 :
        """Prints Prefixlen/Netmask.

        Not really. In fact it is our universal Netmask/Prefixlen printer.
        This is considered an internel function.

        want == 0 / None        don't return anything    1.2.3.0
        want == 1               /prefix                  1.2.3.0/24
        want == 2               /netmask                 1.2.3.0/255.255.255.0
        want == 3               -lastip                  1.2.3.0-1.2.3.255
        """

        if (self._ipversion == 4 and self._prefixlen == 32) or \
           (self._ipversion == 6 and self._prefixlen == 128): 
            if self.NoPrefixForSingleIp:
                want = 0
        if want == None:
            want = self.WantPrefixLen
            if want == None:
                want = 1
        if want:
            if want == 2:
                # this should work wit IP and IPint
                netmask = self.netmask()
                if type(netmask) != types.IntType and type(netmask) != types.LongType:
                    netmask = netmask.int()
                return "/%s" % (intToIp(netmask, self._ipversion))
            elif want == 3:
                return "-%s" % (intToIp(self.ip + self.len() - 1, self._ipversion))
            else:
                # default
                return "/%d" % (self._prefixlen)
        else:
            return ''

        # We have different Favours to convert to:
        # strFullsize   127.0.0.1    2001:0658:022a:cafe:0200:c0ff:fe8d:08fa
        # strNormal     127.0.0.1    2001:658:22a:cafe:200:c0ff:fe8d:08fa
        # strCompressed 127.0.0.1    2001:658:22a:cafe::1
        # strHex        0x7F000001L  0x20010658022ACAFE0200C0FFFE8D08FA
        # strDec        2130706433   42540616829182469433547974687817795834

    def strBin(self, wantprefixlen = None): 


Generated by  Doxygen 1.6.0   Back to index