(self, rule, name=None, match=None, revision=None)
*rule* is the Rule object this match belongs to; it can be changed
        later via *set_rule()*.  *name* is the name of the iptables match
        extension (in lower case), *match* is the raw buffer of the match
        structure if the caller has it.  Either *name* or *match* must be
        provided.  *revision* is the revision number of the extension that
        should be used; different revisions use different structures in C and
        they usually only work with certain kernel versions. Python-iptables
        by default will use the latest revision available.
*rule* is the Rule object this match belongs to; it can be changed
        later via *set_rule()*.  *name* is the name of the iptables match
        extension (in lower case), *match* is the raw buffer of the match
        structure if the caller has it.  Either *name* or *match* must be
        provided.  *revision* is the revision number of the extension that
        should be used; different revisions use different structures in C and
        they usually only work with certain kernel versions. Python-iptables
        by default will use the latest revision available.
* rule * is the Rule object this match belongs to ; it can be changed later via * set_rule () * . * name * is the name of the iptables match extension ( in lower case ) * match * is the raw buffer of the match structure if the caller has it . Either * name * or * match * must be provided . * revision * is the revision number of the extension that should be used ; different revisions use different structures in C and they usually only work with certain kernel versions . Python - iptables by default will use the latest revision available .
def __init__(self, rule, name=None, match=None, revision=None):
        """
        *rule* is the Rule object this match belongs to; it can be changed
        later via *set_rule()*.  *name* is the name of the iptables match
        extension (in lower case), *match* is the raw buffer of the match
        structure if the caller has it.  Either *name* or *match* must be
        provided.  *revision* is the revision number of the extension that
        should be used; different revisions use different structures in C and
        they usually only work with certain kernel versions. Python-iptables
        by default will use the latest revision available.
        """
        if not name and not match:
            raise ValueError("can't create match based on nothing")
        if not name:
            name = match.u.user.name.decode()
        self._name = name
        self._rule = rule
        self._orig_parse = None
        self._orig_options = None

        self._xt = xtables(rule.nfproto)

        module = self._xt.find_match(name)
        real_name = module and getattr(module[0], 'real_name', None) or None
        if real_name:
            # Alias name, look up real module.
            self._name = real_name.decode()
            self._orig_parse = getattr(module[0], 'x6_parse', None)
            self._orig_options = getattr(module[0], 'x6_options', None)
            module = self._xt.find_match(real_name)
        if not module:
            raise XTablesError("can't find match %s" % (name))

        self._module = module[0]
        self._module.mflags = 0
        if revision is not None:
            self._revision = revision
        else:
            self._revision = self._module.revision

        self._match_buf = (ct.c_ubyte * self.size)()
        if match:
            ct.memmove(ct.byref(self._match_buf), ct.byref(match), self.size)
            self._update_pointers()
            self._check_alias()
        else:
            self.reset()
def __init__ ( self , rule , name = None , match = None , revision = None ) : if not name and not match : raise ValueError ( "can't create match based on nothing" ) if not name : name = match . u . user . name . decode ( ) self . _name = name self . _rule = rule self . _orig_parse = None self . _orig_options = None self . _xt = xtables ( rule . nfproto ) module = self . _xt . find_match ( name ) real_name = module and getattr ( module [ 0 ] , 'real_name' , None ) or None if real_name : # Alias name, look up real module. self . _name = real_name . decode ( ) self . _orig_parse = getattr ( module [ 0 ] , 'x6_parse' , None ) self . _orig_options = getattr ( module [ 0 ] , 'x6_options' , None ) module = self . _xt . find_match ( real_name ) if not module : raise XTablesError ( "can't find match %s" % ( name ) ) self . _module = module [ 0 ] self . _module . mflags = 0 if revision is not None : self . _revision = revision else : self . _revision = self . _module . revision self . _match_buf = ( ct . c_ubyte * self . size ) ( ) if match : ct . memmove ( ct . byref ( self . _match_buf ) , ct . byref ( match ) , self . size ) self . _update_pointers ( ) self . _check_alias ( ) else : self . reset ( )