#include <net/packet.h>
Go to the source code of this file.
Packet client interface | |
#define | PACKET_PREFIX(packet, type) (type *) packet_prefix((packet), sizeof(type)) |
Allocates the specified type right before the actual packet content and returns its pointer. | |
#define | PACKET_SUFFIX(packet, type) (type *) packet_suffix((packet), sizeof(type)) |
Allocates the specified type right after the actual packet content and returns its pointer. | |
#define | PACKET_TRIM(packet, prefix, suffix) packet_trim((packet), sizeof(prefix), sizeof(suffix)) |
Trims the actual packet content by the specified prefix and suffix types. | |
int | packet_copy_data (packet_t *packet, const void *data, size_t length) |
Copies the specified data to the beginning of the actual packet content. | |
int | packet_get_addr (const packet_t *packet, uint8_t **src, uint8_t **dest) |
Returns the stored packet addresses and their length. | |
packet_t * | packet_get_copy (int phone, packet_t *packet) |
Returns the packet copy. | |
void * | packet_get_data (const packet_t *packet) |
Returns the pointer to the beginning of the packet content. | |
size_t | packet_get_data_length (const packet_t *packet) |
Returns the packet content length. | |
packet_id_t | packet_get_id (const packet_t *packet) |
Returns the packet identifier. | |
void * | packet_prefix (packet_t *packet, size_t length) |
Allocates the specified space right before the actual packet content and returns its pointer. | |
int | packet_set_addr (packet_t *packet, const uint8_t *src, const uint8_t *dest, size_t addr_len) |
Sets the packet addresses. | |
void * | packet_suffix (packet_t *packet, size_t length) |
Allocates the specified space right after the actual packet content and returns its pointer. | |
int | packet_trim (packet_t *packet, size_t prefix, size_t suffix) |
Trims the actual packet content by the specified prefix and suffix lengths. |
To function correctly, initialization of the packet map by the pm_init() function has to happen at the first place. The module should not send the packet messages to the packet server but use the functions provided. The packet map should be released by the pm_destroy() function during the module termination. The packets and the packet queues can't be locked at all. The processing modules should process them sequentially - by passing the packets to the next module and stopping using the passed ones.
Definition in file packet_client.h.