RTP_Emulation: check received RTP packets

The configuration of the RTP Emulation (RtpemConfig) allows to set a
fixed RTP payload that is then used when RTP packets are transmitted.
However, when packets are received, then the payload is not checked.
Lets check the received data against some user configurable rx payload,
that is by default set to the tx payload.

Change-Id: Id0b125aaf915497d0a4f051af890fc34e09da61d
Related: OS#3807
diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index fcb158b..2494d74 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -119,7 +119,9 @@
 	/* number of packets received wrong payload type */
 	integer num_pkts_rx_err_pt,
 	/* number of packets received during Rx disable */
-	integer num_pkts_rx_err_disabled
+	integer num_pkts_rx_err_disabled,
+	/* number of packets received with mismatching payload */
+	integer num_pkts_rx_err_payload
 }
 
 const RtpemStats c_RtpemStatsReset := {
@@ -130,7 +132,8 @@
 	num_pkts_rx_err_seq := 0,
 	num_pkts_rx_err_ts := 0,
 	num_pkts_rx_err_pt := 0,
-	num_pkts_rx_err_disabled := 0
+	num_pkts_rx_err_disabled := 0,
+	num_pkts_rx_err_payload := 0
 }
 
 type record RtpemConfig {
@@ -139,6 +142,7 @@
 	integer tx_duration_ms,
 	BIT32_BO_LAST tx_ssrc,
 	octetstring tx_fixed_payload optional,
+	octetstring rx_fixed_payload optional,
 	boolean iuup_mode,
 	boolean iuup_tx_init
 };
@@ -149,6 +153,7 @@
 	tx_duration_ms := 20,
 	tx_ssrc := '11011110101011011011111011101111'B,
 	tx_fixed_payload := '01020304'O,
+	rx_fixed_payload := '01020304'O,
 	iuup_mode := false,
 	iuup_tx_init := true
 }
@@ -276,6 +281,10 @@
 		setverdict(fail, "RTP packets received while RX was disabled");
 		mtc.stop;
 	}
+	if (s.num_pkts_rx_err_payload != 0) {
+		setverdict(fail, "RTP packets with mismatching payload received");
+		mtc.stop;
+	}
 }
 
 template PDU_RTP ts_RTP(BIT32_BO_LAST ssrc, INT7b pt, LIN2_BO_LAST seq, uint32_t ts,
@@ -437,8 +446,6 @@
 
 		/* process received RTCP/RTP if receiver enabled */
 		[g_rx_enabled] RTP.receive(tr_rtp) -> value rx_rtp {
-			//log("RX RTP: ", rx_rtp);
-
 			/* increment counters */
 			if (rx_rtp.msg.rtp.payload_type != g_cfg.tx_payload_type) {
 				g_stats_rtp.num_pkts_rx_err_pt := g_stats_rtp.num_pkts_rx_err_pt+1;
@@ -446,6 +453,9 @@
 			g_stats_rtp.num_pkts_rx := g_stats_rtp.num_pkts_rx+1;
 			g_stats_rtp.bytes_payload_rx := g_stats_rtp.bytes_payload_rx +
 								lengthof(rx_rtp.msg.rtp.data);
+			if (ispresent(g_cfg.rx_fixed_payload) and rx_rtp.msg.rtp.data != g_cfg.rx_fixed_payload) {
+				g_stats_rtp.num_pkts_rx_err_payload := g_stats_rtp.num_pkts_rx_err_payload + 1;
+			}
 			if (g_cfg.iuup_mode) {
 				rx_rtp.msg.rtp.data := f_IuUP_Em_rx_decaps(g_iuup_ent, rx_rtp.msg.rtp.data);
 			}