Application-Level Implementation of TCP Team Alaska San Jose State University Fall 2007 CMPE207 Dr. Frank Lin Chris Nelson Ruchir Sutaria Kimsi Singh Gagandeep.

Slides:



Advertisements
Similar presentations
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Advertisements

TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
CCNA – Network Fundamentals
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4.
Transport Layer – TCP (Part2) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Transmission Control Protocol (TCP)
Guide to TCP/IP, Third Edition
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
TCP & UDP - Protocol Details Yen-Cheng Chen
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
Instructor: Sam Nanavaty TCP/IP protocol. Instructor: Sam Nanavaty Version – Allows for the evolution of the protocol IHL (Internet header length) – Length.
5/6/2015© 2010 Raymond P. Jefferis IIILect Transport Layer.
10. UDP/TCP WWW page: Text book: Mastering Networks (Chapter 10) Network IP protocol is routes the data.
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number rcvr window size ptr.
TRANSPORT LAYER  Session multiplexing  Segmentation  Flow control (TCP)  Connection-oriented (TCP)  Reliability (TCP)
EEC-484/584 Computer Networks Lecture 15 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Page: 1 Director 1.0 TECHNION Department of Computer Science The Computer Communication Lab (236340) Summer 2002 Submitted by: David Schwartz Idan Zak.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
1 CCNA 2 v3.1 Module Intermediate TCP/IP CCNA 2 Module 10.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
1 ELEN 602 Lecture 15 More on IP TCP. 2 byte stream Send buffer segments Receive buffer byte stream Application ACKs Transmitter Receiver TCP Streams.
Chapter 4 OSI Transport Layer
Gursharan Singh Tatla Transport Layer 16-May
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
Transmission Control Protocol TCP. Transport layer function.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
CSE 331: Introduction to Networks and Security Fall 2000 Instructor: Carl A. Gunter Slide Set 5.
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
Breno de MedeirosFlorida State University Fall 2005 The IP, TCP, UDP protocols A quick refresher.
© Jörg Liebeherr (modified by Malathi Veeraraghavan) 1 Overview Formats, Data Transfer, etc. Connection Management.
Hour 6 The Transport Layer 1. What You'll Learn in This Hour Connections oriented and connectionless protocols Ports and sockets TCP UDP 2.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
Guide to TCP/IP Fourth Edition
© 2002, Cisco Systems, Inc. All rights reserved..
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
COMP2322 Lab 6 TCP Steven Lee April 1, TCP Transmission Control Protocol Transport layer protocol User Datagram Protocol (UDP) is another one 2.
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead.
Chapter 9: Transport Layer
Instructor Materials Chapter 9: Transport Layer
COMP2322 Lab 6 TCP Steven Lee Mar 29, 2017.
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
Process-to-Process Delivery
TCP.
PART 5 Transport Layer Computer Networks.
TCP Transport layer Er. Vikram Dhiman LPU.
TCP - Part I Karim El Defrawy
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Transport Layer 9/22/2019.
TCP Connection Management
Presentation transcript:

Application-Level Implementation of TCP Team Alaska San Jose State University Fall 2007 CMPE207 Dr. Frank Lin Chris Nelson Ruchir Sutaria Kimsi Singh Gagandeep Singh

Team Alaska – Fall 2007Slide 2 Team Members Gagandeep Singh - Server Application - Concurrency Expert Kimsi Singh - Client Applications - Test Expert Chris Nelson - Team Leader - Documentation - Connection Establishment/ Termination Ruchir Sutaria - Seq/Ack Numbering - Flow Control Guru Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 3 Agenda Project Management  Code Control  Documentation Design Overview  Protocol Code  Concurrent Server  Client Test Applications Test Overview  Test Cases  Test Results Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 4 Project Management SourceForge.net:   CVS repository for code control  Wiki pages for documentation and tasks Google Groups:   Archive of team discussions Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 5 Project Management Our main project wiki page... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 6 Project Management Tracking our tasks and progress... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 7 Project Management Tracking our discussions... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 8 Project Management Tracking our code... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 9 Design Overview General Concept: Create an Additional Layer Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 10 Design Overview Create an API  extern int cmpe207_socket (int type);  extern int cmpe207_bind (int sockfd, cmpe207_sockaddr *myaddr, int addrlen);  extern int cmpe207_listen (int sockfd, int queue_size);  extern int cmpe207_accept (int sockfd, cmpe207_sockaddr *claddr, int addrlen);  extern int cmpe207_send (int sockfd, const char* buf, int len, int flags);  extern int cmpe207_recv (int sockfd, char* buf, int len, int flags);  extern int cmpe207_close (int sockfd);  extern int cmpe207_connect (int sockfd, cmpe207_sockaddr *myaddr, int addrlen); Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 11 Design Overview Control Structures  socket_blocks: Array of socket control blocks /* Socket control block */ typedef struct { int socket_desc;//Socket descriptor short inuse;//In-use flag (TRUE or FALSE)‏ cmpe207_sockaddr local_addr;//Local address, port, UDP port cmpe207_sockaddr remote_addr;//Remote address, port, UDP port int udp_sockfd;//UDP socket descriptor short state;//Connection state int listen_queue_size;//Listen queue size // Send sequence variables... uint32_t snd_una;//send unacknowledged uint32_t snd_nxt;//to keep track of sender seq no uint16_t send_window;//Send window uint16_t snd_wl1;//Seg seq num used for last window uint16_t snd_wl2;//Seg ack num used for last win update uint16_t ISS;// initial send seq number // Receive sequence variables... uint32_t rcv_nxt; //recv next uint16_t rec_window;//Receive window uint16_t IRS;//initisl recv seq number // Current segment variables... uint32_t seg_ack;//ACK Number uint32_t seq_nbr;//Sequence Number uint32_t seg_len;//segment length uint32_t seg_wnd;//segment window // Time variables... uint32_t last_data_snd;//time of last data send uint32_t last_ack_snd; uint32_t last_data_rcvd; uint32_t last_ack_rcvd; } cmpe207_control_block; Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 12 Design Overview Packet Header Structure /* CMPE207 Packet Header */ typedef struct { uint16_t src_port;/* 16-bit source port */ uint16_t dest_port;/* 16-bit destination port */ uint32_t seq_nbr;/* 32-bit sequence number */ uint32_t ack_nbr;/* 32-bit ack number */ uint16_t f_flag : 1,/* Fin flag */ s_flag : 1,/* Sync flag */ r_flag : 1,/* Reset flag */ p_flag : 1,/* Push flag--off except for close */ a_flag : 1,/* Ack flag */ u_flag : 1,/* Urgent flag--always off */ offset : 10;/* Offset--always 0x05 */ uint16_t window;/* 16-bit window field */ uint16_t chksum;/* 16-bit checksum field */ uint16_t urgptr;/* 16-bit urgent pointer--unused */ } cmpe207_pkt_hdr; Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 13 Design Overview Internal Functions  int cmpe207_pack (char *udp_data, cmpe207_pkt_hdr *header, char *data_207, int data_207_length);  int cmpe207_unpack (char *udp_data, unsigned int udp_data_size, cmpe207_pkt_hdr *header, char *data_207, unsigned int data_207_size); headerdata_207 udp_data headerdata_207 udp_data Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 14 Design Overview Screenshot of cmpe207_unpack()... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 15 Design Overview Screenshot of cmpe207_scb_print()... Slide Prepared/Presented by: C. Nelson

Team Alaska – Fall 2007Slide 16 Design Overview Flow Control  Basic sequencing in cmpe207_connect, cmpe207_accept, cmpe207_send, cmpe207_receive and cmpe207_close  Cumulative Ack with no sequence increment for Ack packet  Timeouts and retransmission  Window Management Slide Prepared/Presented by: R. Sutaria

Team Alaska – Fall 2007Slide 17 Design Overview Basic Sequencing Whenever data sent Seq nbr of segment Length of data sent Segment window length Send unack,Send next, Last data send and send window are set based on values in the TCB Whenever data received Checks for flags Check valid range Store the incoming window length Recv nxt, seq nbr, last data recvd and last ack recvd set based on the received header values Slide Prepared/Presented by: R. Sutaria

Team Alaska – Fall 2007Slide 18 Design Overview Timeouts, Retransmission, and Window Management  The timeout done using select() function.  Retransmission based on state and the window size  Window size is dynamic  Have the capability to transmit large chunks of data.  Done by splitting the packet according to window size Slide Prepared/Presented by: R. Sutaria

Team Alaska – Fall 2007Slide 19 Design Overview The cmpe207_send function will split the data and send it to the receiver. This provides us a mechanism to send large chunks of data. Slide Prepared/Presented by: R. Sutaria 2000 Bytes Data 500 Bytes Advertised window size = 500 Data Packet Size = 2000

Team Alaska – Fall 2007Slide 20 Design Overview THE SERVER  Key Elements  Implements the 207 – Protocol API (discussed earlier)‏  In addition, has its own API (For logging any data)‏ - Server_Accept()‏ - Server_Read()‏ - Server_Write()‏ - Server_Close()‏  Concurrent (Can handle upto 10 clients at a given time)‏  Multi-Threaded Slide Prepared/Presented by: G. Singh

Team Alaska – Fall 2007Slide 21 Design Overview THE SERVER (Multi - Threading)‏ master slave 1 slave 2 slave 3 Socket Slide Prepared/Presented by: G. Singh

Team Alaska – Fall 2007Slide 22 Design Overview THE SERVER (Multi - Threading)‏ Socket master slave 1 Request Data Slide Prepared/Presented by: G. Singh

Team Alaska – Fall 2007Slide 23 Design Overview THE SERVER (Our Approach)‏  CRUX: Issue: Race Condition - recvfrom() function, as only ONE socket, but multiple threads Solution: The main thread always yields to the slave thread, except in SYN_RECEIVED state Issue: Shared Memory Solution: Every Thread given its own routine to execute Slide Prepared/Presented by: G. Singh

Team Alaska – Fall 2007Slide 24 Design Overview THE SERVER  Features Targeted: Robustness Performance Reliability Slide Prepared/Presented by: G. Singh

Team Alaska – Fall 2007Slide 25 Test Cases INTERACTIVE TEST APPLICATION Includes 25 Test Cases; 25 Cases have been implemented Plan to include 25 more, before submission Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 26 Test Cases Test Cases: Five chosen test cases All Flags UP (ALL_FLAGS_UP)‏ No Acknowledgment after the received data (NO_ACK_OF_RECEIVED_DATA)‏ Reset after the data sent (RST_AFTER_DATA_SENT)‏ Malformed Header (MALFORMED_HEADER)‏ SYN_ATTACK Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 27 Test Cases (ALL_FLAGS_UP)‏ SERVER in Listen State Clearly a false packet Listen State All flags set, including SYN PKT Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 28 Test Cases EXPECTED RESULT Packet should be ignored! Also, THREE WAY HANDSHAKE should not proceed… ACTUAL RESULT Server Proceeded with the Handshake. Failed the Test. Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 29 Test Cases (NO_ACK_OF_RECEIVED_DATA)‏ The Server waits for an ACK but does not get an ACK! Server ACK Client receives converted data Client Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 30 The Expected Behavior is: 1) Slave Socket times out and closes. 2) Server remains in the listening mode Actual result: Server passed this test. Test Cases Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 31 Test Cases (RST_AFTER_DATA_SENT)‏ Sends Data RST Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 32 Test Cases EXPECTED RESULT Slave socket expected to receive this RST and respond with an RST and Finally close. Server is expected to continue in the listening mode. ACTUAL RESULT Server Failed the Test Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 33 Test Cases MALFORMED_HEADER Header of 18 bytes instead of 20 bytes ( Corrupted header). ALL Flags : OK EXPECTED BEHAVIOUR Slave Socket is expected to ignore the packet. Actual Behavior = Expected Behavior Server passes the test. Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 34 Test Cases SYN_ATTACK Client Keeps Sending SYN even after getting a SYN_ACK from the Server SYN Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 35 Different implementations come up with different solutions to this problem. Bottomline: Server should not be fooled. Our Approach: If Server receives 5 SYN packets from the same IP address and port in SYN_RECEIVED, it sends an RST and goes back to the LISTEN state. Test Cases Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 36 Test Results Slide Prepared/Presented by: K. Singh

Team Alaska – Fall 2007Slide 37 References Slide Prepared/Presented by: C. Nelson