Message queue of the forwarder.
More...
|
typedef void(* | ndn_msg_callback) (void *self, size_t param_length, void *param) |
| The callback function of message. More...
|
|
Message queue of the forwarder.
◆ NDN_MSGQUEUE_SIZE
#define NDN_MSGQUEUE_SIZE 4096 |
The size of message queue in bytes.
◆ ndn_msg_callback
typedef void(* ndn_msg_callback) (void *self, size_t param_length, void *param) |
The callback function of message.
- Parameters
-
[in,out] | self | The object to receive this message. |
[in] | param_length | [Optional] The length of the param . |
[in] | param | [Optional] Point to a raw memory in size param_length . |
◆ ndn_msgqueue_cancel()
void ndn_msgqueue_cancel |
( |
struct ndn_msg * |
msg | ) |
|
Cancel a posted message.
Please make sure the pointer is correct and it's used before dispatch.
- Parameters
-
[in] | msg | Pointer to message |
◆ ndn_msgqueue_dispatch()
bool ndn_msgqueue_dispatch |
( |
void |
| ) |
|
Dispatch a message on the top of the queue.
Call the message by reason(target, param_length, param)
.
- Return values
-
true | One message dispatched. |
false | The queue is empty. Do nothing. |
◆ ndn_msgqueue_empty()
bool ndn_msgqueue_empty |
( |
void |
| ) |
|
Return if the messque queue is empty.
- Return values
-
true | Empty. |
false | Not empty. |
- Note
- This function will defragment the queue if it's empty.
◆ ndn_msgqueue_init()
void ndn_msgqueue_init |
( |
void |
| ) |
|
◆ ndn_msgqueue_post()
Post a message to the queue.
- Parameters
-
[in] | target | The object to receive this message. |
[in] | reason | The message callback function. |
[in] | length | [Optional] The length of parameters param . |
[in] | param | [Optional] The parameters of this message. Its context will be copied into the queue. |
- Returns
- An pointer to cancel the message. NULL if failed.
◆ ndn_msgqueue_process()
void ndn_msgqueue_process |
( |
void |
| ) |
|
Dispatch current messages.
Process all messages currently in the queue. New messages posted during this function will not be dispatched.