02-dhcp.dox 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 use BIND10 logging yet.
  19. *
  20. * @section dhcpv4Session BIND10 message queue integration
  21. *
  22. * DHCPv4 server component is now integrated with the BIND10 message queue.
  23. * The integration is performed by establishSession() and disconnectSession()
  24. * functions in isc::dhcp::ControlledDhcpv4Srv class. main() method deifined
  25. * in the src/bin/dhcp4/main.cc file instantiates isc::dhcp::ControlledDhcpv4Srv
  26. * class that establishes connection with msgq and install necessary handlers
  27. * for receiving commands and configuration updates. It is derived from
  28. * a base isc::dhcp::Dhcpv4Srv class that implements DHCPv4 server functionality,
  29. * without any controlling mechanisms.
  30. *
  31. * ControlledDhcpv4Srv instantiates several components to make management
  32. * session possible. In particular, isc::cc::Session cc_session
  33. * object uses ASIO for establishing connection. It registers its socket
  34. * in isc::asiolink::IOService io_service object. Typically, other components
  35. * (e.g. auth or resolver) that use ASIO for their communication, register their
  36. * other sockets in the
  37. * same io_service and then just call io_service.run() method that does
  38. * not return, until one of the callback decides that it is time to shut down
  39. * the whole component cal calls io_service.stop(). DHCPv4 works in a
  40. * different way. It does receive messages using select()
  41. * (see isc::dhcp::IfaceMgr::receive4()), which is incompatible with ASIO.
  42. * To solve this problem, socket descriptor is extracted from cc_session
  43. * object and is passed to IfaceMgr by using isc::dhcp::IfaceMgr::set_session_socket().
  44. * IfaceMgr then uses this socket in its select() call. If there is some
  45. * data to be read, it calls registered callback that is supposed to
  46. * read and process incoming data.
  47. *
  48. * This somewhat complicated approach is needed for a simple reason. In
  49. * embedded deployments there will be no message queue. Not referring directly
  50. * to anything related to message queue in isc::dhcp::Dhcpv4Srv and
  51. * isc::dhcp::IfaceMgr classes brings in two benefits. First, the can
  52. * be used with and without message queue. Second benefit is related to the
  53. * first one: \ref libdhcp is supposed to be simple and robust and not require
  54. * many dependencies. One notable example of a use case that benefits from
  55. * this approach is a perfdhcp tool. Finally, the idea is that it should be
  56. * possible to instantiate Dhcpv4Srv object directly, thus getting a server
  57. * that does not support msgq. That is useful for embedded environments.
  58. * It may also be useful in validation.
  59. *
  60. */