Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Packet Class Reference
Received packet. More...
#include <Packet.h>
Public Member Functions | |
| uint32_t | size () const |
| Size of the packet. | |
| uint32_t | len () const |
| Amount of data store in the packet. | |
| const char * | data () const |
| Pointer to the internal buffer. | |
| Packet * | next () const |
| Pointer to the next packet in the chain or NULL if none. | |
| uint32_t | append (const char *data, uint32_t len) |
| Appends up to `len` bytes from `data` into this packet and returns the number of bytes copied. | |
| uint32_t | consume (char *data, uint32_t len) |
| Consumes up to `len` bytes from this packet in to `data`. | |
| void | set_next (Packet *next) |
| Sets the pointer to next target. | |
| ~Packet () | |
| Deletes this packet and its following packets in the chain. | |
Static Public Member Functions | |
| static Packet * | new_packet (uint32_t size, volatile uint32_t &heap_usage) |
| Creates a new packet tracking memory usage in heap_usage. | |
Detailed Description
Received packet.
- Warning:
- Packets keep a reference into their source network interface. They shall never outlive this interface.
Definition at line 27 of file Packet.h.
Constructor & Destructor Documentation
| ~Packet | ( | ) |
Deletes this packet and its following packets in the chain.
- Warning:
- it is unsafe to delete a packet that is referenced by another packet.
Definition at line 75 of file Packet.cpp.
Member Function Documentation
| uint32_t append | ( | const char * | data, |
| uint32_t | len | ||
| ) |
Appends up to `len` bytes from `data` into this packet and returns the number of bytes copied.
- Parameters:
-
data Source buffer. len Source length.
- Returns:
- number of bytes copied.
Definition at line 41 of file Packet.cpp.
| uint32_t consume | ( | char * | data, |
| uint32_t | len | ||
| ) |
Consumes up to `len` bytes from this packet in to `data`.
- Parameters:
-
data Output buffer. len Output buffer length.
- Returns:
- number of bytes copied into `data`.
Definition at line 53 of file Packet.cpp.
| Packet * new_packet | ( | uint32_t | size, |
| volatile uint32_t & | heap_usage | ||
| ) | [static] |
Creates a new packet tracking memory usage in heap_usage.
- Parameters:
-
size Size of the packet. heap_usage reference to a volatile long integer thread safely keeping track of the memory usage.
- Returns:
- A new packet or NULL on failure.
Definition at line 21 of file Packet.cpp.
| Packet* next | ( | ) | const |
| void set_next | ( | Packet * | next ) |
Sets the pointer to next target.
- Note:
- Setting to NULL will not delete the next packet but simply detach it.
Definition at line 66 of file Packet.cpp.
Generated on Mon Aug 29 2022 19:53:44 by
1.7.2