Remote Procedure Call: Outline
Remote Procedure Call: Outline
Outline
Protocol Stack
Presentation Formatting
Client Server
Blocked
Blocked Computing
Blocked
RPC RPC
protocol protocol
• Strategy
– selective retransmission
– aka partial
acknowledgements
MID
• TYPE = DATA or SRR
Length
• NumFrags indicates number of fragments NumFrags Type
• FragMask distinguishes among fragments FragMask
…
Spring 2002 CS 461 8
CHAN Details
• Lost message (request, reply, or ACK)
– set RETRANSMIT timer
– use message id (MID) field to distinguish
• Slow (long running) server
– client periodically sends “are you alive” probe, or
– server periodically sends “I’m alive” notice
• Want to support multiple outstanding calls
– use channel id (CID) field to distinguish
• Machines crash and reboot
– use boot id (BID) field to distinguish
Spring 2002 CS 461 9
CHAN Header Format
typedef struct {
u_short Type; /* REQ, REP, ACK, PROBE */
u_short CID; /* unique channel id */
int MID; /* unique message id */
int BID; /* unique boot id */
int Length; /* length of message */
int ProtNum; /* high-level protocol */
} ChanHdr;
typedef struct {
u_char type; /* CLIENT or SERVER */
u_char status; /* BUSY or IDLE */
int retries; /* number of retries */
int timeout; /* timeout value */
XkReturn ret_val; /* return value */
Msg *request; /* request message */
Msg *reply; /* reply message */
Semaphore reply_sem; /* client semaphore */
int mid; /* message id */
int bid; /* boot id */
} ChanState;
• Synchronous interface
call(Protocol llp, Msg *request, Msg *reply)
upcall(Protocol hlp, Msg *request, Msg *reply)
CHAN
BLAST
IP
ETH
ETH
Verifier (variable)
Data
• Unmarshalling
(decoding) messages Presentation
encoding
Presentation
decoding
into application data
…
Message Message Message
High Low
address address
• Compiler layout of structures
Marshaller
• Conversion Strategy
– canonical intermediate form
– receiver-makes-right (an N x N solution)
Spring 2002 CS 461 18
Taxonomy (cont)
• Tagged versus untagged data
type = len = 4 value = 417892
INT
• Stubs Interface
descriptor for
– compiled Call P Procedure P P
– interpreted
Arguments Specification Arguments
RPC RPC
Message
struct item {
int count;
char name[MAXNAME];
int list[MAXLIST];
};
bool_t
xdr_item(XDR *xdrs, struct item *ptr)
{
return(xdr_int(xdrs, &ptr->count) &&
xdr_string(xdrs, &ptr->name, MAXNAME) &&
xdr_array(xdrs, &ptr->list, &ptr->count,
MAXLIST, sizeof(int), xdr_int));
}
Count Name
3 7 J O H N S O N
List
3 4 97 8 321 2 65
0 4 8 16 24 31
IntegrRep CharRep FloatRep Extension 1 Extension 2