Annotation of 43BSDTahoe/new/xns/examples/filing/Filing4.cr, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.