Monday 31 December 2012

New Year 2013 Wishes

Hi viewers.............."Wish u a happy new and prosperous new year my near and dear......."



Saturday 29 December 2012

Top 10 Differences between Windows XP and Windows 7

If you skipped over Windows Vista like so many others have, you may be in for a shock when you upgrade from Windows XP to Windows 7. Microsoft’s newest operating system is a major shift in usability, convenience, and overall computing from previous versions of Windows.
Although not all are earth-shattering changes, listed below are the Top 10 differences between Windows XP and Windows 7. Many of these changes may seem like a big deal because you've gotten so used to how things work in XP. If you are considering upgrading from XP to Windows 7, be prepared for these changes.

1. No e-mail Client
Outlook Express (OE) has been a trusted friend since Windows 95, so much so that many people have never used another e-mail client. OE was removed from Windows Vista but was replaced with Windows Mail. Strangely, Windows does not ship with any e-mail client at all. Users must either purchase an e-mail client such as Outlook, use a free service such as Windows Live Mail, or download an open source e-mail client such as Thunderbird.

2. 32-bit vs. 64-bit
Although Windows XP did have a 64-bit version (Windows XP x64), many people are unaware that it even existed. When upgrading from XP to Windows 7, you will have to decide whether you want the 32-bit version (x86) or the 64-bit version (x64). Which you choose largely depends on your computer’s hardware and the availability of drivers and other software to make everything work in your PC.

3. Aero Desktop
The Aero Desktop is really nothing more than a collection of window and desktop behaviors that make Windows 7 the prettiest version of the operating system to date. Features such as Aero Snap let you quickly organize open windows and transparency makes it easy to see what’s underneath other windows. With Windows XP think opaque, with Windows 7, think translucent.


4. Documents and Settings
The Documents and Settings folder, the location for all protected personal files and folders, has been replaced with a simple Users folders. Not a big deal, but many tech support personnel have spent hundreds of hours answering the simple question of where the Documents and Settings folder went in Windows 7.

5. Start Menu
The Start menu in Windows 7 has been completely reworked and has been met with several criticisms. No longer does the Start menu use fly-outs and scroll-outs to show you what shortcuts to programs and folders you have on your computer.
Now you must use a more conservative folder system that forces you to use a scroll bar to access shortcuts that can’t be displayed because you’ve reached the maximum number that can be shown at one time. Luckily, if you really like the Windows XP Start menu, there is a way to make the Windows 7 Start menu behave like XP.

6. Ribbon
Introduced in Office 2007, it is clear that Microsoft will continue to push the Ribbon interface over the more familiar drop-down menu and toolbar approach to using programs. If you want to get a taste of the Ribbon, start up Microsoft Paint or WordPad on a computer running Windows 7 and you can see for yourself whether the Ribbon is going to be useful or just another technology forced upon you.

7. Libraries
Windows 7 Libraries are nothing more than collections of files that are similar. Similar content that is located in multiple areas of your computer are brought together into the Library system to make finding files easier.
Of course, you can choose to use or not use Libraries depending on whether you find them useful. However, if you store a lot of media on your computer such as music or video and you want access to them without having to physically move them the same location or folder, Libraries may be for you.

8. DirectX 11
If you are a gamer, you know that you must keep up with advances in both hardware and software technology to get the most from your games. Windows XP will not support DirectX versions beyond 9.0c so if your games require a higher version such as 10 or 11, you have no choice but to move a more recent version of Windows.
As more and more people make the switch to Windows 7, the game developers and publishers are likely to take full advantage of more recent DirectX versions. Stick with XP too long, and you may be shut out of the newest games.

9. HomeGroup
Whether you have a simple or complicated home network, you know that any help you can get to make administration easier is always welcomed. HomeGroup is a major shift in home networking simplicity that makes older paradigms seem archaic.
Not much has changed in setting up a home network since Windows NT 4, an operating system from before Windows 95 that you may never have heard of. Marrying simplicity, easy setup, and stable connections, HomeGroup takes the guesswork and troubleshooting out of home networking on any scale.

10. Touch Support
Although touch interfaces have been around for a better part of a decade, touch has not yet replaced the familiar keyboard/mouse combination of navigating personal computers. Still, Windows 7 is the first operating system from the software giant to natively support touch as a computer interface.
If you think that you would like to be on the frontier of this emerging interface paradigm, Windows 7 is your only real choice if you want to run a Microsoft operating system.

Conclusion
Some people have become so comfortable working with Windows XP that they have avoided upgrading to Microsoft’s newest operating system. The Windows Vista fiasco didn’t help matters, forcing some diehard fans of XP to downgrade to make their PCs functional again.
If you are considering upgrading from Windows XP to Windows 7, be prepared for some new things, some missing things, and a few things in between. Still, the stability and usability of Windows 7 has been more or less established so you can rest assured that you are taking a step in the right direction by leaving XP behind.

Network Layer Design Issues

1. Store-and-Forward Packet Switching 
· The major components of the system are the carrier's equipment (routers connected by transmission lines), shown inside the shaded oval, and the customers' equipment, shown outside the oval.

· Host H1 is directly connected to one of the carrier's routers, A, by a leased line. In contrast, H2 is on a LAN with a router, F, owned and operated by the customer. This router also has a leased line to the carrier's equipment.

· We have shown F as being outside the oval because it does not belong to the carrier, but in terms of construction, software, and protocols, it is probably no different from the carrier's routers.

Figure 3-1. The environment of the network layer protocols.




· This equipment is used as follows. A host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-point link to the carrier. The packet is stored there until it has fully arrived so the checksum can be verified.

· Then it is forwarded to the next router along the path until it reaches the destination host, where it is delivered. This mechanism is store-and-forward packet switching.

2. Services Provided to the Transport Layer

· The network layer provides services to the transport layer at the network layer/transport layer interface. An important question is what kind of services the network layer provides to the transport layer.

· The network layer services have been designed with the following goals in mind.

1. The services should be independent of the router technology.

2. The transport layer should be shielded from the number, type, and topology of the routers present.

3. The network addresses made available to the transport layer should use a uniform numbering plan, even across LANs and WANs.

Given these goals, the designers of the network layer have a lot of freedom in writing detailed specifications of the services to be offered to the transport layer. This freedom often degenerates into a raging battle between two warring factions.

The other camp argues that the subnet should provide a reliable, connection-oriented service. They claim that 100 years of successful experience with the worldwide telephone system is an excellent guide. In this view, quality of service is the dominant factor, and without connections in the subnet, quality of service is very difficult to achieve, especially for real-time traffic such as voice and video.

These two camps are best exemplified by the Internet and ATM. The Internet offers connectionless network-layer service; ATM networks offer connection-oriented network-layer service. However, it is interesting to note that as quality-of-service guarantees are becoming more and more important, the Internet is evolving.

3. Implementation of Connectionless Service

Two different organizations are possible, depending on the type of service offered. If connectionless service is offered, packets are injected into the subnet individually and routed independently of each other. No advance setup is needed.

In this context, the packets are frequently called datagrams (in analogy with telegrams) and the subnet is called a datagram subnet. If connection-oriented service is used, a path from the source router to the destination router must be established before any data packets can be sent.

This connection is called a VC (virtual circuit), in analogy with the physical circuits set up by the telephone system, and the subnet is called a virtual-circuit subnet. In this section we will examine datagram subnets; in the next one we will examine virtual-circuit subnets.

Let us now see how a datagram subnet works. Suppose that the process P1 in Fig. 3-2 has a long message for P2. It hands the message to the transport layer with instructions to deliver it to process P2 on host H2.

The transport layer code runs on H1, typically within the operating system. It prepends a transport header to the front of the message and hands the result to the network layer, probably just another procedure within the operating system.

Figure 3-2. Routing within a datagram subnet.


Let us assume that the message is four times longer than the maximum packet size, so the network layer has to break it into four packets, 1, 2, 3, and 4 and sends each of them in turn to router A using some point-to-point protocol, for example, PPP.

At this point the carrier takes over. Every router has an internal table telling it where to send packets for each possible destination. Each table entry is a pair consisting of a destination and the outgoing line to use for that destination.

Only directly-connected lines can be used. For example, in Fig. 5-2, A has only two outgoing lines—to B and C—so every incoming packet must be sent to one of these routers, even if the ultimate destination is some other router. A's initial routing table is shown in the figure under the label ''initially.''

However, something different happened to packet 4. When it got to A it was sent to router B, even though it is also destined for F. For some reason, A decided to send packet 4 via a different route than that of the first three.

Perhaps it learned of a traffic jam somewhere along the ACE path and updated its routing table, as shown under the label ''later.'' The algorithm that manages the tables and makes the routing decisions is called the routing algorithm.

4. Implementation of Connection-Oriented Service

For connection-oriented service, we need a virtual-circuit subnet. The idea behind virtual circuits is to avoid having to choose a new route for every packet sent, as in Fig. 3-2.

Instead, when a connection is established, a route from the source machine to the destination machine is chosen as part of the connection setup and stored in tables inside the routers. That route is used for all traffic flowing over the connection, exactly the same way that the telephone system works.

When the connection is released, the virtual circuit is also terminated. With connection-oriented service, each packet carries an identifier telling which virtual circuit it belongs to. As an example, consider the situation of Fig. 3-3. Here, host H1 has established connection 1 with host H2.

It is remembered as the first entry in each of the routing tables. The first line of A's table says that if a packet bearing connection identifier 1 comes in from H1, it is to be sent to router C and given connection identifier 1. Similarly, the first entry at C routes the packet to E, also with connection identifier 1.

Figure 3-3. Routing within a virtual-circuit subnet.


Now let us consider what happens if H3 also wants to establish a connection to H2. It chooses connection identifier 1 and tells the subnet to establish the virtual circuit. This leads to the second row in the tables.

Note that we have a conflict here because although A can easily distinguish connection 1 packets from H1 from connection 1 packets from H3, C cannot do this. For this reason, A assigns a different connection identifier to the outgoing traffic for the second connection.

Avoiding conflicts of this kind is why routers need the ability to replace connection identifiers in outgoing packets. In some contexts, this is called label switching.

5. Comparison of Virtual-Circuit and Datagram Subnets
Both virtual circuits and datagrams have their supporters and their detractors. We will now attempt to summarize the arguments both ways. The major issues are listed in Fig. 3-4, although purists could probably find a counterexample for everything in the figure.

Figure 3-4. Comparison of datagram and virtual-circuit subnets.


Inside the subnet, several trade-offs exist between virtual circuits and datagrams. One trade-off is between router memory space and bandwidth. Virtual circuits allow packets to contain circuit numbers instead of full destination addresses.
If the packets tend to be fairly short, a full destination address in every packet may represent a significant amount of overhead and hence, wasted bandwidth. The price paid for using virtual circuits internally is the table space within the routers.

Depending upon the relative cost of communication circuits versus router memory, one or the other may be cheaper. Another trade-off is setup time versus address parsing time. Using virtual circuits requires a setup phase, which takes time and consumes resources.

However, figuring out what to do with a data packet in a virtual-circuit subnet is easy: the router just uses the circuit number to index into a table to find out where the packet goes. In a datagram subnet, a more complicated lookup procedure is required to locate the entry for the destination.

For transaction processing systems (e.g., stores calling up to verify credit card purchases), the overhead required to set up and clear a virtual circuit may easily dwarf the use of the circuit. If the majority of the traffic is expected to be of this kind, the use of virtual circuits inside the subnet makes little sense.

On the other hand, permanent virtual circuits, which are set up manually and last for months or years, may be useful here. Virtual circuits also have a vulnerability problem. If a router crashes and loses its memory, even if it comes back up a second later, all the virtual circuits passing through it will have to be aborted.

In contrast, if a datagram router goes down, only those users whose packets were queued in the router at the time will suffer, and maybe not even all those, depending upon whether they have already been acknowledged.

The loss of a communication line is fatal to virtual circuits using it but can be easily compensated for if datagrams are used. Datagrams also allow the routers to balance the traffic throughout the subnet, since routes can be changed partway through a long sequence of packet transmissions.

Broadcast Tree

AIM: Take an example subnet of hosts, Obtain broadcast tree for it.

DESCRIPTION:
Kruskal's algorithm is used to obtain the broadcast tree from the given subnet.
This algorithm constructs a minimal spanning tree for a connected weighted graph G.

ALGORITHM:
Select any edge of minimal value that is not a loop. This is the first edge of T.
Select any remaining edge of G having minimal value that does not from a circuit with the edges already included in T.
Continue step2 until T contains n-1 edges where n is the number of  vertices of G.

 C CODE FOR BROADCAST ROUTING:
#include<stdio.h>
struct ed
{
int v1,v2,w;
}
edj[20],temp;
main()
{
int i,j,n=0,s,d,par[20],s1,d1;
clrscr();
printf("\n enter no of edges");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter the node1,node2,seight");
scanf("%d%d%d",&edj[i].v1,&edj[i].v2,&edj[i].w);
par[i]=0;
}
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
if(edj[j].w>edj[i].w)
{
temp=edj[i];
edj[i]=edj[j];
edj[j]=temp;
}
}
for(i=0;i<n;i++)
printf("\n values %d\t%d\t%d\n",edj[i].v1,edj[i].v2,edj[i].w);
printf("\n BROADCAST TREE FOR THE GIVEN GRAPH\n");
for(i=0;i<n;i++)
{
s=edj[i].v1;
d=edj[i].v2;
s1=s;
d1=d;
while(par[s1]>0)
s1=par[s1];
while(par[d1]>0)
d1=par[d1];
if(s1!=d1)
{
par[d]=s;
printf("\n%d\t%d\t%d\n",s,d,edj[i].w);
}
}
getch();
}

Distance Vector Routing Algorithm


AIM: Take an example subnet graph with weights indicating delay between nodes. Now obtain Routing table at each node using distance vector routing algorithm.

DESCRIPTION:
- In distance vector routing, each router periodically shares its knowledge about the entire internet with its neighbors.
- The three keys to understanding how this algorithm works are as follows:
- Sharing knowledge about the entire autonomous system.
- Sharing only with neighbors.
- Sharing at regular intervals.
- Every router keeps a routing table that has one entry for each destination network which the router aware.

ALGORITHM:
Add one hop to the hop count for each advertised destination.
Repeat the following steps for each advertized destination
If(destination not in the routing table)
Add the advertized information to the table.
Else
If(next-hop field is the same)
Replace entry in the table with the advertised one.
Else
If( advertized hop count smaller than one in table)
Replace entry in Routing table.

C CODE FOR DISTANCE VECTOR ROOTING

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char c1[]={'A','I','H','K','\0'};
char c2[]={'A','B','C','D','E','F','G','H','I','J','K','L'};
int doj[]={8,10,12,6};
int i,j,min,delay[5][12],res,k=0,l=0,pre[5];
clrscr();
for(i=0;i<4;i++)
{
for(j=0;j<12;j++)
{
printf("\nenter delay from %c to %c",c1[i],c2[i]);
scanf("%d",&delay[i][j]);
}
}
min=1000;
for(j=0;j<12;j++)
{
for(i=0;i<4;i++)
{
res=delay[i][j]+doj[i];
if(res<min)
{
min=res;
k=i;
}
}
delay[4][j]=min;
pre[l++]=k;
min=1000;
}
clrscr();
for(i=0;i<12;i++)
{
if(i==9)
delay[4][j]=0;
printf("\nDelay from j to %c is %d",c2[i],delay[4][j]);
if(i!=9)
printf("\t by the mode %c",c1[pre[i]]);
else
printf("\t by the node");
}
getch();
}

Dijkstra's Algorithm

AIM: Implement Dijkstra’s algorithm to compute the Shortest path through graph.

DESCRIPTION:

Dijkstra’s algorithm solves the simple source shortest paths problem on a weighted, directed graph.

G=(V,E) for the case in which all weights are non negative.

The algorithm repeatedly selects the vertex v belong s to v-s with the minimum shortest path estimate add ---

ALGORITHM:

- Take a weighted, directed graph and take number of vertices.

- Next take the weights between the states.

- Start with the source vertex and identify the shortest path.

- Repeat the above process for all the vertices repetitively until the destination is reached.

- Display the shortest path from the source to destination.

C CODE FOR SHORTEST PATH ROUTING 

#include<stdio.h>
#include<string.h>
main()
{
int n,ds[30][30],s,d,pr[30],ln[30],st[30],pt[30],i,j,u,mn=10000;
clrscr();
printf("\n enter the no of nodes");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("\nenter the weight from node %d to %d ",(i+1),(j+1));
scanf("%d",&ds[i][j]);
}
st[i]=0;
ln[i]=10000;
pr[i]=-1;
}
printf("enter the source and destination nodes ");
scanf("%d %d",&s,&d);
s--;
d--;
u=s;
ln[u]=0;
pr[u]=-1;
st[u]=2;
do
{
for(i=0;i<n;i++)
{
if(ds[u][i]!=0 && st[i]!=2)
{
st[i]=1;
if((ln[u]+ds[u][i])<ln[i])
{
pr[i]=u;
ln[i]=ln[u]+ds[u][i];
}
}
}
mn=10000;
for(i=0;i<n;i++)
if(st[i]==1 && ln[i]<mn )
{
mn=ln[i];
u=i;
}
}while(u!=d);
i=0;
u=d;
do
{
pt[i]=u;
i++;
u=pr[u];
}while(u>=0);
pt[i]='\0';
s++;
d++;
printf("\n the shortest from %d to %d is %d",s,d,ln[d-1]);
printf("\npath is ");
for(u=i-1;u>=0;u--)
printf("\t %d ",(pt[u]+1));
getch();
}

CRC

AIM 
To write a program for implementing on a data set characters the three CRC polynomials – CRC 12, CRC16 and CRC CCIP

Description:

Calculation of Polynomial Code (CRC) Checksum
1. For degree of generating polynomial G(x) = r , append r zero bits to low-order of frame. The frame now has m+r bits.
2. Divide the bit string corresponding to G(X) into the bit string xrM(x) mod(2)
3. Subtract the remainder R(x) from the bit string xrM(x) mod(2)
  Frame: 1 1 0 1 0 1 1 0 1 1
Generator: 1 0 0 1 1
G(X) = X4 + X + 1
Message after appending four 0’s:
1 1 0 1 0 1 1 0 1 1 0 0 0 0
Remainder: 1110
Transmitted Frame:
1 1 0 1 0 1 1 0 1 1 1 1 1 0

Common CRC Generator Polynomials

CRC-32: 
 x32 + x 26 + x 23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
Used in FDDI, Ethernet.
CRC-CCITT:
 x16 + X12 + x5 + 1
Used in HDLC.
CRC-8:
 x8 + x2 + x + 1
Used in ATM.

PROCEDURES 

Step-1: Read the frame
Step-2: Read the generator polynomial
Step-3: find out the degree of the generator polynomial
Step-4: Append the number of the zero’s to the frame that number is equal to the degree of the polynomial
Step-5: Find out number of digits in the generator polynomial
Step-6: Repeat the following until the number of digits are exhausted
Step-7: If the frame is starting with 1 , then exclusive-or the frame with generator
Step-8: Check whether the result obtained in step 7 is starting with 1, If so exclusive-or the remainder with the generator
Step-9: If the result obtained in step7 is starting with 0, then exclusive –or the remainder(result) with zeros. The number of zeroes must be equal to the length of the generator.

PROGRAM FOR CYCLIC REDUNDENCY CHECK 

#include<stdio.h>
#include<conio.h>
int gen[4],genl,frl,rem[4];
void main()
{
int i,j,fr[8],dupfr[11],recfr[11],tlen,flag;
clrscr();
frl=8; genl=4;
printf("enter frame:");
for(i=0;i<frl;i++)
{
scanf("%d",&fr[i]);
dupfr[i]=fr[i];
}
printf("enter generator:");
for(i=0;i<genl;i++)
scanf("%d",&gen[i]);
tlen=frl+genl-1;
for(i=frl;i<tlen;i++)
{
dupfr[i]=0;
}
remainder(dupfr);
for(i=0;i<frl;i++)
{
recfr[i]=fr[i];
}
for(i=frl,j=1;j<genl;i++,j++)
{
recfr[i]=rem[j];
}
remainder(recfr);
flag=0;
for(i=0;i<4;i++)
{
if(rem[i]!=0)
flag++;
}
if(flag==0)
{
printf("frame received correctly");
}
else
{
printf("the received frame is wrong");
}
getch();
}
remainder(int fr[])
{
int k,k1,i,j;
for(k=0;k<frl;k++)
{
if(fr[k]==1)
{
k1=k;
for(i=0,j=k;i<genl;i++,j++)
{
rem[i]=fr[j]^gen[i];
}
for(i=0;i<genl;i++)
{
fr[k1]=rem[i];
k1++;
}
}
}
}

INPUT:
enter frame :
1 1 1 1 1 1 1 1
enter generator :
1 1 0 1

OUTPUT:
frame received correctly

C code for character stuffing


#include<stdio.h>
#include<conio.h>
void ins(char,int);
void del(int,int);
char fr[50];
main()
{
 int i,cnt=0,ch;
 clrscr();
 printf("Enter the frame:\t");
 gets(fr);
 /*Charecter Stuffing*/
            ins('s',0);
            ins('e',5);
            //printf("%s",fr);
            for(i=0;i<strlen(fr);i++)
            {
             if(fr[i]=='d'&&fr[i+1]=='l'&&fr[i+2]=='e'&&i!=3&&i!=strlen(fr)-3)
             {
              ins('m',i+3);i+=6;
             }
            }
            printf("\n\nStuffed bit is \t%s\t",fr);getch();
            /*Destuffing*/
            cnt=0;
            del(0,6);
            del(strlen(fr)-6,6);
            for(i=0;i<strlen(fr);i++)
            {
             if(fr[i]=='d'&&fr[i+1]=='l'&&fr[i+2]=='e')
             {
             cnt+=1;
             if(cnt==1)
             {         del(i,3);}
             }else
             {cnt=0;}
            }
            printf("\n\nDestuffed bit is \t%s",fr);getch();
            return 0;
 }
void ins(char in,int p)
{
 char dup[50];
 int i;
 strcpy(dup,fr);
            if(in=='s')
            {
             fr[p]='s';
             fr[p+1]='t';
             fr[p+2]='x';
             fr[p+3]='d';
             fr[p+4]='l';
             fr[p+5]='e';
            for(i=p+6;i<strlen(fr)+6;i++)
            {
             fr[i]=dup[i-6];
            }
            }
            if(in=='e')
            {
             strcat(fr,"etxdle");return;
            }
            if(in=='m')
            {
             fr[p]='d';
             fr[p+1]='l';
             fr[p+2]='e';
             for(i=p+3;i<strlen(fr)+3;i++)
             {
             fr[i]=dup[i-3];
             }
            }
            }
void del(int q,int n)
{
 int i;
            for(i=q;i<strlen(fr);i++)
            {
             fr[i]=fr[i+n];
            }
}
OUTPUT:



Monday 24 December 2012

IP/IPv4: Internet Protocol

Overview 

- The Internet Protocol (IP) is a network-layer (Layer 3) protocol in the OSI model that contains addressing information and some control information to enable packets being routed in network.
-  IP is the primary network-layer protocol in theTCP/IP protocol suite . Along with the Transmission Control Protocol (TCP ), IP represents the heart of the Internet protocols. IP is equally well suited for both LAN and WAN communications.

 -  IP (Internet Protocol) has two primary responsibilities:
     providing connectionless,
     best-effort delivery of datagrams through a network; and
     providing fragmentation and reassembly of datagrams to support data links with different maximum-transmission unit (MTU) sizes.

- The IP addressing scheme is integral to the process of routing IP datagrams through an internetwork. Each IP address has specific components and follows a basic format. These IP addresses can be subdivided and used to create addresses for subnetworks.
- Each computer (known as host) on a TCP/IP network is assigned an unique logical address (32-bit in IPv4) that is divided into two main parts:
 the network number and the host number.

- The network number identifies a network and must be assigned by the Internet Network Information Center (InterNIC) if the network is to be part of the Internet. An Internet Service Provider (ISP) can obtain blocks of network addresses from the InterNIC and can itself assign address space as necessary. The host number identifies a host on a network and is assigned by the local network administrator.

- When you send or receive data (for example, an e-mail note or a Web page), the message gets divided into little chunks called packets. 
- Each of these packets contains both the sender's Internet address and the receiver's address.Because a message is divided into a number of packets, each packet can, if necessary, be sent by a different route across the Internet.
- Packets can arrive in a different order than the order they were sent in. The Internet Protocol just delivers them. It's up to another protocol, the Transmission Control Protocol ( TCP) to put them back in the right order.

All other protocols within the TCP/IP suite, except ARP and RARP, use IP to route frames from host to host.

Protocol Structure - IP/IPv4 Header (Internet Protocol version 4)

- Version -the version of IP currently used.

- IP Header Length (IHL) - datagram header length. Points to the beginning of the data. The minimum value for a correct header is 5.

- Type-of-Service- Indicates the quality of service desired by specifying how an upper-layer protocol would like a current datagram to be handled, and assigns datagrams various levels of importance. This field is used for the assignment of Precedence, Delay, Throughput and Reliability.

- Total Length- Specifies the length, in bytes, of the entire IP packet, including the data and header. The maximum length could be specified by this field is 65,535 bytes. Typically, hosts are prepared to accept datagrams up to 576 bytes.

- Identification- Contains an integer that identifies the current datagram. This field is assigned by sender to help receiver to assemble the datagram fragments.

- Flags - Consists of a 3-bit field of which the two low-order (least-significant) bits control fragmentation. The low-order bit specifies whether the packet can be fragmented. The middle bit specifies whether the packet is the last fragment in a series of fragmented packets. The third or high-order bit is not used.

- Fragment Offset - This 13 bits field indicates the position of the fragment's data relative to the beginning of the data in the original datagram, which allows the destination IP process to properly reconstruct the original datagram.

- Time-to-Live - It is a counter that gradually decrements down to zero, at which point the datagram is discarded. This keeps packets from looping endlessly.

- Protocol- Indicates which upper-layer protocol receives incoming packets after IP processing is complete.

- Header Checksum- Helps ensure IP header integrity. Since some header fields change, e.g., Time To Live, this is recomputed and verified at each point that the Internet header is processed.

- Source Address-Specifies the sending node.

- Destination Address-Specifies the receiving node.

- Options- Allows IP to support various options, such as security.

- Data - Contains upper-layer information.

CN 3-2 lab programs

PROGRAM 1: Implement the data link layer framing methods such as character stuffing and bit stuffing.

                                                 CHARACTER STUFFINIG 

DESCRIPTION:

The first framing method is used in the header to specify the number of characters in frame.
In second method delimit by DLESTX DLEETX.
One way to solve this is to have the senders data link layer, insert an ASCII DLE char just before each accidental flag bit character in data.

FOR EXAMPLE:

‘AB’

Data send by network layer is A B X.
Data after being character stuffing by data link layer DLE STX A DLE ETX.
After destuffing we get original data.

i.e., AB \0

ALGORITHM:

- First read the bit stream clearly.

- Scan for data stream for the continuous 6 is if it is form the in stream bit delimiter.

- In character stuffing also read the given frame clearly.

- Insert DLESTX, data link escaping character starting of the frame.

- If DLE occurs then in the frame insert another DLE after DLE.

- At the end of frame insert DLEETX data link escaping character ending text.

- To destuff the above stuffed frame use simply remove appended DLESTX, DLE and DLEETX.

                                                       BIT STUFFING:
DESCRIPTION:

Starting and ending flags with bit stuffing is one of the framing methods to specify the number of characters or bits in a frame.
Each frame in this techniques begins and ends with a special bit pattern 01111110 called a flag byte.
Whenever the sender’s data link layer encodes five consecutive ones in the data, it automatically stuffs a 0 bit into the outgoing bit stream.

FOR EXAMPLE:


Original data
011011111111111111110010

Data as they appear on the line
01101111101111101111100010

Stuffed Bits

Data stored in the receiver’s memory after destuffing
011011111111111111110010

C CODE FOR BIT STUFFING: 

#include<stdio.h>
#include<conio.h>
void ins(char,int);
void del(int);
char fr[50];
main()
{
int i,cnt=0;
clrscr();
printf("Enter the frame:\t");
gets(fr);
for(i=0;i<strlen(fr);i++)
{
if(fr[i]!='0'&&fr[i]!='1')
{
printf("ivalid input\n press any key to exit");
getch();
exit(0);
}
}
/*Stuffing the given bit*/
for(i=0;i<strlen(fr);i++)
{
if(cnt==5)
{
cnt=0;
ins('0',i);
}
if(fr[i]=='1'){cnt+=1;}else{cnt=0;}
}
printf("\n\nStuffed Frame is \t%s\n\n",fr);
getch();
/*Destuffing of aframe*/
cnt=0;
for(i=0;i<strlen(fr);i++)
{
if(cnt==5)
{
cnt=0;
del(i);
}
if(fr[i]=='1'){cnt+=1;}else{cnt=0;}
}
printf("Destuffed Frame is \t%s",fr);
getch();
return 0;
}
void ins(char in,int p)
{
char dup[50];
int i;
strcpy(dup,fr);
fr[p]=in;
for(i=p+1;i<strlen(fr)+1;i++)
{
fr[i]=dup[i-1];
}
}
void del(int q)
{
int i;
for(i=q;i<strlen(fr);i++)
fr[i]=fr[i+1]; 
}

Explain about Local Area Network (LAN)


Local Area Networks:

Local area networks, generally called LANs, are privately-owned networks within a single building or campus of up to a few kilometres in size. They are widely used to connect personal computers and workstations in company offices and factories to share resources (e.g., printers) and exchange information.

LANs are distinguished from other kinds of networks by three characteristics:
(1) Their size,
(2) Their transmission technology, and
(3) Their topology.

             LANs are restricted in size, which means that the worst-case transmission time is bounded and known in advance. Knowing this bound makes it possible to use certain kinds of designs that would not otherwise be possible. It also simplifies network management.

             LANs may use a transmission technology consisting of a cable to which all the machines are attached, like the telephone company party lines once used in rural areas. Traditional LANs run at speeds of 10 Mbps to 100 Mbps, have low delay (microseconds or nanoseconds), and make very few errors. Newer LANs operate at up to 10 Gbps.

             Various topologies are possible for broadcast LANs. Figure1 shows two of them. In a bus (i.e., a linear cable) network, at any instant at most one machine is the master and is allowed to transmit. All other machines are required to refrain from sending. An arbitration mechanism is needed to resolve conflicts when two or more machines want to transmit simultaneously. The arbitration mechanism may be centralized or distributed. IEEE 802.3, popularly called Ethernet, for example, is a bus-based broadcast network with decentralized control, usually operating at 10 Mbps to 10 Gbps. Computers on an Ethernet can transmit
whenever they want to; if two or more packets collide, each computer just waits a random time and tries again later.
                  fig: Two Broadcast networks            a) Bus                 b)Ring


          A second type of broadcast system is the ring. In a ring, each bit propagates around on its own, not waiting for the rest of the packet to which it belongs. Typically, each bit circumnavigates the entire ring in the time it takes to transmit a few bits, often before the complete packet has even been transmitted. As with all other broadcast systems, some rule is needed for arbitrating simultaneous accesses to the ring. Various methods, such as having the machines take turns, are in use. IEEE 802.5 (the IBM token ring), is a ring-based LAN operating at 4 and 16 Mbps. FDDI is another example of a ring network.