#ifndef __PACKET__#define __PACKET__#include "../../types/types.h"#include "../link/frame.h"#ifndef SUCCESS#define SUCCESS 1#define FAILURE 0#endif#ifndef TRUE#define TRUE 1#define FALSE 0#endif#define WRITEADDRESS 0xFFFFtypedef struct { uint16_t address; // on packet reception, this is TOS_UART_ADDR (0x7E), on transmission, this is destination uint8_t port; // this is referred to as "type" in tos/system/AM.h and is number of parametrized interface uint8_t group; // same as in AM.h uint8_t length; // length of data in bytes} __attribute__((packed)) TOS_Hdr;#define PKT_MAX_DATA_SIZE (MTU - sizeof(TOS_Hdr) - 2) // the "- 2" is for the crctypedef struct { TOS_Hdr hdr; uint8_t data[PKT_MAX_DATA_SIZE];} networkPkt; // monitors serial port until a packet is read successfully, returns SUCCESS or FAILUREint readNetworkPkt(int serial_port_fd, networkPkt *p);// sends a packet over the serial port, returns SUCCESS or FAILUREint writeNetworkPkt(int serial_port_fd, networkPkt *p);// prints a packet to output_file_descriptorvoid printPacket(int debug_type, int debug_level, FILE *output_file_descriptor, networkPkt *p);#endif