xref: /illumos-gate/usr/src/cmd/cmd-crypto/kmfcfg/util.h (revision 99ebb4ca412cb0a19d77a3899a87c055b9c30fa8)
1*99ebb4caSwyllys /*
2*99ebb4caSwyllys  * CDDL HEADER START
3*99ebb4caSwyllys  *
4*99ebb4caSwyllys  * The contents of this file are subject to the terms of the
5*99ebb4caSwyllys  * Common Development and Distribution License (the "License").
6*99ebb4caSwyllys  * You may not use this file except in compliance with the License.
7*99ebb4caSwyllys  *
8*99ebb4caSwyllys  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*99ebb4caSwyllys  * or http://www.opensolaris.org/os/licensing.
10*99ebb4caSwyllys  * See the License for the specific language governing permissions
11*99ebb4caSwyllys  * and limitations under the License.
12*99ebb4caSwyllys  *
13*99ebb4caSwyllys  * When distributing Covered Code, include this CDDL HEADER in each
14*99ebb4caSwyllys  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*99ebb4caSwyllys  * If applicable, add the following below this CDDL HEADER, with the
16*99ebb4caSwyllys  * fields enclosed by brackets "[]" replaced with your own identifying
17*99ebb4caSwyllys  * information: Portions Copyright [yyyy] [name of copyright owner]
18*99ebb4caSwyllys  *
19*99ebb4caSwyllys  * CDDL HEADER END
20*99ebb4caSwyllys  *
21*99ebb4caSwyllys  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
22*99ebb4caSwyllys  * Use is subject to license terms.
23*99ebb4caSwyllys  */
24*99ebb4caSwyllys #ifndef	_UTIL_H
25*99ebb4caSwyllys #define	_UTIL_H
26*99ebb4caSwyllys 
27*99ebb4caSwyllys #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*99ebb4caSwyllys 
29*99ebb4caSwyllys #ifdef	__cplusplus
30*99ebb4caSwyllys extern "C" {
31*99ebb4caSwyllys #endif
32*99ebb4caSwyllys 
33*99ebb4caSwyllys #include <kmfapiP.h>
34*99ebb4caSwyllys 
35*99ebb4caSwyllys 
36*99ebb4caSwyllys typedef struct _policy_list {
37*99ebb4caSwyllys 	KMF_POLICY_RECORD plc;
38*99ebb4caSwyllys 	struct _policy_list *next;
39*99ebb4caSwyllys } POLICY_LIST;
40*99ebb4caSwyllys 
41*99ebb4caSwyllys void free_policy_list(POLICY_LIST *);
42*99ebb4caSwyllys int getopt_av(int, char * const *, const char *);
43*99ebb4caSwyllys 
44*99ebb4caSwyllys int load_policies(char *, POLICY_LIST **);
45*99ebb4caSwyllys int get_boolean(char *);
46*99ebb4caSwyllys char *get_string(char *, int *err_flag);
47*99ebb4caSwyllys int parseEKUOIDs(char *, KMF_POLICY_RECORD *);
48*99ebb4caSwyllys int parseEKUNames(char *, KMF_POLICY_RECORD *);
49*99ebb4caSwyllys uint16_t parseKUlist(char *);
50*99ebb4caSwyllys void print_sanity_error(KMF_RETURN);
51*99ebb4caSwyllys 
52*99ebb4caSwyllys #define	KC_OK			0
53*99ebb4caSwyllys #define	KC_ERR_USAGE		1
54*99ebb4caSwyllys #define	KC_ERR_LOADDB		2
55*99ebb4caSwyllys #define	KC_ERR_FIND_POLICY	3
56*99ebb4caSwyllys #define	KC_ERR_DELETE_POLICY	4
57*99ebb4caSwyllys #define	KC_ERR_ADD_POLICY	5
58*99ebb4caSwyllys #define	KC_ERR_VERIFY_POLICY	6
59*99ebb4caSwyllys #define	KC_ERR_INCOMPLETE_POLICY 7
60*99ebb4caSwyllys #define	KC_ERR_MEMORY		8
61*99ebb4caSwyllys #define	KC_ERR_ACCESS		9
62*99ebb4caSwyllys 
63*99ebb4caSwyllys #ifdef __cplusplus
64*99ebb4caSwyllys }
65*99ebb4caSwyllys #endif
66*99ebb4caSwyllys #endif /* _UTIL_H */
67