Highlights
Introduction
In this assignment, you will implement the packet encoding and decoding for a basic instant messaging pro- tocol. You will be using void pointers and pointer arithmetic, along with functions from string.h to accomplish this. You will learn about pointer arithmetic, raw memory access, and data serialization. This assignment only requires you to encode and decode the outgoing and incoming packets, the rest of the instant messaging application is already implemented for you.
2 Requirements
In this assignment, you must implement encoding and decoding of packets of data according to the formats specified below. Each packet is stored internally as a void *, according to a standard format as specified in Section 3.
Note that the formats in this assignment are very specific, and must be implemented precisely. This in- cludes details such as white space and the value of padding bytes. Be sure not to include any extra characters in quoted strings, insert extra newlines or other formatting, or deviate from this specification in any way!
The standard defines several packet types:
• STATUS This packet type sets your status on the server. It should be sent when the user input starts with “/me” followed by a space. Any input starting with “/me” followed by any other character is invalid.
• LABELED This packet type tags another user. It is sent when the user input starts with “@” followed by at least one and no more than NAME_SIZE non-space characters. NAME_SIZE is defined in src/serialize.h.
• STATISTICS This packet type is used to request and receive a set of basic statistics from the server. It is sent when the user input starts with “/stats” followed by the end of the input. Any input beginning with “/stats” followed by any other character is invalid.
• MESSAGE This packet typeis the most basic, it is just a normal plaintext message. It should besent if the user input does not fall into any of the above categories.
The standard also defines a special packet:
• REFRESH This packet is sent to the server by the client to request new messages to decode. It is sent every second and has no relation to user input.
Through this assignment, you will implement four functions:
• int pack(void *packed, char *input): Parse input to determine the packet type and fill packed with the encoded input.
• int pack_refresh(void *packed, int message_id): Fill packed with an encoded refresh packet according to the specification in Section 3.5.
• int unpack(char *message, void *packed): Decode packed based on the packet type and fill message with the decoded string.
• int unpack_statistics(struct statistics *statistics, void *packed): Decodepacked
This Computer Science Assignemnt has been solved by our Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.