riot_wrappers/gnrc/
netapi.rs#![cfg(riot_module_gnrc_pktbuf)]
use riot_sys::gnrc_nettype_t;
use crate::gnrc_pktbuf::{Pktsnip, Shared};
#[doc(alias = "gnrc_netapi_dispatch_send")]
pub fn dispatch_send(
nettype: gnrc_nettype_t,
demux_ctx: u32,
pkt: impl Into<Pktsnip<Shared>>,
) -> i32 {
let pkt = unsafe { pkt.into().to_ptr() };
let subscribers = unsafe {
riot_sys::gnrc_netapi_dispatch_send(nettype, demux_ctx, crate::inline_cast_mut(pkt))
};
if subscribers == 0 {
unsafe { riot_sys::inline::gnrc_pktbuf_release(crate::inline_cast_mut(pkt)) };
}
subscribers
}