(self, args)
setter for the policy descriptor
setter for the policy descriptor
setter for the policy descriptor
def policy(self, args):
        """
        setter for the policy descriptor
        """

        word = args[0]
        if word == 'reject':
            self.accepted_ports = None
            self.rejected_ports = []
            target = self.rejected_ports

        elif word == 'accept':
            self.accepted_ports = []
            self.rejected_ports = None
            target = self.accepted_ports

        else:
            raise RuntimeError("Don't understand policy word \"%s\"" % word)

        for port in args[1].split(','):
            if '-' in port:
                (a, b) = port.split('-')
                target.append(PortRange(int(a), int(b)))
            else:
                target.append(int(port))
def policy ( self , args ) : word = args [ 0 ] if word == 'reject' : self . accepted_ports = None self . rejected_ports = [ ] target = self . rejected_ports elif word == 'accept' : self . accepted_ports = [ ] self . rejected_ports = None target = self . accepted_ports else : raise RuntimeError ( "Don't understand policy word \"%s\"" % word ) for port in args [ 1 ] . split ( ',' ) : if '-' in port : ( a , b ) = port . split ( '-' ) target . append ( PortRange ( int ( a ) , int ( b ) ) ) else : target . append ( int ( port ) )