Building-Block Protocols

Download Report

Transcript Building-Block Protocols

Ning Yu
Information and Computer Sciences
University of Hawaii at Manoa
Building-Block Protocols
Summary
Network Protocols
Building-Block Protocols
Implementation
Summary
By: Edoardo S. Biagioni
Basic
Idea
Previous
To decompose the existing networking
protocols into simpler components. It should be
possible to easily assemble these components
into functional networking protocol stacks. Use
of different components or the same
components in different orders would lead to
different protocols.
Next
Network Protocols
Definition:
Previous
The abstract objects that make up
the layers of a network system
are called protocols.
Next
•Service interface
defines the operations that local objects can perform on the
protocol
High-level
Object
High-level
Object
Host1
Host2
Protocol
Protocol
•Peer-to-peer interface
defines the form and meaning of messages exchanged between
protocol peers to implement the communication service.
Protocols generally add headers
havethe
as Protocols
the packetgenerally
moves down
two types of functions:
stack in send side, while the
• format functions
receive side removes the header
• control functions
as the packet moves up the stack.
Building - Block Protocols
Simply adds a
fixed-size
constant header
to all outgoing
packets
swap
constant
void
checksum
CRC
flow control
Removes/ Adds
a header for
several higherlevel protocol
stacks
Previous
counter
de/multiplexing
length
… et al.
Next
Simply removes
a fixed-size
constant header
to all outgoing
packets
Adds a
standard CRC
header or
trailer
swap
urgent data
constant
connections
Assemble
TCP
Example
IP
flow control
Example
counter
Internet addressing
type of service
bit error detection
de/multiplexing
length
bit error detection
gateway/interface
routing/loop prevention
CRC
resequencing
fragmentation
fragmentation
Assemble
checksum
acknowledgement
retransmission
length
acknowledgement
de/multiplexing
flow control
de/multiplexing
version
… et al.
Advantages:
•Explicit interaction between blocks
•Easy assembly of custom protocols
•Easier to write, test and verify
Block’s structure
send_protocol_stack
Data
Structure
char * header
int header_size
int (* protocol_function) (
char * spaceBegin,
char * dataBegin,
char * dataEnd,
char * spaceEnd,
struct send_protocol_stack * stack);
struct send_protocol_stack * next
Previous
Next
Send stack push
Data
Structure
Previous
struct send_protocol_stack * send_stack_push(
char * header,
int header_size,
int (* protocol_function)(
char * spaceBegin,
char * dataBegin,
char * dataEnd,
char * spaceEnd,
struct send_protocol_stack * stack),
struct send_protocol_stack * stack);
Next
header
header_size protocol_function()
6
send_stack_push
send_stack_push
send_stack_push
send_protocol_stack
send_stack_push
header
6
header_size
protocol_function()
send _protocol_stack
header
4
header_size
protocol_function()
next send_protocol_stack
send _protocol_stack
Send stack push
header
6
Data
Structure
header_size
send_reorder
protocol_function()
send_constant
send _protocol_stack
send_constant
header
4
header_size
send_constant
protocol_function()
next send_protocol_stack
send_udp
send _protocol_stack
Previous
Next
receive stack push
Data
Structure
receive_reorder
receive_reorder
receive_void
receive_save
receive_demux
receive_check
receive_void
Previous
Next
Implementation
reflect
Feasibility
reflect
send_gettime
receive_rtt
send_gettime
send_constant
send_constant
receive_void
send_constant
send_constant
receive_void
send_constant
send_constant
send_udp
receive_void
send_udp
receive_udp
Next
receive_void
Server
Client
Previous
receive_save
receive_udp
Ping-Pong
Ping-Pong
round-trip (us) min/avg/max =3580 /3759/5192
The average Round trip time could be
more than 5 ms when more print out
----uhunix2.its.hawaii.edu PING Statistics---added.
round-trip (ms) min/avg/max = 3/3/8
uhunix2
uhics
Ping-Pong
round-trip (us) min/avg/max = 2257/3203/10625
--- uhunix2.its.hawaii.edu ping statistics --round-trip min/avg/max = 3.8/4.8/6.2 ms
uhunix2
Cleo
(Linux)
Ethernet
48bits
48bits
16bits
Destination Address
Source Address
Type
The Ethernet’s data field carries:
Contains
physical
a minimum
of the
46the
byes
Indicates
type of
address
of
device
Contains
thethe
hardware
management
a maximum
1500
bytes
that isoftoof
receive
the
address
the
information device
present
packet
the
packet
If there are less than sending
46 bytes
ofpacket.
data,
the field will
in the
be padded to the minimum length
Ethernet Stack
Ethernet send
stack
Assembly
stack
Ethernet receive
stack
Simulating Ethernet Header
send_constant
send_constant
48bits
IP
48bits
ARP
16bits
send_constant
DestinationIP | port #
SourceIP
| port #
Type
receive_demux
send_trim
receive_void
send_extend
receive_void
send_udp
Previous
Next
ARP
0
16
32
Hardware type
The goal: ProtocolType
HLEN
PLEN
Operation
To enable each
host on a network to built
SourceHardwareAddr
SourceHardwareAddr
SourceProtocolAddr
up a table of mappings
between
SourceProtocolAddr
TargetHardwareAddr
IP addressTargetHardwareAddr
and link-level addresses
TargetProtocolAddr
Implementation
ARP stack
Implement ARP reply stack and
request stack by using
send_constant
Implement ARP receive
stack by using
Previous
receive_void
receive_check
receive_save
receive_switch
Next
Internet Protocol (IP)
0
16
Version HLen
TOS
Ident
TTL
32
Length
Flags
Protocol
SourceAddr
DestinationAddr
Offset
Checksum
Implementation
IP stack
Implement IP send stack by using
send_constant
send_flag_offset
send_counter
send_reorder
Implement IP receive stack by using
receive_void
receive_demux
receive_flag_offset
Previous
Next
receive_reorder
A simple implementation of
Building-Block Protocol
IP Stack
Stack
Structure
ARP
Stack
table_lookup
Ethernet Stack
Previous
Next
ARP
Stack
IP
Stack
Ethernet Stack
Implementation
No Global Variable is used !
MAHALO