1. Trang chủ
  2. » Công Nghệ Thông Tin

Advanced Computer Networks: Lecture 33 - Dr. Amir Qayyum

29 4 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 29
Dung lượng 357,19 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Advanced Computer Networks: Lecture 33. This lecture will cover the following: remote procedure call; RPC timeline; remote procedure call semantics; protocol stack; BLAST header format; synchronous vs asynchronous protocols; SunRPC header format;...

Trang 1

CS716 Advanced Computer Networks

By Dr. Amir Qayyum

Trang 2

Lecture No. 33

Trang 3

Outline

Protocol Stack

Trang 5

Blocked Blocked

Trang 8

write_check (CASE, 13500, “tuition payment”);

• Bank’s checking service receives request from your home  machine (possibly  reassembling  UDP packets)

• Verifies your  identity  (possibly via RPC to an authority)

• Identifies request as a write_check request

another format

• Calls write_check handler function with arguments

Trang 11

Client stub

RPC protocol

Return value Arguments

Reply Request

Callee (server)

Server stub

RPC protocol

Return value Arguments

Reply Request

Trang 12

FragmenFragment 5 t 4

Fragment 6

Fragment 3Fragment 5

SRR SRR

Trang 13

• When 1 st  fragment arrives, set timer LAST_FRAG

• When all fragments present,  reassemble  and pass up

• Four  exceptional  conditions:

Trang 15

Request 1

Request 2

Reply 2 Reply 1

Trang 17

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 */

Trang 18

Protocols

• 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  hybrid  protocol

– Synchronous from above: xCall

– Asynchronous from below: xPop/xDemux

Trang 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 */

Trang 23

chanClientPop(Sessn self, Sessn lls, Msg *msg, void *inHdr)

{

ChanState *state = (ChanState *)self->state;

ChanHdr *hdr = (ChanHdr *)inHdr;

/* verify correctness of msg header */

Trang 24

Server Client

Trang 25

buf = msgPush(req, HLEN);

select_hdr_store(state->hdr, buf, HLEN);

return xCall(xGetDown(self, 0), req, rep);

return xCallDemux(xGetUp(s), s, req, rep);

Trang 27

static XkReturn vchanCall(Sessn s, Msg *req, Msg *rep) {

Sessn chan;

XkReturn result;

VchanState *state=(VchanState *)s->state;

/* wait for an idle channel */

semWait(&state->available);

chan = state->stack[ state->tos];

/* use the channel */

result = xCall(chan, req, rep);

/* free the channel */

state->stack[state->tos++] = chan;

semSignal(&state->available);

return result;

Trang 28

UDP

Ngày đăng: 05/07/2022, 12:17