aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorZach Chadwick <zachad@qacafe.com>2023-02-28 15:16:26 -0500
committerGilbert Ramirez <gilbertr@gmail.com>2023-03-04 22:54:55 +0000
commitac28130c76d93329c0019f4a420166164c02e916 (patch)
tree1d6827a6781ca0614bbfc0e3c343be89bb5a61df /test
parentc7823a14ec27d1ac72f1d6c0d3ec5eb72aa661e6 (diff)
Sharkd: show RTP ssrc as hex and improve errors
The token format used by rtp-analyse and rtp-download expect the SSRC field to be a hex string parsable by `ws_hexstrtou32()` as seen in sharkd_session.c:760. The output from tap:rtp-streams was displaying it as an unsigned integer. For consistency, this field is now displayed as a hex string in the output. If the call to download an RTP stream did not match any payloads, Sharkd would not return any information at all. This now returns an error message indicating that there is no RTP data available. Adds three new selftests and sample pcap.
Diffstat (limited to 'test')
-rw-r--r--test/captures/sip-rtp.pcapngbin0 -> 144300 bytes
-rw-r--r--test/suite_sharkd.py70
2 files changed, 69 insertions, 1 deletions
diff --git a/test/captures/sip-rtp.pcapng b/test/captures/sip-rtp.pcapng
new file mode 100644
index 0000000000..5ea96eef1b
--- /dev/null
+++ b/test/captures/sip-rtp.pcapng
Binary files differ
diff --git a/test/suite_sharkd.py b/test/suite_sharkd.py
index 93b263dd50..8c21e9a57e 100644
--- a/test/suite_sharkd.py
+++ b/test/suite_sharkd.py
@@ -261,6 +261,55 @@ class case_sharkd(subprocesstest.SubprocessTestCase):
}},
))
+ def test_sharkd_req_tap_rtp_streams(self, check_sharkd_session, capture_file):
+ check_sharkd_session((
+ {"jsonrpc":"2.0", "id":1, "method":"load",
+ "params":{"file": capture_file('sip-rtp.pcapng')}
+ },
+ {"jsonrpc":"2.0", "id":2, "method":"tap", "params":{"tap0": "rtp-streams"}},
+ {"jsonrpc":"2.0", "id":2, "method":"tap", "params":{"tap0": "rtp-analyse:200.57.7.204_8000_200.57.7.196_40376_0xd2bd4e3e"}},
+ ), (
+ {"jsonrpc":"2.0","id":1,"result":{"status":"OK"}},
+ {"jsonrpc":"2.0","id":2,"result":{
+ "taps":[{
+ "tap":"rtp-streams",
+ "type":"rtp-streams",
+ "streams":[{
+ "ssrc":"0xd2bd4e3e",
+ "payload":"g711A",
+ "saddr":"200.57.7.204",
+ "sport":8000,
+ "daddr":"200.57.7.196",
+ "dport":40376,
+ "pkts":548,
+ "max_delta":5843.742000,
+ "max_jitter":7.406751,
+ "mean_jitter":2.517173,
+ "expectednr":548,
+ "totalnr":548,
+ "problem":False,
+ "ipver":4
+ }]
+ }]
+ }},
+ {"jsonrpc":"2.0","id":2,"result":
+ {"taps":[{
+ "tap":"rtp-analyse:200.57.7.204_8000_200.57.7.196_40376_0xd2bd4e3e",
+ "type":"rtp-analyse",
+ "ssrc":"0xd2bd4e3e",
+ "max_delta":5843.742000,
+ "max_delta_nr":168,
+ "max_jitter":7.406751,
+ "mean_jitter":2.517173,
+ "max_skew":319.289000,
+ "total_nr":548,
+ "seq_err":0,
+ "duration":24124.055000,
+ "items": MatchAny()
+ }]
+ }},
+ ))
+
def test_sharkd_req_follow_bad(self, check_sharkd_session, capture_file):
# Unrecognized taps currently produce no output (not even err).
check_sharkd_session((
@@ -486,7 +535,7 @@ class case_sharkd(subprocesstest.SubprocessTestCase):
))
def test_sharkd_req_download_tls_secrets(self, check_sharkd_session, capture_file):
- # XXX test download for eo: and rtp: too
+ # XXX test download for eo: too
check_sharkd_session((
{"jsonrpc":"2.0", "id":1, "method":"load",
"params":{"file": capture_file('tls12-dsb.pcapng')}
@@ -502,6 +551,25 @@ class case_sharkd(subprocesstest.SubprocessTestCase):
},
))
+ def test_sharkd_req_download_rtp_stream(self, check_sharkd_session, capture_file):
+ check_sharkd_session((
+ {"jsonrpc":"2.0", "id":1, "method":"load",
+ "params":{"file": capture_file('sip-rtp.pcapng')}
+ },
+ {"jsonrpc":"2.0", "id":2, "method":"download",
+ "params":{"token": "rtp:200.57.7.204_8000_200.57.7.196_40376_0xd2bd4e3e"}},
+ {"jsonrpc":"2.0", "id":3, "method":"download",
+ "params":{"token": "rtp:1.1.1.1_8000_1.1.1.2_9000_0xdddddddd"}},
+ ), (
+ {"jsonrpc":"2.0","id":1,"result":{"status":"OK"}},
+ {"jsonrpc":"2.0","id":2,"result":{
+ "file":"rtp:200.57.7.204_8000_200.57.7.196_40376_0xd2bd4e3e",
+ "mime":"audio/x-wav",
+ "data":MatchRegExp(r'UklGRv.+')}
+ },
+ {"jsonrpc":"2.0","id":3,"error":{"code":-10003,"message":"no rtp data available"}},
+ ))
+
def test_sharkd_req_bye(self, check_sharkd_session):
check_sharkd_session((
{"jsonrpc":"2.0", "id":1, "method":"bye"},