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