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