-- TabPostOfficeClientImpl.mesa
-- Please do not edit this file.
-- It was generated using CedarRPCGen.

DIRECTORY
  Rope,
  SunRPC,
  SunRPCAuth,
  TabPostOfficeGetPut,
  TabPostOffice;

TabPostOfficeClientImpl: CEDAR PROGRAM
  IMPORTS SunRPC, TabPostOfficeGetPut
  EXPORTS TabPostOffice =
BEGIN
ROPE: TYPE = Rope.ROPE;

defaultTimeout: CARDINAL ← 2000;
defaultRetries: CARDINAL ← 5;

MakeServer1Client: PUBLIC PROC [h: SunRPC.Handle,
	c: SunRPCAuth.Conversation] RETURNS [TabPostOffice.Server1] ~ {
  RETURN [NEW[TabPostOffice.Server1Object ← [
	tpostartsession1,
	tpogetmsginfo1,
	tpogetmsgtext1,
	tpochecknewmail1,
	tpogetfolders1,
	tpomarkmsg1,
	tpoendsession1,
	h, c, NIL]]];
  };


tpostartsession1: PROC[o: TabPostOffice.Server1,
                numselects: INT32,
                plist: TabPostOffice.PropInfoArray,
                numorders: INT32,
                olist: TabPostOffice.PropertyArray]
		RETURNS [res: TabPostOffice.SessionResult] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 1];
    SunRPC.PutInt32[o.rpcHandle, numselects];
    TabPostOfficeGetPut.PutPropInfoArray[o.rpcHandle, plist];
    SunRPC.PutInt32[o.rpcHandle, numorders];
    TabPostOfficeGetPut.PutPropertyArray[o.rpcHandle, olist];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetSessionResult[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpogetmsginfo1: PROC[o: TabPostOffice.Server1,
                beginId: TabPostOffice.MsgID,
                endId: TabPostOffice.MsgID]
		RETURNS [res: TabPostOffice.MsgInfoResult] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 2];
    TabPostOfficeGetPut.PutMsgID[o.rpcHandle, beginId];
    TabPostOfficeGetPut.PutMsgID[o.rpcHandle, endId];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetMsgInfoResult[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpogetmsgtext1: PROC[o: TabPostOffice.Server1,
                msgId: TabPostOffice.MsgID,
                beginByte: INT32,
                numBytes: INT32,
                whence: TabPostOffice.Whences]
		RETURNS [res: TabPostOffice.MsgTextResult] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 3];
    TabPostOfficeGetPut.PutMsgID[o.rpcHandle, msgId];
    SunRPC.PutInt32[o.rpcHandle, beginByte];
    SunRPC.PutInt32[o.rpcHandle, numBytes];
    TabPostOfficeGetPut.PutWhences[o.rpcHandle, whence];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetMsgTextResult[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpochecknewmail1: PROC[o: TabPostOffice.Server1]
		RETURNS [res: TabPostOffice.NewMailResult] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 4];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetNewMailResult[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpogetfolders1: PROC[o: TabPostOffice.Server1]
		RETURNS [res: TabPostOffice.FoldersResult] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 5];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetFoldersResult[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpomarkmsg1: PROC[o: TabPostOffice.Server1,
                msgId: TabPostOffice.MsgID,
                markID: ROPE,
                markMsg: ROPE]
		RETURNS [res: TabPostOffice.ErrorInfo] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 6];
    TabPostOfficeGetPut.PutMsgID[o.rpcHandle, msgId];
    SunRPC.PutRope[o.rpcHandle, markID];
    SunRPC.PutRope[o.rpcHandle, markMsg];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetErrorInfo[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };

tpoendsession1: PROC[o: TabPostOffice.Server1]
		RETURNS [res: TabPostOffice.ErrorInfo] = {
    SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
                   TabPostOffice.Server, 1, 7];
    [] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
    res ← TabPostOfficeGetPut.GetErrorInfo[o.rpcHandle];
    SunRPC.ReleaseReply[o.rpcHandle];
  };
END.