Chapter 9 Elementary SCTP Sockets

Slides:



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

Socket Programming. Basics Socket is an interface between application and network – Application creates a socket – Socket type dictates the style of communication.
Sockets: Network IPC Internet Socket UNIX Domain Socket.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Socket Programming.
Windows Sockets Purpose Windows Sockets 2 (Winsock) enables programmers to create advanced internet, intranet, and other network-capable applications to.
1 SCTP Tutorial, Ottawa 7/2004 © 2004 Randall Stewart (Cisco Systems), Phill Conrad (University of Delaware). All rights reserved. PR-SCTP I Partial Reliability.
Design, implementation and evaluation issues of local area network devices 期末 DEMO Elementary SCTP Socket Functions & Client/Server Example 陳旻槿.
Tutorial 8 Socket Programming
Programming with Berkeley Sockets Presented by Chris GauthierDickey Written by Daniel Stutzbach (I think!) for CIS 432/532 Useful References: ● man pages.
CPE 401 / 601 Computer Network Systems
Chapter 23 Advanced SCTP Sockets. SCTP Sockets, recall ● Stream Control Transmission Protocol ● Multi-homed ● Association, instead of connection ● IPV4.
Lecture 10 Overview. Network API Application Programming Interface – Services that provide the interface between application and protocol software often.
UNIX Sockets COS 461 Precept 1.
Sockets CIS 370 Fall 2009, UMassD. Introduction  Sockets provide a simple programming interface which is consistent for processes on the same machine.
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
Basic Socket Programming TCP/IP overview. TCP interface Reference: –UNIX Network Programming, by Richard Stevens. –UNIX man page.
TCP Socket Programming. r An abstract interface provided to the application programmer  File descriptor, allows apps to read/write to the network r Allows.
ECE 4110 – Internetwork Programming Client-Server Model.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Elementary TCP Sockets
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
CS345 Operating Systems Φροντιστήριο Άσκησης 2. Inter-process communication Exchange data among processes Methods –Signal –Pipe –Sockets.
Sockets CIS 370 Lab 10 UMass Dartmouth. Introduction 4 Sockets provide a simple programming interface which is consistent for processes on the same machine.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
Chapter 2 Applications and Layered Architectures Sockets.
Remote Shell CS230 Project #4 Assigned : Due date :
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
Advanced Sockets API-II Vinayak Jagtap
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
Distributed Computing A Programmer’s Perspective.
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
CSCE 515: Computer Network Programming UDP Socket Wenyuan Xu Department of Computer Science and Engineering.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
CSCI 330 UNIX and Network Programming Unit XV: Transmission Control Protocol.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
Review: –Concurrent server and multiplexed server How they work? Which one is better?
Introduction to Sockets
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
Lecture 15 Socket Programming CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Cisco I Introduction to Networks Semester 1 Chapter 7 JEOPADY.
Socket Programming in C CS587x Lecture 3 Department of Computer Science Iowa State University.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Sockets API Developing Applications using the Sockets API.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Sockets and Beginning Network Programming
Jim Fawcett CSE 681 – Software Modeling & Analysis Fall 2002
UNIX Sockets COS 461 Precept 1.
Socket Programming in C
Transport layer API: Socket Programming
Stream Control Transmission Protocol (SCTP)
Network Programming CSC- 341
Socket Programming in C
TCP Sockets Programming
Advanced Network Programming spring 2007
TCP/IP Socket Programming in C
Chapter 2 Application Layer
Socket Programming(1/2)
Sockets Programming Socket to me!.
Sockets Programming Socket to me!.
Internet Networking recitation #8
Outline Communications in Distributed Systems Socket Programming
Process-to-Process Delivery: UDP, TCP
Presentation transcript:

Chapter 9 Elementary SCTP Sockets Advance Network Programming Under the Instructor of Hyotaek Lim htlim@dongseo.ac.kr By Dhananjay Singh Ubiquitous IT

SCTP is a reliable and message-oriented protocol. 9.1 Introduction SCTP is a reliable and message-oriented protocol. It provides multiple streams between endpoints and transport-level support for multi-homing. SCTP was originally developed for call control signaling to allow the transport of telephony signals across the Internet. SCTP is a newer protocol, so the interface for all its features has not yet completely stabilized.

SCTP sockets have two type of models: one-to-one socket Model 9.2 Interface Models SCTP sockets have two type of models: one-to-one socket Model one-to-many socket Model A one-to-one socket corresponds to exactly one SCTP association. The association identifier is a value of type sctp assoc. The client closes the association, then the server side will be automatically close. The One-to-One Style: It can be easily mapped to SCTP_NODELAY and SCTP_MAXSEG. A one-to-one-style SCTP socket is an IP socket (family AF_INET or AF_INET6), with type SOCK_STREAM and protocol IPPROTO_SCTP.

Figure 9.1. Socket functions for SCTP one-to-one style. SCTP Server socket() SCTP Client bind() socket() listen() connect() accept() Connection establishment Data Request write() read() Process Request Data Reply write() read() EOF notification read() close() close()

sctp_peeloff Function: It can be used to cause data to be piggybacked on the third or fourth packet of the four-way handshake. The sctp_peeloff function can be used to peel off a particular association. sctp_peeloff Function: int sctp_peeloff(int sockfd, sctp_assoc_t id); Returns: a new socket descriptor on success, –1 on error. shutdown Function A one-to-many-style SCTP socket is an IP socket (family AF_INET or AF_INET6) with type SOCK_SEQPACKET and protocol IPPROTO_SCTP.

Figure 9.2. Socket functions for SCTP one-to-Many style. SCTP Server socket() SCTP Client bind() socket() listen() Data (request ) 0n COOKIE-ECHO sctp_recvmsg() sctp_sendto() Data reply sctp_recvmsg() sctp_sendmsg() close() Association shutdown Server need not care

Socket functions for SCTP 9.3 sctp_bindx Function: #include <netinet/sctp.h> int sctp_bindx(int sockfd, const struct sockaddr *addrs, int addrcnt, int flags); Returns: 0 if OK, –1 on error flags used with sctp_bindx function

9.4 sctp_connectx Function #include <netinet/sctp.h> int sctp_connectx(int sockfd, const struct sockaddr *addrs, int addrcnt); Returns: 0 for success, –1 on error Packed address list format for SCTP calls

9.5 sctp_getpaddrs Function: #include <netinet/sctp.h> int sctp_getpaddrs(int sockfd, sctp_assoc_t id, struct sockaddr **addrs); Returns: the number of peer addresses stored in addrs, –1 on error 9.6 sctp_freepaddrs Function: void sctp_freepaddrs(struct sockaddr *addrs); 9.7 sctp_getladdrs Function: int sctp_getladdrs(int sockfd, sctp_assoc_t id, struct sockaddr **addrs); Returns: the number of local addresses stored in addrs, –1 on error

9.8 sctp_freeladdrs Function: #include <netinet/sctp.h> void sctp_freeladdrs(struct sockaddr *addrs); 9.9 sctp_sendmsg Function: ssize_t sctp_sendmsg(int sockfd, const void *msg, size_t msgsz, const struct sockaddr *to, socklen_t tolen, uint32_t ppid, uint32_t flags, uint16_t stream, uint32_t timetolive, uint32_t context); Returns: the number of bytes written, –1 on error 9.10 sctp_recvmsg Function: ssize_t sctp_recvmsg(int sockfd, void *msg, size_t msgsz, struct sockaddr *from, socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, int *msg_flags); Returns: the number of bytes read, –1 on error

9.11 sctp_opt_info Function: int sctp_opt_info(int sockfd, sctp_assoc_t assoc_id, int opt void *arg, socklen_t *siz); Returns: 0 for success, –1 on error 9.12 sctp_peeloff Function: int sctp_peeloff(int sockfd, sctp_assoc_t id); Returns: a new socket descriptor on success, –1 on error

SCTP over TCP Transmission Control Protocol (TCP) has been the default transport for HTTP. HTTP/TCP Concerns Head-of-line (HOL) blocking Vulnerability to network failures Vulnerability to SYN DoS attacks

SCTP multi-streaming avoid HOL blocking

Calling shutdown to close an SCTP association SHUT_RD : Disables read Operations. SHUT_WR Disables further send operations and initiates the SCTP shutdown procedures, which will terminate the association. SHUT_RDWR Disables all read and write operations, and initiates the SCTP shutdown procedure.

Calling shutdown to close an SCTP association

9.14 Notifications SCTP makes a variety of notifications available to the application programmer. struct sctp_tlv { u_int16_t sn_type; u_int16_t sn_flags; u_int32_t sn_length; }; /* notification event */ union sctp_notification struct sctp_tlv sn_header; struct sctp_assoc_change sn_assoc_change; struct sctp_paddr_change sn_paddr_change; struct sctp_remote_error sn_remote_error; struct sctp_send_failed sn_send_failed; struct sctp_shutdown_event sn_shutdown_event; struct sctp_adaption_event sn_adaption_event; struct sctp_pdapi_event sn_pdapi_event;

SCTP_ASSOC_CHANGE: struct sctp_assoc_change { u_int16_t sac_type; u_int16_t sac_flags; u_int32_t sac_length; u_int16_t sac_state; u_int16_t sac_error; u_int16_t sac_outbound_streams; u_int16_t sac_inbound_streams; sctp_assoc_t sac_assoc_id; uint8_t sac_info[]; }; The sac_state describes the type of event that has occurred on the association. SCTP_COMM_UP SCTP_COMM_LOST SCTP_RESTART SCTP_SHUTDOWN_COMP SCTP_CANT_STR_ASSOC The sac_error field holds any SCTP protocol error.

SCTP_PEER_ADDR_CHANGE struct sctp_paddr_change { u_int16_t spc_type; u_int16_t spc_flags; u_int32_t spc_length; struct sockaddr_storage spc_aaddr; u_int32_t spc_state; u_int32_t spc_error; sctp_assoc_t spc_assoc_id; }; The spc_aaddr field holds the address of the peer affected by this event

SCTP_SEND_FAILED struct sctp_send_failed { u_int16_t ssf_type; u_int16_t ssf_flags; u_int32_t ssf_length; u_int32_t ssf_error; struct sctp_sndrcvinfo ssf_info; sctp_assoc_t ssf_assoc_id; u_int8_t ssf_data[]; }; SCTP_REMOTE_ERROR struct sctp_remote_error { u_int16_t sre_type; u_int16_t sre_flags; u_int32_t sre_length; u_int16_t sre_error; sctp_assoc_t sre_assoc_id; u_int8_t sre_data[]; }; The sre_error will hold one of the SCTP protocol error

SCTP_PARTIAL_DELIVERY_EVENT: SCTP_SHUTDOWN_EVENT: struct sctp_shutdown_event { uint16_t sse_type; uint16_t sse_flags; uint32_t sse_length; sctp_assoc_t sse_assoc_id; }; SCTP_ADAPTION_INDICATION: struct sctp_adaption_event u_int16_t sai_type; u_int16_t sai_flags; u_int32_t sai_length; u_int32_t sai_adaption_ind; sctp_assoc_t sai_assoc_id; SCTP_PARTIAL_DELIVERY_EVENT: struct sctp_pdapi_event { uint16_t pdapi_type; uint16_t pdapi_flags; uint32_t pdapi_length; uint32_t pdapi_indication; sctp_assoc_t pdapi_assoc_id; };

TCP: Network fault-(In)tolerance

SCTP: Transport layer multi-homing SCTP Association {A1 , A2} { B1, B2} SCTP failure detection and failover

HTTP/SCTP streams: Design

Other SCTP features Partial Reliability Extension (PR-SCTP): Timed reliability: Example: Online game client use PR-SCTP to transmit player’s coordinates. Unordered data delivery 1 SCTP association to transmit both ordered and unordered data. UDP: Unordered data transmitted reliably. SCTP shim layer between application and transport layer. No code change to app. Transparently converts app’s TCP calls to corresponding SCTP calls.

9.15 Summary SCTP provides the application writer with two different interface styles: The one-to-one style, mostly compatible with existing TCP applications to ease migration to SCTP. The one-to-many style, allowing access to all of SCTP's features. Functions like sctp_bindx, sctp_connectx, sctp_getladdrs, and sctp_getpaddrs provide methods to better control and examine. The multiple addresses that can make up an SCTP association.

References - Books UNIX Network Programming; The Sockets Networking API, Vol. 1, 3rd ed, W. Richard Stevens, Bill Fenner, Andrew M. Rudoff, Addison-Wesley, 2004, ISBN 0-13-141155-1 – chapter 2: The Transport Layer: TCP, UDP, and SCTP – chapter 9: Elementary SCTP Sockets – chapter 10: SCTP Client/Server Example – chapter 23: Advanced SCTP Sockets

Thank You