Sunday, November 18, 2007

OSI and TCP/IP


The principles that were applied to arrive at the seven layers are as follows:

  1. A layer should be created where a different level of abstraction is needed.
  2. Each layer should perform a well defined function.
  3. The function of each layer should be chosen with an eye toward defining internationally standardized protocols.
  4. The layer boundaries should be chosen to minimize the information flow across the interfaces.
  5. The number of layers should be large enough that distinct functions need not be thrown together in the same layer out of necessity, and small enough that the architecture does not become unwieldy.

Note: the OSI model itself is not a network architecture because it does not specify the exact services and protocols to be used in each layer. It just tells what each layer should do.

The physical layer

The physical layer is concerned with transmitting raw bits over a communication channel.

The major goal: making sure that when one side sends a 1 bit, it is received by the other side as a 1 bit, not as a 0 bit.

Typical questions (main design issues):

  • How many volts should be used to represent a 1 and how many for a 0.
  • How many microseconds a bit lasts.
  • Whether transmission may proceed simultaneously in both directions.
  • How the initial connection is established and how it is torn down when both sides are finished.
  • How many pins the network connector has and what each pin is used for.
These issues belong to the domain of the electrical engineer.

The data link layer

It takes a raw transmission facility from the physical layer and transforms it into a line that appears free of undetected transmission errors to the network layer.

Main design issues:

  • Break the input data up into data frames and transmit the frames sequentially.
  • Process the acknowledgement frames sent back by the receiver.
  • Retransmit lost or damaged frames, and solve the problem of possible duplicate frames.
  • Offer several different service classes to the network layer, each of a different quality and price.
  • Use some traffic regulation mechanism to let the transmitter know how much buffer space the receiver has at the moment. This flow regulation is frequently integrated with error handling.
  • A Medium ACcess (MAC) sublayer is introduced to deal with the access control over the shared channel in broadcast networks.

The network layer

The main task of this layer is to control the operation of the subnet.

  • Routing from source to destination: static, dynamic (per session or per packet). Congestion control.
  • Allowing heterogeneous networks to be interconnected (internetworking): different addressing, length of packet, and protocols.
  • Accounting: count the number of packets or character per customer.

In broadcast networks, the routing problem is simple, so the network layer is often thin or even nonexistent.

The transport layer

The basic function of this layer is to

  • accept data from the session layer,
  • split it up into smaller units if need be,
  • pass these to the network layer, and
  • ensure that the pieces all arrive correctly at the other side.
All these must be done efficiently.

Connection management

  • Each transport connection corresponds to one network connection (in normal conditions).
  • Each transport connection corresponds to multiple network connections (for a high throughput).
  • Multiple transport connections correspond to one network connection (for convenience and low cost).

  • A distinction must be made among multiple connections entering and leaving each host (using transport header ).
  • A naming mechanism is needed so that a process on one host has a way of describing with whom it wishes to converse (establishing a connection).

Type of services

  • An error-free point-to-point channel that delivers messages in the order in which they were sent.
  • Isolated messages with no guarantee about the order of delivery.
  • Broadcasting of messages to multiple destinations.
The type of service is determined when the connection is established.

The transport layer is a true source-to-destination or end-to-end layer. Flow control between hosts is also needed but different from between routers (similar principles will apply to both).

The session layer

This layer provides enhanced services useful in some applications, e.g., remote login, remote file transfer.

The presentation layer

Unlike all the lower layers, which are interested in transmitting messages over the network, this layer is concerned with the syntax and semantics of the information transmitted.

Typical services:

  • Encode data in a standard agreed upon way to facilitate information exchange among heterogeneous systems using different codes for strings (e.g., ASCII and Unicode), integers (e.g., one's complement and two's complement), and so on.
  • Data compression for reducing the number of bits to be transmitted.
  • Cryptography for privacy and authentication.

The application layer

This layer contains a variety of commonly needed protocols.

Typical services:

  • Transfer files among different file systems.
  • Electronic mails among different systems.
  • Remote job entry, directory lookup, and various other general-purpose and special-purpose facilities.

The TCP/IP reference model

The TCP/IP model was used in the grandparent of all computer networks, the ARPANET, and its successor, the worldwide Internet.

Major design goals:

  • The ability to connect multiple networks together in a seamless way.
  • The ability to survive loss of subnet hardware, with conversations not being broken off.
  • A flexible architecture for supporting applications with divergent requirements, ranging from transferring files to real-time speech transmission.

All these goals led to the choices of a packet-switching network based on a connectionless internetwork layer, called the internet layer.

The internet layer

The official packet format and protocol at this layer is called IP (Internet Protocol).

Its job is to inject IP packets into any network and have them travel independently to the destination (potentially on a different network).

The TCP/IP internet layer is very similar in functionality to the OSI network layer, as shown in Figure



The transport layer

It is the same in functionality as the OSI transport layer.

Two official end-to-end protocols:

  • TCP (Transmission Control Protocol): a reliable connection-oriented protocol.
  • UDP (User Datagram Protocol): an unreliable connectionless protocol.

The relation of IP, TCP, and UDP is shown in above Figure



The application layer

The TCP/IP model does not have session or presentation layers, which are of little use to most applications.

The top application layer contains all the higher-level protocols, as shown in Figure .Many other protocols, such as HTTP used on the World Wide Web, have been added over the years.

The host-to-network layer

The layer below the internet layer is a great void. The TCP/IP model just points out that the host has to connect to the network using some protocol so it can send IP packets over it. This protocol is not defined and varies from host and network to network.

A comparison of the OSI and TCP/IP reference models

Fundamental similarities:

  • The same concept of a stack of independent protocols.
  • Similar functionality of the layers.

The three central concepts to the OSI model:

  1. Services: which tell what the layer does, not how entities above it access it or how the layer works.
  2. Interfaces: which tell the processes above it how to access it (i.e., what the parameters and results are), not how the layer works inside.
  3. Protocols: which are used between peer entities to implement the offered services.

The biggest contribution of the OSI model is to make the distinction between these three concepts explicit. The TCP/IP model did not clearly distinguish them.

Other major differences:

  • The OSI model was devised before the protocols were invented, but the reserve was true with the TCP/IP model.
  • The OSI model has seven layers, but the TCP/IP model has only five layers.
  • The OSI model supports both connection-oriented and connectionless communication in the network layer, but only connection-oriented communication in the transport layer.

    The TCP/IP model has only connectionless mode in the internet layer, but has both modes in the transport layer.

A critique of the OSI model and protocols

Summary:

  • Bad timing.
  • Bad technology.
  • Bad implementation.
  • Bad politics.
Read the text for (very instructive) details.

A critique of the TCP/IP reference model

  • No clear distinguishment of the concepts of service, interface, and protocol not much of a guide for designing new networks using new technologies.
  • Not general and poorly suited to describing any protocol stack other than TCP/IP, e.g., SNA.
  • The host-to-network layer is not really a layer at all, but an interface (between the network and data link layers).
  • No distinguishment of the physical and data link layers.
  • Prococols other than the IP and TCP were ad hoc.

Summary:

  • The OSI model minus the session and presentation layers) is exceptionally useful for discussing computer networks, but the OSI protocols have not become popular.
  • The TCP/IP model is practically nonexistent, but the protocols are widely used.

Thursday, November 15, 2007

OSI refrence model

OSI (Open Systems Interconnection)

The OSI Reference Model
In 1983, the International Standards Organization (ISO) created the OSI, or X.200, model. It is a multilayered model for facilitating the transfer of information on a network. The OSI model is made up of seven layers, with each layer providing a distinct network service. By segmenting the tasks that each layer performs, it is possible to change one of the layers with little or no impact on the others. For example, you can now change your network configuration without having to change your application or your presentation layer.

The OSI model was specifically made for connecting open systems. These systems are designed to be open for communication with almost any other system. The model was made to break down each functional layer so that overall design complexity could be lessened. The model was constructed with several precepts in mind:

1) Each layer performs a separate function;
2) The model and its levels should be internationally portable; and
3) The number of layers should be architecturally needed, but not unwieldy.

Each layer of the model has a distinct function and purpose:

Application layer--Provides a means for the user to access information on the network through an application. This layer is the main interface for the user to interact with the application and therefore the network. Examples include file transfer (FTP), DNS, the virtual terminal (Telnet), and electronic mail (SMTP).

Presentation layer--Manages the presentation of the information in an ordered and meaningful manner. This layer's primary function is the syntax and semantics of the data transmission. It converts local host computer data representations into a standard network format for transmission on the network. On the receiving side, it changes the network format into the appropriate host computer's format so that data can be utilized independent of the host computer. ASCII and EBCDIC conversions, cryptography, and the like are handled here.

Session layer--Coordinates dialogue/session/connection between devices over the network. This layer manages communications between connected sessions. Examples of this layer are token management (the session layer manages who has the token) and network time synchronization.

Transport layer--Responsible for the reliable transmission of data and service specification between hosts. The major responsibility of this layer is data integrity--that data transmitted between hosts is reliable and timely. Upper layer datagrams are broken down into network-sized datagrams if needed and then implemented using the appropriate transmission control. The transport layer creates one or more than one network connection, depending on conditions. This layer also handles what type of connection will be created. Two major transport protocols are the TCP (Transmission Control Protocol) and the UDP (User Datagram Protocol

Network layer--Responsible for the routing of data (packets) to a system on the network; handles the addressing and delivery of data. This layer provides for congestion control, accounting information for the network, routing, addressing, and several other functions. ). IP (Internet Protocol) is a good example of a network layer interface.

Data link layer--Provides for the reliable delivery of data across a physical network. This layer guarantees that the information has been delivered, but not that it has been routed or accepted. This layer deals with issues such as flow regulation, error detection and control, and frames. This layer has the important task of creating and managing what frames are sent out on the network. The network data frame, or packet, is made up of checksum, source address, destination address, and the data itself. The largest packet size that can be sent defines the maximum transmission unit (MTU).

Physical layer--Handles the bit-level electrical/light communication across the network channel. The major concern at this level is what physical access method to use. The physical layer deals with four very important characteristics of the network: mechanical, electrical, functional, and procedural. It also defines the hardware characteristics needed to transmit the data (voltage/current levels, signal strength, connector, and media). Basically, this layer ensures that a bit sent on one side of the network is received correctly on the other side.
Data travels from the application layer of the sender, down through the levels, across the nodes of the network service, and up through the levels of the receiver. Not all of the levels for all types of data are needed--certain transmissions might not be valid at a certain level of the model.

To keep track of the transmission, each layer "wraps" the preceding layer's data and header with its own header. A small chunk of data will be transmitted with multiple layers attached to it. On the receiving end, each layer strips off the header that corresponds to its respective level.

The OSI model should be used as a guide for how data is transmitted over the network. It is an abstract representation of the data pathway and should be treated as such.

Saturday, October 20, 2007

.NET Assemblies

Introduction :
You must have heard the word assembly many times in .NET documentation. In this article I will share some thing about .NET assemblies
.

What is an assembly?

The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.


What is assembly manifest?
Assembly manifest is a data structure which stores information about an assembly
This information is stored within the assembly file (DLL/EXE) itself
The information includes version information, list of constituent files etc.

Wednesday, October 17, 2007

single link_list program in c++

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>


class list
{
struct node
{
int data;
node *link;
}*p;
public:
void inslast(int);
void insbeg(int);
void insnext(int,int);
void delelement(int);
void delbeg();
void dellast();
void disp();
int seek(int);
list(){p=NULL;}
~list();
};

void list::inslast(int x)
{
node *q,*t;
if(p==NULL)
{
p=new node;
p->data=x;
p->link=NULL;
}
else
{
q=p;
while(q->link!=NULL)
q=q->link;
t=new node;
t->data=x;
t->link=NULL;
q->link=t;
}
cout<<"Inserted successfully at the end..";
disp();
}

void list:: insbeg(int x)
{
node *q;
q=p;
p=new node;
p->data=x;
p->link=q;
cout<<"
Inserted successfully at the begining..";
disp();
}


void list::delelement(int x)
{
node *q,*r;
q=p;
if(q->data==x)
{
p=q->link;
delete q;
return;
}
r=q;
while(q!=NULL)
{
if(q->data==x)
{
r->link=q->link;
delete q;
return;
}
r=q;
q=q->link;
}
cout<<"
Element u entered "<<x<<" is not found..";
}

void list:: delbeg()
{
cout<<" The list before deletion:";
disp();
node *q;
q=p;
if(q==NULL)
{
cout<<" No data is present..";
return;
}
p=q->link;
delete q;
return;
}


void list:: dellast()
{
cout<<"
The list before deletion:";
disp();
node *q,*t;
q=p;
if(q==NULL)
{
cout<<"
There is no data in the list..";
return;
}
if(q->link==NULL)
{
p=q->link;
delete q;
return;
}

while(q->link->link!=NULL)
q=q->link;
q->link=NULL;
return;
}

list::~list()
{
node *q;
if(p==NULL) return;
while(p!=NULL)
{
q=p->link;
delete p;
p=q;
}
}

void list::disp()
{
node *q;
q=p;
if(q==NULL)
{
cout<<" No data is in the list..";
return;
}
cout<<" The items present in the list are :";
while(q!=NULL)
{
cout<<" "<<q->data;
q=q->link;
}
}

void list :: insnext(int value,int position)
{
node *temp,*temp1;
temp=p;
if(temp1==NULL)
{
temp1= new node;
temp1->data=value;
temp1->link=NULL;
p=temp1;
return;
}
for(int i=0;((i<position)&&(temp->link!=NULL)) ;i++)
{
if(i==(position-1))
{
temp1= new node;
temp1->data= value;
temp1->link=temp->link;
temp->link=temp1;
}
temp=temp->link;
}
//cout<<" Inserted successfully at the position.."<<position;
disp();
}


int list::seek(int value)
{
node *temp;
temp=p;
int position=0;
while(temp!=NULL)
{
if(temp->data==value)
return position+1;
else
{
temp=temp->link;
position=position+1;
}
}
cout<<" Element "<<value<<" not found";
return 0;
}


void main()
{
list l;
int ch,v,p,ps;
do
{
clrscr();
cout<<" Operations on List..";
cout<<"
1.Insertion
2.Deletion
3.Display
4.Seek
5.Exit";
cout<<" Enter ur choice:";
cin>>ch;

switch(ch)
{
case 1:
cout<<"1.Insertion at begining 2.Insertion at the end";
cout<<"3.Insertion after the mentioned position";
cout<<" Enter ur choice:";
cin>>ps;
cout<<" Enter the value to insert:";
cin>>v;
switch(ps)
{
case 1:
l.insbeg(v);
break;
case 2:
l.inslast(v);
break;
case 3:
cout<<" Enter the position to insert the value:";
cin>>p;
l.insnext(v,p);
break;

default:
cout<<" The choice is invalid";
return;
}
break;

case 2:
cout<<"1.Delete the first element 2.Delete the last element";
cout<<"3.Enter the element to delete from the list";
cout<<" Enter ur choice:";
cin>>ps;
switch(ps)
{
case 1:
l.delbeg();
cout<<" The list after deletion:";
l.disp();
break;
case 2:
l.dellast();
cout<<" The list after deletion:";
l.disp();
break;
case 3:
l.disp();
cout<<" Enter the element to delete : ";
cin>>v;
l.delelement(v);
cout<<" The list after deletion:";
l.disp();
break;

default:
cout<<" The option is invalid...";
break;
}
break;

case 3:
l.disp();
break;

case 4:
l.disp();
cout<<" Enter the element to search:";
cin>>v;
cout<<" The position of the element "<< v<<" is "<<l.seek(v);
getch();
break;

case 5:
exit(1);

default:
cout<<" The option is invalid...";
return;
}
getch();
}
while(ch!=5);
getch();
return;
}

C-Programes


  1. WAP to find greatest among two rnumbers using conditional operators?

  2. WAP to find area of triangle using hero’s formula?
  3. Admission to PGDCA class is suspected to following condition:
    marks in matriculation >=50%
    marks in chemistry >=40%
    marks in physics >=45%
    total in all three subjects >=180
    Scan the marks from keyboard. Write a program to display list of eligible candidates.
  4. WAP that will read value of x & evaluate the following function:
    i. y = 5 if x>0
    ii. y = 0 if x=0
    iii. y = -5 if x<0
  5. WAP to find sum of digits?
  6. WAP to check if the given number is peridrom?
  7. WAP to print fibonaci series?
  8. WAP to find factorial of any number?
  9. WAP to check if the entered number is prime or not?
  10. WAP to Print
    *
    * *
    * * *
    * * * *
    * * * * *
  11. WAP a program to swap two numbers using pointers?
  12. WAP to Print
    *
    * *
    * * *
    * * * *
    * * * * *
  13. WAP to print
    1
    2 2
    3 3 3
    4 4 4 4
    5 5 5 5 5
  14. Write a recursion function to find factorial of n?
  15. Write a recursion function to print fibonaci series up to n terms?
  16. WAP to find sum of array elements?
  17. WAP to find product of two matrix?
  18. WAP to find transpose of a matrix?
  19. Write a function to print array elements using pointers?
  20. WAP to find greatest element in 2-D array?
  21. Write a function to find length of string?
  22. Write a function to reverse a string?
  23. WAP to compare two strings
  24. Design a structure named student to store data about a student which contains following info.:
    i. Data items type
    ii. Roll.no. int
    iii. Name char[20]
    iv. Class char[10]
    v. Marks int
    Assume that there are not more than 50 students .W.a.p to input data about students &
    Output stored items?
  25. Demonstrate concepts of nested structures.Consider employee, address, contact as structur

Monday, October 15, 2007

Data Structures using C++

  1. WAP to insert an element into Linear Array at specific position.
  2. WAP to delete an element into Linear Array at specific position.
  3. WAP to delete duplicates from a linear array.
  4. WAP to search largest and smallest element in a linear array.
  5. WAP to add, subtract and multiply matrices
  6. WAP to insert a node into simple linked list at the beginning.
  7. WAP to insert a node into a simple linked list at the end of the list.
  8. WAP to search an element from linked list.
  9. WAP to delete an element from a simple linked list.
  10. WAP to insert a node into the right of node in doubly linked list.
  11. WAP to insert a node into the left most node in doubly linked list.
  12. WAP to insert an element at particular location in doubly linked list.
  13. WAP to delete a node at particular location in doubly linked list.
  14. WAP to merge two-sorted single linked list.
  15. WAP to reverse a link list.
  16. WAP to sort an unsorted single linked list
  17. WAP to implement STACK using array.
  18. WAP to implement STACK using Linked List.
  19. WAP to check Parenthesis in an arithmetic expression using STACK
  20. WAP to convert completely parenthesized expression to postfix expression.
  21. WAP to implement QUEUE using Circular Array.
  22. WAP to implement QUEUE using Single Linked List.
  23. WAP to implement Linear Search
  24. WAP to implement Binary Search
  25. WAP to implement Bubble Sort.
  26. WAP to implement Insertion Sort.
  27. WAP to impalement QUICK Sort.
  28. WAP to implement Selection sort.
  29. Implement following operations on binary search tree
    · Insert a node
    · Delete a node
    · Traverse tree using recursion
    · Search a node
  30. Implement heap sort algorithm in C++.

Sunday, October 14, 2007

C++ Programmes

  1. WAP to find greatest of three numbers using conditional operator.
  2. WAP to find greatest of three numbers using if statement only.
  3. WAP to find sum of digit.
  4. WAP to check whether a given String is palindrome or not.
  5. WAP to store/show employee information (Name, age, address) in structure.
  6. WAP to demonstrator concept of nested structure.
  7. WAP to compare two strings using user defined functions.
  8. WAP to demonstrate how we can print structure value using pointers
  9. WAP to find length of a string using user defined function
  10. WAP to compare two strings using user defined function
  11. WAP to copy a string
  12. . WAP to demonstrate use of access specifier in classes
  13. . WAP to demonstrate an array of bank acc object where acc class consist of acno, name and balance as data members
  14. . WAP to demonstrate passing of an object by value
  15. WAP to demonstrate passing of an object by address
  16. WAP to add two matrices by returning as object form a function using classes and objects
  17. WAP that calculate total number of object created.
  18. WAP to enter time in hours, minutes and seconds and display time in universal format (2:00 pm =14:00)
  19. WAP to generate fibonacci series using object.
  20. WAP to calculate distance between two points using constructors. If (x1,y1) and (x2,y2) are two points then distance between them is:
    D=√(x2-x1)2+(y2-y1)2
  21. WAP to implement basic operation of stack using class
  22. WAP to add two times and display output in proper format
  23. Write a class Box with its data members width, length and height. Initialize data members using default, parameterized and copy constructors and calculate volume of the box.
  24. WAP to overload increment operator for prefix and postfix increment on time class
  25. WAP to overload comparison operator == for strings
  26. WAP to overload >= operator for date object
  27. WAP to demonstrate operator overloading for unary operator using friend functions
  28. WAP to demonstrate operator overloading for binary operator using friend functions
    29. WAP to demonstrate concept of friend functions
    30. WAP to demonstrate friend function act as bridge between two different classes
    31. WAP to show how we can create dynamic objects
    32. WAP to create an array of dynamic object
    33. WAP to demonstrate how to declare entire class as a friend of another class
    34. WAP to demonstrate the concept of overriding
    35. WAP to demonstrate public, private and protected inheritance
    36. WAP to calculate result of students using private inheritance
    37. WAP to demonstrate multilevel and multiple inheritance
    38. WAP to demonstrate hybrid inheritance
    39. WAP to show behavior of constructor in multiple and multilevel inheritance
    40. Design an application for hospital management system. For this create the following classes and members
    Person(name, dob, sex)
    Doctor(specialization)
    Patient(Caseno, disease, doadmin, dodis, billno)
    Write functions to input data from user and display data to user
  29. Design a railway traffic control system. Where TRAIN is a Base class for PASSENGER_TRAIN and GOODS_TRAIN classes. Each class contain following members:
    TRAIN( TrainNo, Source, Destination, NoOfBogies)
    PASSENGER_TRAIN(NoOfPassengerPerBogy)
    GOODS_TRAIN(LoadingCapacityPerBogy)
    Write functions to get data from user and display to user
  30. WAP to demonstrate the behavior of parameterized constructor in multilevel inheritance
  31. WAP to demonstrate #define, #include, #if, #else, #endif, #ifdef #undef
  32. WAP to sum of two number using #define