- 1. Implement the data link layer framing methods such as character, character stuffing and bit stuffing
- 2. Write a program to compute CRC code for the polynomials CRC-12, CRC-16 and CRC CCIP
- 3. Develop a simple data link layer that performs the flow control using the sliding window protocol, and loss recovery using the Go-Back-N mechanism.
- 4. Implement Dijsktra’s algorithm to compute the shortest path through a network
- 5. Take an example subnet of hosts and obtain a broadcast tree for the subnet
- 6. Implement distance vector routing algorithm for obtaining routing tables at each node
- 7. Implement data encryption and data decryption
- 8. Write a program for congestion control using Leaky bucket algorithm
-
10. Wireshark
i. Packet Capture Using Wire shark
ii. Starting Wire shark
iii. Viewing Captured Traffic
iv. Analysis and Statistics & Filters - 11. How to run Nmap scan
- 12. Operating System Detection using Nmap
-
13. Do the following using NS2 Simulator
i. NS2 Simulator-Introduction
ii. Simulate to Find the Number of Packets Dropped
iii. Simulate to Find the Number of Packets Dropped by TCP/UDP
iv. Simulate to Find the Number of Packets Dropped due to Congestion
v. Simulate to Compare Data Rate& Throughput.
vi. Simulate to Plot Congestion for Different Source/Destination
vii. Simulate to Determine the Performance with respect to Transmission of Packets
Aim: Write a program for frame sorting technique used in buffers.
Theory:
The data link layer divides the stream of bits received from the network layer into manageabledata units called frames.If frames are to be distributed to different systems on the network, the Data link layer adds a header to the frame to define the sender and/or receiver of the frame.
Each Data link layer has its own frame format. One of the fields defined in the format is the maximum size of the data field. In other words, when datagram is encapsulated in a frame, the total size of the datagram must be less than this maximum size, which is defined by restriction imposed by the hardware and software used in the network.
The value of MTU differs from one physical network to another In order to make IP protocol portable/independent of the physical network, the packagers decided to make the maximum length of the IP datagram equal to the largest Maximum Transfer Unit (MTU) defined so far. However for other physical networks we must divide the datagrams to make it possible to pass through these networks. This is called fragmentation.
When a datagram is fragmented, each fragmented has its own header. A fragmented datagrammay itself be fragmented if it encounters a network with an even smaller MTU. In another words, a datagram may be fragmented several times before it reached the final destination and also, the datagrams referred to as (frames in Data link layer) may arrives out of order at destination. Hence sorting of frames need to be done at the destination to recover the original data.
ALGORITHM/FLOWCHART:
Step 1: Start
Step 2: Enter the Message to be transmitted(read in msg) Step3:Caluculate no of packets
Step4: Goto Step 5,6,7,8 Step5:void shuffle(intNoOfPacket)
Step 5.1: Calculate status,transdata Step 5.2:for i = 0; i <NoOfPacket;
Step 5.2.1: calculate trans
trans = rand()%NoOfPacket; Step 5.2.2: if Status[trans]!=1
Copy read data in transmitted data and goto step 6 Step 6: void receive(intNoOfPacket)
Step 6.1:Print the packets received
Step 6.2: Print the frame in sorted order go to Step 7 Step 7: void sortframes(intNoOfPacket)
Step 7.1 : if transdata[j].SeqNum>transdata[j + 1].SeqNumgoto 7.1.1 Step 7.1.1: Sort the packets
Step 8: Stop
SOURCE CODE:
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define FSize 3 typedefstruct packet
{
intSeqNum;
char Data[FSize+1];
}
packet;
struct packet *readdata, *transdata;
int divide(char *msg)
{
intmsglen, NoOfPacket, i, j; msglen = strlen(msg); NoOfPacket = msglen/FSize;
if ((msglen%FSize)!=0) NoOfPacket++;
readdata = (struct packet *)malloc(sizeof(packet) * NoOfPacket);
for(i = 0; i <NoOfPacket; i++)
{
readdata[i].SeqNum = i + 1;
for (j = 0; (j <FSize) && (*msg != ‘\0’); j++, msg++) readdata[i].Data[j] = *msg;
readdata[i].Data[j] = ‘\0’;
}
printf(“\nThe Message has been divided as follows\n”); printf(“\nPacket No. Data\n\n”);
for (i = 0; i <NoOfPacket; i++)
printf(” %2d %s\n”, readdata[i].SeqNum, readdata[i].Data);
returnNoOfPacket;
}
void shuffle(intNoOfPacket)
{
int *Status; int i, j, trans;
randomize();
Status=(int * )calloc(NoOfPacket, sizeof(int));
transdata = (struct packet *)malloc(sizeof(packet) * NoOfPacket);
for (i = 0; i <NoOfPacket;)
{
trans = rand()%NoOfPacket;
if (Status[trans]!=1)
{
transdata[i].SeqNum = readdata[trans].SeqNum; strcpy(transdata[i].Data, readdata[trans].Data); i++; Status[trans] = 1;
}
}
free(Status);
}
voidsortframes(intNoOfPacket)
{
packet temp; int i, j;
for (i = 0; i <NoOfPacket; i++)
for (j = 0; j <NoOfPacket – i-1; j++)
if (transdata[j].SeqNum>transdata[j + 1].SeqNum)
{
temp.SeqNum = transdata[j].SeqNum; strcpy(temp.Data, transdata[j].Data); transdata[j].SeqNum = transdata[j + 1].SeqNum; strcpy(transdata[j].Data, transdata[j + 1].Data); transdata[j + 1].SeqNum = temp.SeqNum; strcpy(transdata[j + 1].Data, temp.Data);
}
}
void receive(intNoOfPacket)
{
int i;
printf(“\nPackets received in the following order\n”); for (i = 0; i <NoOfPacket; i++)
printf(“%4d”, transdata[i].SeqNum); sortframes(NoOfPacket);
printf(“\n\nPackets in order after sorting..\n”);
for (i = 0; i <NoOfPacket; i++)
printf(“%4d”, transdata[i].SeqNum);
printf(“\n\nMessage received is :\n”);
for (i = 0; i <NoOfPacket; i++)
printf(“%s”, transdata[i].Data);
}
void main()
{
char *msg;
intNoOfPacket;
clrscr();
printf(“\nEnter The message to be Transmitted :\n”); scanf(“%[^\n]”, msg);
NoOfPacket = divide(msg);
shuffle(NoOfPacket);
receive(NoOfPacket);
free(readdata);
free(transdata);
getch();
}
Output:
Enter The messgae to be Transmitted : hi, it was nice meeting u on sunday
The Message has been divided as follows Packet No. Data
- hi,
- it
- wa
- s n
- ice
- me
- eti
- ng
- u o
- n s
- und
- ay
Packets received in the following order 4 2 6 3 5 1 8 9 11 7 12 10
Packets in order after sorting.. 1 2 3 4 5 6 7 8 9 10 11 12
Message received is :
hi, it was nice meeting u on sunday