#include "msg_buf.h"
#include <stdlib.h>
#include "minmax.h"
#include "ptp_core.h"
Go to the source code of this file.
|
void | msgb_init (PtpMsgBuf *buf, PtpMsgBufBlock *pool, uint32_t n) |
|
static PtpMsgBufBlock * | msgb_get_entry_by_tag (PtpMsgBuf *buf, uint32_t tag) |
|
static void | msgb_free_block (PtpMsgBuf *buf, PtpMsgBufBlock *block) |
|
RawPtpMessage * | msgb_alloc (PtpMsgBuf *buf, uint32_t tag, uint32_t ttl) |
|
void | msgb_commit (PtpMsgBuf *buf, RawPtpMessage *msg) |
|
void | msgb_free (PtpMsgBuf *buf, RawPtpMessage *msg) |
|
static PtpMsgBufBlock * | msgb_get_oldest_block (PtpMsgBuf *buf) |
|
RawPtpMessage * | msgb_get_oldest (PtpMsgBuf *buf) |
|
static PtpMsgBufBlock * | msgb_get_block_by_uid (PtpMsgBuf *buf, uint32_t uid) |
|
RawPtpMessage * | msgb_get_by_uid (PtpMsgBuf *buf, uint32_t uid) |
|
static PtpMsgBufBlock * | msgb_get_sent_block_by_tag (PtpMsgBuf *buf, uint32_t tag) |
|
RawPtpMessage * | msgb_get_sent_by_tag (PtpMsgBuf *buf, uint32_t tag) |
|
static void | msgb_set_block_sent (PtpMsgBuf *buf, PtpMsgBufBlock *block) |
|
void | msgb_set_sent (PtpMsgBuf *buf, RawPtpMessage *msg) |
|
uint32_t | msgb_get_uid (const PtpMsgBuf *buf, const RawPtpMessage *msg) |
|
void | msgb_tick (PtpMsgBuf *buf) |
|
void | msgb_report (PtpMsgBuf *buf) |
|
uint32_t | msgb_get_error (PtpMsgBuf *buf) |
|
◆ MSGB_DEBUG
Message buffer debugging.
Definition at line 9 of file msg_buf.c.
◆ RAW_MSG_TO_BLOCK
Get block address by message address.
Definition at line 96 of file msg_buf.c.
◆ msgb_alloc()
Allocate a block.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
tag | unique tag |
ttl | Time-to-Live in ticks |
- Returns
- pointer to a RawPtpMessage object or NULL if there's a block already allocated with the current tag or the buffer is full
Definition at line 39 of file msg_buf.c.
◆ msgb_commit()
Commit a previous allocation, make the message available for later pulling.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
msg | pointer to the allocated message |
Definition at line 98 of file msg_buf.c.
◆ msgb_free()
Release an allocated message block.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
msg | pointer to the allocated message |
Definition at line 115 of file msg_buf.c.
◆ msgb_free_block()
Release an allocated block.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
block | pointer to a previously allocated block |
Definition at line 109 of file msg_buf.c.
◆ msgb_get_block_by_uid()
Get block by its UID.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
uid | uid of the message sought |
- Returns
- message block with the UID or NULL if not found
Definition at line 160 of file msg_buf.c.
◆ msgb_get_by_uid()
Get message by its UID.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
uid | uid of the message sought |
- Returns
- message with the UID or NULL if not found
Definition at line 170 of file msg_buf.c.
◆ msgb_get_entry_by_tag()
Retrieve entry by tag.
- Parameters
-
- Returns
- corresponding allocated entry if found OR NULL
Definition at line 27 of file msg_buf.c.
◆ msgb_get_error()
Read and clear last error.
- Parameters
-
- Returns
- error code
Definition at line 253 of file msg_buf.c.
◆ msgb_get_oldest()
Get oldest message from the buffer. (i.e. sequential reading)
- Parameters
-
- Returns
- pointer to the oldest message or NULL if the buffer is empty
Definition at line 143 of file msg_buf.c.
◆ msgb_get_oldest_block()
Get oldest block from the buffer. (i.e. sequential reading)
- Parameters
-
- Returns
- pointer to the oldest block or NULL if the buffer is empty
Definition at line 127 of file msg_buf.c.
◆ msgb_get_sent_block_by_tag()
Get sent block by tag.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
uid | uid of the message sought |
- Returns
- sent message block with the tag or NULL if not found
Definition at line 187 of file msg_buf.c.
◆ msgb_get_sent_by_tag()
Get sent message by tag.
- Parameters
-
buf | pointer to the PtpMsgBuf object |
tag | tag of the message sought |
- Returns
- message with the tag or NULL if not found
Definition at line 197 of file msg_buf.c.
◆ msgb_get_uid()
Get the UID of an allocated message.
- Parameters
-
buf | pointer to PtpMsgBuf object |
msg | pointer to an allocated message |
- Returns
- message UID
Definition at line 221 of file msg_buf.c.
◆ msgb_init()
Initialize PTP message buffer.
- Parameters
-
buf | pointer to an empty (non-initialized) PtpMsgBuf object |
pool | pointer to an allocated pool for n pieces of PtpMsgBufEntry |
n | number of supported elements |
Definition at line 12 of file msg_buf.c.
◆ msgb_report()
Report the message buffer state.
- Parameters
-
Definition at line 240 of file msg_buf.c.
◆ msgb_set_block_sent()
Set sent flag in a block.
- Parameters
-
buf | pointer to PtpMsgBuf object |
block | pointer to a block |
Definition at line 212 of file msg_buf.c.
◆ msgb_set_sent()
Set sent flag for a message.
- Parameters
-
buf | pointer to PtpMsgBuf object |
msg | pointer to an allocated message |
Definition at line 216 of file msg_buf.c.
◆ msgb_tick()
Tick the storage.
- Parameters
-
Definition at line 226 of file msg_buf.c.