'check packets using filterfn here'

def IPHandler(self, addr, pkt, ts, **kwargs):

    raw = str(kwargs['raw'])
    p = dshell.Packet(self, addr, pkt=str(pkt), ts=ts, **kwargs)
    a = []
    match = None
    for (r, msg) in self.rules:
        if r(p):
            match = True
            if msg:
                a.append(msg)
            if (self.none or (not self.all)):
                break
        else:
            match = False
            if self.all:
                break
    if ((match is not None) and ((match and (not self.none)) or (self.none and (not match)))):
        self.decodedbytes += len(str(pkt))
        self.count += 1
        if self.alerts:
            self.alert(*a, **p.info())
        if self.subDecoder:
            self.subDecoder.decode(len(raw), raw, ts)
        else:
            self.dump(len(raw), raw, ts)
