Question: Help me with the given guidelines and C code guidelines. I already have the code for the print menu, I just need help on the

Help me with the given guidelines and C code guidelines. I already have the code for the print menu, I just need help on the codes for, void print_packet, int find_byte_packet, int find_string_packet, int find_string_all, int find_byte_all, int find_websites, and void store_packet . The code should match the given outputs and inputs in the photo provided. Some of the code is provided below and the rest is in in the screenshot provided. Everything needed and mentioned should be in the code below or the screenshots.
* Purpose: A simple packet sniffer that can handle packets with non-printable
* characters. The sniffer can find any byte, string, or web address
* in any packet.
*
* Assumptions:
* Input file is read in as bytes. The input file must have the correct
* format. Minimal error checking is included to validate the input data.
* Command line argument
* Name of file to read. The file must contain one packet per line with
* the format
* size packet_contents
* The size is the number of bytes in the packet, and the packet_contents
* is the binary data, read as bytes. The size of the packet must be
* correct, and there must be exactly one space character between the size
* field and the start of the packet_contents. Note the bytes in a packet
* can have any value, so the packet may not be printable.
*
* Bugs:
*
* Notes:
* The number of packets that can be stored is limited to MAXPACKETS -1
* because one position is needed to mark where the last packet ends.
*
* See the ECE 2220 programming guide
*
* Format with
* astyle --style=kr lab4.c
*
* Replace "kr" with: bsd, ansi, java, gnu, linux, vtk, or google.
*/
#include
#include
#include
#include
#define MAXLINE 128
#define MAXPACKETLENGTH 128
#define MAXPACKETS 8192
#define MAXFILESIZE 1048576
/*----------------------------------------------------------*/
/* A stub function for printing packets as 16-byte aligned lines of text.
*
* input:
* position: the location of the point of interest. For example, the found
* byte or the first character in a found string. If position is
*-1, then there is no point of interest.
* slen: the length of the found string (or 1 for a found byte)
* packets: an array of pointers to each packet's starting address in memory
* packetnum: the index of the packet of interest
*
* output:
* prints a packet as formatted 16-byte lines of text.
* This function continues to print 16-byte lines so that the entire packet
* is displayed. A non-printable character is replaced with a space ('').
* In addition, the point of interest (e.g. the found byte or found string)
* is marked, as discussed in the pdf.
*/
void print_packet(int position, int slen, char *packets[MAXPACKETS], int packetnum)
{
return; // fix this
}
/*----------------------------------------------------------*/
/* This function is a stub for searching a particular packet for a byte.
*
* Use packets[packetnum] as the starting address for the particular packet.
* Search within this packet for the first matching byte. Use the starting
* address of the next packet (packets[packetnum+1]) to know when to end.
*
* input:
* packets: an array of pointers to each packet's starting address in memory
* packetnum: is the index of the packet of interest
* byte: is a string with the hex characters of the byte to find
*
* return value:
*1 if byte found within the packet
*0 if byte not found
* side effects:
* If the byte is found, your function should call print_packet() and
* display the matched byte as discussed in the pdf
*/
int find_byte_packet(char * packets[MAXPACKETS], int packetnum, char * byte)
{
int found =0;
return found;
}
/*----------------------------------------------------------*/
/* This function is a stub for searching a particular packet for a string.
*
* Use packets[packetnum] as the starting address for the particular packet.
* Search within this packet for the first matching byte. Use the starting
* address of the next packet (packets[packetnum+1]) to know when to end.
*
* input:
* packets: an array of pointers to each packet's starting address in memory
* packetnum: is the index of the packet of interest
* str: is the string to find
*
* return value:
*1 if string found within the packet
*0 if string not found
* side effects:
* If the string is found, your function should call print_packet()
* and display the matched string as discussed in the pdf
*/
int find_string_packet(char *packets[MAXPACKETS], int packetnum, const char *str)
{
int found =0;
return found;
}
Help me with the given guidelines and C code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!