database_backends.dox 2.37 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
  @page dhcp-database-backends DHCP Database Back-Ends

  All DHCP lease data is stored in some form of database, the interface
  to this being through the Lease Manager.

  All backend classes such as isc::dhcp::MySqlLeaseMgr are derived from
  the abstract isc::dhcp::LeaseMgr class.  This provides methods to
  create, retrieve, modify and delete leases in the database.

  @section dhcpdb-instantiation Instantiation of Lease Managers

  A lease manager is instantiated through a the LeaseMgrFactory class.  This
  has three methods:

  - isc::dhcp::LeaseMgrFactory::create - Creates a singleton Lease
    Manager of the appropriate type.
  - isc::dhcp::LeaseMgrFactory::instance - Returns a reference to the
    the instance of the Lease Manager.
  - isc::dhcp::LeaseMgrFactory::destroy - Destroys the singleton lease manager.

  The selection of the Lease Manager (and thus the backend database) is
  is controlled by the argument passed to isc::dhcp::LeaseMgrfactory::create.
  This is a string containing a set of "keyword=value" pairs (no embedded
  spaces), each pair separated by a space from the others, e.g.

  \code
  type=mysql user=keatest password=keatest name=keatest host=localhost
  \endcode

  The following keywords are used for all backends:

  - type - specifies the type of database backend.  The following types are
    supported:
       - mysql - Use MySQL as the database

  The following keywords apply to the MySQL backend:

  - host - host on which the selected database is running.  If not supplied,
    "localhost" is assumed.
  - name - name of the MySQL database to access.  There is no default - this
    must be supplied.
  - password - password for the selected user ID (see below).  If not specified,
    no password is used.
  - user - database user ID under which the database is accessed.  If not
    specified, no user ID is used - the database is assumed to be open.
47
48
49
50
51
52
53
54
55
56
57

  @section dhcp-backend-unittest Running Unit Tests

  With the use of databases requiring separate authorisation, there are
  certain pre-requisties for scuccessfully running the unit tests.  These are
  database-specific:

  MySQL: a database called keatest needs to be set up.  A database user, also
  called keatest (with a password keatest) must be given full privileges in
  that database.  The unit tests create the database schema in the database
  before each test, and delete it afterwards.
58
  */