From ff3ddd8332fbaab5ff76f140ae9f185a2d2d6e34 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Mon, 7 Oct 2013 11:30:53 +0200 Subject: [PATCH] [3180] Updated Developer Guide with an info about option parsing callbacks. --- doc/devel/mainpage.dox | 2 ++ src/bin/dhcp4/dhcp4.dox | 7 ++++++- src/bin/dhcp6/dhcp6.dox | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/devel/mainpage.dox b/doc/devel/mainpage.dox index 2b1ea8d0fc..97b722aaa6 100644 --- a/doc/devel/mainpage.dox +++ b/doc/devel/mainpage.dox @@ -53,12 +53,14 @@ * - @subpage dhcpv4Session * - @subpage dhcpv4ConfigParser * - @subpage dhcpv4ConfigInherit + * - @subpage dhcpv4OptionsParse * - @subpage dhcpv4Other * - @subpage dhcp6 * - @subpage dhcpv6Session * - @subpage dhcpv6ConfigParser * - @subpage dhcpv6ConfigInherit * - @subpage dhcpv6DDNSIntegration + * - @subpage dhcpv6OptionsParse * - @subpage dhcpv6Other * - @subpage libdhcp * - @subpage libdhcpIntro diff --git a/src/bin/dhcp4/dhcp4.dox b/src/bin/dhcp4/dhcp4.dox index bd490fbf35..b77ac244a5 100644 --- a/src/bin/dhcp4/dhcp4.dox +++ b/src/bin/dhcp4/dhcp4.dox @@ -1,4 +1,4 @@ -// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -79,6 +79,11 @@ See \ref dhcpv6ConfigParser. Configuration inheritance in DHCPv4 follows exactly the same logic as its DHCPv6 counterpart. See \ref dhcpv6ConfigInherit. +@section dhcpv4OptionsParse Custom functions to parse message options + +The DHCPv4 server uses the same logic to supply custom callback function to +parse message option as DHCPv6 server implementation. See \ref dhcpv6OptionsParse. + @section dhcpv4Other Other DHCPv4 topics For hooks API support in DHCPv4, see @ref dhcpv4Hooks. diff --git a/src/bin/dhcp6/dhcp6.dox b/src/bin/dhcp6/dhcp6.dox index 4cdea53653..7684f5337c 100644 --- a/src/bin/dhcp6/dhcp6.dox +++ b/src/bin/dhcp6/dhcp6.dox @@ -167,6 +167,29 @@ Once the configuration is implemented, these constants will be removed. @todo Add section about setting up options and their definitions with bindctl. +@section dhcpv6OptionsParse Custom functions to parse message options + +The DHCPv6 server implementation provides a generic support to define option +formats and set option values. A number of options formats have been defined +for standard options in libdhcp++. However, the formats for vendor specific +options are dynamically configured by the server's administrator and thus can't +be stored in libdhcp++. Such option formats are stored in the +@c isc::dhcp::CfgMgr. The libdhcp++ provides functions for recursive parsing +of options which may be encapsulated by other options up to the any level of +encapsulation but these functions are unaware of the option formats defined +in the @c isc::dhcp::CfgMgr because they belong to a different library. +Therefore, the generic functions @c isc::dhcp::LibDHCP::unpackOptions4 and +@c isc::dhcp::LibDHCP::unpackOptions6 are only useful to parse standard +options which definitions are provided in the libdhcp++. In order to overcome +this problem a callback mechanism has been implemented in @c Option and @c Pkt6 +classes. By installing a callback function on the instance of the @c Pkt6 the +server may provide a custom implementation of the options parsing algorithm. +This callback function will take precedence over the @c LibDHCP::unpackOptions6 +and @c LibDHCP::unpackOptions4 functions. With this approach, the callback is +implemented within the context of the server and it has access to all objects +which define its configuration (including dynamically created option +definitions). + @section dhcpv6Other Other DHCPv6 topics For hooks API support in DHCPv6, see @ref dhcpv6Hooks.