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