Annotation of 43BSD/contrib/xns/examples/filing/Filing4.cr, revision 1.1.1.1

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