netgauze-udp-notif-pkt

Crates.ionetgauze-udp-notif-pkt
lib.rsnetgauze-udp-notif-pkt
version0.9.0
created_at2024-11-05 16:54:19.735838+00
updated_at2026-01-19 10:35:59.749822+00
descriptionUDP-Notif (draft-ietf-netconf-udp-notif) packet library for YANG Push streaming telemetry. Provides zero-copy wire format handling, automatic JSON/CBOR deserialization, and type-safe access to RFC 8639/8641 subscription notifications.
homepagehttps://github.com/NetGauze/NetGauze
repositoryhttps://github.com/NetGauze/NetGauze
max_upload_size
id1436820
size169,229
Ahmed Elhassany (ahassany)

documentation

README

UDP-Notif Packet Library

Crates.io Documentation Apache licensed

A complete Rust implementation of draft-ietf-netconf-udp-notif for UDP-based transport of YANG Push streaming telemetry notifications.

Features

  • Multi-layer API: Raw wire format, decoded notifications, and YANG data structures
  • Zero-copy parsing: Efficient Bytes-based for raw payload handling
  • Media type support: JSON (application/yang-data+json) and CBOR (application/yang-data+cbor)
  • Protocol options: Segmentation and private encoding extensions
  • Dual notification formats: Standard NETCONF notification (RFC 8639/RFC 8641) and YANG-based notification envelope draft-ietf-netconf-notif-envelope
  • Async codec: Tokio-based UDP framing for stream processing
  • Type-safe: Strongly typed YANG Push notification structures from RFC 8639 and RFC 8641

Architecture

The library provides three levels of abstraction:

raw - Wire Format Layer

Direct access to UDP-Notif packet structure with unparsed payload bytes. Use for maximum performance, custom processing, or protocol-level inspection.

use udp_notif_pkt::raw::UdpNotifPacket;

// Access packet metadata and raw payload
let version = packet.version();
let publisher_id = packet.publisher_id();
let payload_bytes = packet.payload();

decoded - Parsed Notification Layer

Automatic JSON/CBOR deserialization into structured Rust types. Use for type-safe access to notification contents.

use udp_notif_pkt::decoded::{UdpNotifPacketDecoded, UdpNotifPayload};

let decoded: UdpNotifPacketDecoded = (&raw_packet).try_into()?;
match decoded.payload() {
    UdpNotifPayload::NotificationEnvelope(envelope) => {
        // Handle modern format
    }
    UdpNotifPayload::NotificationLegacy(legacy) => {
        // Handle legacy format
    }
}

notification - YANG Data Structures

Complete YANG Push notification types (subscriptions, updates, lifecycle events).

use udp_notif_pkt::notification::NotificationVariant;

match variant {
    NotificationVariant::YangPushUpdate(update) => {
        println!("Update for subscription {}", update.id());
    }
    NotificationVariant::SubscriptionStarted(sub) => {
        println!("Subscription started with encoding {:?}", sub.encoding());
    }
    // ... handle other notification types
}
Commit count: 974

cargo fmt