]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1088] fixed comments
authorRazvan Becheriu <razvan@isc.org>
Mon, 17 Feb 2020 15:17:24 +0000 (17:17 +0200)
committerRazvan Becheriu <razvan@isc.org>
Thu, 27 Feb 2020 07:03:27 +0000 (09:03 +0200)
src/bin/dhcp4/tests/callout_library_1.cc
src/bin/dhcp4/tests/callout_library_2.cc
src/bin/dhcp4/tests/callout_library_3.cc
src/bin/dhcp6/tests/callout_library_3.cc
src/lib/hooks/hooks_component_developer.dox
src/lib/hooks/hooks_user.dox

index f5278dd970aff4bea985a60438bd5d9f1d999a37..661d76143473ea509aff3459ea0cb1b63dc236a9 100644 (file)
@@ -12,5 +12,5 @@
 
 static const int LIBRARY_NUMBER = 1;
 #include <config.h>
-#include <dhcp4/tests/callout_library_common.h>
 
+#include <dhcp4/tests/callout_library_common.h>
index df4fdcdc442af86e6bec0c3ec668fc3f58f1da47..0b29aecaffff606bb7e963b90dfe56d02869959c 100644 (file)
@@ -12,5 +12,5 @@
 
 static const int LIBRARY_NUMBER = 2;
 #include <config.h>
-#include <dhcp4/tests/callout_library_common.h>
 
+#include <dhcp4/tests/callout_library_common.h>
index fdd1730fc1e3a1f3363fa0ad2a80a64401167296..274df98923ce17a4146aa0e64328ba2452347dd1 100644 (file)
@@ -5,7 +5,7 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 /// @file
-/// @brief Callout library for tesing execution of the dhcp4_srv_configured
+/// @brief Callout library for testing execution of the dhcp4_srv_configured
 /// hook point.
 ///
 static const int LIBRARY_NUMBER = 3;
index b268aedde1ced06c9e6b9179cc460b164af35113..e69dbaaf5be81e2f341b0108d6c149c38bbff094 100644 (file)
@@ -5,7 +5,7 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 /// @file
-/// @brief Callout library for tesing execution of the dhcp6_srv_configured
+/// @brief Callout library for testing execution of the dhcp6_srv_configured
 /// hook point.
 ///
 static const int LIBRARY_NUMBER = 3;
index be8658468eb07bad47769acea88c5aa5b633fa89..850b33620a2f935a0348ff93b35a7f5ea9a1cb11 100644 (file)
@@ -314,7 +314,7 @@ An example of use could be:
 handle->setArgument("query", query);
 handle->setArgument("response", response);
 HooksManager::callCallouts(lease_hook_index, *handle_ptr);
-if (handle_ptr->getStatus() != CalloutHandle::NEXT_STEP_SKIP) {
+if (handle_ptr->getStatus() != CalloutHandle::NEXT_STEP_SKIP) {
     // Skip flag not set, do the address allocation
     :
 }
@@ -377,7 +377,7 @@ if (HooksManager::calloutsPresent(lease_hook_index)) {
     handle->setArgument("query", query);
     handle->setArgument("response", response);
     HooksManager::callCallouts(lease_hook_index, *handle);
-    if ( handle->getStatus() != CalloutHandle::NEXT_STEP_DROP ) {
+    if (handle->getStatus() != CalloutHandle::NEXT_STEP_DROP) {
         // Next step allows us to continue, do the address allocation
         :
     }
index fd026ad2489012f5ab8a661d64d03f148d94ff70..892164228a26c03618b428fa4c17db5b4e106d41 100644 (file)
@@ -474,8 +474,8 @@ documentation for details. For historic reasons (Kea 0.9.2 used a single
 boolean flag called skip that also doubled in some cases as an indicator
 to drop the packet) several hooks use SKIP status to drop the packet.
 
-The methods to get and set the "skip" flag are getSkip and setSkip. Their
-usage is intuitive:
+The methods to get and set the "skip" or "drop" state are getStatus and
+setStatus. Their usage is intuitive:
 
 @code
     // Get the current setting of the next step status.
@@ -485,6 +485,10 @@ usage is intuitive:
        // Do something...
        :
 
+    if (status == CalloutHandle::NEXT_STEP_SKIP)
+       // Do something...
+       :
+
     // Do some processing...
         :
     if (lease_allocated) {
@@ -499,6 +503,21 @@ usage is intuitive:
 Like arguments, the next step status is passed to all callouts on a hook.  Callouts
 later in the list are able to examine (and modify) the settings of earlier ones.
 
+If using multiple libraries, when the library wants to drop the current packet,
+the DROP status must be used instead of the SKIP status so that the packet
+processing ends at that specific hook point.
+
+It is recommended for all callouts to check the status before doing any
+processing.  As callouts can modify the status, it is recommended to take good
+care when doing so, because this will have impact on all remaining hooks as well.
+It is highly recommended to not reset the SKIP or DROP status to CONTINUE, even
+though possible, so that the rest of the loaded hooks and the server can check
+and perform the proper action.
+
+As stated before, the order of loading libraries is crucial in achieving the
+desired behavior, so please read @ref hooksdgMultipleLibraries when configuring
+multiple libraries.
+
 @subsubsection hooksdgSkipFlag The "Skip" Flag (deprecated)
 
 In releases 0.9.2 and earlier, the functionality currently offered by next step