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