xref: /titanic_44/usr/src/lib/libnsl/yp/yperr_string.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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  * Copyright 1992 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /*	  All Rights Reserved   */
28 
29 /*
30  * Portions of this source code were derived from Berkeley
31  * under license from the Regents of the University of
32  * California.
33  */
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #include <rpcsvc/ypclnt.h>
38 #include <sys/types.h>
39 #include <rpc/trace.h>
40 
41 /*
42  * This returns a pointer to an error message string appropriate to an input
43  * yp error code.  An input value of zero will return a success message.
44  * In all cases, the message string will start with a lower case chararacter,
45  * and will be terminated neither by a period (".") nor a newline.
46  */
47 
48 char *
49 yperr_string(code)
50 	int code;
51 {
52 	char *pmesg;
53 
54 	trace2(TR_yperr_string, 0, code);
55 	switch (code) {
56 
57 	case 0:  {
58 		pmesg = "yp operation succeeded";
59 		break;
60 	}
61 
62 	case YPERR_BADARGS:  {
63 		pmesg = "args to yp function are bad";
64 		break;
65 	}
66 
67 	case YPERR_RPC:  {
68 		pmesg = "RPC failure on yp operation";
69 		break;
70 	}
71 
72 	case YPERR_DOMAIN:  {
73 		pmesg = "can't bind to a server which serves domain";
74 		break;
75 	}
76 
77 	case YPERR_MAP:  {
78 		pmesg = "no such map in server's domain";
79 		break;
80 	}
81 
82 	case YPERR_KEY:  {
83 		pmesg = "no such key in map";
84 		break;
85 	}
86 
87 	case YPERR_YPERR:  {
88 		pmesg = "internal yp server or client error";
89 		break;
90 	}
91 
92 	case YPERR_RESRC:  {
93 		pmesg = "local resource allocation failure";
94 		break;
95 	}
96 
97 	case YPERR_NOMORE:  {
98 		pmesg = "no more records in map database";
99 		break;
100 	}
101 
102 	case YPERR_PMAP:  {
103 		pmesg = "can't communicate with rpcbind";
104 		break;
105 		}
106 
107 	case YPERR_YPBIND:  {
108 		pmesg = "can't communicate with ypbind";
109 		break;
110 		}
111 
112 	case YPERR_YPSERV:  {
113 		pmesg = "can't communicate with ypserv";
114 		break;
115 		}
116 
117 	case YPERR_NODOM:  {
118 		pmesg = "local domain name not set";
119 		break;
120 	}
121 
122 	case YPERR_BADDB:  {
123 		pmesg = "yp map data base is bad";
124 		break;
125 	}
126 
127 	case YPERR_VERS:  {
128 		pmesg = "yp client/server version mismatch";
129 		break;
130 	}
131 
132 	case YPERR_ACCESS: {
133 		pmesg = "permission denied";
134 		break;
135 	}
136 
137 	case YPERR_BUSY: {
138 		pmesg = "database is busy";
139 		break;
140 	}
141 
142 	default:  {
143 		pmesg = "unknown yp client error code";
144 		break;
145 	}
146 
147 	}
148 
149 	trace1(TR_yperr_string, 1);
150 	return (pmesg);
151 }
152