com.h3c.of.ctl.pkt

## Interface PacketSequencer

-     public interface PacketSequencer

  A packet sequencer provides the functionality of an OpenFlow Packet-In message event processing engine.

  Packet `listeners` register with the sequencer to participate in the processing chain orchestrated by the sequencer.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPacketListener(SequencedPacketListener listener, PacketListenerRole role, int altitude)` Adds the specified packet listener to the sequencer, in the specified role and at the specified altitude.
    `void` | `addPacketListener(SequencedPacketListener listener, PacketListenerRole role, int altitude, Set<ProtocolId> interest)` Adds the specified packet listener to the sequencer, in the specified role and at the specified altitude.
    `Map<SequencedPacketListener,Long>` | `getListenerMetrics()` Returns a set of metrics representing the average processing time of each listener implementation.
    `List<SequencedPacketListener>` | `getListeners(PacketListenerRole role)` Returns an ordered list of packet listeners for the specified role.
    `void` | `removePacketListener(SequencedPacketListener listener)` Removes the specified packet listener from the sequencer.

- - ### Method Detail

    - #### addPacketListener

          void addPacketListener(SequencedPacketListener listener,
                               PacketListenerRole role,
                               int altitude)

      Adds the specified packet listener to the sequencer, in the specified role and at the specified altitude. Higher altitudes come earlier in the sequence than lower altitudes (within the specific role). Note that no two listeners (in the same role) may register with the same altitude; if this is attempted an exception will be thrown.

      The listener's `event()` callback will be invoked for every Packet-In message that the controller passes to the packet sequencer.

      Parameters:
        `listener` - the listener to be added
        `role` - the role the listener wishes to assume
        `altitude` - the listener's altitude
      Throws:
        `NullPointerException` - if listener or role is null
        `IllegalArgumentException` - if altitude is negative
        `IllegalStateException` - if the altitude (for the role) has already been claimed

    - #### addPacketListener

          void addPacketListener(SequencedPacketListener listener,
                               PacketListenerRole role,
                               int altitude,
                               Set<ProtocolId> interest)

      Adds the specified packet listener to the sequencer, in the specified role and at the specified altitude. Higher altitudes come earlier in the sequence than lower altitudes (within the specific role). Note that no two listeners (in the same role) may register with the same altitude; if this is attempted an exception will be thrown.

      The `interest` argument specifies the protocols that the listener cares about. When the sequencer receives a Packet-In message, it will be forwarded to the listener if the packet contains any protocol that is a member of the specified set.

      Parameters:
        `listener` - the listener to be added
        `role` - the role the listener wishes to assume
        `altitude` - the listener's altitude
        `interest` - the protocols the listener is interested in
      Throws:
        `NullPointerException` - if listener or role is null
        `IllegalArgumentException` - if altitude is negative
        `IllegalStateException` - if the altitude (for the role) has already been claimed

    - #### removePacketListener

          void removePacketListener(SequencedPacketListener listener)

      Removes the specified packet listener from the sequencer.
      Parameters:
        `listener` - the listener to be removed
      Throws:
        `NullPointerException` - if listener is null

    - #### getListeners

          List<SequencedPacketListener> getListeners(PacketListenerRole role)

      Returns an ordered list of packet listeners for the specified role. The order of listeners is that of descending altitude.
      Parameters:
        `role` - the role to examine
      Returns:
        the listeners in this role
      Throws:
        `NullPointerException` - if role is null

    - #### getListenerMetrics

          Map<SequencedPacketListener,Long> getListenerMetrics()

      Returns a set of metrics representing the average processing time of each listener implementation. The value of each map entry is the computed average duration (in ms) of the respective SPL's `event()` callback.
      Returns:
        the metrics

Copyright © 2014. All Rights Reserved.