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