comparison libgsmhr1/rtp_in.c @ 586:b21ea4ab586d

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.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 10 Mar 2025 02:03:31 +0000
parents cc3a831712a4
children
comparison
equal deleted inserted replaced
585:3c6bf0d26ee7 586:b21ea4ab586d
26 * RFC 5993 or TW-TS-002 format with FT=1 or FT=7. 26 * RFC 5993 or TW-TS-002 format with FT=1 or FT=7.
27 */ 27 */
28 if (rtp_in[0] & 0x80) 28 if (rtp_in[0] & 0x80)
29 goto bad_rtp_input; 29 goto bad_rtp_input;
30 ft = rtp_in[0] >> 4; 30 ft = rtp_in[0] >> 4;
31 if (ft == 1 || ft == 7) { 31 switch (ft) {
32 case 1:
33 if (rtp_in[0] & 0x04)
34 goto bad_rtp_input;
35 /* FALL THRU */
36 case 7:
32 canon_pl[0] = rtp_in[0]; 37 canon_pl[0] = rtp_in[0];
33 return 0; 38 return 0;
34 } else 39 default:
35 goto bad_rtp_input; 40 goto bad_rtp_input;
41 }
36 case GSMHR_FRAME_LEN_RPF: 42 case GSMHR_FRAME_LEN_RPF:
37 /* 43 /*
38 * The length is that of a TS 101 318 payload. 44 * The length is that of a TS 101 318 payload.
39 * No further checks can be done: every possible 45 * No further checks can be done: every possible
40 * bit pattern is a valid payload in this format. 46 * bit pattern is a valid payload in this format.
51 * RFC 5993 or TW-TS-002 format with FT=0, FT=2 or FT=6. 57 * RFC 5993 or TW-TS-002 format with FT=0, FT=2 or FT=6.
52 */ 58 */
53 if (rtp_in[0] & 0x80) 59 if (rtp_in[0] & 0x80)
54 goto bad_rtp_input; 60 goto bad_rtp_input;
55 ft = rtp_in[0] >> 4; 61 ft = rtp_in[0] >> 4;
56 if (ft == 0 || ft == 2 || ft == 6) { 62 switch (ft) {
63 case 1:
64 if (!(rtp_in[0] & 0x04))
65 goto bad_rtp_input;
66 /* FALL THRU */
67 case 0:
68 case 2:
69 case 6:
57 memcpy(canon_pl, rtp_in, GSMHR_FRAME_LEN_5993); 70 memcpy(canon_pl, rtp_in, GSMHR_FRAME_LEN_5993);
58 return 0; 71 return 0;
59 } else 72 default:
60 goto bad_rtp_input; 73 goto bad_rtp_input;
74 }
61 default: 75 default:
62 bad_rtp_input: 76 bad_rtp_input:
63 /* 77 /*
64 * Treat it like BFI-no-data, and tell the caller 78 * Treat it like BFI-no-data, and tell the caller
65 * that we received an invalid RTP payload. 79 * that we received an invalid RTP payload.