ndn-lite
Data Structures | Macros | Typedefs | Functions | Variables
msg-queue.c File Reference
#include "msg-queue.h"
#include <string.h>

Data Structures

struct  ndn_msg
 

Macros

#define NDN_MSG_PADDING   (ndn_msg_callback)(-1)
 Padding message. More...
 
#define MSGQUEUE_NEXT(ptr)
 

Typedefs

typedef struct ndn_msg ndn_msg_t
 

Functions

void ndn_msgqueue_init (void)
 Init the message queue. More...
 
bool ndn_msgqueue_empty (void)
 Return if the messque queue is empty. More...
 
bool ndn_msgqueue_dispatch (void)
 Dispatch a message on the top of the queue. More...
 
struct ndn_msgndn_msgqueue_post (void *target, ndn_msg_callback reason, size_t param_length, void *param)
 Post a message to the queue. More...
 
void ndn_msgqueue_process (void)
 Dispatch current messages. More...
 
void ndn_msgqueue_cancel (struct ndn_msg *msg)
 Cancel a posted message. More...
 

Variables

static uint8_t msg_queue [NDN_MSGQUEUE_SIZE]
 
static ndn_msg_tpfront
 
static ndn_msg_tptail
 
static ndn_msg_tpsplit
 

Macro Definition Documentation

◆ MSGQUEUE_NEXT

#define MSGQUEUE_NEXT (   ptr)
Value:
ptr = (ndn_msg_t*)(((uint8_t*)ptr) + ptr->length); \
if(((uint8_t*)ptr) >= &msg_queue[NDN_MSGQUEUE_SIZE]){ \
ptr = (ndn_msg_t*)&msg_queue[0]; \
};
Definition: msg-queue.c:28
#define NDN_MSGQUEUE_SIZE
The size of message queue in bytes.
Definition: msg-queue.h:32
static uint8_t msg_queue[NDN_MSGQUEUE_SIZE]
Definition: msg-queue.c:36

◆ NDN_MSG_PADDING

#define NDN_MSG_PADDING   (ndn_msg_callback)(-1)

Padding message.

This will only occur at the end of the queue. When the last message's func is NDN_MSG_PADDING, it means the next message is at the begining of the queue and has a size larger than this padding one.

Typedef Documentation

◆ ndn_msg_t

typedef struct ndn_msg ndn_msg_t

Variable Documentation

◆ msg_queue

uint8_t msg_queue[NDN_MSGQUEUE_SIZE]
static

◆ pfront

ndn_msg_t* pfront
static

◆ psplit

ndn_msg_t * psplit
static

◆ ptail

ndn_msg_t * ptail
static