End-to-End Protocols Guevara Noubir Textbook: Computer - - PowerPoint PPT Presentation

end to end protocols
SMART_READER_LITE
LIVE PREVIEW

End-to-End Protocols Guevara Noubir Textbook: Computer - - PowerPoint PPT Presentation

End-to-End Protocols Guevara Noubir Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie, Morgan Kaufmann Chapter 5. Fundamentals of Computer Networks End-to-End Protocols 1 Lecture Outline


slide-1
SLIDE 1

End-­‑to-­‑End ¡Protocols ¡

Guevara ¡Noubir ¡

Fundamentals of Computer Networks End-to-End Protocols

Textbook: Computer Networks: A Systems Approach,

  • L. Peterson, B. Davie, Morgan Kaufmann

Chapter 5.

1

slide-2
SLIDE 2

Lecture ¡Outline ¡

– Connec8on ¡ – Establishment/Termina8on ¡ – Sliding ¡Window ¡Revisited ¡ ¡ – Flow ¡Control ¡ – Adap8ve ¡Timeout ¡ – Overview ¡of ¡Remote ¡Procedure ¡Call ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 2

slide-3
SLIDE 3

End-­‑to-­‑End ¡Protocols ¡

  • Goal: ¡turn ¡host-­‑to-­‑host ¡packet ¡delivery ¡into ¡process-­‑to-­‑process ¡

communica8on ¡channel ¡

  • Underlying ¡best-­‑effort ¡network ¡

– drop ¡messages ¡ – re-­‑orders ¡messages ¡ – delivers ¡duplicate ¡copies ¡of ¡a ¡given ¡message ¡ – limits ¡messages ¡to ¡some ¡finite ¡size ¡ – delivers ¡messages ¡aMer ¡an ¡arbitrarily ¡long ¡delay ¡

  • Common ¡end-­‑to-­‑end ¡services ¡

– guarantee ¡message ¡delivery ¡ – deliver ¡messages ¡in ¡the ¡same ¡order ¡they ¡are ¡sent ¡ – deliver ¡at ¡most ¡one ¡copy ¡of ¡each ¡message ¡ – support ¡arbitrarily ¡large ¡messages ¡ – support ¡synchroniza8on ¡ – allow ¡the ¡receiver ¡to ¡flow ¡control ¡the ¡sender ¡ – support ¡mul8ple ¡applica8on ¡processes ¡on ¡each ¡host ¡

Fundamentals of Computer Networks End-to-End Protocols 3

slide-4
SLIDE 4

Types ¡of ¡End-­‑to-­‑End ¡Protocols ¡

  • Simple ¡asynchronous ¡demul8plexing ¡service ¡

(e.g., ¡UDP) ¡

  • Reliable ¡byte-­‑stream ¡service ¡(e.g., ¡TCP) ¡
  • Request ¡reply ¡service ¡(e.g., ¡RPC) ¡

Fundamentals of Computer Networks End-to-End Protocols 4

slide-5
SLIDE 5

Simple ¡Demul8plexor ¡(UDP) ¡

  • Unreliable ¡and ¡unordered ¡datagram ¡service ¡
  • Adds ¡mul8plexing ¡
  • No ¡flow ¡control ¡
  • Endpoints ¡iden8fied ¡by ¡ports ¡

– servers ¡have ¡well-­‑known ¡ports ¡(e.g., ¡DNS: ¡port ¡53, ¡talk: ¡517) ¡ – On ¡Unix ¡see ¡/etc/services ¡and ¡port ¡mapper ¡

  • Header ¡format ¡
  • Op8onal ¡checksum ¡

– pseudo ¡header ¡+ ¡UDP ¡header ¡+ ¡data ¡ – Pseudo ¡header ¡= ¡protocol ¡number, ¡source ¡IP ¡addr, ¡dest ¡IP ¡addr, ¡ UDP ¡length ¡

Fundamentals of Computer Networks End-to-End Protocols SrcPort DstPort Checksum Length Data 16 31 5

slide-6
SLIDE 6

TCP ¡Overview ¡

  • Reliable ¡
  • Connec8on-­‑oriented ¡
  • Byte-­‑stream ¡

– app ¡writes ¡bytes ¡ – TCP ¡sends ¡segments ¡ – app ¡reads ¡bytes ¡

Fundamentals of Computer Networks End-to-End Protocols Application process W rite bytes TCP Send buffer Segment Segment Segment T ransmit segments Application process Read bytes TCP Receive buffer … … …

  • Full duplex
  • Flow control: keep sender

from overrunning receiver

  • Congestion control: keep

sender from overrunning network

6

slide-7
SLIDE 7

Data ¡Link ¡Versus ¡Transport ¡

  • Poten8ally ¡connects ¡many ¡different ¡hosts ¡

– need ¡explicit ¡connec8on ¡establishment ¡and ¡termina8on ¡

  • Poten8ally ¡different ¡RTT ¡

– need ¡adap8ve ¡8meout ¡mechanism ¡

  • Poten8ally ¡long ¡delay ¡in ¡network ¡

– need ¡to ¡be ¡prepared ¡for ¡arrival ¡of ¡very ¡old ¡packets ¡

  • Poten8ally ¡different ¡capacity ¡at ¡des8na8on ¡ ¡

– need ¡to ¡accommodate ¡different ¡node ¡capacity ¡

  • Poten8ally ¡different ¡network ¡capacity ¡

– need ¡to ¡be ¡prepared ¡for ¡network ¡conges8on ¡

Fundamentals of Computer Networks End-to-End Protocols 7

slide-8
SLIDE 8

End-­‑to-­‑End ¡Argument ¡

  • A ¡func8on ¡should ¡not ¡be ¡provided ¡in ¡the ¡lower ¡

levels ¡of ¡the ¡system ¡unless ¡it ¡can ¡be ¡ completely ¡and ¡correctly ¡implemented ¡

  • Excep8on: ¡op8miza8on ¡

– Example: ¡CRC ¡at ¡layer ¡2 ¡+ ¡checksum ¡at ¡layer ¡4 ¡

  • The ¡end-­‑to-­‑end ¡argument ¡has ¡to ¡be ¡revisited ¡

for ¡wireless ¡networks ¡

Fundamentals of Computer Networks End-to-End Protocols 8

slide-9
SLIDE 9

Segment ¡Format ¡

Fundamentals of Computer Networks End-to-End Protocols 9

slide-10
SLIDE 10

Segment ¡Format ¡(cont) ¡

  • Each ¡connec8on ¡iden8fied ¡with ¡4-­‑tuple: ¡

– (SrcPort, SrcIPAddr, DsrPort, DstIPAddr) ¡

  • Sliding ¡window ¡+ ¡flow ¡control ¡

– acknowledgment, SequenceNum, AdvertisedWindow

  • Flags ¡

– SYN, FIN, RESET, PUSH, URG, ACK ¡

  • Checksum ¡

– pseudo ¡header ¡+ ¡TCP ¡header ¡+ ¡data ¡

Fundamentals of Computer Networks End-to-End Protocols

Sender Data (SequenceNum) Acknowledgment + AdvertisedWindow Receiver

10

slide-11
SLIDE 11

Segments ¡Transmission ¡

  • Transmission ¡of ¡segments ¡can ¡be ¡triggered ¡by: ¡

– When ¡the ¡data ¡to ¡be ¡sent ¡reaches: ¡Maximum ¡ Segment ¡Size ¡(MSS). ¡MSS ¡is ¡usually ¡equal ¡to ¡the ¡ longest ¡segment ¡that ¡won’t ¡result ¡in ¡local ¡IP ¡ fragmenta8on ¡ – Request ¡from ¡the ¡applica8on: ¡Push ¡opera8on ¡ (e.g., ¡ssh, ¡telnet) ¡ – Periodic ¡8mer ¡

Fundamentals of Computer Networks End-to-End Protocols 11

slide-12
SLIDE 12

Connec8on ¡Establishment ¡and ¡ Termina8on ¡

Fundamentals of Computer Networks End-to-End Protocols

Active participant (client) Passive participant (server) SYN, SequenceNum = x

SYN + ACK, SequenceNum =

y

,

A C K , A c k n

  • w

l e d g m e n t = y + 1 Acknowledgment = x + 1

12

slide-13
SLIDE 13

State ¡Transi8on ¡Diagram ¡

Fundamentals of Computer Networks End-to-End Protocols CLOSED LISTEN SYN_RCVD SYN_SENT ESTABLISHED CLOSE_WAIT LAST_ACK CLOSING TIME_WAIT FIN_WAIT_2 FIN_WAIT_1 Passive open Close Send/ SYN SYN/SYN + ACK SYN + ACK/ACK SYN/SYN + ACK ACK Close /FIN FIN/ACK Close /FIN FIN/ACK Timeout after two segment lifetimes FIN/ACK ACK ACK ACK Close /FIN Close CLOSED Active open /SYN 13

slide-14
SLIDE 14

Sliding ¡Window ¡in ¡TCP ¡

  • Purpose: ¡

– Guarantees ¡a ¡reliable ¡delivery ¡of ¡data ¡(ARQ) ¡ – Ensures ¡that ¡data ¡is ¡delivered ¡in ¡order ¡(SeqNum) ¡ – Enforces ¡flow-­‑control ¡between ¡sender ¡and ¡ receiver ¡(Adver8sedWindow ¡field) ¡

Fundamentals of Computer Networks End-to-End Protocols 14

slide-15
SLIDE 15

Sliding ¡Window ¡Revisited ¡

  • Sending ¡side ¡

– LastByteAcked < ¡= LastByteSent ¡ – LastByteSent < ¡= LastByteWritten ¡ – buffer ¡bytes ¡between ¡ LastByteAcked ¡and ¡ LastByteWritten ¡

Fundamentals of Computer Networks End-to-End Protocols Sending application LastByteWritten TCP LastByteSent LastByteAcked Receiving application LastByteRead TCP LastByteRcvd NextByteExpected

  • Receiving side

– LastByteRead < NextByteExpected – NextByteExpected < = LastByteRcvd +1 – buffer bytes between LastByteRead and LastByteRcvd

15

slide-16
SLIDE 16

Flow ¡Control ¡

  • Send ¡buffer ¡size: ¡MaxSendBuffer ¡
  • Receive ¡buffer ¡size: ¡MaxRcvBuffer
  • Receiving ¡side ¡

– LastByteRcvd ¡-­‑ ¡LastByteRead ¡< ¡= ¡MaxRcvBuffer ¡ – AdvertisedWindow ¡= ¡MaxRcvBuffer ¡-­‑ ¡(LastByteRcvd ¡-­‑ ¡ LastByteRead ¡) ¡

  • Sending ¡side ¡

– LastByteSent ¡-­‑ ¡LastByteAcked ¡< ¡= ¡AdvertisedWindow ¡ – EffectiveWindow ¡= ¡AdvertisedWindow ¡-­‑ ¡(LastByteSent ¡-­‑ ¡ ¡ ¡ ¡ ¡ LastByteAcked) ¡ – LastByteWritten ¡-­‑ ¡LastByteAcked ¡< ¡= ¡MaxSendBuffer ¡ – block ¡sender ¡if ¡(LastByteWritten ¡-­‑ ¡LastByteAcked) ¡+ ¡y ¡> ¡ MaxSenderBuffer ¡

  • Always/only ¡send ¡ACK ¡in ¡response ¡to ¡arriving ¡data ¡segment ¡
  • Persist ¡when ¡AdvertisedWindow ¡= 0

Fundamentals of Computer Networks End-to-End Protocols 16

slide-17
SLIDE 17

Protec8on ¡Against ¡Wrap ¡Around ¡

  • 32-­‑bit ¡SequenceNum

¡ ¡Bandwidth ¡ ¡ ¡ ¡Time ¡Un8l ¡Wrap ¡Around ¡ ¡ ¡T1 ¡(1.5 ¡Mbps) ¡ ¡ ¡6.4 ¡hours ¡ ¡ ¡Ethernet ¡(10 ¡Mbps) ¡ ¡57 ¡minutes ¡ ¡ ¡T3 ¡(45 ¡Mbps) ¡ ¡ ¡ ¡13 ¡minutes ¡ ¡ ¡FDDI ¡(100 ¡Mbps) ¡ ¡ ¡6 ¡minutes ¡ ¡ ¡STS-­‑3 ¡(155 ¡Mbps) ¡ ¡ ¡4 ¡minutes ¡ ¡ ¡STS-­‑12 ¡(622 ¡Mbps) ¡ ¡55 ¡seconds ¡ ¡ ¡STS-­‑24 ¡(1.2 ¡Gbps) ¡ ¡ ¡28 ¡seconds ¡

Fundamentals of Computer Networks End-to-End Protocols 17

slide-18
SLIDE 18

Keeping ¡the ¡Pipe ¡Full ¡

  • 16-­‑bit ¡AdvertisedWindow

– (assuming an RTT ~100ms) ¡ ¡Bandwidth ¡ ¡ ¡ ¡Delay ¡x ¡Bandwidth ¡Product ¡ ¡ ¡T1 ¡(1.5 ¡Mbps) ¡ ¡ ¡18KB ¡ ¡ ¡Ethernet ¡(10 ¡Mbps) ¡ ¡122KB ¡ ¡ ¡T3 ¡(45 ¡Mbps) ¡ ¡ ¡ ¡549KB ¡ ¡ ¡FDDI ¡(100 ¡Mbps) ¡ ¡ ¡1.2MB ¡ ¡ ¡STS-­‑3 ¡(155 ¡Mbps) ¡ ¡ ¡1.8MB ¡ ¡ ¡STS-­‑12 ¡(622 ¡Mbps) ¡ ¡7.4MB ¡ ¡ ¡STS-­‑24 ¡(1.2 ¡Gbps)

¡ ¡ ¡14.8MB ¡

Fundamentals of Computer Networks End-to-End Protocols 18

slide-19
SLIDE 19

TCP ¡Extensions ¡

  • Implemented ¡as ¡header ¡op8ons: ¡

– Why? ¡ ¡

  • Store ¡8mestamp ¡in ¡outgoing ¡segments ¡
  • Extend ¡sequence ¡space ¡with ¡ ¡32-­‑bit ¡8mestamp ¡

(PAWS: ¡Protec8on ¡Against ¡Wrapped ¡Sequences) ¡

  • ShiM ¡(scale) ¡adver8sed ¡window ¡

– Count ¡in ¡16 ¡bytes ¡

  • Selec8ve ¡Acknowledgment ¡(SACK) ¡

Fundamentals of Computer Networks End-to-End Protocols 19

slide-20
SLIDE 20

Adap8ve ¡Retransmission ¡ (Original ¡Algorithm) ¡

  • Measure ¡SampleRTT ¡for ¡each ¡segment/ ¡ACK ¡pair ¡
  • Compute ¡weighted ¡average ¡of ¡RTT ¡

– EstRTT ¡= ¡α ¡x ¡EstRTT ¡+ ¡β ¡x ¡SampleRTT ¡ – where ¡ ¡α ¡+ ¡β ¡= 1 ¡

  • α ¡between ¡0.8 ¡and ¡0.9 ¡
  • β ¡between ¡0.1 ¡and ¡0.2 ¡
  • Set ¡8meout ¡based ¡on ¡EstRTT ¡

– TimeOut ¡= ¡2 ¡x ¡EstRTT ¡

Fundamentals of Computer Networks End-to-End Protocols 20

slide-21
SLIDE 21

Problem ¡with ¡Original ¡Algorithm ¡

  • ACK ¡indicate ¡receipt ¡of ¡data ¡and ¡not ¡of ¡packet ¡
  • If ¡ACK ¡corresponds ¡to ¡retransmimed ¡packet ¡

than ¡es8mated ¡RTT ¡would ¡be ¡too ¡large. ¡The ¡ reverse ¡is ¡also ¡possible. ¡

Fundamentals of Computer Networks End-to-End Protocols 21

slide-22
SLIDE 22

Karn/Partridge ¡Algorithm ¡

  • Do ¡not ¡sample ¡RTT ¡when ¡retransminng ¡ ¡
  • Double ¡8meout ¡aMer ¡each ¡retransmission ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols

Sender Receiver O r i g i n a l t r a n s m i s s i

  • n

A C K SampleR TT R e t r a n s m i s s i

  • n

Sender Receiver O r i g i n a l t r a n s m i s s i

  • n

A C K SampleR TT R e t r a n s m i s s i

  • n

22

slide-23
SLIDE 23

Jacobson/ ¡Karels ¡Algorithm ¡

  • New ¡Calcula8ons ¡for ¡average ¡RTT ¡
  • Diff ¡= ¡SampleRTT ¡-­‑ ¡EstRTT ¡
  • EstRTT = EstRTT + (δ x Diff)
  • Dev = Dev + δ( |Diff| - Dev) ¡

– where ¡δ ¡is ¡a ¡factor ¡between ¡0 ¡and ¡1 ¡

  • Consider ¡variance ¡when ¡senng ¡8meout ¡value ¡
  • TimeOut ¡= ¡µ ¡x ¡EstRTT ¡+ ¡φ ¡x ¡Dev ¡

– where ¡typically ¡µ ¡= ¡1 ¡and ¡φ ¡= ¡4 ¡

  • Notes ¡

– algorithm ¡only ¡as ¡good ¡as ¡granularity ¡of ¡clock ¡(500ms ¡on ¡old ¡Unix) ¡ – accurate ¡8meout ¡mechanism ¡important ¡to ¡conges8on ¡control ¡(later) ¡

Fundamentals of Computer Networks End-to-End Protocols 23

slide-24
SLIDE 24

Record ¡Boundaries ¡

  • TCP ¡is ¡a ¡byte-­‑stream ¡protocol ¡
  • How ¡to ¡indicate ¡some ¡structure ¡within ¡the ¡

stream? ¡

– URG ¡flag ¡+ ¡UrgPtr ¡(out-­‑of-­‑band ¡data). ¡Ini8ally ¡ designed ¡for ¡urgent ¡data. ¡ – PUSH ¡mechanism: ¡ ¡

  • Ini8ally ¡and ¡s8ll ¡used ¡by ¡interac8ve ¡applica8ons ¡
  • Can ¡also ¡be ¡used ¡to ¡break ¡the ¡received ¡stream ¡into ¡

records ¡

– Applica8on ¡program ¡

Fundamentals of Computer Networks End-to-End Protocols 24

slide-25
SLIDE 25

Remote ¡Procedure ¡Calls ¡(RPC) ¡

  • RPC: ¡ ¡

– Generic ¡mechanism ¡for ¡structuring ¡distributed ¡ systems ¡

  • Components: ¡

– Protocol: ¡manages ¡the ¡messages ¡sent ¡between ¡ the ¡client ¡and ¡the ¡server ¡processes ¡and ¡handles ¡ network ¡issues ¡ – Programming ¡language ¡and ¡compiler ¡support: ¡

  • Arguments ¡transla8on ¡from ¡one ¡machine ¡architecture ¡

to ¡another… ¡

Fundamentals of Computer Networks End-to-End Protocols 25

slide-26
SLIDE 26

RPC ¡Components ¡ ¡

  • Protocol ¡Stack ¡

– BLAST: ¡fragments ¡and ¡reassembles ¡large ¡messages ¡ – CHAN: ¡synchronizes ¡request ¡and ¡reply ¡messages ¡ ¡ – SELECT: ¡dispatches ¡request ¡to ¡the ¡correct ¡process ¡

  • Stubs ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols

Caller (client) Client stub RPC protocol Return value Arguments Reply Request Callee (server) Server stub RPC protocol Return value Arguments Reply Request

26

slide-27
SLIDE 27

Transport ¡for ¡Real-­‑Time ¡Applica8ons ¡

  • Applica8ons ¡with ¡8me ¡constraints ¡on ¡packets ¡

delivery ¡

– E.g., ¡VoIP, ¡interac8ve ¡video, ¡mul8media ¡

  • Constraints ¡include ¡

– Deadlines, ¡ ¡ – Mul8ple ¡streams ¡synchroniza8on ¡(e.g., ¡audio/video) ¡ – Interoperability, ¡e.g., ¡codecs ¡nego8a8on ¡ – Packet ¡loss ¡detec8on ¡ – Frame ¡boundaries ¡

  • Example ¡RTP ¡+ ¡RTCP ¡

– Run ¡on ¡top ¡of ¡UDP ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 27

slide-28
SLIDE 28

RTP ¡& ¡RTCP ¡

  • Real8me ¡Transport ¡Protocol ¡

– Mul8media ¡date ¡exchange ¡

  • Real8me ¡Transport ¡Control ¡Protocol ¡

– Periodic ¡control ¡informa8on ¡e.g., ¡sta8s8cs ¡on ¡packets ¡loss, ¡inter-­‑ arrival ¡jimer, ¡sender ¡iden8ty ¡

  • Run ¡on ¡consecu8ve ¡UDP ¡ports ¡
  • Flexible ¡and ¡low ¡overhead ¡to ¡support ¡a ¡wide ¡variety ¡of ¡

applica8ons ¡

– ¡through ¡profiles, ¡and ¡formats, ¡ ¡ – compact ¡header ¡format ¡(ver., ¡padding, ¡extension, ¡# ¡contribu8ng ¡ sources, ¡payload ¡type ¡(e.g., ¡codecs), ¡sequence ¡number, ¡ 8mestamp, ¡synchroniza8on ¡source ¡(SSRC), ¡contribu8ng ¡source ¡ (CSRC) ¡

Fundamentals of Computer Networks End-to-End Protocols 28

slide-29
SLIDE 29

Bulk ¡Transfer ¡(BLAST) ¡

  • Unlike ¡AAL ¡and ¡IP, ¡

tries ¡to ¡recover ¡from ¡ lost ¡fragments ¡ ¡

  • Strategy ¡

– selec8ve ¡ retransmission ¡ ¡ – par8al ¡ acknowledgements ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols

Sender Receiver F r a g m e n t 1 F r a g m e n t 2 F r a g m e n t 3 F r a g m e n t 5 F r a g m e n t 4 F r a g m e n t 6 F r a g m e n t 3 F r a g m e n t 5 SRR SRR

29

slide-30
SLIDE 30

BLAST ¡Details ¡ ¡

  • Sender: ¡

– aMer ¡sending ¡all ¡fragments, ¡set ¡8mer ¡DONE ¡ – if ¡receive ¡SRR, ¡send ¡missing ¡fragments ¡and ¡reset ¡ DONE ¡ – if ¡8mer ¡DONE ¡expires, ¡free ¡fragments ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 30

slide-31
SLIDE 31

BLAST ¡Details ¡(cont) ¡

  • Receiver: ¡

– when ¡first ¡fragments ¡arrives, ¡set ¡8mer ¡LAST_FRAG ¡ – when ¡all ¡fragments ¡present, ¡reassemble ¡and ¡pass ¡ up ¡ – four ¡excep8onal ¡condi8ons: ¡

  • if ¡last ¡fragment ¡arrives ¡but ¡message ¡not ¡complete ¡ ¡

– send ¡SRR ¡and ¡set ¡8mer ¡RETRY ¡

  • if ¡8mer ¡LAST_FRAG ¡expires ¡

– send ¡SRR ¡and ¡set ¡8mer ¡RETRY ¡

  • if ¡8mer ¡RETRY ¡expires ¡for ¡first ¡or ¡second ¡8me ¡

– send ¡SRR ¡and ¡set ¡8mer ¡RETRY ¡

  • if ¡8mer ¡RETRY ¡expires ¡a ¡third ¡8me ¡

– give ¡up ¡and ¡free ¡par8al ¡message ¡

Fundamentals of Computer Networks End-to-End Protocols 31

slide-32
SLIDE 32

BLAST ¡Header ¡Format ¡ ¡

  • MID ¡must ¡protect ¡against ¡wrap ¡around ¡
  • TYPE ¡= ¡DATA ¡or ¡SRR ¡
  • NumFrags ¡indicates ¡number ¡of ¡fragments ¡ ¡
  • FragMask ¡dis8nguishes ¡among ¡fragments ¡

– if ¡Type=DATA, ¡iden8fies ¡this ¡fragment ¡ – if ¡Type=SRR, ¡iden8fies ¡missing ¡fragments ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 32

slide-33
SLIDE 33

Request/Reply ¡(CHAN) ¡ ¡

  • Guarantees ¡message ¡delivery ¡
  • Synchronizes ¡client ¡with ¡server ¡
  • Supports ¡at-­‑most-­‑once ¡seman8cs ¡

Simple ¡case ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Implicit ¡Acks ¡

Fundamentals of Computer Networks End-to-End Protocols

Client Server Request ACK R e p l y A C K

Client Server Request 1 Request 2 R e p l y 2 R e p l y 1

33

slide-34
SLIDE 34

CHAN ¡Details ¡ ¡

  • Lost ¡message ¡(request, ¡reply, ¡or ¡ACK) ¡

– set ¡RETRANSMIT ¡8mer ¡ – use ¡message ¡id ¡(MID) ¡field ¡to ¡dis8nguish ¡ ¡

  • Slow ¡(long ¡running) ¡server ¡

– client ¡periodically ¡sends ¡“are ¡you ¡alive” ¡probe, ¡or ¡ ¡ – server ¡periodically ¡sends ¡“I’m ¡alive” ¡no8ce ¡ ¡

  • Want ¡to ¡support ¡mul8ple ¡outstanding ¡calls ¡

– use ¡channel ¡id ¡(CID) ¡field ¡to ¡dis8nguish ¡ ¡

  • Machines ¡crash ¡and ¡reboot ¡

– use ¡boot ¡id ¡(BID) ¡field ¡to ¡dis8nguish ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 34

slide-35
SLIDE 35

Synchronous ¡vs ¡Asynchronous ¡ 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 ¡

Fundamentals of Computer Networks End-to-End Protocols 35

slide-36
SLIDE 36

Dispatcher ¡(SELECT) ¡

  • Dispatch ¡to ¡

appropriate ¡ procedure ¡

  • Synchronous ¡

counterpart ¡to ¡UDP ¡

Fundamentals of Computer Networks End-to-End Protocols

Caller SELECT CHAN xCall xCall xDemux xPush Callee SELECT CHAN xCallDemux xCallDemux xDemux xPush Server Client

  • Address Space for Procedures

– flat: unique id for each possible procedure – hierarchical: program + procedure number

36

slide-37
SLIDE 37

Simple ¡RPC ¡Stack ¡

Fundamentals of Computer Networks End-to-End Protocols

BLAST ETH IP SELECT CHAN

37

slide-38
SLIDE 38

SunRPC ¡

  • IP ¡implements ¡BLAST-­‑equivalent ¡

– except ¡no ¡selec8ve ¡retransmit ¡

  • SunRPC ¡implements ¡CHAN-­‑equivalent ¡ ¡

– except ¡not ¡at-­‑most-­‑once ¡

  • UDP ¡+ ¡SunRPC ¡implement ¡SELECT-­‑equivalent ¡ ¡

– UDP ¡dispatches ¡to ¡program ¡(ports ¡bound ¡to ¡programs) ¡ – SunRPC ¡dispatches ¡to ¡procedure ¡within ¡program ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols 38

slide-39
SLIDE 39

SunRPC ¡Header ¡Format ¡

  • XID ¡(transac8on ¡id) ¡is ¡

similar ¡to ¡CHAN’s ¡MID ¡

  • Server ¡does ¡not ¡

remember ¡last ¡XID ¡it ¡ serviced ¡ ¡

  • Problem ¡if ¡client ¡

retransmits ¡request ¡ while ¡reply ¡is ¡in ¡transit ¡

Fundamentals of Computer Networks End-to-End Protocols Data MsgType = CALL XID RPCVersion = 2 Program Version Procedure Credentials (variable) Verifier (variable) 31 Data MsgType = REPLY XID Status = ACCEPTED 31 39

slide-40
SLIDE 40

Presenta8on ¡Formanng ¡ ¡

  • Marshalling ¡(encoding) ¡

applica8on ¡data ¡into ¡ messages ¡

  • Unmarshalling ¡

(decoding) ¡messages ¡ into ¡applica8on ¡data ¡

  • Data ¡types ¡we ¡consider ¡

– integers ¡ – floats ¡ – strings ¡ – arrays ¡ – structs ¡

Fundamentals of Computer Networks End-to-End Protocols

Application data Presentation encoding Application data Presentation decoding Message Message Message …

  • Types of data we do not consider

– images – video – multimedia documents

40

slide-41
SLIDE 41

Difficul8es ¡

  • Representa8on ¡of ¡base ¡types ¡

– floa8ng ¡point: ¡IEEE ¡754 ¡versus ¡non-­‑standard ¡ ¡ – integer: ¡big-­‑endian ¡versus ¡limle-­‑endian ¡(e.g., ¡34,677,374) ¡

  • Compiler ¡layout ¡of ¡structures ¡

Fundamentals of Computer Networks End-to-End Protocols

(126) (34) (17) (2) 00000010 Big- endian Little- endian (2) (17) (34) (126) High address Low address 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1

41

slide-42
SLIDE 42

Taxonomy ¡

  • Data ¡types ¡

– base ¡types ¡(e.g., ¡ints, ¡floats); ¡must ¡convert ¡ – flat ¡types ¡(e.g., ¡structures, ¡arrays); ¡must ¡pack ¡ – complex ¡types ¡(e.g., ¡pointers); ¡must ¡linearize ¡

  • Conversion ¡Strategy ¡

– canonical ¡intermediate ¡form ¡ – receiver-­‑makes-­‑right ¡(an ¡N ¡x ¡N ¡solu8on) ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols

Marshaller Application data structure

42

slide-43
SLIDE 43

Taxonomy ¡(cont) ¡

  • Tagged ¡versus ¡untagged ¡data ¡
  • Stubs ¡

– compiled ¡ ¡ – interpreted ¡ ¡

Fundamentals of Computer Networks End-to-End Protocols

type = INT len = 4 value = 417892

Call P Client stub RPC Arguments Marshalled arguments Interface descriptor for Procedure P Stub compiler Message Specification P Server stub RPC Arguments Marshalled arguments Code Code

43

slide-44
SLIDE 44

eXternal ¡Data ¡Representa8on ¡ ¡ (XDR) ¡

  • Defined ¡by ¡Sun ¡for ¡use ¡with ¡SunRPC ¡
  • C ¡type ¡system ¡(without ¡func8on ¡pointers) ¡
  • Canonical ¡intermediate ¡form ¡
  • Untagged ¡(except ¡array ¡length) ¡
  • Compiled ¡stubs ¡

Fundamentals of Computer Networks End-to-End Protocols 44

slide-45
SLIDE 45

#define MAXNAME 256; #define MAXLIST 100; 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)); }

Fundamentals of Computer Networks End-to-End Protocols

Count Name J O 3 7 H N S O N List 3 4 9 7 2 6 5 8 3 2 1

45

slide-46
SLIDE 46

Abstract ¡Syntax ¡Nota8on ¡One ¡ (ASN-­‑1) ¡

  • An ¡ISO ¡standard ¡ ¡
  • Essen8ally ¡the ¡C ¡type ¡system ¡
  • Canonical ¡intermediate ¡form ¡
  • Tagged ¡
  • Compiled ¡or ¡interpreted ¡ ¡stubs ¡
  • BER: ¡Basic ¡Encoding ¡Rules ¡

¡ ¡(tag, length, value) ¡

Fundamentals of Computer Networks End-to-End Protocols

value type type length value length type value length

46

slide-47
SLIDE 47

Network ¡Data ¡Representa8on ¡ ¡ (NDR) ¡

  • Defined ¡by ¡DCE ¡
  • Essen8ally ¡the ¡C ¡type ¡system ¡
  • Receiver-­‑makes-­‑right ¡

(architecture ¡tag) ¡ ¡

  • Individual ¡data ¡items ¡

untagged ¡

  • Compiled ¡stubs ¡from ¡IDL ¡
  • 4-­‑byte ¡architecture ¡tag ¡

Fundamentals of Computer Networks End-to-End Protocols

– IntegerRep

  • 0 = big-endian
  • 1 = little-endian

– CharRep

  • 0 = ASCII
  • 1 = EBCDIC

– FloatRep

  • 0 = IEEE 754
  • 1 = VAX
  • 2 = Cray
  • 3 = IBM

47