Notes 03
Notes 03
Chapter 03
(version April 23, 2007)
01 Introduction
02 Physical Layer
03 Data Link Layer
04 MAC Sublayer
05 Network Layer
06 Transport Layer
07 Application Layer
08 Network Security
00 – 1 /
Packet Packet
Frame
Basic Services
4 4 4 4
3 3 3 3
Virtual
data path
2 2 2 2
1 1 1 1
Actual
data path
(a) (b)
Router
2 3 2 2 3
Data link
Frames Packets protocol
here here
Transmission
line to a router
Frames
The physical layer doesn’t do much: it just pumps bits
from one end to the other. But things may go wrong
⇒ the data link layer needs a means to do retransmis-
sions. The unit of retransmission is a frame (which is
just a fixed number of bits).
(a) 5 1 2 3 4 5 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
Error
(b) 5 1 2 3 4 7 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
(a)
Original characters After stuffing
(b)
(a) 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0
(b) 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0
Stuffed bits
(c) 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11
1 X X X X X X
2 X X X X X X
4 X X X X
8 X X X X
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11
1 X X X X X X
2 X X X X X X
4 X X X X
8 X X X X
1 0 1 1 1 0 0 1 0 0 1
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11
1 X X X X X X
2 X X X X X X
4 X X X X
8 X X X X
C: 0 0 1 1 1 0 0 0 1 0 1
S: 1 0 1 1 1 0 0 1 0 0 1
R: 1 0 1 1 1 0 0 1 1 0 1
F: 1 0 1 1 1 0 0 1 0 0 1
S: string sent
R: string received
C: string corrected on the check bits: #1 and #8 cor-
rected ⇒ bit #9 is wrong
F: final result after correction
h01101i 7→ 0 · x0 + 1 · x + 1 · x2 + 0 · x3 + 1 · x4
= x + x2 + x4
Example: a = h01011i
a(x) = 0 · x0 + 1 · x1 + 0 · x2 + 1 · x3 + 1 · x4
= x + x3 + x4
g(x) = 1 + x2 + x3
a(x) · g(x) = (x + x3 + x4)(1 + x2 + x3 )
= x + 2x3 + 2x4 + x5 + 2x6 + x7
= x + x5 + x7
Simplex Stop-and-Wait
01 typedef enum {frame_arrival} event_type;
02 #include "protocol.h"
03
04 void sender2(void){
05 frame s; packet buffer;
06 event_type event;
07 while (true) {
08 from_network_layer(&buffer);
09 s.info = buffer;
10 to_physical_layer(&s);
11 wait_for_event(&event);
12 }
13 }
14
15 void receiver2(void){
16 frame r, s; event_type event;
17 while (true) {
18 wait_for_event(&event);
19 from_physical_layer(&r);
20 to_network_layer(&r.info);
21 to_physical_layer(&s);
22 }
23 }
6 1 6 1 6 1 6 1
5 2 5 2 5 2 5 2
4 3 4 3 4 3 4 3
Receiver
7 0 7 0 7 0 7 0
6 1 6 1 6 1 6 1
5 2 5 2 5 2 5 2
4 3 4 3 4 3 4 3
a: Initially.
b: After sending frame #1.
c: After receiving frame #1.
d: After receiving ack for frame #1.
Time
(a) (b)
0 1 2 3 4 5 6 7 Advance window
Recall:
Bits 8 8 8 >0 16 8
Modem
TCP/IP connection
using PPP
Router Routing
process
Problem: One way or the other we’d like to use the In-
ternet protocol stack at our home. The bottom line is
that we’ll have to transfer IP (network) packets across
our telephone line. Note: We may also be talking
ADSL here!
Establish Authenticate
Failed
Dead Network
Failed
Terminate Open
(2) Can someone else ever send you data (they don’t
know your address, do they?)