def add(self, apid, ctid): """Add new filter pair""" if dltlib.dlt_filter_add(ctypes.byref(self), apid or b"", ctid or b"", self.verbose) == -1: if self.counter >= DLT_FILTER_MAX: logger.error("Maximum number (%d) of allowed filters reached, ignoring filter!\n", DLT_FILTER_MAX) return MAX_FILTER_REACHED logger.debug("Filter ('%s', '%s') already exists", apid, ctid) return REPEATED_FILTER return 0
def add(self, apid, ctid): """Add new filter pair""" if six.PY3: if isinstance(apid, str): apid = bytes(apid, "ascii") if isinstance(ctid, str): ctid = bytes(ctid, "ascii") if dltlib.dlt_filter_add(ctypes.byref(self), apid or b"", ctid or b"", self.verbose) == DLT_RETURN_ERROR: if self.counter >= DLT_FILTER_MAX: logger.error( "Maximum number (%d) of allowed filters reached, ignoring filter!\n", DLT_FILTER_MAX) return MAX_FILTER_REACHED logger.debug("Filter ('%s', '%s') already exists", apid, ctid) return REPEATED_FILTER return 0