Service Provider Layer API
This chapter lists and describes the API functions exported by public modules and consumed by the Framework Configuration Layer. The functions are grouped in sections according to their purpose. Within each section, functions are listed in an order in which you might use them.
The following topics are included:
All implementations that match a certain Service Provider Layer API version must follow this specification for the API functions they implement. Later versions of the API must be backward-compatible with earlier versions. This means that additional API calls may be added, but existing ones cannot be changed or deleted.
See the include file /usr/include/dhcp_svc_public.h for more details about the functions.
General Data Store Functions
This section lists functions related to general data store activities.
configure()
Purpose
To pass a configuration string to the data store.
Synopsis
int configure(const char *configp);
Description
The configure() function is optional. If it is provided together with the required public module management bean (see "Data Service Configuration and DHCP Management Tools"), the Framework Configuration Layer calls this function when the public module loads, and passes in the public-module-specific configuration string, which is cached by the Framework Configuration Layer on the DHCP server for the data store module.
Returns
DSVC_SUCCESS, DSVC_MODULE_CFG_ERR
The configure() function returns DSVC_SUCCESS if the module wants the Framework Configuration Layer to continue to load the module, or DSVC_MODULE_CFG_ERR if the module wants the Framework Configuration Layer to fail the loading of the module. An example of such a situation is a configuration string so malformed that the required configuration of the module cannot take place.
mklocation()
Purpose
To create the directory where the data store containers are to reside.
Synopsis
int mklocation(const char *location);
Description
Creates the directory pointed to by location (if the directory does not exist) for data store containers to reside.
Returns
DSVC_SUCCESS, DSVC_ACCESS, DSVC_EXISTS, DSVC_BUSY, DSVC_INTERNAL, DSVC_UNSUPPORTED.
status()
Purpose
To obtain the general status of the data store.
Synopsis
int status(const char *location);
Description
The status() function instructs the data store to return its general status, and if location is non-NULL, further validates the location of the data store container by determining if the container does in fact exist, is accessible, and is formed correctly for the data store type. The data store must return the appropriate error codes if the facilities it needs are unavailable or it is otherwise not ready.
Returns
DSVC_SUCCESS, DSVC_ACCESS, DSVC_NO_LOCATION, DSVC_BUSY, DSVC_INTERNAL.
version()
Purpose
To obtain the version number of the API implemented by the data store.
Synopsis
int version(int *versionp);
Description
Data stores that support the Service Provider Layer API described in this manual are version 1 (one). The version is returned in the int pointed to by versionp.
Returns
DSVC_SUCCESS, DSVC_INTERNAL, DSVC_MODULE_ERR.
dhcptab Functions
The API functions described in this section are used with the dhcptab container.
list_dt()
Purpose
To list the name of the dhcptab container.
Synopsis
int list_dt(const char *location, char ***listppp, uint_t *count);
Description
Produces a dynamically allocated list of dhcptab container objects (listppp) found at location and stores the number of list items in count. If no dhcptab container objects exist, then DSVC_SUCCESS is returned, listppp is set to NULL, and count is set to 0.
Returns
DSVC_SUCCESS, DSVC_ACCESS, DSVC_NO_LOCATION.
open_dt()
Purpose
To open a dhcptab container or create a new one.
Synopsis
int open_dt(void **handpp, const char *location, uint_t flags);