Setups a packet filter bound with this NIO.

        Filter "freq_drop" has 1 argument "<frequency>". It will drop
        everything with a -1 frequency, drop every Nth packet with a
        positive frequency, or drop nothing.

        Filter "capture" has 2 arguments "<link_type_name> <output_file>".
        It will capture packets to the target output file. The link type
        name is a case-insensitive DLT_ name from the PCAP library
        constants with the DLT_ part removed.See http://www.tcpdump.org/linktypes.html
        for a list of all available DLT values.

        :param direction: "in", "out" or "both"
        :param options: options for the packet filter (string)

def setup_filter(self, direction, options):
        """
        Setups a packet filter bound with this NIO.

        Filter "freq_drop" has 1 argument "<frequency>". It will drop
        everything with a -1 frequency, drop every Nth packet with a
        positive frequency, or drop nothing.

        Filter "capture" has 2 arguments "<link_type_name> <output_file>".
        It will capture packets to the target output file. The link type
        name is a case-insensitive DLT_ name from the PCAP library
        constants with the DLT_ part removed.See http://www.tcpdump.org/linktypes.html
        for a list of all available DLT values.

        :param direction: "in", "out" or "both"
        :param options: options for the packet filter (string)
        """

        if direction not in self._dynamips_direction:
            raise DynamipsError("Unknown direction {} to setup filter:".format(direction))
        dynamips_direction = self._dynamips_direction[direction]

        yield from self._hypervisor.send("nio setup_filter {name} {direction} {options}".format(name=self._name,
                                                                                                direction=dynamips_direction,
                                                                                                options=options))

        if direction == "in":
            self._input_filter_options = options
        elif direction == "out":
            self._output_filter_options = options
        elif direction == "both":
            self._input_filter_options = options
            self._output_filter_options = options