-- EnvelopeContentsP0V0ClientImpl.Mesa
-- Copyright Ó 1991 by Xerox Corporation. All rights reserved.
 -- Copyright (C) 1989 by Xerox Corporation. All rights reserved.
 -- Generated by Willie-sue.pa at February 13, 1989 6:52:59 pm PST
 -- using Sirocco [2.0] of February 10, 1989 6:26:26 pm PST

DIRECTORY
 CrRPC,
 CHNameP2V0,
 MailTransportP17V5,
 EnvelopeFormatP1517V1,
 EnvelopeContentsP0V0;

EnvelopeContentsP0V0ClientImpl: CEDAR PROGRAM
 IMPORTS CrRPC
 EXPORTS EnvelopeContentsP0V0 ~ {
 OPEN EnvelopeContentsP0V0;

GetError: CrRPC.GetErrorProc ~ {
  ERROR CrRPC.Error[h, remoteError, "Unexpected Remote Error"];
  };

-- Remote Procedures --

 OriginatorFromItem: PUBLIC OriginatorFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc2[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~5 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 OtherRecipientsFromItem: PUBLIC OtherRecipientsFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc3[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~13 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 PostmarkFromItem: PUBLIC PostmarkFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value.postedAt ¬ UProc2[h, s];
   value.time ¬ CrRPC.GetCard32[s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~0 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 TableOfContentsFromItem: PUBLIC TableOfContentsFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc4[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~3 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 ReportFromItem: PUBLIC ReportFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value.originalEnvelope ¬ UProc5[h, s];
   value.fateOfThisReport ¬ UProc6[h, s];
   value.reportType ¬ UProc7[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~6 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 ReturnToNameFromItem: PUBLIC ReturnToNameFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc2[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~7 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 AuthenticationLevelOfSenderFromItem: PUBLIC AuthenticationLevelOfSenderFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ VAL[CrRPC.GetCard16[s]];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~16 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 ContentsTypeFromItem: PUBLIC ContentsTypeFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ CrRPC.GetCard32[s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~2 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 TransportOptionsFromItem: PUBLIC TransportOptionsFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value.returnOfContents ¬ CrRPC.GetBool[s];
   value.alternateRecipientAllowed ¬ CrRPC.GetBool[s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~11 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 AddressChangeNoticeFromItem: PUBLIC AddressChangeNoticeFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc2[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~10 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 ContentsSizeFromItem: PUBLIC ContentsSizeFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ CrRPC.GetCard32[s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~4 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 MessageIDFromItem: PUBLIC MessageIDFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   FOR i8: CARDINAL IN [0..5) DO
    value[i8] ¬ CrRPC.GetCard16[s];
    ENDLOOP;
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~1 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 ConvertedFromItem: PUBLIC ConvertedFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc9[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~15 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 PriorityFromItem: PUBLIC PriorityFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ VAL[CrRPC.GetCard16[s]];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~14 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 X400SpecificReportInformationFromItem: PUBLIC X400SpecificReportInformationFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc10[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~12 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 PreviousRecipientsFromItem: PUBLIC PreviousRecipientsFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value ¬ UProc3[h, s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~8 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

 GatewayPostmarkFromItem: PUBLIC GatewayPostmarkFromItemType ~ {
  PutArgs: CrRPC.PutArgsProc ~ {
   MProc1[h, s, item];
   };
  GetResults: CrRPC.GetResultsProc ~ {
   length ¬ CrRPC.GetCard16[s];
   value.postedAt ¬ UProc2[h, s];
   value.time ¬ CrRPC.GetCard32[s];
   };
   
  CrRPC.Call[h~h, remotePgm~0, remotePgmVersion~0, remoteProc~9 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
  };

-- Unmarshal / Marshal Procs --


 UProc4: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.TableOfContents] ~ {
  {
   length12: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.TableOfContentsObject[length12]];
   FOR i11: CARDINAL IN [0..length12) DO
    res.body[i11].type ¬ CrRPC.GetCard32[s];
    res.body[i11].sizeInBytes ¬ CrRPC.GetCard32[s];
    ENDLOOP;
   };
  };

 UProc6: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.Fate] ~ {
  {
   tag13: EnvelopeFormatP1517V1.FateKind ~ VAL[CrRPC.GetCard16[s]];
   SELECT tag13 FROM
    delivered => {
     temp14: EnvelopeFormatP1517V1.DelType;
     temp14 ¬ VAL[CrRPC.GetCard16[s]];
     res ¬ NEW[EnvelopeFormatP1517V1.FateObject.delivered ¬ [delivered[temp14]]] };
    notDelivered => {
     temp14: EnvelopeFormatP1517V1.NonDelType;
     temp14.reason ¬ VAL[CrRPC.GetCard16[s]];
     temp14.reportCreationPostmark.postedAt ¬ UProc2[h, s];
     temp14.reportCreationPostmark.time ¬ CrRPC.GetCard32[s];
     res ¬ NEW[EnvelopeFormatP1517V1.FateObject.notDelivered ¬ [notDelivered[temp14]]] };
    ENDCASE => ERROR;
   };
  };

 UProc5: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.Envelope] ~ {
  {
   length16: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[MailTransportP17V5.EnvelopeObject[length16]];
   FOR i15: CARDINAL IN [0..length16) DO
    res.body[i15].type ¬ CrRPC.GetCard32[s];
    res.body[i15].value ¬ UProc17[h, s];
    ENDLOOP;
   };
  };

 MProc1: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: MailTransportP17V5.Opaque] ~ {
  CrRPC.PutCard16[s, val.length];
  FOR i18: CARDINAL IN [0..val.length) DO
   CrRPC.PutCard16[s, val.body[i18]];
   ENDLOOP;
  };

 UProc2: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.RName] ~ {
  {
   tag19: MailTransportP17V5.RNameKind ~ VAL[CrRPC.GetCard16[s]];
   SELECT tag19 FROM
    xns => {
     temp20: CHNameP2V0.ThreePartName;
     temp20.organization ¬ CrRPC.GetRope[s];
     temp20.domain ¬ CrRPC.GetRope[s];
     temp20.object ¬ CrRPC.GetRope[s];
     res ¬ NEW[MailTransportP17V5.RNameObject.xns ¬ [xns[temp20]]] };
    gateway => {
     temp20: MailTransportP17V5.GatewayRecord;
     temp20.country ¬ CrRPC.GetRope[s];
     temp20.adminDomain ¬ CrRPC.GetRope[s];
     temp20.privateDomain ¬ CrRPC.GetRope[s];
     temp20.organization ¬ CrRPC.GetRope[s];
     temp20.organizationalUnits ¬ UProc21[h, s];
     temp20.personal ¬ UProc22[h, s];
     temp20.gatewaySpecificInformation ¬ UProc23[h, s];
     res ¬ NEW[MailTransportP17V5.RNameObject.gateway ¬ [gateway[temp20]]] };
    ENDCASE => ERROR;
   };
  };

 UProc21: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.OrgUnits] ~ {
  {
   length25: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[MailTransportP17V5.OrgUnitsObject[length25]];
   FOR i24: CARDINAL IN [0..length25) DO
    res.body[i24] ¬ CrRPC.GetRope[s];
    ENDLOOP;
   };
  };

 UProc10: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.X400SpecificReportInformation] ~ {
  {
   length27: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.X400SpecificReportInformationObject[length27]];
   FOR i26: CARDINAL IN [0..length27) DO
    res.body[i26] ¬ UProc28[h, s];
    ENDLOOP;
   };
  };

 UProc7: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.RepType] ~ {
  {
   tag29: EnvelopeFormatP1517V1.RepTypeKind ~ VAL[CrRPC.GetCard16[s]];
   SELECT tag29 FROM
    dlMember => {
     temp30: EnvelopeFormatP1517V1.DLMem;
     temp30.dlName ¬ UProc2[h, s];
     temp30.invalidDLRecipients ¬ UProc31[h, s];
     res ¬ NEW[EnvelopeFormatP1517V1.RepTypeObject.dlMember ¬ [dlMember[temp30]]] };
    other => {
     temp30: EnvelopeFormatP1517V1.OtherRep;
     temp30.succeeded ¬ UProc32[h, s];
     temp30.failed ¬ UProc33[h, s];
     res ¬ NEW[EnvelopeFormatP1517V1.RepTypeObject.other ¬ [other[temp30]]] };
    ENDCASE => ERROR;
   };
  };

 UProc32: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.SucList] ~ {
  {
   length35: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.SucListObject[length35]];
   FOR i34: CARDINAL IN [0..length35) DO
    res.body[i34].recipient.name ¬ UProc2[h, s];
    res.body[i34].recipient.recipientID ¬ CrRPC.GetCard16[s];
    res.body[i34].recipient.report ¬ VAL[CrRPC.GetCard16[s]];
    res.body[i34].when ¬ CrRPC.GetCard32[s];
    ENDLOOP;
   };
  };

 UProc9: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.Converted] ~ {
  {
   length37: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.ConvertedObject[length37]];
   FOR i36: CARDINAL IN [0..length37) DO
    res.body[i36] ¬ VAL[CrRPC.GetCard16[s]];
    ENDLOOP;
   };
  };

 UProc3: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.RecipientList] ~ {
  {
   length39: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[MailTransportP17V5.RecipientListObject[length39]];
   FOR i38: CARDINAL IN [0..length39) DO
    res.body[i38].name ¬ UProc2[h, s];
    res.body[i38].recipientID ¬ CrRPC.GetCard16[s];
    res.body[i38].report ¬ VAL[CrRPC.GetCard16[s]];
    ENDLOOP;
   };
  };

 UProc33: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.FailList] ~ {
  {
   length41: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.FailListObject[length41]];
   FOR i40: CARDINAL IN [0..length41) DO
    res.body[i40].recipient.name ¬ UProc2[h, s];
    res.body[i40].recipient.recipientID ¬ CrRPC.GetCard16[s];
    res.body[i40].recipient.report ¬ VAL[CrRPC.GetCard16[s]];
    res.body[i40].reason ¬ VAL[CrRPC.GetCard16[s]];
    ENDLOOP;
   };
  };

 UProc22: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.PerChoice] ~ {
  {
   tag42: MailTransportP17V5.PerChoiceKind ~ VAL[CrRPC.GetCard16[s]];
   SELECT tag42 FROM
    whole => {
     temp43: ROPE;
     temp43 ¬ CrRPC.GetRope[s];
     res ¬ NEW[MailTransportP17V5.PerChoiceObject.whole ¬ [whole[temp43]]] };
    broken => {
     temp43: MailTransportP17V5.BrokenName;
     temp43.given ¬ CrRPC.GetRope[s];
     temp43.initials ¬ CrRPC.GetRope[s];
     temp43.family ¬ CrRPC.GetRope[s];
     temp43.generation ¬ CrRPC.GetRope[s];
     res ¬ NEW[MailTransportP17V5.PerChoiceObject.broken ¬ [broken[temp43]]] };
    ENDCASE => ERROR;
   };
  };

 UProc23: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.GatewaySpecInfo] ~ {
  {
   length45: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[MailTransportP17V5.GatewaySpecInfoObject[length45]];
   FOR i44: CARDINAL IN [0..length45) DO
    res.body[i44].type ¬ CrRPC.GetRope[s];
    res.body[i44].value ¬ CrRPC.GetRope[s];
    ENDLOOP;
   };
  };

 UProc17: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: MailTransportP17V5.Opaque] ~ {
  {
   length47: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[MailTransportP17V5.OpaqueObject[length47]];
   FOR i46: CARDINAL IN [0..length47) DO
    res.body[i46] ¬ CrRPC.GetCard16[s];
    ENDLOOP;
   };
  };

 UProc28: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.X400ReportItem] ~ {
  {
   length49: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.X400ReportItemObject[length49]];
   FOR i48: CARDINAL IN [0..length49) DO
    res.body[i48] ¬ CrRPC.GetCard16[s];
    ENDLOOP;
   };
  };

 UProc31: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: EnvelopeFormatP1517V1.InvalRecip] ~ {
  {
   length51: CARDINAL ~ CrRPC.GetCard16[s];
   res ¬ NEW[EnvelopeFormatP1517V1.InvalRecipObject[length51]];
   FOR i50: CARDINAL IN [0..length51) DO
    res.body[i50].recipient.name ¬ UProc2[h, s];
    res.body[i50].recipient.recipientID ¬ CrRPC.GetCard16[s];
    res.body[i50].recipient.report ¬ VAL[CrRPC.GetCard16[s]];
    res.body[i50].reason ¬ VAL[CrRPC.GetCard16[s]];
    ENDLOOP;
   };
  };

}...