1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright (c) 2001 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29/*
30 * This module contains public API functions for managing dhcp network
31 * containers.
32 */
33
34#include <dhcp_svc_public.h>
35
36/*
37 * Creates or opens the dhcp network container ``netp'' (host order) in
38 * ``location'' and initializes ``handlep'' to point to the instance handle.
39 * Performs any initialization needed by data store. New containers are
40 * created with the identity of the caller.
41 */
42int
43open_dn(void **handlep, const char *location, uint_t flags,
44    const struct in_addr *netp, const struct in_addr *maskp)
45{
46	return (DSVC_UNSUPPORTED);
47}
48
49/*
50 * Frees instance handle, cleans up per instance state.
51 */
52int
53close_dn(void **handlep)
54{
55	return (DSVC_UNSUPPORTED);
56}
57
58/*
59 * Remove DHCP network container ``netp'' (host order) in location.
60 * This function will block if the underlying data service is busy or
61 * otherwise unavailable.
62 */
63int
64remove_dn(const char *location, const struct in_addr *netp)
65{
66	return (DSVC_UNSUPPORTED);
67}
68
69/*
70 * Searches DHCP network container for instances that match the query
71 * described by the combination of query and targetp.  If the partial
72 * argument is true, then lookup operations that are unable to
73 * complete entirely are allowed (and considered successful).  The
74 * query argument consists of 2 fields, each 16 bits long.  The lower
75 * 16 bits selects which fields {client_id, flags, client_ip,
76 * server_ip, expiration, macro, or comment} of targetp are to be
77 * considered in the query.  The upper 16 bits identifies whether a
78 * particular field value must match (bit set) or not match (bit
79 * clear).  Bits 7-15 in both 16 bit fields are currently unused, and
80 * must be set to 0.  The count field specifies the maximum number of
81 * matching records to return, or -1 if any number of records may be
82 * returned.  The recordsp argument is set to point to the resulting
83 * list of records; if recordsp is passed in as NULL then no records
84 * are actually returned. Note that these records are dynamically
85 * allocated, thus the caller is responsible for freeing them.  The
86 * number of records found is returned in nrecordsp; a value of 0 means
87 * that no records matched the query.
88 */
89int
90lookup_dn(void *handle, boolean_t partial, uint_t query, int count,
91    const dn_rec_t *targetp, dn_rec_list_t **recordsp, uint_t *nrecordsp)
92{
93	return (DSVC_UNSUPPORTED);
94}
95
96/*
97 * Add the record pointed to by ``addp'' to from the dhcp network container
98 * referred to by the handle.  The underlying public module will set ``addp's''
99 * signature as part of the data store operation.
100 */
101int
102add_dn(void *handle, dn_rec_t *addp)
103{
104	return (DSVC_UNSUPPORTED);
105}
106
107/*
108 * Atomically modify the record ``origp'' with the record ``newp'' in the dhcp
109 * network container referred to by the handle.  ``newp's'' signature will
110 * be set by the underlying public module.  If an update collision
111 * occurs, either because ``origp's'' signature in the data store has changed
112 * or ``newp'' would overwrite an preexisting record, DSVC_COLLISION is
113 * returned and no update of the data store occurs.
114 */
115int
116modify_dn(void *handle, const dn_rec_t *origp, dn_rec_t *newp)
117{
118	return (DSVC_UNSUPPORTED);
119}
120
121/*
122 * Delete the record pointed to by ``pnp'' from the dhcp network container
123 * referred to by the handle. If ``pnp's'' signature is zero, the caller
124 * is not interested in checking for collisions, and the record should simply
125 * be deleted if it exists. If the signature is non-zero, and the signature of
126 * the data store version of this record do not match, an update collision
127 * occurs, no deletion of any record is done, and DSVC_COLLISION is returned.
128 */
129int
130delete_dn(void *handle, const dn_rec_t *pnp)
131{
132	return (DSVC_UNSUPPORTED);
133}
134
135/*
136 * List the current number of dhcp network container objects located at
137 * ``location'' in ``listppp''. Return number of list elements in ``count''.
138 * If no objects exist, then ``count'' is set to 0 and DSVC_SUCCESS is returned.
139 *
140 * This function will block if the underlying data service is busy or is
141 * otherwise unvailable.
142 */
143int
144list_dn(const char *location, char ***listppp, uint_t *count)
145{
146	return (DSVC_UNSUPPORTED);
147}
148