|
|
1.1 root 1: -- $Header: Filing5.cr,v 2.6 87/03/23 13:06:20 ed Exp $
2:
3: -- Note: this is a TEST version of Filing, and is not guaranteed to
4: -- match the official Xerox version at all. It does seem to be adequate
5: -- for FTP, however.
6:
7: -- $Log: Filing5.cr,v $
8: -- Revision 2.6 87/03/23 13:06:20 ed
9: -- Minor Type in SerializedTree.
10: --
11: -- Revision 2.5 87/03/23 11:48:42 ed
12: -- Slight mod to SerializedTree to allow current implementation.
13: --
14: -- Revision 2.4 87/01/14 13:02:00 ed
15: -- Remove controls from Move
16: --
17: -- Revision 2.3 86/12/31 11:45:30 ed
18: -- Added RandomAccess and Serialize/Deserialize for completeness
19: -- Some REPORTS error typos fixed
20: --
21: -- Revision 2.2 86/06/30 11:31:13 jqj
22: -- convert to Authentication v 2 for compatibility with spec., now that
23: -- compiler allows it.
24: --
25: -- Revision 2.1 86/06/02 07:08:22 jqj
26: -- typos
27: --
28: -- Revision 2.0 85/11/21 07:22:38 jqj
29: -- 4.3BSD standard release
30: --
31: -- Revision 1.1 85/05/27 06:30:46 jqj
32: -- Initial revision
33: --
34: -- Revision 1.1 85/05/27 06:30:46 jqj
35: -- Initial revision
36: --
37:
38: Filing: PROGRAM 10 VERSION 5 =
39: BEGIN
40: DEPENDS UPON
41: BulkData(0) VERSION 1,
42: Clearinghouse(2) VERSION 2,
43: Authentication(14) VERSION 2,
44: Time(15) VERSION 2;
45:
46:
47:
48:
49: -- TYPES AND CONSTANTS --
50:
51: -- Attributes (individual attributes defined later) --
52:
53: AttributeType: TYPE = LONG CARDINAL;
54: AttributeTypeSequence: TYPE = SEQUENCE OF AttributeType;
55: allAttributeTypes: AttributeTypeSequence = [37777777777B];
56: Attribute: TYPE = RECORD [type: AttributeType, value: SEQUENCE OF UNSPECIFIED];
57: AttributeSequence: TYPE = SEQUENCE OF Attribute;
58:
59: -- Controls --
60:
61: ControlType: TYPE = {lockControl(0), timeoutControl(1), accessControl(2)};
62: ControlTypeSequence: TYPE = SEQUENCE 3 OF ControlType;
63:
64: Lock: TYPE = {lockNone(0), share(1), exclusive(2)};
65:
66: Timeout: TYPE = CARDINAL; -- in seconds --
67: defaultTimeout: Timeout = 177777B; -- actual value impl.-dependent --
68:
69: AccessType: TYPE = {
70: readAccess(0), writeAccess(1), ownerAccess(2), -- all files --
71: addAccess(3), removeAccess(4) }; -- directories only --
72: AccessSequence: TYPE = SEQUENCE 5 OF AccessType;
73: -- fullAccess: AccessSequence = [177777B]; --
74:
75: Control: TYPE = CHOICE ControlType OF {
76: lockControl => Lock,
77: timeoutControl => Timeout,
78: accessControl => AccessSequence};
79: ControlSequence: TYPE = SEQUENCE 3 OF Control;
80:
81: -- Scopes --
82:
83: Count: TYPE = CARDINAL;
84: unlimitedCount: Count = 177777B;
85:
86: Depth: TYPE = CARDINAL;
87: allDescendants: Depth = 177777B;
88:
89: Direction: TYPE = {forward(0), backward(1)};
90:
91: Interpretation: TYPE = { interpretationNone(0), boolean(1), cardinal(2),
92: longCardinal(3), time(4), integer(5), longInteger(6), string(7) };
93: FilterType: TYPE = {
94: -- relations --
95: less(0), lessOrEqual(1), equal(2), notEqual(3), greaterOrEqual(4),
96: greater(5),
97: -- logical --
98: and(6), or(7), not(8),
99: -- constants --
100: filterNone(9), all(10),
101: -- patterns --
102: matches(11) };
103: RestrictedFilter: TYPE = CHOICE FilterType OF {
104: less, lessOrEqual, equal, notEqual, greaterOrEqual, greater =>
105: RECORD [attribute: Attribute, interpretation: Interpretation],
106: -- interpretation ignored if attribute interpreted by
107: -- implementor
108: -- NOT IMPLEMENTED: and, or, not --
109: filterNone, all => RECORD [],
110: matches => RECORD [attribute: Attribute] };
111: Filter: TYPE = CHOICE FilterType OF {
112: less, lessOrEqual, equal, notEqual, greaterOrEqual, greater =>
113: RECORD [attribute: Attribute, interpretation: Interpretation],
114: -- interpretation ignored if attribute interpreted by
115: -- implementor
116: -- NOT YET IMPLEMENTED: (at least, not generally) and, or, not --
117: and, or => SEQUENCE OF RestrictedFilter,
118: not => RestrictedFilter,
119: filterNone, all => RECORD [],
120: matches => RECORD [attribute: Attribute] };
121: nullFilter: Filter = all[];
122:
123: ScopeType: TYPE = { count(0), direction(1), filter(2), depth(3) };
124: Scope: TYPE = CHOICE ScopeType OF {
125: count => Count,
126: depth => Depth,
127: direction => Direction,
128: filter => Filter };
129: ScopeSequence: TYPE = SEQUENCE 4 OF Scope;
130:
131: -- Handles and Authentication --
132:
133: Credentials: TYPE = Authentication.Credentials;
134: Verifier: TYPE = Authentication.Verifier;
135: SimpleVerifier: TYPE = Authentication.SimpleVerifier;
136:
137: Handle: TYPE = ARRAY 2 OF UNSPECIFIED;
138: nullHandle: Handle = [0,0];
139:
140: Session: TYPE = RECORD [token: ARRAY 2 OF UNSPECIFIED, verifier: Verifier ];
141:
142:
143: -- Random Access --
144:
145: ByteAddress: TYPE = LONG CARDINAL;
146: ByteCount: TYPE = LONG CARDINAL;
147: endOfFile: LONG CARDINAL = 3777777777B; -- logical end of file --
148:
149: ByteRange: TYPE = RECORD [ firstByte: ByteAddress, count: ByteCount ];
150:
151:
152: -- REMOTE ERRORS --
153:
154: ArgumentProblem: TYPE = {
155: illegal(0),
156: disallowed(1),
157: unreasonable(2),
158: unimplemented(3),
159: duplicated(4),
160: missing(5) };
161:
162: -- problem with an attribute type or value --
163: AttributeTypeError: ERROR [ problem: ArgumentProblem, type: AttributeType]
164: = 0;
165: AttributeValueError: ERROR [ problem: ArgumentProblem, type: AttributeType]
166: = 1;
167:
168: -- problem with an control type or value --
169: ControlTypeError: ERROR [ problem: ArgumentProblem, type: ControlType]
170: = 2;
171: ControlValueError: ERROR [ problem: ArgumentProblem, type: ControlType]
172: = 3;
173:
174: -- problem with an scope type or value --
175: ScopeTypeError: ERROR [ problem: ArgumentProblem, type: ScopeType]
176: = 4;
177: ScopeValueError: ERROR [ problem: ArgumentProblem, type: ScopeType]
178: = 5;
179:
180: -- problem in obtaining access to a file --
181: AccessProblem: TYPE = {
182: accessRightsInsufficient(0),
183: accessRightsIndeterminate(1),
184: fileChanged(2),
185: fileDamaged(3),
186: fileInUse(4),
187: fileNotFound(5),
188: fileOpen(6) };
189: AccessError: ERROR [problem: AccessProblem] = 6;
190:
191: -- problem with a credentials or verifier --
192: AuthenticationError: ERROR [problem: Authentication.Problem] = 7;
193:
194: -- problem with a BDT --
195: ConnectionProblem: TYPE = {
196: -- communication problems --
197: noRoute(0),
198: noResponse(1),
199: transmissionHardware(2),
200: transportTimeout(3),
201: -- resource problems --
202: tooManyLocalConnections(4),
203: tooManyRemoteConnections(5),
204: -- remote program implementation problems --
205: missingCourier(6),
206: missingProgram(7),
207: missingProcedure(8),
208: protocolMismatch(9),
209: parameterInconsistency(10),
210: invalidMessage(11),
211: returnTimedOut(12),
212: -- miscellaneous --
213: otherCallProblem(177777B) };
214: ConnectionError: ERROR [problem: ConnectionProblem] = 8;
215:
216: -- problem with file handle --
217: HandleProblem: TYPE = {
218: invalid(0),
219: nullDisallowed(1),
220: directoryRequired(2) };
221: HandleError: ERROR [problem: HandleProblem] = 9;
222:
223: -- problem during insertion in directory or changing attributes --
224: InsertionProblem: TYPE = {
225: positionUnavailable(0),
226: fileNotUnique(1),
227: loopInHierarchy(2) };
228: InsertionError: ERROR [problem: InsertionProblem] = 10;
229:
230: -- problem during random access operation --
231: RangeError: ERROR [problem: ArgumentProblem] = 16;
232:
233: -- problem during logon or logoff --
234: ServiceProblem: TYPE = {
235: cannotAuthenticate(0),
236: serviceFull(1),
237: serviceUnavailable(2),
238: sessionInUse(3) };
239: ServiceError: ERROR [problem: ServiceProblem] = 11;
240:
241: -- problem with a session --
242: SessionProblem: TYPE = {
243: tokenInvalid(0),
244: serviceAlreadySet(1) };
245: SessionError: ERROR [problem: SessionProblem ] = 12;
246:
247: -- problem obtaining space for file contents or attributes --
248: SpaceProblem: TYPE = {
249: allocationExceeded(0),
250: attributeAreaFull(1),
251: mediumFull(2) };
252: SpaceError: ERROR [problem: SpaceProblem ] = 13;
253:
254: -- problem during BDT --
255: TransferProblem: TYPE = {
256: aborted(0),
257: checksumIncorrect(1),
258: formatIncorrect(2),
259: noRendezvous(3),
260: wrongDirection(4) };
261: TransferError: ERROR [problem: TransferProblem ] = 14;
262:
263: -- some undefined (and implementation-dependent) problem occurred --
264: UndefinedProblem: TYPE = CARDINAL;
265: UndefinedError: ERROR [problem: UndefinedProblem ] = 15;
266:
267:
268:
269:
270: -- REMOTE PROCEDURES --
271:
272: -- Logging On and Off --
273:
274: Logon: PROCEDURE [
275: service: Clearinghouse.Name, credentials: Credentials,
276: verifier: Verifier ]
277: RETURNS [ session: Session ]
278: REPORTS [ AuthenticationError, ServiceError, SessionError,
279: UndefinedError ]
280: = 0;
281:
282: Logoff: PROCEDURE [ session: Session ]
283: REPORTS [ AuthenticationError, ServiceError, SessionError,
284: UndefinedError ]
285: = 1;
286:
287: Continue: PROCEDURE [ session: Session ]
288: RETURNS [ continuance: CARDINAL ]
289: REPORTS [ AuthenticationError, SessionError, UndefinedError ]
290: = 19;
291:
292: -- Opening and Closing Files --
293:
294: Open: PROCEDURE [ attributes: AttributeSequence, directory: Handle,
295: controls: ControlSequence, session: Session ]
296: RETURNS [ file: Handle ]
297: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
298: AuthenticationError, ControlTypeError, ControlValueError,
299: HandleError, SessionError, UndefinedError ]
300: = 2;
301:
302: Close: PROCEDURE [ file: Handle, session: Session ]
303: REPORTS [ AuthenticationError, HandleError, SessionError,
304: UndefinedError ]
305: = 3;
306:
307: -- Creating and Deleting Files --
308:
309: Create: PROCEDURE [ directory: Handle, attributes: AttributeSequence,
310: controls: ControlSequence, session: Session ]
311: RETURNS [ file: Handle ]
312: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
313: AuthenticationError, ControlTypeError, ControlValueError,
314: HandleError, InsertionError, SessionError, SpaceError,
315: UndefinedError ]
316: = 4;
317:
318: Delete: PROCEDURE [ file: Handle, session: Session ]
319: REPORTS [ AccessError, AuthenticationError, HandleError, SessionError,
320: UndefinedError ]
321: = 5;
322:
323: -- Getting and Changing Controls (transient) --
324:
325: GetControls: PROCEDURE [ file: Handle, types: ControlTypeSequence,
326: session: Session ]
327: RETURNS [ controls: ControlSequence ]
328: REPORTS [ AccessError, AuthenticationError, ControlTypeError,
329: HandleError, SessionError, UndefinedError ]
330: = 6;
331:
332: ChangeControls: PROCEDURE [ file: Handle, controls: ControlSequence,
333: session: Session ]
334: REPORTS [ AccessError, AuthenticationError,
335: ControlTypeError, ControlValueError,
336: HandleError, SessionError, UndefinedError ]
337: = 7;
338:
339:
340: -- Getting and Changing Attributes (permanent) --
341:
342: GetAttributes: PROCEDURE [ file: Handle, types: AttributeTypeSequence,
343: session: Session ]
344: RETURNS [ attributes: AttributeSequence ]
345: REPORTS [ AccessError, AttributeTypeError, AuthenticationError,
346: HandleError, SessionError, UndefinedError ]
347: = 8;
348:
349: ChangeAttributes: PROCEDURE [file: Handle, attributes: AttributeSequence,
350: session: Session ]
351: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
352: AuthenticationError, HandleError, InsertionError,
353: SessionError, SpaceError, UndefinedError ]
354: = 9;
355:
356: UnifyAccessLists: PROCEDURE [directory: Handle, session: Session ]
357: REPORTS [ AccessError, AuthenticationError, HandleError, SessionError,
358: UndefinedError ]
359: = 20;
360:
361: -- Copying and Moving Files --
362:
363: Copy: PROCEDURE [ file, destinationDirectory: Handle ,
364: attributes: AttributeSequence, controls: ControlSequence,
365: session: Session ]
366: RETURNS [ newFile: Handle ]
367: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
368: AuthenticationError, ControlTypeError, ControlValueError,
369: HandleError, InsertionError, SessionError, SpaceError,
370: UndefinedError ]
371: = 10;
372:
373: Move: PROCEDURE [ file, destinationDirectory: Handle ,
374: attributes: AttributeSequence, session: Session ]
375: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
376: AuthenticationError, HandleError, InsertionError,
377: SessionError, SpaceError, UndefinedError ]
378: = 11;
379:
380: -- Transfering Bulk Data (File Content) --
381:
382: Store: PROCEDURE [ directory: Handle, attributes: AttributeSequence,
383: controls: ControlSequence, content: BulkData.Source,
384: session: Session ]
385: RETURNS [ file: Handle ]
386: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
387: AuthenticationError, ConnectionError, ControlTypeError,
388: ControlValueError, HandleError, InsertionError, SessionError,
389: SpaceError, TransferError, UndefinedError ]
390: = 12;
391:
392: Retrieve: PROCEDURE [ file: Handle, content: BulkData.Sink, session: Session ]
393: REPORTS [ AccessError, AuthenticationError, ConnectionError,
394: HandleError, SessionError, TransferError,
395: UndefinedError ]
396: = 13;
397:
398: Replace: PROCEDURE [ file: Handle, attributes: AttributeSequence,
399: content: BulkData.Source, session: Session ]
400: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
401: AuthenticationError, ConnectionError, HandleError,
402: SessionError, SpaceError, TransferError, UndefinedError ]
403: = 14;
404:
405: -- Transferring Bulk Data (Serialized Files) --
406:
407: Serialize: PROCEDURE [ file: Handle, serializedFile: BulkData.Sink,
408: session: Session ]
409: REPORTS [ AccessError, AuthenticationError, ConnectionError,
410: HandleError, SessionError, TransferError, UndefinedError ]
411: = 15;
412:
413: Deserialize: PROCEDURE [ directory: Handle, attributes: AttributeSequence,
414: controls: ControlSequence, serializedFile: BulkData.Source,
415: session: Session ]
416: RETURNS [ file: Handle ]
417: REPORTS [ AccessError, AttributeTypeError, AttributeValueError,
418: AuthenticationError, ConnectionError, ControlTypeError,
419: ControlValueError, HandleError, InsertionError,
420: SessionError, SpaceError, TransferError, UndefinedError ]
421: = 16;
422:
423: -- Random Access to File Data --
424:
425: RetrieveBytes: PROCEDURE [ file: Handle, range: ByteRange,
426: sink: BulkData.Sink, session: Session ]
427: REPORTS [ AccessError, HandleError, RangeError, SessionError,
428: UndefinedError ]
429: = 22;
430:
431: ReplaceBytes: PROCEDURE [ file: Handle, range: ByteRange,
432: source: BulkData.Source, session: Session ]
433: REPORTS [ AccessError, HandleError, RangeError, SessionError,
434: SpaceError, UndefinedError ]
435: = 23;
436:
437: -- Locating and Listing Files in a Directory --
438:
439: Find: PROCEDURE [ directory: Handle, scope: ScopeSequence,
440: controls: ControlSequence, session: Session ]
441: RETURNS [ file: Handle ]
442: REPORTS [ AccessError, AuthenticationError,
443: ControlTypeError, ControlValueError, HandleError,
444: ScopeTypeError, ScopeValueError,
445: SessionError, UndefinedError ]
446: = 17;
447:
448: List: PROCEDURE [ directory: Handle, types: AttributeTypeSequence,
449: scope: ScopeSequence, listing: BulkData.Sink,
450: session: Session ]
451: REPORTS [ AccessError, AttributeTypeError,
452: AuthenticationError, ConnectionError,
453: HandleError,
454: ScopeTypeError, ScopeValueError,
455: SessionError, TransferError, UndefinedError ]
456: = 18;
457:
458:
459:
460:
461:
462: -- INTERPRETED ATTRIBUTE DEFINITIONS --
463:
464: -- common definitions --
465:
466: Time: TYPE = Time.Time; -- seconds --
467: nullTime: Time = Time.earliestTime;
468:
469: User: TYPE = Clearinghouse.Name;
470:
471: -- attributes --
472:
473: accessList: AttributeType = 19;
474: AccessEntry: TYPE = RECORD [key: Clearinghouse.Name, access: AccessSequence ];
475: AccessList: TYPE = RECORD [entries: SEQUENCE OF AccessEntry, defaulted: BOOLEAN];
476:
477: checksum: AttributeType = 0;
478: Checksum: TYPE = CARDINAL;
479: unknownChecksum: Checksum = 177777B;
480:
481: childrenUniquelyNamed: AttributeType = 1;
482: ChildrenUniquelyNamed: TYPE = BOOLEAN;
483:
484: createdBy: AttributeType = 2;
485: CreatedBy: TYPE = User;
486:
487: createdOn: AttributeType = 3;
488: CreatedOn: TYPE = Time;
489:
490: dataSize: AttributeType = 16;
491: DataSize: TYPE = LONG CARDINAL;
492:
493: fileID: AttributeType = 4;
494: FileID: TYPE = ARRAY 5 OF UNSPECIFIED;
495: nullFileID: FileID = [0,0,0,0,0];
496:
497: isDirectory: AttributeType = 5;
498: IsDirectory: TYPE = BOOLEAN;
499:
500: isTemporary: AttributeType = 6;
501: IsTemporary: TYPE = BOOLEAN;
502:
503: modifiedBy: AttributeType = 7;
504: ModifiedBy: TYPE = User;
505:
506: modifiedOn: AttributeType = 8;
507: ModifiedOn: TYPE = Time;
508:
509: name: AttributeType = 9; -- name relative to parent --
510: Name: TYPE = STRING; -- must not exceed 100 bytes --
511:
512: numberOfChildren: AttributeType = 10;
513: NumberOfChildren: TYPE = CARDINAL;
514:
515: ordering: AttributeType = 11;
516: Ordering: TYPE = RECORD [key: AttributeType, ascending: BOOLEAN,
517: interpretation: Interpretation];
518: -- see below for defaultOrdering, byAscendingPosition, byDescendingPosition --
519:
520: parentID: AttributeType = 12;
521: ParentID: TYPE = FileID;
522:
523: pathname: AttributeType = 21;
524: Pathname: TYPE = STRING;
525:
526: position: AttributeType = 11;
527: Position: TYPE = SEQUENCE 100 OF UNSPECIFIED;
528: firstPosition: Position = [0];
529: lastPosition: Position = [177777B];
530:
531: readBy: AttributeType = 14;
532: ReadBy: TYPE = User;
533:
534: readOn: AttributeType = 15;
535: ReadOn: TYPE = Time;
536:
537: storedSize: AttributeType = 26;
538: StoredSize: TYPE = LONG CARDINAL;
539:
540: subtreeSize: AttributeType = 27;
541: SubtreeSize: TYPE = LONG CARDINAL;
542:
543: subtreeSizeLimit: AttributeType = 28;
544: SubtreeSizeLimit: TYPE = LONG CARDINAL;
545: nullSubtreeSizeLimit: SubtreeSizeLimit = 37777777777B;
546:
547: type: AttributeType = 17;
548: Type: TYPE = LONG CARDINAL;
549:
550: version: AttributeType = 18;
551: Version: TYPE = CARDINAL;
552: lowestVersion: Version = 0;
553: highestVersion: Version = 177777B;
554:
555: defaultOrdering: Ordering = [key: name, ascending: TRUE, interpretation:
556: string];
557: byAscendingPosition: Ordering = [key: position, ascending: TRUE,
558: interpretation: interpretationNone];
559: byDescendingPosition: Ordering = [key: position, ascending: FALSE,
560: interpretation: interpretationNone];
561:
562:
563:
564:
565: -- BULK DATA FORMATS --
566:
567: -- Serialized File Format, used in Serialize and Deserialize --
568:
569: -- SerializedTree should contain following but compiler won't allow it
570: -- Use Sequence of Unspecified to get around it for now.
571: --
572: -- SerializedTree: TYPE = RECORD [
573: -- attributes: AttributeSequence,
574: -- content: RECORD [ data: BulkData.StreamOfUnspecified ,
575: -- lastByteIsSignificant: BOOLEAN ],
576: -- children: SEQUENCE OF SerializedTree ];
577:
578: SerializedTree: TYPE = RECORD [
579: attributes: AttributeSequence,
580: content: RECORD [ data: BulkData.StreamOfUnspecified ,
581: lastByteIsSignificant: BOOLEAN ],
582: children: SEQUENCE OF UNSPECIFIED ];
583:
584: SerializedFile: TYPE = RECORD [ version: LONG CARDINAL, file: SerializedTree ];
585: currentVersion: LONG CARDINAL = 3;
586:
587:
588:
589: -- Attribute Series Format, used in List --
590:
591: StreamOfAttributeSequence: TYPE = CHOICE OF {
592: nextSegment(0) => RECORD [
593: segment: SEQUENCE OF AttributeSequence,
594: restOfStream: StreamOfAttributeSequence],
595: lastSegment(1) => SEQUENCE OF AttributeSequence};
596:
597:
598:
599:
600:
601: -- FILE TYPES --
602:
603: tUnspecified: Type = 0;
604: tDirectory: Type = 1;
605: tText: Type = 2;
606: tSerialized: Type = 3;
607: tEmpty: Type = 4;
608:
609: END. -- of Filing --
610:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.