'Get a function for parsing a datagram read from a I{tun} device.
@return: A function which accepts a datagram exactly as might be read
from a I{tun} device.  The datagram is expected to ultimately carry
a UDP datagram.  When called, it returns a L{list} of L{tuple}s.
Each tuple has the UDP application data as the first element and
the sender address as the second element.'

def parser(self):

    datagrams = []
    receiver = DatagramProtocol()
    def capture(*args):
        datagrams.append(args)
    receiver.datagramReceived = capture
    udp = RawUDPProtocol()
    udp.addProto(12345, receiver)
    ip = IPProtocol()
    ip.addProto(17, udp)
    def parse(data):
        ip.datagramReceived(data, False, None, None, None)
        return datagrams
    return parse
