#include "mip_packet.h"
#include "mip_offsets.h"
#include "definitions/descriptors.h"
#include <string.h>
#include <assert.h>
Go to the source code of this file.
Functions | |
bool | mip_packet_add_field (mip_packet *packet, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length) |
Adds a pre-constructed MIP field to the packet. More... | |
int | mip_packet_alloc_field (mip_packet *packet, uint8_t field_descriptor, uint8_t payload_length, uint8_t **const payload_ptr_out) |
Allocate a MIP field within the packet and return the payload pointer. More... | |
uint8_t * | mip_packet_buffer (mip_packet *packet) |
Returns a writable pointer to the data buffer. More... | |
uint_least16_t | mip_packet_buffer_size (const mip_packet *packet) |
Returns the size of the buffer backing the MIP packet. More... | |
int | mip_packet_cancel_last_field (mip_packet *packet, uint8_t *payload_ptr) |
Removes the last field from the packet after having allocated it. More... | |
uint16_t | mip_packet_checksum_value (const mip_packet *packet) |
Returns the value of the checksum as written in the packet. More... | |
uint16_t | mip_packet_compute_checksum (const mip_packet *packet) |
Computes the checksum of the MIP packet. More... | |
void | mip_packet_create (mip_packet *packet, uint8_t *buffer, size_t buffer_size, uint8_t descriptor_set) |
Create a brand-new MIP packet in the given buffer. More... | |
uint8_t | mip_packet_descriptor_set (const mip_packet *packet) |
Returns the MIP descriptor set for this packet. More... | |
void | mip_packet_finalize (mip_packet *packet) |
Prepares the packet for transmission by adding the checksum. More... | |
void | mip_packet_from_buffer (mip_packet *packet, uint8_t *buffer, size_t length) |
Initializes a MIP packet from an existing buffer. More... | |
bool | mip_packet_is_data (const mip_packet *packet) |
Returns true if the packet is from a data descriptor set. More... | |
bool | mip_packet_is_empty (const mip_packet *packet) |
Returns true if the mip packet contains no payload. More... | |
bool | mip_packet_is_sane (const mip_packet *packet) |
Returns true if the packet buffer is not NULL and is at least the minimum size (MIP_PACKET_LENGTH_MIN). More... | |
bool | mip_packet_is_valid (const mip_packet *packet) |
Returns true if the packet is valid. More... | |
const uint8_t * | mip_packet_payload (const mip_packet *packet) |
Returns a pointer to the packet's payload (the first field). More... | |
uint8_t | mip_packet_payload_length (const mip_packet *packet) |
Returns the length of the payload (MIP fields). More... | |
const uint8_t * | mip_packet_pointer (const mip_packet *packet) |
Returns a pointer to the data buffer containing the packet. More... | |
int | mip_packet_realloc_last_field (mip_packet *packet, uint8_t *payload_ptr, uint8_t new_payload_length) |
Changes the size of the last field in the packet. More... | |
int | mip_packet_remaining_space (const mip_packet *packet) |
Returns the remaining space available for more payload data. More... | |
void | mip_packet_reset (mip_packet *packet, uint8_t descriptor_set) |
Reinitialize the packet with the given descriptor set. More... | |
uint_least16_t | mip_packet_total_length (const mip_packet *packet) |
Returns the total length of the packet, in bytes. More... | |