




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















2
3
5
6
8
-^ Verifies your
-^ Identifies request as a write_check request•^ Unpackages
9
-^ Tags^ package (message) with your bank’s identificationand unique ID for previous request•^ Sends reply to your machine (potentially as several UDPpackets)
11
-^ Protocol Stack– BLAST: fragments and reassembles large messages– CHAN: synchronizes request and reply messages– SELECT: dispatches request to the correct process•^ Stubs
Caller(client)ReturnArgumentsvalueClientstubReplyRequestRPCprotocol
Callee(server)ReturnArgumentsvalueServerstubReplyRequestRPCprotocol
12
-^ Unlike AAL and IP, tries to^ recover
-^ Strategy–^ Selective
-^ Sender:– After sending all fragments, set timerDONE– If receive SRR, send missingfragments and reset DONE– If timer DONE expires, freefragments
Sender^
Receiver docsity.com
14
-^ MID must protect against wrap around•^ TYPE = DATA or SRR•^ NumFrags indicates number of fragments•^ FragMask distinguishes among fragments– If Type=DATA, identifies this fragment– If Type=SRR, identifies missing fragments
0 16 31 ProtNumMIDLengthNumFrags^ TypeFragMask^ Data docsity.com
15
Client^
17
/ 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;
18
-^ Asynchronous interface^ xPush(Sessn
s,^ Msg^ *msg) xPop(Sessn
s,^ Msg^ *msg,
void^ *hdr) xDemux(Protl
hlp,^ Sessn
s,^ Msg^ *msg)
-^ Synchronous interface^ xCall(Sessn
s,^ Msg^ *req,
Msg^ *rep) xCallPop(Sessn
s,^ Msg^ *req,
Msg^ *rep,
void^ *hdr)
xCallDemux(Protl
hlp,^ Sessn
s,^ Msg^ *req,
Msg^ *rep)
-^ CHAN is a
20
/ attach header to msg and send it /buf = msgPush(msg, HDR_LEN);chan_hdr_store(hdr, buf, HDR_LEN);xPush(xGetDown(self, 0), msg);/ schedule first timeout event /state->retries = 1;state->event = evSchedule(retransmit, self, state->timeout);/ wait for the reply msg /semWait(&state->reply_sem);/ clean up state and*
return^ */ flush_msg(state->request);state->status = IDLE;return state->ret_val;}
21
*retransmit(Event ev, int arg){Sessn^
s = (Sessn)arg; ChanState^
**state = (ChanState )s->state; Msg^
tmp; / see if event was*
cancelled / if ( evIsCancelled(ev) ) return;/ unblock client if we've
*retried 4 times / if (++state->retries > 4) {state->ret_val =
XK_FAILURE; semSignal(state->rep_sem);return;} / retransmit request message /msgConstructCopy(&tmp, &state->request);xPush(xGetDown(s, 0), &tmp);/ reschedule event with exponential backoff /evDetach(state->event);state->timeout^ = 2state->timeout;state->event = evSchedule(retransmit, s,state->timeout);}*