riot_sys

Function gnrc_netreg_register

Source
pub unsafe extern "C" fn gnrc_netreg_register(
    type_: gnrc_nettype_t,
    entry: *mut gnrc_netreg_entry_t,
) -> c_int
Expand description

@brief Registers a thread to the registry.

@details The semantics are: Thread gnrc_netreg_entry_t::pid is interested in packets of protocol @p type with context gnrc_netreg_entry_t::demux_ctx.

@param[in] type Type of the protocol. Must not be < GNRC_NETTYPE_UNDEF or >= GNRC_NETTYPE_NUMOF. @param[in] entry An entry you want to add to the registry. This needs to be initialized before hand using the @ref net_gnrc_netreg_init_static “static” or @ref net_gnrc_netreg_init_dyn “dynamic” initialization helpers.

@warning Call gnrc_netreg_unregister() before you leave the context you allocated @p entry in. Otherwise it might get overwritten.

@pre The calling thread must provide a [message queue](@ref msg_init_queue) when using @ref GNRC_NETREG_TYPE_DEFAULT for gnrc_netreg_entry_t::type of @p entry.

@return 0 on success @return -EINVAL if @p type was < GNRC_NETTYPE_UNDEF or >= GNRC_NETTYPE_NUMOF