|
|
1.1 root 1: /* $Header: errmsg.c,v 2.3 87/05/12 11:46:32 ed Exp $ */
2:
3: /* $Log: errmsg.c,v $
4: * Revision 2.3 87/05/12 11:46:32 ed
5: * Change to use FilingSubset1_defs.h, new AuthenticationError problems.
6: *
7: * Revision 2.2 87/03/07 14:44:42 jqj
8: * set problem correctly. Cardinal != Enum on most UNIX systems
9: *
10: * Revision 2.1 86/06/02 07:10:30 jqj
11: * print more information on unspecifiedError
12: *
13: * Revision 2.0 85/11/21 07:22:44 jqj
14: * 4.3BSD standard release
15: *
16: * Revision 1.1 85/11/20 14:19:04 jqj
17: * Initial revision
18: *
19: */
20: #include "FilingSubset1_defs.h"
21:
22: FilingErrMsg(Code, Message)
23: int Code;
24: char *Message;
25: {
26: static char *errmsgs[] = {
27: "AttributeTypeError",
28: "AttributeValueError",
29: "ControlTypeError",
30: "ControlValueError",
31: "ScopeTypeError",
32: "ScopeValueError",
33: "AccessError",
34: "AuthenticationError",
35: "ConnectionError",
36: "HandleError",
37: "InsertionError",
38: "ServiceError",
39: "SessionError",
40: "SpaceError",
41: "TransferError",
42: "UndefinedError",
43: "RangeError" };
44: static char *argproblems[] = {
45: "illegal",
46: "disallowed",
47: "unreasonable",
48: "unimplemented",
49: "duplicated",
50: "missing" };
51: static char *accessproblems[] = {
52: "accessRightsInsufficient",
53: "accessRightsIndeterminate",
54: "fileChanged",
55: "fileDamaged",
56: "fileInUse",
57: "fileNotFound",
58: "fileOpen" };
59: static char *connectionproblems[] = {
60: "noRoute",
61: "noResponse",
62: "transmissionHardware",
63: "transportTimeout",
64: "tooManyLocalConnections",
65: "tooManyRemoteConnections",
66: "missingCourier",
67: "missingProgram",
68: "missingProcedure",
69: "protocolMismatch",
70: "parameterInconsistency",
71: "invalidMessage",
72: "returnTimedOut",
73: "otherCallProblem" };
74: static char* handleproblems[] = {
75: "invalid",
76: "nullDisallowed",
77: "directoryRequired" };
78: static char *insertionproblems[] = {
79: "positionUnavailable",
80: "fileNotUnique",
81: "loopInHierarchy" };
82: static char *serviceproblems[] = {
83: "cannotAuthenticate",
84: "serviceFull",
85: "serviceUnavailable",
86: "sessionInUse" };
87: static char *sessionproblems[] = {
88: "tokenInvalid",
89: "serviceAlreadySet" };
90: static char *spaceproblems[] = {
91: "allocationExceeded",
92: "attributeAreadFull",
93: "mediumFull" };
94: static char *transferproblems[] = {
95: "aborted",
96: "checksumIncorrect",
97: "formatIncorrect",
98: "noRendevous",
99: "wrongDirection" };
100: static char *authenticationproblems[] = {
101: "primaryCredentialsInvalid",
102: "verifierInvalid",
103: "verifierExpired",
104: "verifierReused",
105: "primaryCredentialsExpired",
106: "inappropriatePrimaryCredentials",
107: "secondaryCredentialsRequired",
108: "secondaryCredentialsTypeInvalid",
109: "secondaryCredentialsValueInvalid" };
110: static char *rejectproblem[] = {
111: "noSuchProgramNumber",
112: "noSuchVersionNumber",
113: "noSuchProcedureValue",
114: "invalidArgument" };
115: char *msg, *problemstr;
116: int problem;
117: char tempbuf[40];
118:
119: if (Code < 1000) {
120: if (Message != (char *) 0)
121: printf("ERROR: %s\n", Message);
122: return;
123: }
124:
125: msg = "";
126: problem = 0;
127: if (Code-ERROR_OFFSET >= 0 && Code-ERROR_OFFSET <= 16) {
128: msg = errmsgs[Code-ERROR_OFFSET];
129: }
130: switch (Code) {
131: case AttributeTypeError:
132: case AttributeValueError:
133: case ControlTypeError:
134: case ControlValueError:
135: case ScopeTypeError:
136: case ScopeValueError:
137: /* the following fails because "type" is defined as "Filing4_type". Argh!!
138: /* problem = (int) (((ScopeTypeErrorArgs *) Message)->problem);
139: /* (void)sprintf(tempbuf,"problem: %s; type: %d",
140: /* argproblems[problem],
141: /* ((ScopeTypeErrorArgs *) Message)->type);
142: /* problemstr = tempbuf;
143: /* break;
144: */
145: case RangeError:
146: problem = (int) (((RangeErrorArgs *) Message)->problem);
147: problemstr = argproblems[problem];
148: break;
149: case AccessError:
150: problem = (int) (((AccessErrorArgs *) Message)->problem);
151: problemstr = accessproblems[problem];
152: break;
153: case AuthenticationError:
154: problem = (int) (((AuthenticationErrorArgs *) Message)->problem);
155: problemstr = authenticationproblems[problem];
156: break;
157: case ConnectionError:
158: problem = (int) (((ConnectionErrorArgs *) Message)->problem);
159: problemstr = connectionproblems[problem];
160: break;
161: case HandleError:
162: problem = (int) (((HandleErrorArgs *) Message)->problem);
163: problemstr = handleproblems[problem];
164: break;
165: case InsertionError:
166: problem = (int) (((InsertionErrorArgs *) Message)->problem);
167: problemstr = insertionproblems[problem];
168: break;
169: case ServiceError:
170: problem = (int) (((ServiceErrorArgs *) Message)->problem);
171: problemstr = serviceproblems[problem];
172: break;
173: case SessionError:
174: problem = (int) (((SessionErrorArgs *) Message)->problem);
175: problemstr = sessionproblems[problem];
176: break;
177: case SpaceError:
178: problem = (int) (((SpaceErrorArgs *) Message)->problem);
179: problemstr = spaceproblems[problem];
180: break;
181: case TransferError:
182: problem = (int) (((TransferErrorArgs *) Message)->problem);
183: problemstr = transferproblems[problem];
184: break;
185: case UndefinedError:
186: problem = (int) (((UndefinedErrorArgs *) Message)->problem);
187: problemstr = tempbuf;
188: sprintf(problemstr,"number %d",problem);
189: break;
190: case REJECT_ERROR:
191: msg = "Courier REJECT";
192: problem = (int) (((rejectionDetails *) Message)->designator);
193: if (problem <= 3)
194: problemstr = rejectproblem[problem];
195: else {
196: problemstr = tempbuf;
197: sprintf(problemstr,"unspecifiedError (%d)", problem);
198: }
199: break;
200: case PROTOCOL_VIOLATION:
201: problemstr = "Courier protocol violation";
202: break;
203: default:
204: problemstr = tempbuf;
205: sprintf(problemstr,"unexpected error number %d", Code);
206: break;
207: }
208: printf("ERROR: %s, %s\n", msg, problemstr);
209: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.