JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris DHCP Service Developer's Guide     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

1.  Overview of Solaris DHCP Data Access Architecture

2.  Architecture Features for Module Writers

3.  Service Provider Layer API

General Data Store Functions

configure()

Purpose

Synopsis

Description

Returns

mklocation()

Purpose

Synopsis

Description

Returns

status()

Purpose

Synopsis

Description

Returns

version()

Purpose

Synopsis

Description

Returns

dhcptab Functions

list_dt()

Purpose

Synopsis

Description

Returns

open_dt()

Purpose

Synopsis

Description

Returns

lookup_dt()

Purpose

Synopsis

Description

Returns

add_dt()

Purpose

Synopsis

Description

Returns

modify_dt()

Purpose

Synopsis

Description

Returns

delete_dt()

Purpose

Synopsis

Description

Returns

close_dt()

Purpose

Synopsis

Description

Returns

remove_dt()

Purpose

Synopsis

Description

Returns

DHCP Network Container Functions

list_dn()

Purpose

Synopsis

Description

Returns

open_dn()

Purpose

Synopsis

Description

Returns

lookup_dn()

Purpose

Synopsis

Description

Returns

add_dn()

Purpose

Synopsis

Description

Returns

modify_dn()

Purpose

Synopsis

Description

Returns

delete_dn()

Purpose

Synopsis

Description

Returns

close_dn()

Purpose

Synopsis

Description

Returns

remove_dn()

Purpose

Synopsis

Description

Returns

Generic Error Codes

4.  Code Samples and Testing

Index

DHCP Network Container Functions

The API functions described in this section are used to manipulate the DHCP network containers and the IP address records within them.

list_dn()

Purpose

To return a list of network containers.

Synopsis

int list_dn(const char *location, char ***listppp, uint_t *count);

Description

Produces a dynamically allocated list of network container objects (listppp) found at location and stores the number of list items in count. If no network 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_dn()

Purpose

To open a network container or create a new one.

Synopsis

int open_dn(void **handpp, const char *location, uint_t flags, const struct in_addr *netp, const struct in_addr *maskp);

Description

Opens an existing DHCP network container or creates a new container specified by netp and maskp (both host order) in location and initializes handpp to point to the instance handle. Performs any initialization needed by the data store. When creating a new DHCP network container, the caller's identity is used for owner/permissions. Valid flags include DSVC_CREATE, DSVC_READ, DSVC_WRITE, DSVC_NONBLOCK. Note that the creation of a DHCP network container as read-only (DSVC_CREATE | DSVC_READ) is invalid.

Returns

DSVC_SUCCESS, DSVC_EXISTS, DSVC_ACCESS, DSVC_NOENT, DSVC_NO_LOCATION, DSVC_BUSY, DSVC_INTERNAL, DSVC_UNSUPPORTED.

lookup_dn()

Purpose

To perform a lookup query for records in a DHCP network container.

Synopsis

int lookup_dn(void *handp, boolean_t partial, uint_t query, int count, const dn_rec_t *targetp, dn_rec_list_t **resultp, uint_t *records);

Description

Searches a DHCP network container for instances that match the query described by the combination of query and targetp. If the partial argument is B_TRUE, then partial query results are acceptable to the caller. Thus, when partial is B_TRUE, any query that returns at least one matching record is considered successful. When partial is B_FALSE, the query returns DSVC_SUCCESS only if it has been applied to the entire container.

The query argument consists of 2 fields, each 16 bits long. The lower 16 bits select which fields {client id, flags, client IP, server IP, expiration, macro, or comment} of targetp are to be considered in the query. The upper 16 bits identify whether a particular field value selected in the lower 16 bits must match (bit set) or not match (bit clear). Bits 7 through 15 in both 16-bit fields are currently unused, and must be set to 0. Useful macros for constructing queries can be found in Example 3-1.

The count field specifies the maximum number of matching records to return. A count value of -1 requests the return of all records that match, regardless of the number. A count value of 0 causes lookup_dn to return immediately with no data.

resultp is set to point to the returned list of records. If resultp is NULL, then the caller is simply interested in knowing how many records match the query. Note that these records are dynamically allocated, and therefore the caller is responsible for freeing them. lookup_dn() returns the number of matching records in the records argument. A records value of 0 means that no records matched the query.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_BUSY, DSVC_INTERNAL.

add_dn()

Purpose

To add a record to the DHCP network container.

Synopsis

int add_dn(void *handp, dn_rec_t *newp);

Description

Adds the record newp to the DHCP network container referred to by the handle handp. The signature associated with newp is updated by the underlying public module. If an update collision occurs, the data store is not updated.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_BUSY, DSVC_INTERNAL, DSVC_EXISTS.

modify_dn()

Purpose

To modify a record in a DHCP network container.

Synopsis

int modify_dn(void *handp, const dn_rec_t *origp, dn_rec_t *newp);

Description

Atomically modifies the record origp with the record newp in the DHCP network container referred to by the handle handp. The signature associated with newp is updated by the underlying public module. If an update collision occurs, the data store is not updated.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_BUSY, DSVC_COLLISION, DSVC_INTERNAL, DSVC_NOENT.

delete_dn()

Purpose

To delete a record from a DHCP network container.

Synopsis

int delete_dn(void *handp, const dn_rec_t *pnp);

Description

Deletes the record identified by the dn_cip and dn_sig elements of pnp from the DHCP network container referred to by the handle handp. If an update collision occurs, the matching record is not deleted from the data store and DSVC_COLLISION is returned.

If the dn_sig signature of pnp is 0, the matching record is simply deleted with no detection of update collisions.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_NOENT, DSVC_BUSY, DSVC_INTERNAL, DSVC_COLLISION.

close_dn()

Purpose

To close the network container.

Synopsis

int close_dn(void **handpp);

Description

Frees the instance handle and cleans up per-instance state.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_INTERNAL.

remove_dn()

Purpose

To delete the DHCP network container from the data store location.

Synopsis

int remove_dn(const char *location, const struct in_addr *netp);

Description

Removes DHCP network container netp (host order) in location.

Returns

DSVC_SUCCESS, DSVC_ACCESS, DSVC_NOENT, DSVC_NO_LOCATION, DSVC_BUSY, DSVC_INTERNAL.