Implement The Data Link Layer Framing Methods Such As and Bit Stuffing
Implement The Data Link Layer Framing Methods Such As and Bit Stuffing
- Lab Manual
Implement the data link layer framing methods such as and bit stuffing.
Program Algorithm:
Begin
Step 1: Read frame length n
Step 2: Repeat step (3 to 4) until i<n(: Read values into the input frame (0’s and
1’s) i.e.
Step 3: initialize I i=0;
Step 4: read a[i] and increment i
Step 5: Initialize i=0, j=0,count =0
Step 6: repeat step (7 to 22) until i<n
Step 7: If a[i] == 1 then
Step 8: b[j] = a[i]
Step 9: Repeat step (10 to 18) until (a[k] =1 and k<n and count <5)
Step 10: Initialize k=i+1;
Step 11: Increment j and b[j]= a[k];
Step 12: Increment count ;
Step 13: if count =5 then
Step 14: increment j,
Step 15: b[j] =0
Step 16: end if
Step 17: i=k;
Step 18: increment k
Step 19: else
Step 20: b[j] = a[i]
Step 21: end if
https://programingmanual.blogspot.com/2018/02/implement-data-link-layer-framing.html 1/3
5/2/23, 1:49 PM Implement the data link layer framing methods such as and bit stuffing. - Lab Manual
https://programingmanual.blogspot.com/2018/02/implement-data-link-layer-framing.html 2/3
5/2/23, 1:49 PM Implement the data link layer framing methods such as and bit stuffing. - Lab Manual
}
printf("After stuffing the frame is:");
for(i=0;i<j;i++)
printf("%d",b[i]);
}
Program Output:
Enter frame length:5
Enter input frame (0's & 1's only):
1
1
1
1
1
After stuffing the frame is:111110
------------------
(program exited with code: 6)
Press return to continue
https://programingmanual.blogspot.com/2018/02/implement-data-link-layer-framing.html 3/3