Skip to main content

Crate zerodds_coap_bridge

Crate zerodds_coap_bridge 

Source
Expand description

Crate zerodds-coap-bridge. Safety classification: STANDARD.

CoAP (RFC 7252) wire codec + reliability + discovery + bridge — pure Rust no_std + alloc, forbid(unsafe_code). Beyond the bare wire codec it also implements all the accompanying CoAP layers: reliability/congestion control (§4.2-§4.7), request/response matching (§5.3), block-wise transfer (RFC 7959), resource discovery in CoRE-Link format (RFC 6690), observe registry (RFC 7641), multicast discovery, caching/proxying (§5.6 + §5.7), DTLS mode marker (§9), and a bidirectional CoAP↔DDS topic bridge.

Spec references:

  • RFC 7252 — CoAP (Constrained Application Protocol).
  • RFC 7641 — Observing Resources in CoAP.
  • RFC 7959 — Block-Wise Transfer.
  • RFC 6690 — CoRE-Link-Format.

§Layer position

Layer 5 — bridges. Substrate for DDS↔IoT endpoint mapping (constrained devices, OPC-UA-PubSub mapping, ROS-2-on-constrained bridges).

§Public API (as of 1.0.0-rc.1)

§Example

use zerodds_coap_bridge::{decode, encode, CoapCode, CoapMessage, MessageType};

let msg = CoapMessage {
    version: 1,
    message_type: MessageType::Confirmable,
    token: Vec::new(),
    code: CoapCode::GET,
    message_id: 0xBEEF,
    options: Vec::new(),
    payload: Vec::new(),
};

let wire = encode(&msg).expect("encode");
let decoded = decode(&wire).expect("decode");
assert_eq!(decoded.code, CoapCode::GET);

Re-exports§

pub use blockwise::BlockError;
pub use blockwise::BlockOption;
pub use blockwise::BlockReassembler;
pub use blockwise::BlockValue;
pub use bridge::BridgeError;
pub use bridge::BridgeOp;
pub use bridge::CoapDdsBridge;
pub use bridge::map_method;
pub use bridge::parse_dds_path;
pub use codec::CodecError;
pub use codec::decode;
pub use codec::encode;
pub use message::CoapCode;
pub use message::CoapMessage;
pub use message::MessageType;
pub use observe::OBSERVE_OPTION_NUMBER;
pub use observe::ObserveRegistry;
pub use observe::ObserverEntry;
pub use option::CoapOption;
pub use option::OptionNumber;
pub use option::OptionValue;
pub use reliability::ACK_TIMEOUT_MS;
pub use reliability::MAX_RETRANSMIT;
pub use reliability::PendingConfirmable;
pub use reliability::ReliabilityTracker;
pub use reliability::TickOutput;

Modules§

blockwise
Block-Wise Transfer — RFC 7959.
bridge
CoAP↔DDS topic bridge.
caching_proxy
CoAP caching + proxying per RFC 7252 §2.3 / §5.6 / §5.7 + HTTP cross-protocol mapping per RFC 7252 §10.
codec
CoAP wire codec — RFC 7252 §3 + §3.1.
core_link
CoRE-Link-Format — RFC 6690.
daemon
zerodds-coap-bridged daemon implementation.
dtls
CoAP DTLS mode per RFC 7252 §9.
matching
Request/response matching per RFC 7252 §5.3.
message
CoAP message model — RFC 7252 §3 + §12.1.
method_props
Method properties (idempotency / safety) per RFC 7252 §5.8.
multicast
CoAP multicast operation per RFC 7252 §8.
observe
Observe pattern — RFC 7641.
option
CoAP option model — RFC 7252 §3.1, §5.10 + RFC 7641 §2.
reliability
CoAP reliability — RFC 7252 §4.2-§4.7.
uri
CoAP URI scheme parser per RFC 7252 §6.