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 the public API functions for managing the dhcptab
31*0Sstevel@tonic-gate * container.
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 dhcptab container in ``location'' and initializes
38*0Sstevel@tonic-gate * ``handlep'' to point to the instance handle. When creating a new dhcptab, the
39*0Sstevel@tonic-gate * caller's identity is used for owner/permissions. Performs any initialization
40*0Sstevel@tonic-gate * needed by data store.
41*0Sstevel@tonic-gate */
42*0Sstevel@tonic-gate int
open_dt(void ** handlep,const char * location,uint_t flags)43*0Sstevel@tonic-gate open_dt(void **handlep, const char *location, uint_t flags)
44*0Sstevel@tonic-gate {
45*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
46*0Sstevel@tonic-gate }
47*0Sstevel@tonic-gate
48*0Sstevel@tonic-gate /*
49*0Sstevel@tonic-gate * Frees instance handle, cleans up per instance state.
50*0Sstevel@tonic-gate */
51*0Sstevel@tonic-gate int
close_dt(void ** handlep)52*0Sstevel@tonic-gate close_dt(void **handlep)
53*0Sstevel@tonic-gate {
54*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
55*0Sstevel@tonic-gate }
56*0Sstevel@tonic-gate
57*0Sstevel@tonic-gate /*
58*0Sstevel@tonic-gate * Remove dhcptab container in ``location'' from data store. If the underlying
59*0Sstevel@tonic-gate * data store is busy, this function will block.
60*0Sstevel@tonic-gate */
61*0Sstevel@tonic-gate int
remove_dt(const char * location)62*0Sstevel@tonic-gate remove_dt(const char *location)
63*0Sstevel@tonic-gate {
64*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
65*0Sstevel@tonic-gate }
66*0Sstevel@tonic-gate
67*0Sstevel@tonic-gate /*
68*0Sstevel@tonic-gate * Searches the dhcptab container for instances that match the query
69*0Sstevel@tonic-gate * described by the combination of query and targetp. If the partial
70*0Sstevel@tonic-gate * argument is true, then lookup operations that are unable to
71*0Sstevel@tonic-gate * complete entirely are allowed (and considered successful). The
72*0Sstevel@tonic-gate * query argument consists of 2 fields, each 16 bits long. The lower
73*0Sstevel@tonic-gate * 16 bits selects which fields {key, flags} of targetp are to be
74*0Sstevel@tonic-gate * considered in the query. The upper 16 bits identifies whether a
75*0Sstevel@tonic-gate * particular field value must match (bit set) or not match (bit
76*0Sstevel@tonic-gate * clear). Bits 2-15 in both 16 bit fields are currently unused, and
77*0Sstevel@tonic-gate * must be set to 0. The count field specifies the maximum number of
78*0Sstevel@tonic-gate * matching records to return, or -1 if any number of records may be
79*0Sstevel@tonic-gate * returned. The recordsp argument is set to point to the resulting
80*0Sstevel@tonic-gate * list of records; if recordsp is passed in as NULL then no records
81*0Sstevel@tonic-gate * are actually returned. Note that these records are dynamically
82*0Sstevel@tonic-gate * allocated, thus the caller is responsible for freeing them. The
83*0Sstevel@tonic-gate * number of records found is returned in nrecordsp; a value of 0
84*0Sstevel@tonic-gate * means that no records matched the query.
85*0Sstevel@tonic-gate */
86*0Sstevel@tonic-gate int
lookup_dt(void * handle,boolean_t partial,uint_t query,int count,const dt_rec_t * targetp,dt_rec_list_t ** recordsp,uint_t * nrecordsp)87*0Sstevel@tonic-gate lookup_dt(void *handle, boolean_t partial, uint_t query, int count,
88*0Sstevel@tonic-gate const dt_rec_t *targetp, dt_rec_list_t **recordsp, uint_t *nrecordsp)
89*0Sstevel@tonic-gate {
90*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
91*0Sstevel@tonic-gate }
92*0Sstevel@tonic-gate
93*0Sstevel@tonic-gate /*
94*0Sstevel@tonic-gate * Add the record pointed to by ``addp'' to from the dhcptab container referred
95*0Sstevel@tonic-gate * to by the handle. The underlying public module will set ``addp's'' signature
96*0Sstevel@tonic-gate * as part of the data store operation.
97*0Sstevel@tonic-gate */
98*0Sstevel@tonic-gate int
add_dt(void * handle,dt_rec_t * addp)99*0Sstevel@tonic-gate add_dt(void *handle, dt_rec_t *addp)
100*0Sstevel@tonic-gate {
101*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
102*0Sstevel@tonic-gate }
103*0Sstevel@tonic-gate
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate * Atomically modify the record ``origp'' with the record ``newp'' in the
106*0Sstevel@tonic-gate * dhcptab container referred to by the handle. ``newp's'' signature will
107*0Sstevel@tonic-gate * be set by the underlying public module. If an update collision
108*0Sstevel@tonic-gate * occurs, either because ``origp's'' signature in the data store has changed
109*0Sstevel@tonic-gate * or ``newp'' would overwrite an existing record, DSVC_COLLISION is
110*0Sstevel@tonic-gate * returned and no update of the data store occurs.
111*0Sstevel@tonic-gate */
112*0Sstevel@tonic-gate int
modify_dt(void * handle,const dt_rec_t * origp,dt_rec_t * newp)113*0Sstevel@tonic-gate modify_dt(void *handle, const dt_rec_t *origp, dt_rec_t *newp)
114*0Sstevel@tonic-gate {
115*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
116*0Sstevel@tonic-gate }
117*0Sstevel@tonic-gate
118*0Sstevel@tonic-gate /*
119*0Sstevel@tonic-gate * Delete the record referred to by dtp from the dhcptab container
120*0Sstevel@tonic-gate * referred to by the handle. If ``dtp's'' signature is zero, the
121*0Sstevel@tonic-gate * caller is not interested in checking for collisions, and the record
122*0Sstevel@tonic-gate * should simply be deleted if it exists. If the signature is non-zero,
123*0Sstevel@tonic-gate * and the signature of the data store version of this record do not match,
124*0Sstevel@tonic-gate * an update collision occurs, no deletion of matching record in data store
125*0Sstevel@tonic-gate * is done, and DSVC_COLLISION is returned.
126*0Sstevel@tonic-gate */
127*0Sstevel@tonic-gate int
delete_dt(void * handle,const dt_rec_t * dtp)128*0Sstevel@tonic-gate delete_dt(void *handle, const dt_rec_t *dtp)
129*0Sstevel@tonic-gate {
130*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
131*0Sstevel@tonic-gate }
132*0Sstevel@tonic-gate
133*0Sstevel@tonic-gate /*
134*0Sstevel@tonic-gate * List the current number of dhcptab container objects located at
135*0Sstevel@tonic-gate * ``location'' in ``listppp''. Return number of list elements in ``count''.
136*0Sstevel@tonic-gate * If no objects exist, then ``count'' is set to 0 and DSVC_SUCCESS is returned.
137*0Sstevel@tonic-gate *
138*0Sstevel@tonic-gate * This function will block waiting for a result, if the underlying data store
139*0Sstevel@tonic-gate * is busy.
140*0Sstevel@tonic-gate */
141*0Sstevel@tonic-gate int
list_dt(const char * location,char *** listppp,uint_t * count)142*0Sstevel@tonic-gate list_dt(const char *location, char ***listppp, uint_t *count)
143*0Sstevel@tonic-gate {
144*0Sstevel@tonic-gate return (DSVC_UNSUPPORTED);
145*0Sstevel@tonic-gate }
146