sysrepo  5.2.34
YANG-based system repository for all-around configuration management.
Publisher

Encoding notifications into UDP-Notif datagrams. More...

Collaboration diagram for Publisher:

Data Structures

struct  srudpn_dgram_t
 One encoded UDP-Notif datagram, header and data to be sent together. More...
 

Functions

int srudpn_build_dgrams (srudpn_media_type_t media_type, uint32_t publisher_id, uint32_t message_id, const uint8_t *payload, uint32_t payload_len, uint16_t max_segment_size, srudpn_dgram_t **dgrams)
 Encode a payload into UDP-Notif datagrams. More...
 
int srudpn_encode_notification (const struct lyd_node *notif, const struct timespec *event_time, srudpn_media_type_t media_type, uint8_t **payload, uint32_t *payload_len)
 Encode a notification in the RFC 5277 envelope. More...
 

Detailed Description

Encoding notifications into UDP-Notif datagrams.


Data Structure Documentation

◆ srudpn_dgram_t

struct srudpn_dgram_t

One encoded UDP-Notif datagram, header and data to be sent together.

Definition at line 296 of file udp_notif.h.

Data Fields
const uint8_t * data

datagram data, points into the encoded payload

uint16_t data_len

length of the datagram data

uint8_t hdr[12+4]

header including options

uint8_t hdr_len

used length of the header

Function Documentation

◆ srudpn_build_dgrams()

int srudpn_build_dgrams ( srudpn_media_type_t  media_type,
uint32_t  publisher_id,
uint32_t  message_id,
const uint8_t *  payload,
uint32_t  payload_len,
uint16_t  max_segment_size,
srudpn_dgram_t **  dgrams 
)

Encode a payload into UDP-Notif datagrams.

Parameters
[in]media_typeMedia type of the payload, not SRUDPN_MT_PRIVATE.
[in]publisher_idMessage publisher ID.
[in]message_idMessage ID.
[in]payloadPayload to send, dgrams point into it so it must not be freed before them.
[in]payload_lenLength of payload.
[in]max_segment_sizeMaximum datagram size, segmenting the message if it does not fit, 0 to never segment.
[out]dgramsAddress of a srudpn_dgram_t pointer set to the encoded datagrams as a libyang sized array, iterate with LYA_FOR() and free with LYA_FREE().
Returns
SR_ERR_OK on success,
SR_ERR_INVAL_ARG if the payload is empty or does not fit into a datagram or the segments,
another error code on failure.

◆ srudpn_encode_notification()

int srudpn_encode_notification ( const struct lyd_node *  notif,
const struct timespec *  event_time,
srudpn_media_type_t  media_type,
uint8_t **  payload,
uint32_t *  payload_len 
)

Encode a notification in the RFC 5277 envelope.

Parameters
[in]notifNotification to encode.
[in]event_timeEvent time of the notification.
[in]media_typeMedia type to encode in.
[out]payloadEncoded payload.
[out]payload_lenLength of payload.
Returns
Error code (SR_ERR_OK on success).