# HG changeset patch
# User Mychaela Falconia <falcon@freecalypso.org>
# Date 1741572211 0
# Node ID b21ea4ab586d72e39f8529ceb388a7a8916f57a3
# Parent  3c6bf0d26ee7e54b7e9198b18617f1b99a1f4708
libgsmhr1: update for TW-TS-002 version 1.2.0

The component of libgsmhr1 being changed is RTP input functions;
the change is accepting FT=1 (invalid SID) frames both with and
without payload data bits.

diff -r 3c6bf0d26ee7 -r b21ea4ab586d libgsmhr1/rtp_in.c
--- a/libgsmhr1/rtp_in.c	Tue Feb 25 07:49:28 2025 +0000
+++ b/libgsmhr1/rtp_in.c	Mon Mar 10 02:03:31 2025 +0000
@@ -28,11 +28,17 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 1 || ft == 7) {
+		switch (ft) {
+		case 1:
+			if (rtp_in[0] & 0x04)
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 7:
 			canon_pl[0] = rtp_in[0];
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	case GSMHR_FRAME_LEN_RPF:
 		/*
 		 * The length is that of a TS 101 318 payload.
@@ -53,11 +59,19 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 0 || ft == 2 || ft == 6) {
+		switch (ft) {
+		case 1:
+			if (!(rtp_in[0] & 0x04))
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 0:
+		case 2:
+		case 6:
 			memcpy(canon_pl, rtp_in, GSMHR_FRAME_LEN_5993);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	default:
 	bad_rtp_input:
 		/*
diff -r 3c6bf0d26ee7 -r b21ea4ab586d libgsmhr1/rtp_in_direct.c
--- a/libgsmhr1/rtp_in_direct.c	Tue Feb 25 07:49:28 2025 +0000
+++ b/libgsmhr1/rtp_in_direct.c	Mon Mar 10 02:03:31 2025 +0000
@@ -39,11 +39,17 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 1 || ft == 7) {
+		switch (ft) {
+		case 1:
+			if (rtp_in[0] & 0x04)
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 7:
 			gsmhr_decoder_twts002_in(rtp_in, params);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	case GSMHR_FRAME_LEN_RPF:
 		/*
 		 * The length is that of a TS 101 318 payload.
@@ -67,11 +73,19 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 0 || ft == 2 || ft == 6) {
+		switch (ft) {
+		case 1:
+			if (!(rtp_in[0] & 0x04))
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 0:
+		case 2:
+		case 6:
 			gsmhr_decoder_twts002_in(rtp_in, params);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	default:
 	bad_rtp_input:
 		/*