Exemple #1
0
void
RibManager::sendErrorResponse(uint32_t code, const std::string& error,
                              const shared_ptr<const Interest>& request)
{
  NFD_LOG_ERROR("NFD returned an error: " << error << " (code: " << code << ")");

  if (!static_cast<bool>(request)) {
    return;
  }

  ControlResponse response;

  if (code == 404) {
    response.setCode(code);
    response.setText(error);
  }
  else {
    response.setCode(533);
    std::ostringstream os;
    os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
    response.setText(os.str());
  }

  if (static_cast<bool>(request)) {
    sendResponse(request->getName(), response);
  }
}
Exemple #2
0
void
RibManager::onUnRegSuccess(const shared_ptr<const Interest>& request,
                           const ControlParameters& parameters,
                           const Route& route)
{
  ControlResponse response;

  response.setCode(200);
  response.setText("Success");
  response.setBody(parameters.wireEncode());

  NFD_LOG_TRACE("onUnRegSuccess: unregistered " << route);

  if (static_cast<bool>(request)) {
    sendResponse(request->getName(), response);
  }
}
Exemple #3
0
void
RibManager::sendSuccessResponse(const shared_ptr<const Interest>& request,
                                const ControlParameters& parameters)
{
  if (!static_cast<bool>(request)) {
    return;
  }

  ControlResponse response;

  response.setCode(200);
  response.setText("Success");
  response.setBody(parameters.wireEncode());

  if (static_cast<bool>(request)) {
    sendResponse(request->getName(), response);
  }
}