sysrepo  5.2.34
YANG-based system repository for all-around configuration management.
udp_notif.h File Reference

UDP-Notif (draft-ietf-netconf-udp-notif) collector and encoder functions header. More...

#include <net/if.h>
#include <netinet/in.h>
#include <stdint.h>
#include <time.h>
#include "sysrepo.h"
Include dependency graph for udp_notif.h:

Go to the source code of this file.

Data Structures

struct  srudpn_dgram_t
 One encoded UDP-Notif datagram, header and data to be sent together. More...
 
struct  srudpn_hdr_t
 Parsed header of one UDP-Notif datagram. More...
 
struct  srudpn_stats_t
 UDP-Notif collector diagnostic counters. More...
 

Macros

#define SRUDPN_ADDR_STRLEN   (INET6_ADDRSTRLEN + IF_NAMESIZE)
 
#define SRUDPN_HDR_SIZE   12
 
#define SRUDPN_OPT_SEGMENTATION   1
 
#define SRUDPN_OPT_SEGMENTATION_SIZE   4
 
#define SRUDPN_VERSION   1
 

Typedefs

typedef struct srudpn_msg_s srudpn_msg_t
 Complete (reassembled) UDP-Notif message. More...
 
typedef struct srudpn_notif_s srudpn_notif_t
 Parsed notification of a UDP-Notif message. More...
 
typedef struct srudpn_s srudpn_t
 UDP-Notif collector receiving and reassembling notifications over UDP. More...
 

Enumerations

enum  srudpn_media_type_t { SRUDPN_MT_JSON = 1 , SRUDPN_MT_XML = 2 , SRUDPN_MT_CBOR = 3 , SRUDPN_MT_PRIVATE = 16 }
 UDP-Notif media types (MT values with the S-flag unset). 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...
 
void srudpn_close (srudpn_t *udp)
 Close a collector, any incomplete messages are dropped. 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...
 
int srudpn_get_fd (const srudpn_t *udp)
 Get the socket of a collector for polling. More...
 
uint16_t srudpn_get_port (const srudpn_t *udp)
 Get the port a collector is bound to. More...
 
srudpn_stats_t srudpn_get_stats (const srudpn_t *udp)
 Get the diagnostic counters of a collector. More...
 
void srudpn_msg_free (srudpn_msg_t *msg)
 Free a message. More...
 
const srudpn_hdr_t * srudpn_msg_get_hdr (const srudpn_msg_t *msg)
 Get the header of a message. More...
 
srudpn_media_type_t srudpn_msg_get_media_type (const srudpn_msg_t *msg)
 Get the media type of a message. More...
 
void srudpn_msg_get_payload (const srudpn_msg_t *msg, const uint8_t **payload, uint32_t *payload_len)
 Get the payload of a message. More...
 
void srudpn_msg_get_source (const srudpn_msg_t *msg, char *addr, uint16_t *port)
 Get the source address and port of a message. More...
 
int srudpn_msg_parse (const srudpn_msg_t *msg, const struct ly_ctx *ly_ctx, srudpn_notif_t **notif)
 Parse the notification of a message. More...
 
void srudpn_notif_free (srudpn_notif_t *notif)
 Free a parsed notification. More...
 
const struct lyd_node * srudpn_notif_get_envelope (const srudpn_notif_t *notif)
 Get the envelope of a parsed notification. More...
 
const struct timespec * srudpn_notif_get_event_time (const srudpn_notif_t *notif)
 Get the event time of a parsed notification. More...
 
const struct lyd_node * srudpn_notif_get_tree (const srudpn_notif_t *notif)
 Get the notification data tree of a parsed notification. More...
 
int srudpn_open (const char *address, uint16_t port, srudpn_t **udp)
 Open a UDP-Notif collector bound to a local address. More...
 
int srudpn_read_msg (srudpn_t *udp, int32_t timeout_ms, srudpn_msg_t **msg)
 Read one complete UDP-Notif message. More...
 

Detailed Description

UDP-Notif (draft-ietf-netconf-udp-notif) collector and encoder functions header.

Author
Roman Janota Roman.nosp@m..Jan.nosp@m.ota@c.nosp@m.esne.nosp@m.t.cz

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://opensource.org/licenses/BSD-3-Clause

Definition in file udp_notif.h.