xref: /titanic_51/usr/src/common/net/wanboot/wanboot_conf.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_WANBOOT_CONF_H
28 #define	_WANBOOT_CONF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/time.h>
33 #include <sys/nvpair.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Valid wanboot.conf(4) names
41  */
42 #define	BC_BOOT_FILE			"boot_file"
43 #define	BC_ROOT_SERVER			"root_server"
44 #define	BC_ROOT_FILE			"root_file"
45 #define	BC_ENCRYPTION_TYPE		"encryption_type"
46 #define	BC_SIGNATURE_TYPE		"signature_type"
47 #define	BC_CLIENT_AUTHENTICATION	"client_authentication"
48 #define	BC_SERVER_AUTHENTICATION	"server_authentication"
49 #define	BC_BOOT_LOGGER			"boot_logger"
50 #define	BC_RESOLVE_HOSTS		"resolve_hosts"
51 #define	BC_SYSTEM_CONF			"system_conf"
52 
53 /*
54  * Valid encryption types
55  */
56 #define	BC_ENCRYPTION_3DES		"3des"
57 #define	BC_ENCRYPTION_AES		"aes"
58 
59 /*
60  * Valid signature types
61  */
62 #define	BC_SIGNATURE_SHA1		"sha1"
63 
64 /*
65  * Valid yes/no options
66  */
67 #define	BC_YES				"yes"
68 #define	BC_NO				"no"
69 
70 /*
71  * Define some maximum length for a line in wanboot.conf(4):
72  */
73 #define	BC_MAX_LINE_LENGTH		4096
74 
75 /*
76  * Return codes from init_bootconf(); if BC_FAILURE, the 'bc_error_code'
77  * field below gives the reason:
78  */
79 #define	BC_SUCCESS			0
80 #define	BC_FAILURE			1
81 
82 /*
83  * Possible values of the 'bc_error_code' field below; refer to
84  * bootconf_errmsg.c for a description of these codes:
85  */
86 typedef enum {
87 	BC_E_NOERROR,
88 	BC_E_ACCESS,
89 	BC_E_NVLIST,
90 	BC_E_IOERR,
91 	BC_E_TOO_LONG,
92 	BC_E_SYNTAX,
93 	BC_E_UNKNOWN_NAME,
94 	BC_E_ENCRYPTION_ILLEGAL,
95 	BC_E_SIGNATURE_ILLEGAL,
96 	BC_E_CLIENT_AUTH_ILLEGAL,
97 	BC_E_SERVER_AUTH_ILLEGAL,
98 	BC_E_ROOT_SERVER_BAD,
99 	BC_E_ROOT_SERVER_ABSENT,
100 	BC_E_ROOT_FILE_ABSENT,
101 	BC_E_BOOT_LOGGER_BAD,
102 	BC_E_ENCRYPTED_NOT_SIGNED,
103 	BC_E_CLIENT_AUTH_NOT_ENCRYPTED,
104 	BC_E_CLIENT_AUTH_NOT_SERVER,
105 	BC_E_SERVER_AUTH_NOT_SIGNED,
106 	BC_E_SERVER_AUTH_NOT_HTTPS,
107 	BC_E_SERVER_AUTH_NOT_HTTP,
108 	BC_E_BOOTLOGGER_AUTH_NOT_HTTP
109 } bc_errcode_t;
110 
111 /*
112  * Structure defining the bootconf context:
113  */
114 typedef struct bc_handle {
115 	nvlist_t	*bc_nvl;	/* The nvpair list representation */
116 	bc_errcode_t	bc_error_code;	/* On error, one of the above codes */
117 	int		bc_error_pos;	/* Line in error in wanboot.conf */
118 } bc_handle_t;
119 
120 /*
121  * The interfaces to be used when accessing the wanboot.conf file:
122  */
123 extern int	bootconf_init(bc_handle_t *handle, const char *bootconf);
124 extern char	*bootconf_get(bc_handle_t *handle, const char *name);
125 extern void	bootconf_end(bc_handle_t *handle);
126 #if	!defined(_BOOT)
127 extern char	*bootconf_errmsg(bc_handle_t *handle);
128 #endif	/* !defined(_BOOT) */
129 
130 #ifdef	__cplusplus
131 }
132 #endif
133 
134 #endif	/* _WANBOOT_CONF_H */
135