xref: /titanic_50/usr/src/lib/libpkg/common/pkgerr.h (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _PKGERR_H
28 #define	_PKGERR_H
29 
30 
31 /*
32  * Module:	pkgerr.h
33  * Description:
34  *
35  *   Implements error routines to handle the creation,
36  *   management, and destruction of error objects, which
37  *   hold error messages and codes returned from libpkg
38  *   routines that support the objects defined herein.
39  */
40 
41 #include <stdio.h>
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Public Definitions
49  */
50 
51 typedef enum {
52 	PKGERR_OK = 0,
53 	PKGERR_EXIST,
54 	PKGERR_READ,
55 	PKGERR_CORRUPT,
56 	PKGERR_PARSE,
57 	PKGERR_BADPASS,
58 	PKGERR_BADALIAS,
59 	PKGERR_INTERNAL,
60 	PKGERR_UNSUP,
61 	PKGERR_NOALIAS,
62 	PKGERR_NOALIASMATCH,
63 	PKGERR_MULTIPLE,
64 	PKGERR_INCOMPLETE,
65 	PKGERR_NOPRIVKEY,
66 	PKGERR_NOPUBKEY,
67 	PKGERR_NOCACERT,
68 	PKGERR_NOMEM,
69 	PKGERR_CHAIN,
70 	PKGERR_LOCKED,
71 	PKGERR_WRITE,
72 	PKGERR_UNLOCK,
73 	PKGERR_TIME,
74 	PKGERR_DUPLICATE,
75 	PKGERR_WEB,
76 	PKGERR_VERIFY
77 } PKG_ERR_CODE;
78 
79 /*
80  * Public Structures
81  */
82 
83 /* external reference to PKG_ERR object (contents private) */
84 typedef PKG_ERR_CODE pkg_err_t;
85 
86 typedef struct _pkg_err_struct PKG_ERR;
87 
88 /*
89  * Public Methods
90  */
91 
92 PKG_ERR		*pkgerr_new();
93 void		pkgerr_add(PKG_ERR *, PKG_ERR_CODE, char *, ...);
94 void		pkgerr_clear(PKG_ERR *);
95 int		pkgerr_dump(PKG_ERR *, FILE *);
96 int		pkgerr_num(PKG_ERR *);
97 char		*pkgerr_get(PKG_ERR *, int);
98 void		pkgerr_free(PKG_ERR *);
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif /* _PKGERR_H */
105