Go to the documentation of this file.
21 #ifndef NET_GNRC_NETREG_H
22 #define NET_GNRC_NETREG_H
30 #ifdef MODULE_GNRC_NETAPI_MBOX
38 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS) || \
54 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(DOXYGEN)
63 #if defined(MODULE_GNRC_NETAPI_CALLBACKS) || defined(DOXYGEN)
80 #define GNRC_NETREG_DEMUX_CTX_ALL (0xffff0000)
96 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
97 #define GNRC_NETREG_ENTRY_INIT_PID(demux_ctx, pid) { NULL, demux_ctx, \
98 GNRC_NETREG_TYPE_DEFAULT, \
101 #define GNRC_NETREG_ENTRY_INIT_PID(demux_ctx, pid) { NULL, demux_ctx, { pid } }
104 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(DOXYGEN)
116 #define GNRC_NETREG_ENTRY_INIT_MBOX(demux_ctx, _mbox) { NULL, demux_ctx, \
117 GNRC_NETREG_TYPE_MBOX, \
121 #if defined(MODULE_GNRC_NETAPI_CALLBACKS) || defined(DOXYGEN)
133 #define GNRC_NETREG_ENTRY_INIT_CB(demux_ctx, _cbd) { NULL, demux_ctx, \
134 GNRC_NETREG_TYPE_CB, \
183 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS) || \
195 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(DOXYGEN)
204 #if defined(MODULE_GNRC_NETAPI_CALLBACKS) || defined(DOXYGEN)
240 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
246 #if defined(MODULE_GNRC_NETAPI_MBOX) || defined(DOXYGEN)
268 #if defined(MODULE_GNRC_NETAPI_CALLBACKS) || defined(DOXYGEN)
static void gnrc_netreg_entry_init_cb(gnrc_netreg_entry_t *entry, uint32_t demux_ctx, gnrc_netreg_entry_cbd_t *cbd)
Initializes a netreg entry dynamically with callback.
void(* gnrc_netreg_entry_cb_t)(uint16_t cmd, gnrc_pktsnip_t *pkt, void *ctx)
Packet handler callback for netreg entries with callback.
@ GNRC_NETREG_TYPE_MBOX
Use centralized IPC for netapi operations.
int16_t kernel_pid_t
Unique process identifier.
static void gnrc_netreg_entry_init_pid(gnrc_netreg_entry_t *entry, uint32_t demux_ctx, kernel_pid_t pid)
Initializes a netreg entry dynamically with PID.
gnrc_netreg_entry_cbd_t * cbd
Target callback for the registry entry.
@ GNRC_NETREG_TYPE_CB
Use function callbacks for netapi operations.
union gnrc_netreg_entry::@278 target
Target for the registry entry.
gnrc_netreg_type_t
The type of the netreg entry.
mbox_t * mbox
Target mailbox for the registry entry.
Scheduler API definition.
gnrc_netreg_type_t type
Type of the registry entry.
Entry to the Network protocol registry.
@ GNRC_NETREG_TYPE_DEFAULT
Use default IPC for netapi operations.
Mailbox struct definition.
int gnrc_netreg_num(gnrc_nettype_t type, uint32_t demux_ctx)
Returns number of entries with the same gnrc_netreg_entry_t::type and gnrc_netreg_entry_t::demux_ctx.
struct gnrc_netreg_entry gnrc_netreg_entry_t
Entry to the Network protocol registry.
General definitions for network packets and their helper functions.
Protocol type definitions.
static void gnrc_netreg_entry_init_mbox(gnrc_netreg_entry_t *entry, uint32_t demux_ctx, mbox_t *mbox)
Initializes a netreg entry dynamically with mbox.
void gnrc_netreg_unregister(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
Removes a thread from the registry.
gnrc_nettype_t
Definition of protocol types in the network stack.
Callback + Context descriptor.
gnrc_netreg_entry_cb_t cb
the callback
struct gnrc_netreg_entry * next
next element in list
gnrc_netreg_entry_t * gnrc_netreg_getnext(gnrc_netreg_entry_t *entry)
Returns the next entry after entry with the same gnrc_netreg_entry_t::type and gnrc_netreg_entry_t::d...
void gnrc_netreg_init(void)
Initializes module.
gnrc_netreg_entry_t * gnrc_netreg_lookup(gnrc_nettype_t type, uint32_t demux_ctx)
Searches for entries with given parameters in the registry and returns the first found.
int gnrc_netreg_calc_csum(gnrc_pktsnip_t *hdr, gnrc_pktsnip_t *pseudo_hdr)
Calculates the checksum for a header.
kernel_pid_t pid
The PID of the registering thread.
void * ctx
application context for the callback
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
Registers a thread to the registry.
Adds include for missing inttype definitions.
uint32_t demux_ctx
The demultiplexing context for the registering thread.
Type to represent parts (either headers or payload) of a packet, called snips.