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, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * This file contains the message strings for the data store error
  31  * return codes.
  32  */
  33 
  34 #include <dhcp_svc_public.h>
  35 #include <locale.h>
  36 
  37 /*
  38  * Note: must be kept in sync with error codes in <dhcp_svc_public.h>
  39  */
  40 static char *errmsgs[DSVC_NERR] = {
  41 /*  0 DSVC_SUCCESS */           "Success",
  42 /*  1 DSVC_EXISTS */            "Already exists",
  43 /*  2 DSVC_ACCESS */            "Access denied",
  44 /*  3 DSVC_NO_CRED */           "No underlying service credential",
  45 /*  4 DSVC_NOENT */             "Entry does not exist",
  46 /*  5 DSVC_BUSY */              "Busy",
  47 /*  6 DSVC_INVAL */             "Invalid arguments",
  48 /*  7 DSVC_INTERNAL */          "Internal error",
  49 /*  8 DSVC_UNAVAILABLE */       "Underlying service required by "
  50                                 "public module is unavailable",
  51 /*  9 DSVC_COLLISION */         "Update collision",
  52 /* 10 DSVC_UNSUPPORTED */       "Operation unsupported",
  53 /* 11 DSVC_NO_MEMORY */         "Virtual memory exhausted",
  54 /* 12 DSVC_NO_RESOURCES */      "Non-memory resources unavailable",
  55 /* 13 DSVC_BAD_RESOURCE */      "Malformed/missing RESOURCE setting",
  56 /* 14 DSVC_BAD_PATH */          "Malformed/missing PATH setting",
  57 /* 15 DSVC_MODULE_VERSION */    "Public module version mismatch",
  58 /* 16 DSVC_MODULE_ERR */        "Error in public module",
  59 /* 17 DSVC_MODULE_LOAD_ERR */   "Error loading public module",
  60 /* 18 DSVC_MODULE_UNLOAD_ERR */ "Error unloading public module",
  61 /* 19 DSVC_MODULE_CFG_ERR */    "Module-specific configuration failed",
  62 /* 20 DSVC_SYNCH_ERR */         "Error in synchronization protocol",
  63 /* 21 DSVC_NO_LOCKMGR */        "Cannot contact lock manager",
  64 /* 22 DSVC_NO_LOCATION */       "Location does not exist",
  65 /* 23 DSVC_BAD_CONVER */        "Malformed/missing CONVER setting",
  66 /* 24 DSVC_NO_TABLE */          "Table does not exist",
  67 /* 25 DSVC_TABLE_EXISTS */      "Table already exists"
  68 };
  69 
  70 /*
  71  * Return the appropriate error message for a given DSVC error.
  72  */
  73 const char *
  74 dhcpsvc_errmsg(unsigned int index)
  75 {
  76         if (index >= DSVC_NERR)
  77                 return (dgettext(TEXT_DOMAIN, "<unknown error>"));
  78 
  79         return (dgettext(TEXT_DOMAIN, errmsgs[index]));
  80 }