Document Sample
1a TCP-IP Powered By Docstoc
					OSI-RM (Open Systems Interconnect Reference Model)
The purpose of the OSI reference model.

The OSI reference model is the primary model for network communications. Although there are other models in
existence, most network vendors, today, relate their products to the OSI reference model, especially when they
want to educate users on the use of their products. They consider it the best tool available for teaching people
about sending and receiving data on a network.

The OSI reference model allows users to view the network functions that occur at each layer. It is a method of
illustrating how information travels throughout a network. It explains, visually, how information, or data, travels
from application programs (e.g. spreadsheets, documents, etc.), through a network medium (e.g. wires, etc.), to
another application program that is located in another computer on a network, even if the sender and receiver
have different types of networks.

In the OSI reference model, there are seven numbered layers, each of which illustrates a particular network
function. This separation of networking functions is called layering. Dividing the network into these seven
layers provides the following advantages:

   divides the interrelated aspects of network operation into less complex elements
   defines standard interfaces for plug-and-play compatibility and multi-vendor integration
   enables engineers to specialize design and promote symmetry in the different internetwork modular
    functions so that they interoperate
   prevents changes in one area from affecting other areas, so that each area can evolve more quickly
   divides the complexity of internetworking into discrete, more easily learned, operation subsets

The seven layers of the OSI model.

The problem of moving information between computers is divided into seven smaller and more manageable
problems in the OSI reference model. Each of the seven smaller problems is represented by its own layer in the
model. The seven layers of the OSI reference model are:

Layer 1: The Physical Layer
Layer 2: The Data Link Layer
Layer 3: The Network Layer
Layer 4: The Transport Layer
Layer 5: The Session Layer
Layer 6: The Presentation Layer
Layer 7: The Application Layer

An easy way to help you memorize the names of the layers might be to use a mnemonic device such as All
People Seem To Need Data Processing.

Description of each of the seven layers of the OSI model.

Each individual OSI layer has a predetermined set of functions that it must perform in order for communication
to occur. The seven layers and their functions can be described, in detail, as follows:

Layer 7: The application layer

The application layer is the OSI layer that is closest to the user; it provides network services to the user’s
applications. It differs from the other layers in that it does not provide services to any other OSI layer, but rather
only to application processes outside the scope of the OSI model. Examples of such application processes are
spreadsheet programs, word processing programs, and banking terminal programs.
The application layer identifies and establishes the availability of intended communication partners,
synchronizes cooperating applications, and establishes agreement on procedures for error recovery and control
of data integrity. It also determines whether sufficient resources for the intended communication exist. If you
want to remember Layer 7 in as few words as possible, think of browsers.

Layer 6: The presentation layer

The presentation layer ensures that the information that the application layer of one system sends out is readable
by the application layer of another system. If necessary, the presentation layer translates between multiple data
representation formats by using a common data representation format. If you want to think of Layer 6 in as few
words as possible, think of encoding, representation of data, ASCII.

Layer 5: The session layer

As its name implies, the session layer establishes, manages, and terminates sessions between applications.
Sessions consist of dialogues between two or more presentation entities. The session layer provides its services
to the presentation layer. Also, the session layer synchronizes dialogue between presentation layer entities and
manages their data exchange. In addition to basic regulation of conversations (sessions), the session layer offers
provisions for data expedition, class of service, and exception reporting of session layer, presentation layer, and
application layer problems. If you want to remember Layer 5 in as few words as possible, think of dialogues and

Layer 4: The transport layer

The transport layer segments and reassembles data into a data stream. The boundary between the session layer
and the transport layer can be thought of as the boundary between media-layer protocols and host-layer
protocols. Whereas the application, presentation, and session layers are concerned with application issues, the
lower three layers are concerned with data transport issues.

The transport layer attempts to provide a data transport service that shields the upper layers from transport
implementation details. Specifically, issues such as how reliable transport over an internetwork is accomplished
are the concern of the transport layer. In providing reliable service, the transport layer provides mechanisms for
the establishment, maintenance, and orderly termination of virtual circuits, transport fault detection and
recovery, and information flow control, to prevent one system from overrunning another with data. If you want
to remember Layer 4 in as few words as possible, think of quality of service, and reliability.

Layer 3: The network layer

The network layer is a complex layer that provides connectivity and path selection between two end systems
that may be located on geographically diverse networks. You'll learn more about Layer 3 in Chapter 3,
"Networking Devices." If you want to remember Layer 3 in as few words as possible, think of path selection,
switching, addressing, and routing.

Layer 2: The data link layer

The data link layer provides reliable transit of data across a physical link. In so doing, the data link layer is
concerned with physical (as opposed to network, or logical) addressing, network topology, line discipline (how
end systems use the network link), error notification, ordered delivery of frames, and flow control. If you want
to remember Layer 2 in as few words as possible, think of naming, framing, and of media access control.

Layer 1: The physical layer

The physical layer defines the electrical, mechanical, procedural, and functional specifications for activating,
maintaining, and deactivating the physical link between end systems. Such characteristics as voltage levels,
timing of voltage changes, physical data rates, maximum transmission distances, physical connectors, and other,
similar, attributes are defined by physical layer specifications. If you want to remember Layer 1 in as few words
as possible, think of signals and media.
TCP/IP & Internet
The TCP/IP protocols are used in tens of thousands of networks to connect millions of machines throughout the
world. The largest collection of such networks is the Internet. Although the OSI model is universally
recognized, the historical and technical open standard of the Internet is the TCP/IP reference model and the
TCP/IP protocol stack. To get up-to-date information on networking models and standards, visit the following


The largest growth of the Internet is in LANs. Most of these LANs use Ethernet technology with TCP/IP. As
new LAN technologies (E.g. ATM, Fibre Channel) become available, they are implemented to work with the
TCP/IP protocol suite.

The Internet is not a single network, rather an internetwork consisting of many smaller networks. The TCP/IP
protocol suite makes this internetwork possible by providing common services over the diverse set of underlying
protocols and physical network hardware. The key protocol in the stack is the Internet Protocol (IP) which
provides a common address space and routes the packets of data across the entire internet. The Transmission
Control Protocol (TCP) provides extremely reliable data transmission over IP. Another protocol, User
Datagram Protocol (UDP), provides a discrete packet delivery service for applications, like a messaging
service, without guarantee of delivery. Both TCP and UDP rely on IP.

Description of the layers of the TCP/IP model.
The U.S. Department of Defense (DoD) created the TCP/IP model because it wanted a network that could
survive any conditions, even a nuclear war. The Department of Defense wants its packets to get through, every
time, under any conditions, from any one point to any other point. It was this very difficult design problem that
brought about the creation of the TCP/IP model, and which has since then become the standard on which the
Internet has grown. To read about the history of the Internet:


The TCP/IP model has four layers: the application layer, the transport layer, the Internet layer, and the host-to-
network layer.

Application Layer
The designers of TCP/IP felt that the higher level protocols should include session and presentation layer details,
so they simply created an application layer that handles high-level protocols, issues of representation, encoding,
and dialog control. The TCP/IP combines all application-related issues into one layer, and assumes this data is
properly packaged for the next layer.

Transport Layer
The transport layer deals with the quality-of-service issues of reliability, flow control, and error correction. One
of its protocols, the transmission control protocol (TCP), provides excellent and flexible ways to create reliable,
well-flowing, low-error network communications. TCP is a connection-oriented protocol. It dialogues between
source and destination while packaging application layer information into units called segments. Connection
oriented does not mean that a circuit exists between the communicating computers (that could be circuit
switching). It does mean that Layer 4 segments travel back and forth for some period.

Internet Layer
The purpose of the Internet layer is to send source packets from any network on the internetwork and have them
arrive at the destination independent of the path and networks they took to get there. The specific protocol that
governs this layer is called the Internet protocol (IP). Best path determination and packet switching occur at this
Host-to-Network Layer
This is the layer that is concerned with all of the issues that an IP packet requires to actually make a physical
link, and then to make another physical link. It includes the LAN and WAN technology details, and all the
details in the OSI physical and data link layers. Sometimes this layer is actually divided into two layers: the
Network Interface layer, and the Physical layer, corresponding to the data link and physical layers of the OSI
model respectively.

Comparison of the OSI model with the TCP/IP model, layer by layer.

                TCP/IP Model                                        OSI Model

          Application         Protocols                     Application           Host
           No Layers                                        Presentation

           Transport                                         Transport

            Internet                                          Network            Media
            Host to           Networks                       Data Link

Here are the more important similarities and differences between the OSI model and the TCP/IP models:

   Both have comparable transport and network layers
   Packet-switched (not circuit-switched) technology is assumed

   TCP/IP combines the presentation and session layer issues into its application layer
   TCP/IP combines the OSI data link and physical layers into one layer
   TCP/IP protocols are the standards around which the Internet developed, so the TCP/IP model gains
    credibility just because of its protocols. In contrast, no networks are built around specific OSI-related
    protocols, even though everyone uses the OSI model to guide their thinking.
Service Primitives in TCP/IP

IP Primitives (from RFC 1122, see also RFC 791)
       Send Datagram
         SEND(src, dst, prot, TOS, TTL, BufPTR, len, Id, DF, opt
            => result )
       Receive Datagram
         RECV(BufPTR, prot
            => result, src, dst, SpecDest, TOS, len, opt)
       Select Source Address
         GET_SRCADDR(remote, TOS) -> local
       Find Maximum Datagram Sizes
         GET_MAXSIZES(local, remote, TOS) -> MMS_R, MMS_S
       Advice on Delivery Success
         ADVISE_DELIVPROB(sense, local, remote, TOS)
       Send ICMP Message
         SEND_ICMP(src, dst, TOS, TTL, BufPTR, len, Id, DF, opt)
            -> result
       Receive ICMP Message
         RECV_ICMP(BufPTR ) -> result, src, dst, len, opt

Socket Object Functions in Metrowerks CodeWarrior
TCP/UDP functionality is often made available to programmers through sockets. The socket concept
originated with BSD Unix, but has been copied for most other operating systems where TCP/IP is
used. Below are some of the common functions that are used in Metrowerks CodeWarrior to
communicate through sockets.

   BOOL Create( UINT nSocketPort = 0, int nSocketType = SOCK_STREAM, long lEvent =
   lpszSocketAddress = NULL );

   BOOL Listen( int nConnectionBacklog = 5 );

   BOOL Connect( LPCTSTR lpszHostAddress, UINT nHostPort );
   BOOL Connect( const SOCKADDR* lpSockAddr, int nSockAddrLen );

   virtual BOOL Accept( CAsyncSocket& rConnectedSocket, SOCKADDR* lpSockAddr = NULL, int*
   lpSockAddrLen = NULL );

   virtual void Close( );

   virtual int Receive( void* lpBuf, int nBufLen, int nFlags = 0 );

   virtual int Send( const void* lpBuf, int nBufLen, int nFlags = 0 );
IP Datagram Format

     VERS - indicates the version of IP currently used
     HLEN - indicates the IP datagram header length in 32 bit words
     Type-of-Service - level of importance assigned by a particular upper-layer protocol
     Total Length - length of the entire IP packet, including data and header, in bytes
     Identification - contains an integer that identifies the current datagram
     Flags - a 3-bit field in which the low-order 2 bits control fragmentation
     Frag Offset - the field that is used to help piece together datagram fragments
     TTL (Time-to-Live) - gradually decreases to zero, at which point the datagram is discarded
     Protocol - upper-layer protocol to receive incoming packets after IP processing
     Header Checksum - helps ensure IP header integrity
     Source IP Address - specifies the sending node
     Destination IP Address - specifies the receiving node
     IP Options - allows IP to support various options, such as security (variable length)
     Data - contains upper-layer information (variable length, maximum 64 kb)

TCP Segment Format

     Source Port - The number of the calling port
     Destination Port - The number of the called port
     Sequence Number - The number used to ensure correct sequencing of the arriving data
     Acknowledgment Number - The next expected TCP octet
     HLEN - The number of 32-bit words in the header
     Reserved - Set to zero
     Code Bits - The control functions (such as setup and termination of a session)
     Window - The number of octets that the sender is willing to accept
     Checksum - The calculated checksum of the header and data fields
     Urgent Pointer - Indicates the end of the urgent data
     Option - One currently defined: maximum TCP segment size
     Data - Upper-layer protocol data

Shared By: