<commit_before>/*
Pax : tool support for prototyping packet processors
<NAME>, Cambridge University Computer Lab, June 2016

Use of this source code is governed by the Apache 2.0 license; see LICENSE.
*/

namespace Pax {

  /// <summary>
  /// A packet processor makes some sort of forwarding decision, in addition
  /// to possibly analysing/modifying the packet (and generating new packets).
  /// </summary>
  /// <remark>
  /// The forwarding decision makes clear whether the processor recommends to
  /// * drop the packet (i.e., nothing more is to be done with it)
  /// * forward to a single port
  /// * forward to multiple ports
  ///
  /// NOTE this idiom simulates using algebraic types in C#. It's values are
  ///      analysed using the Visitor pattern.
  /// </remark>
  /// <remark>
  /// Note that there is a hierarchy between forwarding decisions: Drop is
  /// subsumed by SinglePortForward (which allows forwarding to at most one
  /// port), which is subsumed by MultiPortForward (which allows forwarding to
  /// any number of ports, including one port, or none).
  /// </remark>
  public abstract class ForwardingDecision {
    private ForwardingDecision() {}

    // FIXME can use singleton to avoid multiple allocations of this?
    /// <summary>
    /// The decision to drop the packet.
    /// </summary>
    public sealed class Drop : ForwardingDecision {
      // We only need to keep a single instance of Drop, so we use a singleton pattern.
      public static Drop Instance { get; } = new Drop();
    }

    /// <summary>
    /// The decision to forward the packet to *at most* a single port.
    /// Note that a processor that forwards to a single port might still
    /// decide to drop packets, even if it returns a <c>ForwardingDecision</c>
    /// of type <c>SinglePortForward</c>. A drop decision within
    /// <c>SinglePortForward</c> is communicated by having a negative
    /// "target_port" parameter to the constructor.<commit_msg>restored code erased by mistake in 1da9c43dce25f0ad034cb50045b9e5733305b467 that broke singleton pattern;<commit_after>/*
Pax : tool support for prototyping packet processors
<NAME>, Cambridge University Computer Lab, June 2016

Use of this source code is governed by the Apache 2.0 license; see LICENSE.
*/

namespace Pax {

  /// <summary>
  /// A packet processor makes some sort of forwarding decision, in addition
  /// to possibly analysing/modifying the packet (and generating new packets).
  /// </summary>
  /// <remark>
  /// The forwarding decision makes clear whether the processor recommends to
  /// * drop the packet (i.e., nothing more is to be done with it)
  /// * forward to a single port
  /// * forward to multiple ports
  ///
  /// NOTE this idiom simulates using algebraic types in C#. It's values are
  ///      analysed using the Visitor pattern.
  /// </remark>
  /// <remark>
  /// Note that there is a hierarchy between forwarding decisions: Drop is
  /// subsumed by SinglePortForward (which allows forwarding to at most one
  /// port), which is subsumed by MultiPortForward (which allows forwarding to
  /// any number of ports, including one port, or none).
  /// </remark>
  public abstract class ForwardingDecision {
    private ForwardingDecision() {}

    // FIXME can use singleton to avoid multiple allocations of this?
    /// <summary>
    /// The decision to drop the packet.
    /// </summary>
    public sealed class Drop : ForwardingDecision {
      // We only need to keep a single instance of Drop, so we use a singleton pattern.
      private Drop () {}
      public static Drop Instance { get; } = new Drop();
    }

    /// <summary>
    /// The decision to forward the packet to *at most* a single port.
    /// Note that a processor that forwards to a single port might still
    /// decide to drop packets, even if it returns a <c>ForwardingDecision</c>
    /// of type <c>SinglePortForward</c>. A drop decision within
    /// <c>SinglePortForward</c> is communicated by having a negative
    /// "target_port" parameter to the constructor.
{'fraction_non_alphanumeric': 0.0981067125645439, 'fraction_numerical': 0.009343496434718466, 'mean_word_length': 2.784186046511628, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6572687', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1038, 'n_words': 513}