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