bool
Checksum::verify(const Packet &pkt) const {
  if (!is_checksum_condition_met(pkt)) {
    BMLOG_TRACE_PKT(
        pkt, "Skipping checksum '{}' verification because condition not met",
        get_name());
    return true;
  } else {
    bool valid = verify_(pkt);
    BMLOG_DEBUG_PKT(pkt, "Verifying checksum '{}': {}", get_name(), valid);
    return valid;
  }
}
void
Checksum::update(Packet *pkt) const {
  // is it a good idea to put this in the implementation; should the deparser be
  // aware that nothing was updated?
  if (!is_checksum_condition_met(*pkt)) {
    BMLOG_TRACE_PKT(
        *pkt, "Skipping checksum '{}' update because condition not met",
        get_name());
  } else {
    BMLOG_DEBUG_PKT(*pkt, "Updating checksum '{}'", get_name());
    update_(pkt);
  }
}
示例#3
0
const ControlFlowNode *
MatchActionTable::operator()(Packet *pkt) const {
  // TODO(antonin)
  // this is temporary while we experiment with the debugger
  DEBUGGER_NOTIFY_CTR(
      Debugger::PacketId::make(pkt->get_packet_id(), pkt->get_copy_id()),
      DBG_CTR_TABLE | get_id());
  BMLOG_TRACE_PKT(*pkt, "Applying table '{}'", get_name());
  const auto next = match_table->apply_action(pkt);
  DEBUGGER_NOTIFY_CTR(
      Debugger::PacketId::make(pkt->get_packet_id(), pkt->get_copy_id()),
      DBG_CTR_EXIT(DBG_CTR_TABLE) | get_id());
  return next;
}