<commit_before>#include "simplechannellistener.h"

namespace controller { // <namespace controller>

void SimpleChannelListener::onChannelUp(Channel *channel) {
  UInt32 xid;

  log::debug("SimpleChannelListener UP");

  SetConfigBuilder config;
  config.setMissSendLen(14); // ethernet header only
  config.send(channel);
  // No Reply expected.

  FlowModBuilder flowMod;
  flowMod.setTableId(OFPTT_ALL);
  flowMod.setCommand(OFPFC_DELETE);
  flowMod.setPriority(0x8000);
  flowMod.setBufferId(OFP_NO_BUFFER);
  flowMod.setOutPort(OFPP_ANY);
  flowMod.setOutGroup(OFPG_ANY);
  (void)flowMod.send(channel);
  // No reply expected.

  BarrierRequestBuilder barrier;
  xid = barrier.send(channel);
  trackReply(xid, &SimpleChannelListener::onBarrierReply);
}

void SimpleChannelListener::onMessage(const Message *message) {
  switch (message->type()) {
  case PacketIn::type() :
    if (auto msg = PacketIn::cast(message))
      controller_.onPacketIn(message->source(), msg);
    break;

  case PortStatus::type() :
    if (auto msg = PortStatus::cast(message))
      controller_.onPortStatus(message->source(), msg);
    break;

  case Error::type() :
    if (auto msg = Error::cast(message))
      controller_.onError(message->source(), msg);
    break;

  default:
    onReply(message);
    break;
  }
}<commit_msg>version 1 protocol doesn't support tableId field in FlowModBuilder.<commit_after>#include "simplechannellistener.h"

namespace controller { // <namespace controller>

void SimpleChannelListener::onChannelUp(Channel *channel) {
  UInt32 xid;

  log::debug("SimpleChannelListener UP");

  SetConfigBuilder config;
  config.setMissSendLen(14); // ethernet header only
  config.send(channel);
  // No Reply expected.

  if (channel->version() > OFP_VERSION_1) {
    FlowModBuilder flowMod;
    flowMod.setTableId(OFPTT_ALL);
    flowMod.setCommand(OFPFC_DELETE);
    flowMod.setPriority(0x8000);
    flowMod.setBufferId(OFP_NO_BUFFER);
    flowMod.setOutPort(OFPP_ANY);
    flowMod.setOutGroup(OFPG_ANY);
    (void)flowMod.send(channel);
    // No reply expected.
  }

  BarrierRequestBuilder barrier;
  xid = barrier.send(channel);
  trackReply(xid, &SimpleChannelListener::onBarrierReply);
}

void SimpleChannelListener::onMessage(const Message *message) {
  switch (message->type()) {
  case PacketIn::type() :
    if (auto msg = PacketIn::cast(message))
      controller_.onPacketIn(message->source(), msg);
    break;

  case PortStatus::type() :
    if (auto msg = PortStatus::cast(message))
      controller_.onPortStatus(message->source(), msg);
    break;

  case Error::type() :
    if (auto msg = Error::cast(message))
      controller_.onError(message->source(), msg);
    break;

  default:
    onReply(message);
    break;
  }
}
{'fraction_non_alphanumeric': 0.1302612481857765, 'fraction_numerical': 0.00725689404934688, 'mean_word_length': 4.525050100200401, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '664620', 'n_tokens_mistral': 907, 'n_tokens_neox': 869, 'n_words': 165}