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