Advanced Computer Networks: Lecture 3. This lecture will cover the following: protocol machinery; message transmission using layers; open system interconnect (OSI) architecture; TCP/IP architecture; protocol acronyms; elements of a protocol implementation; network application programming interface (API);...
CS716 Advanced Computer Networks By Dr. Amir Qayyum Lecture No. 3 Protocol Machinery Multiplexing and Demultiplexing (demux key) Encapsulation (header/body) in peertopeer interfaces indirect communication (except at hardware level) each protocol adds a header part of header includes demultiplexing field (e.g., pass up to request/reply or to message stream?) Encapsulation Host Host Application program Application program Data Data RRP RRP RRP Data RRP Data HHP HHP HHP RRP Data Message Transmission Using Layers Standard Architectures • Open System Interconnect (OSI) Architecture – International Standards Organization (ISO) – International Telecommunications Union (ITU), formerly CCITT – “X dot” series: X.25, X.400, X.500 – Primarily a reference model OSI Architecture End host End host User level OS kernel Application Application Application Presentation Presentation Data formatting Session Session Connection management Transport Transport Processtoprocess communication channel Network Network Network Network Data link Data link Data link Data link Physical Physical Physical Physical Hosttohost packet delivery Framing of data bits Transmission of raw bits One or more nodes within the network Internet Architecture • TCP/IP Architecture – Developed with ARPANET and NSFNET – Internet Engineering Task Force (IETF) • Culture: implement, then standardize • OSI culture: standardize, then implement – Became popular with release of Berkeley Software Distribution (BSD) Unix; i.e. free software – Standard suggestions traditionally debated publically through “Request For Comments” (RFC’s) Internet Architecture • Implementation and design done together • Hourglass Design (bottleneck is IP) • Application vs Application Protocol (FTP, HTTP) FTP HTTP NV TFTP UDP TCP IP NET1 NET2 … NETn Internet Architecture • Layering is not very strict Application TCP UDP IP Network 10 ProtocoltoProtocol Interface • A protocol interacts with a lower level protocol like an application interacts with underlying network • Why not using available network APIs for PPI ? – Inefficiencies built into the socket interface • application programmer tolerate them to simplify their task – inefficiency at one level • protocol implementers do not tolerate them 23 ProtocoltoProtocol Interface Issues • Configure multiple layers – static versus extensible • Process Model – avoid context switches • Buffer Model – avoid data copies 24 Process Model procedure call interprocess communication (a) ProcessperProtocol (b) ProcessperMessage 25 Process Model (cont.) TCP send(IP, message) deliver(TCP, message) IP int send(Protocol llp, Msg *message) int deliver(Protocol hlp, Msg *message) 26 Buffer Model Application process buffer copy buffer copy send() deliver() Topmost protocol 27 Message Library • Add header m • Strip header m abcdefg abcdefg bcopy (“ xyz” , hdr , 3); msgAddHdr (m, hdr, 3); hdr =msgStripHdr (m, 3); m m defg + hdr = “ abc” xyzabcdefg 28 Message Library (cont) • Fragment message m m1 abcdefg m + m2 abcd msgFragment (m, new, 3); new defg • Reassemble messages abc efg msgReassemble(new, m1, m2) new abcdefg 29 Network Programming • Things to learn – Internet protocols (IP, TCP, UDP, …) – Sockets API (Application Programming Interface) • Why IP and sockets • allows a common name space across most of Internet – IP (Internet Protocol) is standard • reduces number of translations, which incur overhead – Sockets: reasonably simple and elegant Unix interface (most servers run Unix) 30 OSI Model application layers Internet Protocols FTP network physical NV TFTP UDP TCP transport data link HTTP IP FDDI Ethernet … ATM 31 Programming transport network • learn to use Internet for communication (with focus on implementation of networking concepts) data link physical Principles and concepts • learn to build network from ground up 32 Socket Programming • Reading: Stevens 2nd edition, Chapter 16 • Sockets API: a transport layer service interface – – – – introduced in 1981 by BSD 4.1 implemented as library and/or system calls similar interfaces to TCP and UDP can also serve as interface to IP (for superuser); known as “raw sockets” – Linux also provides interface to MAC layer (for super user); known as “datalink sockets” 33 Outline • • • • • • Clientserver model TCP connections UDP services Addresses and data Sockets API Example of usage 34 ClientServer Model • Asymmetric relationship • Server/daemon – wellknown name – waits for contact – process requests, sends replies • Client server client client client – initiates contact – waits for response 35 ClientServer Model • Bidirectional communication channel • Service models – sequential: server processes only one client’s requests at a time – concurrent: server processes multiple clients’ requests simultaneously – hybrid: server maintains multiple connections, but processes requests sequentially • Server and client categories not disjoint – server can be client of another server – server as client of its own client (peertopeer architecture) 36 Review Lecture 3 • • • • • • • • Protocol Machinery Encapsulation Standard architectures: OSI, Internet Network models and layering Elements of protocol implementation Network software Network API – Socket API – PPI Process and buffer model Programming – Client server model 37 ... hdr , 3) ; msgAddHdr (m, hdr, 3) ; hdr =msgStripHdr (m, 3) ; m m defg + hdr = “ abc” xyzabcdefg 28 Message Library (cont) • Fragment message m m1 abcdefg m + m2 abcd msgFragment (m, new, 3) ; new... user); known as “datalink sockets” 33 Outline • • • • • • Clientserver model TCP connections UDP services Addresses and data Sockets API Example of usage 34 ClientServer Model • Asymmetric relationship... server can be client of another server – server as client of its own client (peertopeer architecture) 36 Review? ?Lecture? ?3 • • • • • • • • Protocol Machinery Encapsulation Standard architectures: OSI, Internet