/*
 * $Source: $
 * $Revision: $
 * $Date: $
 * $State: $
 * $Author: $
 *
 *
 * $Log: $
 *
 */

/*
 *	Copyright (c) 1991 by the Massachusetts Institute of Technology,
 *	For copying and distribution information, see the file
 *	"mit-copyright.h".
 */

#include <MacTCPCommonTypes.h>
#include <strings.h>
#include "mit-copyright.h"

MacTCPErr(short MacOSErr, char  *err_string) {
int	error;

	error = MacOSErr;

	switch(error) {

	/* MacTCP return Codes in the range   -23000 through   -23049 */
	case (int) inProgress:					
		strcpy(err_string, "I/O in progress");
		break;
	case (int) ipBadLapErr:	  		
		strcpy(err_string, "bad network configuration");
		break;
	case (int) ipBadCnfgErr:	
		strcpy(err_string, "bad IP configuration error");
		break;
	case (int) ipNoCnfgErr:	
		strcpy(err_string, "missing IP or LAP configuration error");
		break;
	case (int) ipLoadErr:	
		strcpy(err_string, "error in MacTCP load");
		break;
	case (int) ipBadAddr:	
		strcpy(err_string, "error in getting address");
		break;
	case (int) connectionClosing:	
		strcpy(err_string, "connection is closing");
		break;
	case (int) invalidLength:        
		strcpy(err_string, "invalid length");
		break;
	case (int) connectionExists:	
		strcpy(err_string, "request conflicts with existing connection");
		break;
	case (int) connectionDoesntExist:	
		strcpy(err_string, "connection does not exist");
		break;
	case (int) insufficientResources:	
		strcpy(err_string, "insufficient resources to perform request");
		break;
	case (int) invalidStreamPtr:       
		strcpy(err_string, "invalid stream ptr");
		break;
	case (int) streamAlreadyOpen:       
		strcpy(err_string, "stream already open");
		break;
	case (int) connectionTerminated:       
		strcpy(err_string, "connection terminated");
		break;
	case (int) invalidBufPtr:     
		strcpy(err_string, "invalid buf ptr");
		break;
	case (int) invalidWDS:        
		strcpy(err_string, "invalid RDS/WDS");
		break;
	case (int) openFailed	:        
		strcpy(err_string, "open failed");
		break;
	case (int) commandTimeout:        
		strcpy(err_string, "command timeout");
		break;
	case (int) duplicateSocket:         
		strcpy(err_string, "duplicate socket");
		break;

	/* Error codes from internal IP functions */
	case (int) ipDontFragErr:	
		strcpy(err_string, "Packet too large to send w/o fragmenting");
		break;
	case (int) ipDestDeadErr:		
		strcpy(err_string, "destination not responding");
		break;
	case (int) ipNoFragMemErr:	
		strcpy(err_string, "no memory to send fragmented pkt");
		break;
	case (int) ipRouteErr:		
		strcpy(err_string, "can't route packet off  -net");
		break;
	case (int) nameSyntaxErr:
		strcpy(err_string, "name syntax error");
		break;
	case (int) cacheFault:
		strcpy(err_string, "cache fault");
		break;
	case (int) noResultProc:
		strcpy(err_string, "no result proc");
		break;
	case (int) noNameServer:
		strcpy(err_string, "no name server");
		break;
	case (int) authNameErr:
		strcpy(err_string, "auth name error");
		break;
	case (int) noAnsErr:
		strcpy(err_string, "no answer error");
		break;
	case (int) dnrErr:
		strcpy(err_string, "driver error");
		break;
	case (int) outOfMemory:
		strcpy(err_string, "out of memory");
		break;
	default:
		sprintf(err_string, "unknown error %d:",error);
		break;

	}
}
