#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);
}
The character count method is a way to identify the size of a data frame during transmission. A number in the header tells how many characters are in the frame, so the receiver knows where it ends. Its main disadvantage is that if the count is corrupted during transmission, synchronization can be lost. Because of this, more reliable framing methods are commonly used today.
Application layer: Data Presentation layer: Data Session layer: Data Transport layer: Segment (TCP) or Datagram (UDP) Network layer: Packet Data Link layer: Frame Physical layer: Bit
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.
Data Link Layer
Data link layer
Wifi
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.
Layer 6 - Presentation Layer