0 evaluări0% au considerat acest document util (0 voturi)
35 vizualizări3 pagini
Write two C-language programs that perform bit stuffing on a sequence of ASCII represented zeros and ones. One program will read an input text file that contains the data bits that will be framed and "stuffed" the other program will unstuff the ASCII formatted frame.
Write two C-language programs that perform bit stuffing on a sequence of ASCII represented zeros and ones. One program will read an input text file that contains the data bits that will be framed and "stuffed" the other program will unstuff the ASCII formatted frame.
Write two C-language programs that perform bit stuffing on a sequence of ASCII represented zeros and ones. One program will read an input text file that contains the data bits that will be framed and "stuffed" the other program will unstuff the ASCII formatted frame.
Objectives Understand the bitstuffing technique in-depth. Write two C-language programs. One that performs bit stuffing on a sequence of ASCII represented zeros and ones and the other that unstuffs the ASCII formatted frame. Become more proficient in C-programming. Discussion Consider the bit stuffing technique described in class and in the textbook. In this technique, we use the special bit pattern, 01111110, as a flag to delimit the start and end of frames. Bit stuffing allows arbitrary data patterns to be used in a frame and still allow a receiver to determine where a frame begins and ends. In summary, after every 5 consecutive 1's in the data, an extra 0 is inserted by the sender. This process is reversed at the receiver. If there are two consecutive back-to-back frames, then assume that there is a separate flag for the end of the first and a separate flag for the start of the second. Any frames that do not start or end with a valid flag are discarded. One of the most common applications that uses bit stuffing is USB interfaces. The bit stuffing/unstuffing procedure can be efficiently implemented using a finite-state machine. The state diagram for a bit unstuffing finite-state machine is shown below:
ECE 477 Bitstuffing Created Fall 2010 Revised: Fall 2010 Implementation Since the objective of this assignment is to understand the bitstuffing technique, I have some simplifications that will make the assignment easier. We will represent the data bits in a frame as the ASCII characters 0 (hex 0x30) and 1 (hex 0x31). This will allows us to process and view the input and output data using a terminal or text editor rather than going through the steps of manipulating the individual bits themselves, which is somewhat complicated in software. Your sending program will read the data from an input text file that contains the ASCII represented bits that will be framed and stuffed by your sending program and its output saved to an output text file. Likewise your receiving program will read an input text file, detect the start-of-frame and end-of-frame delimiters, and unstuff the stuffed bits as necessary. To further simplify things, we can use an input/output method called standard-I/O (stdio) redirection what will eliminate the need for you to learn and use file I/O operations. To jump-start you on this task, I have made a sample program available that illustrates the implementation of a finite-state machine, the processing of ASCII data, and the usage of I/O redirection. All files necessary for this assignment can be found at: http://www.ee.siue.edu/~bnoble/classes/ece477/lab/bitstuff/files/ At this URL, there are two directories of interest. The directory named sample contains a C-program that detects a simple ASCII sequence by use of a finite-state machine implemented in C. To use and learn from it, save the source file, seqdetect.c, to your account on your lab computer and open it with a text editor. Contained in the comments are the instructions for both compiling it as well as examples of using it with I/O redirection. For this task you will need to open a terminal program. The terminal gives you access to the UNIX shell where you can execute commands on your operating system. You need to become familiar with the shell since later labs will require you to modify the behavior of your lab system using commands executed within the shell.
ECE 477 Bitstuffing Created Fall 2010 Revised: Fall 2010 Assignment Write two C-programs. Sender: Reads ASCII 0's and 1's from a file and frames them with the 01111110 sequence appropriately. A file can contain multiple frames with each frame corresponding to a single line of ASCII 0s and 1s. A carriage-return or new-line means the end of that data to be framed. Each subsequent line represents a new set of data to be framed. The output of the sender program should not place any carriage-returns or new-lines between the frames; the output should only be one long line of zeros and ones terminated by a single carriage-return/new-line at the end. Receiver: Reads a bitstuffed ASCII string of 0s and 1s from a file, in the format described in the sender program description, and breaks it up into the data contained in each of the frames. Your output should be a sequence of frames (1 per line) with all start/end sequences and stuffed bits removed. If an error is detected, it should print "Error Detected" and exit immediately. Both programs should be thoroughly commented in such a way that its logic and flow can be followed by reading the comments and the source code alone. Demonstration and Report On the due date you need to schedule a demonstration time with the TA. During the demonstration, you will be expected to show your programs operation and may be asked to run it on a frame supplied by the TA. You will also be expected to answer questions about its operation. Credit for this assignment will only be earned if you can demonstrate complete knowledge of your programs implementation and operation, even if the program works correctly. You must include the output of your sender program when it is given the files named sinput and the output of your receiver program when it is given the files named rinput, both of which are located in the directory named data at the URL given above. Your report should describe the logic you used in implementing the program as well as its operation. You should also describe how you determined that it was functioning correctly and how you verified that all states within your program were tested for correct operation. You must include a state diagram for your sender program.
Kali Linux - An Ethical Hacker's Cookbook - Second Edition: Practical recipes that combine strategies, attacks, and tools for advanced penetration testing, 2nd Edition
Mastering Linux Security and Hardening - Second Edition: Protect your Linux systems from intruders, malware attacks, and other cyber threats, 2nd Edition