#include <stdio.h>
#include <string.h>
void stuff(char str[40]);
main()
{
char str[40];
int i;
printf("\n enter the string:");
scanf("%s", &str);
printf("\n the given string is:");
printf("\n %s", str);
stuff(str);
}
void stuff(char str[40])
{
int i, j, k = 0, l, n, z;
printf("\n now we are stuffing the data::\n");
n = strlen(str);
for (i = 0; i < n; i++)
{
if (str[i] == '1')
{
k = 1;
for (l = i + 1; l <= i + 5; l++)
{
if (str[l] == '1')
k++;
else
break;
}
if (k == 6)
{
i = i + 6;
z = n + 1;
for (j = z; j >= i; j--)
{
str[j] = str[j - 1];
}
str[j] = '0';
}
}
}
printf("\nThe resultant string after stuffing is..\n");
printf("%s\n", str);
}
This method uses a field in the header to specify the number of characters in the frame. When the data link layer at the destination sees the character count,it knows how many characters follow, and hence where the end of the frame is. The disadvantage is that if the count is garbled by a transmission error, the destination will lose synchronization and will be unable to locate the start of the next frame. So, this method is rarely used.
Layer 2 (Data Link Layer) http://compnetworking.about.com/cs/internetworking/g/bldef_bridge.htm
You can not change the range of a data type. It is a function of the implementation and is dependent on the word size of the implementation's computer hardware.
7. Application Layer - Data 6. Presentation Layer - Data 5. Session Layer - Data 4. Transport Layer - Segments 3. Network - Packet 2. Data Link - Frame 1. Physical - Bit
The data link layer (layer 2) and the physical layer (layer 1) use the constructed frame.
Wifi
Data Link Layer
Data link layer
Layer 2 or the 'Data' layer of the OSI model encapsulates either 'bits' from the physical layer (1)- moving up the TCP stack or 'Packets' from the Network layer (3)- going down the the stack. 7 - Application Layer DATA 6 - Presentation Layer DATA 5 - Session Layer DATA 4 - Transport Layer SEGMENT 3 - Network Layer PACKET 2 - Data Layer (Incorporating LLC and MAC) FRAME 1 - Physical Layer BIT A good nmemonic for remembering the data encapsulation in the OSI model is 'Don't Some Peolple Fry Bacon' - Data, Segments, Packets, Bits.
The Transport layer (layer 4) handles segmentation and reassembly of the data.
in wireless network our data is travel by air, so whats the sequirty for our data?
Layer 2 - Data Link layer.