02-dhcp.dox 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * @page dhcpv4 DHCPv4 Server Component
  3. *
  4. * BIND10 offers DHCPv4 server implementation. It is implemented as
  5. * b10-dhcp4 component. Its primary code is located in
  6. * isc::dhcp::Dhcpv4Srv class. It uses \ref libdhcp extensively,
  7. * especially isc::dhcp::Pkt4, isc::dhcp::Option and
  8. * isc::dhcp::IfaceMgr classes. Currently this code offers skeleton
  9. * functionality, i.e. it is able to receive and process incoming
  10. * requests and trasmit responses. However, it does not have database
  11. * management, so it returns only one, hardcoded lease to whoever asks
  12. * for it.
  13. *
  14. * DHCPv4 server component does not support direct traffic (relayed
  15. * only), as support for transmission to hosts without IPv4 address
  16. * assigned is not implemented in IfaceMgr yet.
  17. *
  18. * DHCPv4 server component does not listen to BIND10 message queue.
  19. *
  20. * DHCPv4 server component does not use BIND10 logging yet.
  21. *
  22. * DHCPv4 server component is not integrated with boss yet.
  23. *
  24. * @page dhcpv6 DHCPv6 Server Component
  25. *
  26. * BIND10 offers DHCPv6 server implementation. It is implemented as
  27. * b10-dhcp6 component. Its primary code is located in
  28. * isc::dhcp::Dhcpv6Srv class. It uses \ref libdhcp extensively,
  29. * especially lib::dhcp::Pkt6, isc::dhcp::Option and
  30. * isc::dhcp::IfaceMgr classes. Currently this code offers skeleton
  31. * functionality, i.e. it is able to receive and process incoming
  32. * requests and trasmit responses. However, it does not have database
  33. * management, so it returns only one, hardcoded lease to whoever asks
  34. * for it.
  35. *
  36. * DHCPv6 server component does not support relayed traffic yet, as
  37. * support for relay decapsulation is not implemented yet.
  38. *
  39. * DHCPv6 server component does not listen to BIND10 message queue.
  40. *
  41. * DHCPv6 server component does not use BIND10 logging yet.
  42. *
  43. * DHCPv6 server component is not integrated with boss yet.
  44. *
  45. * @page libdhcp libdhcp++ library
  46. *
  47. * @section libdhcpIntro Libdhcp++ Introduction
  48. *
  49. * libdhcp++ is an all-purpose DHCP-manipulation library, written in
  50. * C++. It offers packet parsing and assembly, DHCPv4 and DHCPv6
  51. * options parsing and ssembly, interface detection (currently on
  52. * Linux systems only) and socket operations. Following classes are
  53. * implemented:
  54. *
  55. * - isc::dhcp::Pkt4 - represents DHCPv4 packet.
  56. * - isc::dhcp::Pkt6 - represents DHCPv6 packet.
  57. *
  58. * There are two pointer types defined: Pkt4Ptr and Pkt6Ptr. They are
  59. * smart pointer and are using boost::shared_ptr. There are not const
  60. * versions defined, as we assume that hooks can modify any aspect of
  61. * the packet at almost any stage of processing.
  62. *
  63. * Both packets use collection of Option objects to represent DHCPv4
  64. * and DHCPv6 options. The base class -- Option -- can be used to
  65. * represent generic option that contains collection of
  66. * bytes. Depending on if the option is instantiated as v4 or v6
  67. * option, it will adjust its header (DHCPv4 options use 1 octet for
  68. * type and 1 octet for length, while DHCPv6 options use 2 bytes for
  69. * each).
  70. *
  71. * There are many specialized classes that are intended to handle options with
  72. * specific content:
  73. * - isc::dhcp::Option4AddrLst -- DHCPv4 option, contains one or more IPv4 addresses;
  74. * - isc::dhcp::Option6AddrLst -- DHCPv6 option, contains one or more IPv6 addresses;
  75. * - isc::dhcp::Option6IAAddr -- DHCPv6 option, represents IAADDR_OPTION (an option that
  76. * contains IPv6 address with extra parameters);
  77. * - isc::dhcp::Option6IA -- DHCPv6 option used to store IA_NA and its suboptions.
  78. *
  79. * All options can store sub-options (i.e. options that are stored within option
  80. * rather than in a message directly). This functionality is commonly used in
  81. * DHCPv6, but is rarely used in DHCPv4. isc::dhcp::Option::addOption(),
  82. * isc::dhcp::Option::delOption(), isc::dhcp::Option::getOption() can be used
  83. * for that purpose.
  84. *
  85. * @section lidhcpIfaceMgr Interface Manager
  86. *
  87. * Interface Manager (or IfaceMgr) is an abstraction layer about low-level
  88. * network operations. In particlar, it provides information about existing
  89. * network interfaces See isc::dhcp::IfaceMgr::Iface class and
  90. * isc::dhcp::IfaceMgr::detectIfaces() and isc::dhcp::IfaceMgr::getIface().
  91. *
  92. * Currently there is interface detection is implemented in Linux only. There
  93. * are plans to implement such support for other OSes, but they remain low
  94. * priority for now.
  95. *
  96. * Generic parts of the code are isc::dhcp::IfaceMgr class in
  97. * src/lib/dhcp/iface_mgr.cc file. OS-specific code is located in separate
  98. * files, e.g. iface_mgr_linux.cc. Such separation should be maintained when
  99. * additional code will be developed.
  100. *
  101. * For systems that interface detection is not supported on, there is a stub
  102. * mechanism implemented. It assumes that interface name is read from a text
  103. * file. This is a temporary solution and will be removed as soon as proper
  104. * interface detection is implemented. It is not going to be developed further.
  105. * To use this feature, store interfaces.txt file. It uses a simple syntax.
  106. * Each line represents an interface name, followed by IPv4 or IPv6 address
  107. * that follows it. This is usually link-local IPv6 address that the server
  108. * should bind to. In theory this mechanism also supports IPv4, but it was
  109. * never tested. The code currently supports only a single interface defined
  110. * that way.
  111. *
  112. * Another useful methods are dedicated to transmission
  113. * (isc::dhcp::IfaceMgr::send(), 2 overloads) and reception
  114. * (isc::dhcp::IfaceMgr::receive4() and isc::dhcp::IfaceMgr::receive6()).
  115. * Note that receive4() and receive6() methods may return NULL, e.g.
  116. * when timeout is reached or if dhcp daemon receives a signal.
  117. */