From: Jaroslav Kysela Date: Mon, 12 Feb 2018 19:56:29 +0000 (+0100) Subject: satip,webui: add client extra ports to the status page, fixes #4881 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0f9aa605ce4293b28430af3344b65ba14ec4e6e;p=thirdparty%2Ftvheadend.git satip,webui: add client extra ports to the status page, fixes #4881 --- diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c index 1ed019130..6bc98dad4 100644 --- a/src/satip/rtsp.c +++ b/src/satip/rtsp.c @@ -1658,6 +1658,9 @@ rtsp_stream_status ( void *opaque, htsmsg_t *m ) { http_connection_t *hc = opaque; char buf[128]; + struct session *rs = NULL; + htsmsg_t *c, *l; + int udpport, s32; htsmsg_add_str(m, "type", "SAT>IP"); if (hc->hc_proxy_ip) { @@ -1666,6 +1669,31 @@ rtsp_stream_status ( void *opaque, htsmsg_t *m ) } if (hc->hc_username) htsmsg_add_str(m, "user", hc->hc_username); + + TAILQ_FOREACH(rs, &rtsp_sessions, link) { + if (hc->hc_session && + strcmp(rs->session, hc->hc_session) == 0 && + strcmp(rs->peer_ipstr, hc->hc_peer_ipstr) == 0 && + (udpport = rs->rtp_peer_port) > 0) { + if (udpport == RTSP_TCP_DATA) { + if (rs->tcp_data == hc) { + c = htsmsg_create_map(); + l = htsmsg_create_list(); + s32 = htsmsg_get_s32_or_default(m, "peer_port", -1); + htsmsg_add_s32(l, NULL, s32); + htsmsg_add_msg(c, "tcp", l); + htsmsg_add_msg(m, "peer_extra_ports", c); + } + } else { + c = htsmsg_create_map(); + l = htsmsg_create_list(); + htsmsg_add_s32(l, NULL, udpport); + htsmsg_add_s32(l, NULL, udpport+1); + htsmsg_add_msg(c, "udp", l); + htsmsg_add_msg(m, "peer_extra_ports", c); + } + } + } } /* diff --git a/src/webui/static/app/status.js b/src/webui/static/app/status.js index 0ac4b78e9..62e3b67b4 100644 --- a/src/webui/static/app/status.js +++ b/src/webui/static/app/status.js @@ -607,6 +607,7 @@ tvheadend.status_conns = function(panel, index) { { name: 'server_port' }, { name: 'peer', sortType: stype }, { name: 'peer_port' }, + { name: 'peer_extra_ports' }, { name: 'proxy' }, { name: 'user', sortType: stype }, { @@ -648,6 +649,23 @@ tvheadend.status_conns = function(panel, index) { header: _("Client Port"), dataIndex: 'peer_port', sortable: true + }, { + width: 50, + id: 'peer_extra_ports', + header: _("Client Data Ports"), + dataIndex: 'peer_extra_ports', + sortable: false, + renderer: function(v) { + if (!v) return ''; + var o = ''; + if ('tcp' in v) + o += _("TCP") + v.tcp.join(','); + if ('udp' in v) { + if (o) o += ';'; + o += _("UDP") + v.udp.join(','); + } + return o; + } }, { width: 50, id: 'user',