02-dhcp.dox 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @page libdhcp libdhcp++
  3. *
  4. * @section libdhcpIntro Libdhcp++ Library Introduction
  5. *
  6. * libdhcp++ is an all-purpose DHCP-manipulation library, written in
  7. * C++. It offers packet parsing and assembly, DHCPv4 and DHCPv6
  8. * options parsing and ssembly, interface detection (currently on
  9. * Linux systems only) and socket operations. Following classes are
  10. * implemented:
  11. *
  12. * - isc::dhcp::Pkt4 - represents DHCPv4 packet.
  13. * - isc::dhcp::Pkt6 - represents DHCPv6 packet.
  14. *
  15. * There are two pointer types defined: Pkt4Ptr and Pkt6Ptr. They are
  16. * smart pointer and are using boost::shared_ptr. There are not const
  17. * versions defined, as we assume that hooks can modify any aspect of
  18. * the packet at almost any stage of processing.
  19. *
  20. * Both packets use collection of Option objects to represent DHCPv4
  21. * and DHCPv6 options. The base class -- Option -- can be used to
  22. * represent generic option that contains collection of
  23. * bytes. Depending on if the option is instantiated as v4 or v6
  24. * option, it will adjust its header (DHCPv4 options use 1 octet for
  25. * type and 1 octet for length, while DHCPv6 options use 2 bytes for
  26. * each).
  27. *
  28. * There are many specialized classes that are intended to handle options with
  29. * specific content:
  30. * - isc::dhcp::Option4AddrLst -- DHCPv4 option, contains one or more IPv4 addresses;
  31. * - isc::dhcp::Option6AddrLst -- DHCPv6 option, contains one or more IPv6 addresses;
  32. * - isc::dhcp::Option6IAAddr -- DHCPv6 option, represents IAADDR_OPTION (an option that
  33. * contains IPv6 address with extra parameters);
  34. * - isc::dhcp::Option6IA -- DHCPv6 option used to store IA_NA and its suboptions.
  35. *
  36. * All options can store sub-options (i.e. options that are stored within option
  37. * rather than in a message directly). This functionality is commonly used in
  38. * DHCPv6, but is rarely used in DHCPv4. isc::dhcp::Option::addOption(),
  39. * isc::dhcp::Option::delOption(), isc::dhcp::Option::getOption() can be used
  40. * for that purpose.
  41. *
  42. * @section libdhcpIfaceMgr Interface Manager
  43. *
  44. * Interface Manager (or IfaceMgr) is an abstraction layer about low-level
  45. * network operations. In particlar, it provides information about existing
  46. * network interfaces See isc::dhcp::IfaceMgr::Iface class and
  47. * isc::dhcp::IfaceMgr::detectIfaces() and isc::dhcp::IfaceMgr::getIface().
  48. *
  49. * Currently there is interface detection is implemented in Linux only. There
  50. * are plans to implement such support for other OSes, but they remain low
  51. * priority for now.
  52. *
  53. * Generic parts of the code are isc::dhcp::IfaceMgr class in
  54. * src/lib/dhcp/iface_mgr.cc file. OS-specific code is located in separate
  55. * files, e.g. iface_mgr_linux.cc. Such separation should be maintained when
  56. * additional code will be developed.
  57. *
  58. * For systems that interface detection is not supported on, there is a stub
  59. * mechanism implemented. It assumes that interface name is read from a text
  60. * file. This is a temporary solution and will be removed as soon as proper
  61. * interface detection is implemented. It is not going to be developed further.
  62. * To use this feature, store interfaces.txt file. It uses a simple syntax.
  63. * Each line represents an interface name, followed by IPv4 or IPv6 address
  64. * that follows it. This is usually link-local IPv6 address that the server
  65. * should bind to. In theory this mechanism also supports IPv4, but it was
  66. * never tested. The code currently supports only a single interface defined
  67. * that way.
  68. *
  69. * Another useful methods are dedicated to transmission
  70. * (isc::dhcp::IfaceMgr::send(), 2 overloads) and reception
  71. * (isc::dhcp::IfaceMgr::receive4() and isc::dhcp::IfaceMgr::receive6()).
  72. * Note that receive4() and receive6() methods may return NULL, e.g.
  73. * when timeout is reached or if dhcp daemon receives a signal.
  74. */