#[unsafe(no_mangle)]pub unsafe extern "C" fn pamoja_gateway_network_uplink(
network: *mut PamojaGatewayNetwork,
packet: PamojaGatewayRxpk,
payload: *const u8,
payload_len: usize,
buffer: *mut u8,
capacity: usize,
out_event: *mut PamojaGatewayNetworkEvent,
) -> PamojaStatusExpand description
Reads a packet the gateway forwarded.
A join request is verified against every registered key, granted an address and a session,
and answered with an accept written into the buffer and described by event.accept. A
data frame is routed by its address, checked against the counter last seen, and decrypted
into the buffer. A frame for a device this site never granted is reported rather than
refused, because a gateway hears every network in range.
§Arguments
network- the network.packet- the metadata of what the gateway heard.payload- the frame as it came off the air.payload_len- its length.buffer- where to write the decrypted payload, or the accept to transmit.capacity- how many bytes the buffer holds.out_event- receives what the packet turned out to be.
§Returns
PamojaStatus::Ok, PamojaStatus::InvalidArgument for a null argument, or
PamojaStatus::Codec when the frame is refused, whose reason is available from
pamoja_last_error_message.
§Safety
network must be a live handle, payload must point at payload_len readable bytes or
be null, buffer must point at capacity writable bytes or be null, and out_event must
point at a writable event.