'Receive an ethernet frame that matches the dst, src and proto.
Filters all received packet to find a matching one, then unpack
it and present it to the caller as a frame.
Waits up to self._socket_timeout for a matching frame before
returning.
Args:
dst_mac: \'byte string\'. None do not use in filter.
src_mac: \'byte string\'. None do not use in filter.
protocol: short in host byte order. None do not use in filter.
Returns:
ethernet frame: { \'dst\' : byte string,
\'src\' : byte string,
\'proto\' : short in host byte order,
\'payload\' : byte string'

def recv_from(self, dst_mac, src_mac, protocol):

    start_time = time.clock()
    timeout = self._socket_timeout
    while 1:
        frame = None
        (packet, timeout) = self.recv(timeout)
        if (packet is not None):
            frame = ethernet.unpack(packet)
            if (((src_mac is None) or (frame['src'] == src_mac)) and ((dst_mac is None) or (frame['dst'] == dst_mac)) and ((protocol is None) or (frame['proto'] == protocol))):
                break
            elif ((timeout == 0) or ((time.clock() - start_time) > float(self._socket_timeout))):
                frame = None
                break
        else:
            if ((timeout == 0) or ((time.clock() - start_time) > float(self._socket_timeout))):
                frame = None
                break
            continue
    return frame
