/** Node type: rtp * * @file * @author Steffen Vogel * @author Marvin Klimke * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC * @license Apache 2.0 *********************************************************************************/ #pragma once #include #include #include #include #include #include #include #include #include extern "C" { #include #include } namespace villas { namespace node { /* Forward declarations */ class NodeCompat; class SuperNode; /** The maximum length of a packet which contains rtp data. */ #define RTP_INITIAL_BUFFER_LEN 1500 #define RTP_PACKET_TYPE 21 enum class RTPHookType { DISABLED, DECIMATE, LIMIT_RATE }; struct rtp { struct rtp_sock *rs; /**< RTP socket */ struct { struct sa saddr_rtp; /**< Local/Remote address of the RTP socket */ struct sa saddr_rtcp; /**< Local/Remote address of the RTCP socket */ } in, out; Format *formatter; struct { int enabled; int num_rrs; } rtcp; struct { double a; double b; enum RTPHookType rate_hook_type; LimitHook::Ptr rate_hook; dsp::PID rate_pid; /* PID parameters for rate controller */ double Kp, Ki, Kd; double rate_min; double rate; double rate_source; /**< Sample rate of source */ std::ofstream *log; char *log_filename; } aimd; /** AIMD state */ struct CQueueSignalled recv_queue; struct mbuf *send_mb; }; char * rtp_print(NodeCompat *n); int rtp_parse(NodeCompat *n, json_t *json); int rtp_init(NodeCompat *n); int rtp_destroy(NodeCompat *n); int rtp_reverse(NodeCompat *n); int rtp_type_start(SuperNode *sn); int rtp_type_stop(); int rtp_start(NodeCompat *n); int rtp_stop(NodeCompat *n); int rtp_netem_fds(NodeCompat *n, int fds[]); int rtp_poll_fds(NodeCompat *n, int fds[]); int rtp_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt); int rtp_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt); } /* namespace node */ } /* namespace villas */