1: /*
   2:  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
   3:  * unrestricted use provided that this legend is included on all tape
   4:  * media and as a part of the software program in whole or part.  Users
   5:  * may copy or modify Sun RPC without charge, but are not authorized
   6:  * to license or distribute it to anyone else except as part of a product or
   7:  * program developed by the user.
   8:  *
   9:  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  10:  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  11:  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  12:  *
  13:  * Sun RPC is provided with no support and without any obligation on the
  14:  * part of Sun Microsystems, Inc. to assist in its use, correction,
  15:  * modification or enhancement.
  16:  *
  17:  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  18:  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  19:  * OR ANY PART THEREOF.
  20:  *
  21:  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  22:  * or profits or other special, indirect and consequential damages, even if
  23:  * Sun has been advised of the possibility of such damages.
  24:  *
  25:  * Sun Microsystems, Inc.
  26:  * 2550 Garcia Avenue
  27:  * Mountain View, California  94043
  28:  */
  29: #ifndef lint
  30: static char sccsid[] = "@(#)clnt_perror.c 1.1 85/02/08 Copyr 1984 Sun Micro";
  31: #endif
  32: 
  33: /*
  34:  * clnt_perror.c
  35:  *
  36:  * Copyright (C) 1984, Sun Microsystems, Inc.
  37:  *
  38:  */
  39: #include "types.h"
  40: #include "xdr.h"
  41: #include "auth.h"
  42: #include "clnt.h"
  43: #include "rpc_msg.h"
  44: #include <stdio.h>
  45: extern char *sys_errlist[];
  46: 
  47: /*
  48:  * Print reply error info
  49:  */
  50: void
  51: clnt_perror(rpch, s)
  52:     CLIENT *rpch;
  53:     char *s;
  54: {
  55:     struct rpc_err e;
  56:     void clnt_perrno();
  57: 
  58:     CLNT_GETERR(rpch, &e);
  59:     fprintf(stderr, "%s: ", s);
  60:     switch (e.re_status) {
  61:         case RPC_SUCCESS:
  62:         case RPC_CANTENCODEARGS:
  63:         case RPC_CANTDECODERES:
  64:         case RPC_TIMEDOUT:
  65:         case RPC_PROGUNAVAIL:
  66:         case RPC_PROCUNAVAIL:
  67:         case RPC_CANTDECODEARGS:
  68:             clnt_perrno(e.re_status);
  69:             break;
  70:         case RPC_CANTSEND:
  71:             clnt_perrno(e.re_status);
  72:             fprintf(stderr, "; errno = %s",
  73:                 sys_errlist[e.re_errno]);
  74:             break;
  75: 
  76:         case RPC_CANTRECV:
  77:             clnt_perrno(e.re_status);
  78:             fprintf(stderr, "; errno = %s",
  79:                 sys_errlist[e.re_errno]);
  80:             break;
  81: 
  82:         case RPC_VERSMISMATCH:
  83:             clnt_perrno(e.re_status);
  84:             fprintf(stderr, "; low version = %lu, high version = %lu", e.re_vers.low, e.re_vers.high);
  85:             break;
  86: 
  87:         case RPC_AUTHERROR:
  88:             clnt_perrno(e.re_status);
  89:             fprintf(stderr, "; why = ");
  90:             switch (e.re_why) {
  91:             case AUTH_OK:
  92:                 fprintf(stderr, "AUTH_OK");
  93:                 break;
  94: 
  95:             case AUTH_BADCRED:
  96:                 fprintf(stderr, "AUTH_BOGUS_CREDENTIAL");
  97:                 break;
  98: 
  99:             case AUTH_REJECTEDCRED:
 100:                 fprintf(stderr, "AUTH_REJECTED_CREDENTIAL");
 101:                 break;
 102: 
 103:             case AUTH_BADVERF:
 104:                 fprintf(stderr, "AUTH_BOGUS_VERIFIER");
 105:                 break;
 106: 
 107:             case AUTH_REJECTEDVERF:
 108:                 fprintf(stderr, "AUTH_REJECTED_VERIFIER");
 109:                 break;
 110: 
 111:             case AUTH_TOOWEAK:
 112:                 fprintf(stderr, "AUTH_TOO_WEAK (remote error)");
 113:                 break;
 114: 
 115:             case AUTH_INVALIDRESP:
 116:                 fprintf(stderr, "AUTH_INVALID_RESPONSE");
 117:                 break;
 118: 
 119:             default:
 120:                 fprintf(stderr, "AUTH_UNKNOWN_FAILURE");
 121:                 break;
 122:             }
 123:             break;
 124: 
 125:         case RPC_PROGVERSMISMATCH:
 126:             clnt_perrno(e.re_status);
 127:             fprintf(stderr, "; low version = %lu, high version = %lu", e.re_vers.low, e.re_vers.high);
 128:             break;
 129: 
 130:         default:
 131:             fprintf(stderr, "RPC_UNKNOWN_FAILURE; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2);
 132:             break;
 133:     }
 134:     fprintf(stderr, "\n");
 135: }
 136: 
 137: /*
 138:  * This interface for use by clntrpc
 139:  */
 140: void
 141: clnt_perrno(num)
 142:     enum clnt_stat num;
 143: {
 144:     switch (num) {
 145:         case RPC_SUCCESS:
 146:             fprintf(stderr, "RPC_SUCCESS");
 147:             break;
 148: 
 149:         case RPC_CANTENCODEARGS:
 150:             fprintf(stderr, "RPC_CANT_ENCODE_ARGS");
 151:             break;
 152: 
 153:         case RPC_CANTDECODERES:
 154:             fprintf(stderr, "RPC_CANT_DECODE_RESULTS");
 155:             break;
 156: 
 157:         case RPC_CANTSEND:
 158:             fprintf(stderr, "RPC_CANT_SEND");
 159:             break;
 160: 
 161:         case RPC_CANTRECV:
 162:             fprintf(stderr, "RPC_CANT_RECV");
 163:             break;
 164: 
 165:         case RPC_TIMEDOUT:
 166:             fprintf(stderr, "RPC_TIMED_OUT");
 167:             break;
 168: 
 169:         case RPC_VERSMISMATCH:
 170:             fprintf(stderr, "RPC_VERSION_MISMATCH");
 171:             break;
 172: 
 173:         case RPC_AUTHERROR:
 174:             fprintf(stderr, "RPC_AUTH_ERROR");
 175:             break;
 176: 
 177:         case RPC_PROGUNAVAIL:
 178:             fprintf(stderr, "RPC_REMOTE_PROGRAM_UNAVAILABLE");
 179:             break;
 180: 
 181:         case RPC_PROGVERSMISMATCH:
 182:             fprintf(stderr, "RPC_PROGRAM_MISMATCH");
 183:             break;
 184: 
 185:         case RPC_PROCUNAVAIL:
 186:             fprintf(stderr, "RPC_UNKNOWN_PROCEDURE");
 187:             break;
 188: 
 189:         case RPC_CANTDECODEARGS:
 190:             fprintf(stderr, "RPC_CANT_DECODE_ARGS");
 191:             break;
 192:         case RPC_UNKNOWNHOST:
 193:             fprintf(stderr, "RPC_UNKNOWNHOST");
 194:             break;
 195:         case RPC_PMAPFAILURE:
 196:             fprintf(stderr, "RPC_PMAP_FAILURE");
 197:             break;
 198:         case RPC_PROGNOTREGISTERED:
 199:             fprintf(stderr, "RPC_PROG_NOT_REGISTERED");
 200:             break;
 201:         case RPC_SYSTEMERROR:
 202:             fprintf(stderr, "RPC_SYSTEM_ERROR");
 203:             break;
 204:     }
 205: }
 206: 
 207: /*
 208:  * A handle on why an rpc creation routine failed (returned NULL.)
 209:  */
 210: struct rpc_createerr rpc_createerr;
 211: 
 212: clnt_pcreateerror(s)
 213:     char *s;
 214: {
 215: 
 216:     fprintf(stderr, "%s: ", s);
 217:     clnt_perrno(rpc_createerr.cf_stat);
 218:     switch (rpc_createerr.cf_stat) {
 219:         case RPC_PMAPFAILURE:
 220:             fprintf(stderr, " - ");
 221:             clnt_perrno(rpc_createerr.cf_error.re_status);
 222:             break;
 223: 
 224:         case RPC_SYSTEMERROR:
 225:             fprintf(stderr, " - %s", sys_errlist[rpc_createerr.cf_error.re_errno]);
 226:             break;
 227: 
 228:     }
 229:     fprintf(stderr, "\n");
 230: }

Defined functions

clnt_pcreateerror defined in line 212; used 2 times
clnt_perrno defined in line 140; used 12 times

Defined variables

sccsid defined in line 30; never used
Last modified: 1985-04-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1298
Valid CSS Valid XHTML 1.0 Strict