134449Sbostic /* $Header: errmsg.c,v 2.3 87/05/12 11:46:32 ed Exp $ */
234449Sbostic
334449Sbostic /* $Log: errmsg.c,v $
434449Sbostic * Revision 2.3 87/05/12 11:46:32 ed
534449Sbostic * Change to use FilingSubset1_defs.h, new AuthenticationError problems.
634449Sbostic *
734449Sbostic * Revision 2.2 87/03/07 14:44:42 jqj
834449Sbostic * set problem correctly. Cardinal != Enum on most UNIX systems
934449Sbostic *
1034449Sbostic * Revision 2.1 86/06/02 07:10:30 jqj
1134449Sbostic * print more information on unspecifiedError
1234449Sbostic *
1334449Sbostic * Revision 2.0 85/11/21 07:22:44 jqj
1434449Sbostic * 4.3BSD standard release
1534449Sbostic *
1634449Sbostic * Revision 1.1 85/11/20 14:19:04 jqj
1734449Sbostic * Initial revision
1834449Sbostic *
1934449Sbostic */
2034449Sbostic #include "FilingSubset1_defs.h"
2134449Sbostic
FilingErrMsg(Code,Message)2234449Sbostic FilingErrMsg(Code, Message)
2334449Sbostic int Code;
2434449Sbostic char *Message;
2534449Sbostic {
2634449Sbostic static char *errmsgs[] = {
2734449Sbostic "AttributeTypeError",
2834449Sbostic "AttributeValueError",
2934449Sbostic "ControlTypeError",
3034449Sbostic "ControlValueError",
3134449Sbostic "ScopeTypeError",
3234449Sbostic "ScopeValueError",
3334449Sbostic "AccessError",
3434449Sbostic "AuthenticationError",
3534449Sbostic "ConnectionError",
3634449Sbostic "HandleError",
3734449Sbostic "InsertionError",
3834449Sbostic "ServiceError",
3934449Sbostic "SessionError",
4034449Sbostic "SpaceError",
4134449Sbostic "TransferError",
4234449Sbostic "UndefinedError",
4334449Sbostic "RangeError" };
4434449Sbostic static char *argproblems[] = {
4534449Sbostic "illegal",
4634449Sbostic "disallowed",
4734449Sbostic "unreasonable",
4834449Sbostic "unimplemented",
4934449Sbostic "duplicated",
5034449Sbostic "missing" };
5134449Sbostic static char *accessproblems[] = {
5234449Sbostic "accessRightsInsufficient",
5334449Sbostic "accessRightsIndeterminate",
5434449Sbostic "fileChanged",
5534449Sbostic "fileDamaged",
5634449Sbostic "fileInUse",
5734449Sbostic "fileNotFound",
5834449Sbostic "fileOpen" };
5934449Sbostic static char *connectionproblems[] = {
6034449Sbostic "noRoute",
6134449Sbostic "noResponse",
6234449Sbostic "transmissionHardware",
6334449Sbostic "transportTimeout",
6434449Sbostic "tooManyLocalConnections",
6534449Sbostic "tooManyRemoteConnections",
6634449Sbostic "missingCourier",
6734449Sbostic "missingProgram",
6834449Sbostic "missingProcedure",
6934449Sbostic "protocolMismatch",
7034449Sbostic "parameterInconsistency",
7134449Sbostic "invalidMessage",
7234449Sbostic "returnTimedOut",
7334449Sbostic "otherCallProblem" };
7434449Sbostic static char* handleproblems[] = {
7534449Sbostic "invalid",
7634449Sbostic "nullDisallowed",
7734449Sbostic "directoryRequired" };
7834449Sbostic static char *insertionproblems[] = {
7934449Sbostic "positionUnavailable",
8034449Sbostic "fileNotUnique",
8134449Sbostic "loopInHierarchy" };
8234449Sbostic static char *serviceproblems[] = {
8334449Sbostic "cannotAuthenticate",
8434449Sbostic "serviceFull",
8534449Sbostic "serviceUnavailable",
8634449Sbostic "sessionInUse" };
8734449Sbostic static char *sessionproblems[] = {
8834449Sbostic "tokenInvalid",
8934449Sbostic "serviceAlreadySet" };
9034449Sbostic static char *spaceproblems[] = {
9134449Sbostic "allocationExceeded",
9234449Sbostic "attributeAreadFull",
9334449Sbostic "mediumFull" };
9434449Sbostic static char *transferproblems[] = {
9534449Sbostic "aborted",
9634449Sbostic "checksumIncorrect",
9734449Sbostic "formatIncorrect",
9834449Sbostic "noRendevous",
9934449Sbostic "wrongDirection" };
10034449Sbostic static char *authenticationproblems[] = {
10134449Sbostic "primaryCredentialsInvalid",
10234449Sbostic "verifierInvalid",
10334449Sbostic "verifierExpired",
10434449Sbostic "verifierReused",
10534449Sbostic "primaryCredentialsExpired",
10634449Sbostic "inappropriatePrimaryCredentials",
10734449Sbostic "secondaryCredentialsRequired",
10834449Sbostic "secondaryCredentialsTypeInvalid",
10934449Sbostic "secondaryCredentialsValueInvalid" };
11034449Sbostic static char *rejectproblem[] = {
11134449Sbostic "noSuchProgramNumber",
11234449Sbostic "noSuchVersionNumber",
11334449Sbostic "noSuchProcedureValue",
11434449Sbostic "invalidArgument" };
11534449Sbostic char *msg, *problemstr;
11634449Sbostic int problem;
11734449Sbostic char tempbuf[40];
11834449Sbostic
11934449Sbostic if (Code < 1000) {
12034449Sbostic if (Message != (char *) 0)
12134449Sbostic printf("ERROR: %s\n", Message);
12234449Sbostic return;
12334449Sbostic }
12434449Sbostic
12534449Sbostic msg = "";
12634449Sbostic problem = 0;
12734449Sbostic if (Code-ERROR_OFFSET >= 0 && Code-ERROR_OFFSET <= 16) {
12834449Sbostic msg = errmsgs[Code-ERROR_OFFSET];
12934449Sbostic }
13034449Sbostic switch (Code) {
13134449Sbostic case AttributeTypeError:
13234449Sbostic case AttributeValueError:
13334449Sbostic case ControlTypeError:
13434449Sbostic case ControlValueError:
13534449Sbostic case ScopeTypeError:
13634449Sbostic case ScopeValueError:
13734449Sbostic /* the following fails because "type" is defined as "Filing4_type". Argh!!
13834449Sbostic /* problem = (int) (((ScopeTypeErrorArgs *) Message)->problem);
139*34450Sbostic /* (void)sprintf(tempbuf,"problem: %s; type: %d",
14034449Sbostic /* argproblems[problem],
14134449Sbostic /* ((ScopeTypeErrorArgs *) Message)->type);
142*34450Sbostic /* problemstr = tempbuf;
14334449Sbostic /* break;
14434449Sbostic */
14534449Sbostic case RangeError:
14634449Sbostic problem = (int) (((RangeErrorArgs *) Message)->problem);
14734449Sbostic problemstr = argproblems[problem];
14834449Sbostic break;
14934449Sbostic case AccessError:
15034449Sbostic problem = (int) (((AccessErrorArgs *) Message)->problem);
15134449Sbostic problemstr = accessproblems[problem];
15234449Sbostic break;
15334449Sbostic case AuthenticationError:
15434449Sbostic problem = (int) (((AuthenticationErrorArgs *) Message)->problem);
15534449Sbostic problemstr = authenticationproblems[problem];
15634449Sbostic break;
15734449Sbostic case ConnectionError:
15834449Sbostic problem = (int) (((ConnectionErrorArgs *) Message)->problem);
15934449Sbostic problemstr = connectionproblems[problem];
16034449Sbostic break;
16134449Sbostic case HandleError:
16234449Sbostic problem = (int) (((HandleErrorArgs *) Message)->problem);
16334449Sbostic problemstr = handleproblems[problem];
16434449Sbostic break;
16534449Sbostic case InsertionError:
16634449Sbostic problem = (int) (((InsertionErrorArgs *) Message)->problem);
16734449Sbostic problemstr = insertionproblems[problem];
16834449Sbostic break;
16934449Sbostic case ServiceError:
17034449Sbostic problem = (int) (((ServiceErrorArgs *) Message)->problem);
17134449Sbostic problemstr = serviceproblems[problem];
17234449Sbostic break;
17334449Sbostic case SessionError:
17434449Sbostic problem = (int) (((SessionErrorArgs *) Message)->problem);
17534449Sbostic problemstr = sessionproblems[problem];
17634449Sbostic break;
17734449Sbostic case SpaceError:
17834449Sbostic problem = (int) (((SpaceErrorArgs *) Message)->problem);
17934449Sbostic problemstr = spaceproblems[problem];
18034449Sbostic break;
18134449Sbostic case TransferError:
18234449Sbostic problem = (int) (((TransferErrorArgs *) Message)->problem);
18334449Sbostic problemstr = transferproblems[problem];
18434449Sbostic break;
18534449Sbostic case UndefinedError:
18634449Sbostic problem = (int) (((UndefinedErrorArgs *) Message)->problem);
18734449Sbostic problemstr = tempbuf;
18834449Sbostic sprintf(problemstr,"number %d",problem);
18934449Sbostic break;
19034449Sbostic case REJECT_ERROR:
19134449Sbostic msg = "Courier REJECT";
19234449Sbostic problem = (int) (((rejectionDetails *) Message)->designator);
19334449Sbostic if (problem <= 3)
19434449Sbostic problemstr = rejectproblem[problem];
19534449Sbostic else {
19634449Sbostic problemstr = tempbuf;
19734449Sbostic sprintf(problemstr,"unspecifiedError (%d)", problem);
19834449Sbostic }
19934449Sbostic break;
20034449Sbostic case PROTOCOL_VIOLATION:
20134449Sbostic problemstr = "Courier protocol violation";
20234449Sbostic break;
20334449Sbostic default:
20434449Sbostic problemstr = tempbuf;
20534449Sbostic sprintf(problemstr,"unexpected error number %d", Code);
20634449Sbostic break;
20734449Sbostic }
20834449Sbostic printf("ERROR: %s, %s\n", msg, problemstr);
20934449Sbostic }
210