libosmo-netif 1.5.1.31-6b3f
Osmocom network interface library
twrtp_private.h
1/*
2 * Themyscira Wireless RTP endpoint implementation:
3 * internal definitions confined to twrtp code inside libosmo-netif.
4 *
5 * This code was contributed to Osmocom Cellular Network Infrastructure
6 * project by Mother Mychaela N. Falconia of Themyscira Wireless.
7 * Mother Mychaela's contributions are NOT subject to copyright:
8 * no rights reserved, all rights relinquished.
9 */
10
11#pragma once
12
13#include <stdint.h>
14#include <stdbool.h>
15
16#include <osmocom/core/osmo_io.h>
17#include <osmocom/core/socket.h>
18#include <osmocom/core/timer.h>
19
20#include <osmocom/netif/twrtp.h>
21
23 uint32_t ssrc;
24 uint32_t ts;
25 uint32_t ts_addend;
26 uint16_t seq;
27 bool started;
28 bool restart;
29};
30
32 uint32_t sr_ssrc;
33 uint16_t sr_ntp_sec;
34 uint16_t sr_ntp_fract;
35 struct timespec sr_rx_time;
36 uint32_t rr_lost_word;
37 uint32_t rr_jitter;
38 uint32_t rr_jitter_max;
39 bool got_sr;
40 bool got_rr;
41};
42
44 uint32_t last_received;
45 uint32_t last_expected;
46};
47
48struct osmo_twjit;
49
50struct osmo_twrtp {
51 /* the root of the matter: the two sockets */
52 struct osmo_io_fd *iofd_rtp;
53 struct osmo_io_fd *iofd_rtcp;
54 struct osmo_sockaddr rtp_remote;
55 struct osmo_sockaddr rtcp_remote;
56 /* count of RTP timestamp units per quantum */
57 uint32_t ts_quantum;
58 /* scaling factors for RTP Tx timestamp computation */
59 uint32_t ts_units_per_sec;
60 uint32_t ns_to_ts_units;
61 /* RTP Rx path: twjit and raw options */
62 struct osmo_twjit *twjit;
63 osmo_twrtp_raw_rx_cb raw_rx_cb;
64 void *raw_rx_cb_data;
65 /* RTP Tx state */
66 struct twrtp_endp_tx tx;
67 /* RTCP info */
68 struct twrtp_endp_rtcp_rx rtcp_rx;
69 struct twrtp_endp_rtcp_tx rtcp_tx;
70 uint8_t *sdes_buf;
71 uint16_t sdes_len;
72 uint16_t auto_rtcp_interval;
73 uint16_t auto_rtcp_count;
74 /* always have to have stats */
75 struct osmo_twrtp_stats stats;
76 /* bool flags at the end for structure packing optimization */
77 bool register_done;
78 bool remote_set;
79 bool twjit_rx_enable;
80};
81
82/* internal linkage */
83
84extern const struct osmo_io_ops _osmo_twrtp_iops_rtp;
85extern const struct osmo_io_ops _osmo_twrtp_iops_rtcp;
86
87int _osmo_twrtp_send_rtcp(struct osmo_twrtp *endp, bool send_sr,
88 const struct timespec *utc, uint32_t rtp_ts);
Definition: twjit_private.h:51
Definition: twrtp.h:26
Definition: twrtp_private.h:50
Definition: twrtp_private.h:31
Definition: twrtp_private.h:43
Definition: twrtp_private.h:22