/* crn_err.c -- this file deals with charon errors.  Bascially, it
 * is just user nicety for returning an error message string from 
 * an error value.
 *
 * Created by:	Derek Atkins <warlord@MIT.EDU>
 *
 * $Source: /afs/net.mit.edu/user/warlord/Thesis/src/lib/RCS/crn_err.c,v $
 * $Author: warlord $
 *
 */

#include <warlord-copyright.h>

#if !defined(lint) && !defined(SABER)
static char rcsid_crn_err_c[] = "$Id: crn_err.c,v 1.3 93/12/11 15:15:14 warlord Exp $";
#endif

#include <charon_err.h>

/* Effects:	Returns a string that explains the error we received
 */
char *
crn_err_msg(int error)
{
  char *s;

  switch(error) {

  case CRN_OK:
    s = "No Error";
    break;

  case CRN_UNKNOWN_PKT_TYPE:
    s = "Unknown packet type";
    break;

  case CRN_ERR_DATALEN:
    s = "Bad Data Length";
    break;

  case CRN_BAD_VERSION:
    s = "Bad Version Number";
    break;

  case CRN_ALLOC:
    s = "Error allocating memory";
    break;

  case CRN_BAD_PACKET:
    s = "Bad Packet Type";
    break;

  case CRN_BADPW:
    s = "Bad Password";
    break;

  case CRN_KRB_PROT:
    s = "Kerberos Protocol Error";
    break;

  case CRN_MK_PRIV:
    s = "Error in krb_mk_priv";
    break;

  case CRN_ERR_COOKIE:
    s = "Cookie Mismatch";
    break;

  case CRN_ERROR:
    s = "Generic Charon Error";
    break;

  default:
    s = "Unknown Error";
    break;
  }

  return(s);
}
