xref: /onnv-gate/usr/src/lib/libdhcpsvc/head/dhcp_svc_confopt.h (revision 0:68f95e015346)
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 #ifndef _DHCP_SVC_CONFOPT_H
28 #define	_DHCP_SVC_CONFOPT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Contains SMI-private interfaces to /etc/inet/dhcpsvc.conf file. DO NOT SHIP!
34  */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #include <sys/types.h>
41 
42 #define	DHCP_CONFOPT_FILE		"/etc/inet/dhcpsvc.conf"
43 
44 enum dhcp_confopt {
45 	DHCP_END,			/* final entry, must be 0 */
46 	DHCP_KEY,			/* key / value form */
47 	DHCP_COMMENT			/* comment form */
48 };
49 
50 /*
51  * Records in the /etc/inet/dhcpsvc.conf file are of key=value form. Comments
52  * begin a line with '#', and end with newline (\n). See dhcpsvc(4) for more
53  * details. This structure is used to represent them within a program.
54  */
55 
56 typedef struct {
57 	enum dhcp_confopt	co_type;
58 	char			*co_key;	/* identifier */
59 	char			*co_value;	/* data */
60 } dhcp_confopt_t;
61 #define	co_comment		co_key		/* key doubles as comment */
62 
63 extern int	add_dsvc_conf(dhcp_confopt_t **, const char *, const char *);
64 extern int	read_dsvc_conf(dhcp_confopt_t **);
65 extern int	replace_dsvc_conf(dhcp_confopt_t **, const char *,
66 			const char *);
67 extern int	write_dsvc_conf(dhcp_confopt_t *, mode_t);
68 extern void	free_dsvc_conf(dhcp_confopt_t *);
69 extern int	delete_dsvc_conf(void);
70 extern int	query_dsvc_conf(dhcp_confopt_t *, const char *, char **);
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif	/* !_DHCP_SVC_CONFOPT_H */
77