Implementation of TCP over UDP

Post on 01-Jan-2016

57 views 1 download

Tags:

description

Implementation of TCP over UDP. Team : Fortworth Piyush Patel Hiren Bhorania Dhiwakar Mani Ketan Nawal. Agenda. Introduction Server design Concurrency Flow Reliability Test cases. Goal. Provide a TCP like 207 layer over the UDP protocol - PowerPoint PPT Presentation

Transcript of Implementation of TCP over UDP

Implementation of TCP over UDP

Team : FortworthPiyush PatelHiren BhoraniaDhiwakar ManiKetan Nawal

Agenda

• Introduction• Server design• Concurrency• Flow• Reliability• Test cases

Goal

• Provide a TCP like 207 layer over the UDP protocol

• Implement TCP like 207 protocol to develop 207 Server which provides TCP like functionalities

• Provide application on top of 207 layer

Features • Packet Generator

• Packet Parser

• Connection Management

• Data transfer

• Reliability

• Flow control

• Error control

• Concurrency

• Application

Server Design

• Multi threaded Server• Descriptor table• Master handles incoming packets• Message queues for each child thread• Packets get buffered in child’s queue• Child thread waits for packet in its queue

Concurrency

Concurrency (Cont…)

Slave 1 Slave 1 Slave 1

Master

207 Server

Q Q Q

Descriptor table

Connection establishmentC reate and B ind

Listen

R eceive packet

If SYN

C reate new threadPass packet in queue

C heck client entry

N

Y

Y

C heck client entry

D iscard packet

N

N

Y N

Data transfer and connection termination• Master thread handles and check initial

packet• Slave thread completes handshaking and

handles data transfer and connection termination

• Master remove the thread after completion and free the resources

• Four way teardown

Packet Generator

• Single function to prepare outgoing data

• Set the flags of the header• Append data to it, if any• Append pseudo header to it• Calculate checksum• Remove pseudo header• Print the segment

Packet Parser

• Single function to check on incoming data• Check on the flags of the header• Calculate checksum• Compare checksum• Print the segment• Separate data from header

Error Control

• Checksum• Scenario

• Psuedo header format typedef struct

{    uint32_t src_adr;    uint32_t dst_adr;        uint16_t offset : 8,               protocol : 8;        uint16_t hlen;            }PSEUDO207;

Error control (Cont…)

Flow Control

• Basic windowing• Check incoming window size• Set proper outgoing window size• Server advertise the window size first• Server set outgoing buffer according to client’s window• Same procedure is followed at client side

• Sequencing • Check sequence number and update entries in TCB• If out of sequence packet arrives in data transfer then send

the ACK again

Logging

• Log file for each session• Logging capability for each incoming and

outgoing packet• Logging in a text file• Log error messages and connection state

Test casesID Description

T01 Connection Establishment

T02 3-way handshake

T03 3-way handshake, Data transfer

T03 3-way handshake, Data transfer, Connection termination

T04 Conversion application test

T05 Sending Data multiple times during the established state

T06 Out of Sequence ACK received

T07 Client sending a RST

T08 Client sending an unexpected FIN

T09 Verifying concurrency in Server

T10 Multiple SYN from a client

T11 SYN during data transfer

T12 Malformed packet test

T13 All flags on packet

Test Case - 1

SERVERCLIENT

SYN

SYN-ACK

SYNRST

Test Case - 2

CLIENT SERVER

Data Transfer

SYN

RST

Test Case - 3

SERVERCLIENT

All Flags ON

RST

Test Case - 4

SERVERCLIENT

Not SYN packet

RST

Test Case - 5 SERVERCLIENT

SYN 2

Drop

SYN 1

SYN 4

SYN 3

SYN 10

SYN 11

Reference

• RFC 793 • http://www.unpbook.com/unpv13e.tar.gz• https://computing.llnl.gov/tutorials/pthreads/

Thank You