Kea  2.1.7-git
reconnect_ctl.cc
Go to the documentation of this file.
1 // Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 #include <util/reconnect_ctl.h>
10 
11 namespace isc {
12 namespace util {
13 
14 std::string
16  switch (action) {
18  return ("stop-retry-exit");
20  return ("serve-retry-exit");
22  return ("serve-retry-continue");
23  }
24  return ("invalid-action-type");
25 }
26 
28 ReconnectCtl::onFailActionFromText(const std::string& text) {
29  if (text == "stop-retry-exit") {
31  } else if (text == "serve-retry-exit") {
33  } else if (text == "serve-retry-continue") {
35  } else {
36  isc_throw(BadValue, "Invalid action on connection loss: " << text);
37  }
38 }
39 
40 }
41 }
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
OnFailAction
Type of action to take on connection loss.
Definition: reconnect_ctl.h:17
static std::string onFailActionToText(OnFailAction action)
Convert action to string.
Defines the logger used by the top-level component of kea-lfc.
static OnFailAction onFailActionFromText(const std::string &text)
Convert string to action.