falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/33060 )
Change subject: codec: new function osmo_hr_sid_reset()
......................................................................
codec: new function osmo_hr_sid_reset()
If a network element that receives call leg A UL and is responsible
for preparing leg B DL receives a GSM-HR SID frame whose SID field
is not all 1s but which is marked as valid SID by out-of-band means
(TRAU-UL frame control bits or the FT field in RFC 5993 ToC octet),
this SID frame should be rejuvenated (SID field reset to all 1s)
prior to retransmission on call leg B DL. Provide a function
that performs this operation.
Related: OS#6036
Change-Id: Iebc0863ffcc3f8f25aeb54d4b14fac0487bc2bbb
---
M include/osmocom/codec/codec.h
M src/codec/gsm620.c
2 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/33060/1
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index 4dbe129..c5981f8 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -131,6 +131,7 @@
bool osmo_efr_sid_preen(uint8_t *rtp_payload);
void osmo_fr_sid_reset(uint8_t *rtp_payload);
+void osmo_hr_sid_reset(uint8_t *rtp_payload);
void osmo_efr_sid_reset(uint8_t *rtp_payload);
int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,
diff --git a/src/codec/gsm620.c b/src/codec/gsm620.c
index 4eae514..ef1d3b9 100644
--- a/src/codec/gsm620.c
+++ b/src/codec/gsm620.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <string.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/utils.h>
@@ -285,3 +286,31 @@
return true;
}
+
+/*! Reset the SID field of a potentially corrupted, but still valid GSM-HR
+ * SID frame in TS 101 318 format to its pristine state (full SID codeword).
+ * \param[in] rtp_payload Buffer with RTP payload - must be writable!
+ *
+ * Per GSM 06.22 section 5.3, a freshly minted SID frame consists of 33 bits
+ * of comfort noise parameters and 79 bits of SID codeword (all 1s). Network
+ * elements that receive SID frames from call leg A uplink and need to
+ * retransmit them on leg B downlink should "rejuvenate" received SID frames
+ * prior to retransmission by resetting the SID field to its pristine state
+ * of all 1s; this function does the job.
+ *
+ * Important note: because of HR-specific quirks (lack of exact bit counting
+ * rules in GSM 06.41 spec compared to 06.31 & 06.81, plus the fact that such
+ * bit counting can only be done efficiently in the GSM 05.03 channel decoder
+ * prior to bit reordering based on voiced or unvoiced mode), a generic
+ * (usable from any network element) SID classification function similar to
+ * osmo_{fr,efr}_sid_classify() unfortunately cannot exist for HR. Therefore,
+ * the triggering condition for invoking this SID rejuvenation/reset function
+ * can only be an out-of-band SID indication, as in GSM 08.61 TRAU frames
+ * or RFC 5993 ToC octet.
+ */
+void osmo_hr_sid_reset(uint8_t *rtp_payload)
+{
+ /* set all 79 SID codeword bits to 1 */
+ rtp_payload[4] |= 0x7F;
+ memset(rtp_payload + 5, 0xFF, 9);
+}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33060
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iebc0863ffcc3f8f25aeb54d4b14fac0487bc2bbb
Gerrit-Change-Number: 33060
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-MessageType: newchange
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/33059 )
Change subject: codec: new functions osmo_{fr,efr}_sid_reset()
......................................................................
codec: new functions osmo_{fr,efr}_sid_reset()
In Iec5c1f2619a82499f61cb3e5a7cd03ff0f020ad8 we added
osmo_{fr,efr}_sid_preen() functions that apply SID classification
of GSM 06.31/06.81 section 6.1.1 (osmo_{fr,efr}_sid_classify()),
reject invalid SID, and "rejuvenate" deemed-valid SID frames by
resetting their SID code word, correcting the one bit error that
may be present in a deemed-valid SID frame. However, the last
operation (rejuvenation of a SID frame by resetting its SID field)
should also be made available as its own function, as it may be
more efficient in some applications: for example, an application
may need to call osmo_{fr,efr}_sid_classify(), apply the rejuvenation
to valid SID, but also use the classification result to drive other
logic. Factor out these functions.
Change-Id: I1d6dd867a358bdda8850cd8c959d0f361c0a5b6d
---
M include/osmocom/codec/codec.h
M src/codec/gsm610.c
M src/codec/gsm660.c
3 files changed, 94 insertions(+), 32 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/33059/1
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index 731f169..4dbe129 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -130,6 +130,9 @@
bool osmo_fr_sid_preen(uint8_t *rtp_payload);
bool osmo_efr_sid_preen(uint8_t *rtp_payload);
+void osmo_fr_sid_reset(uint8_t *rtp_payload);
+void osmo_efr_sid_reset(uint8_t *rtp_payload);
+
int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,
enum osmo_amr_quality bfi);
int osmo_amr_rtp_dec(const uint8_t *payload, int payload_len, uint8_t *cmr,
diff --git a/src/codec/gsm610.c b/src/codec/gsm610.c
index 19c7aa4..5cc4f14 100644
--- a/src/codec/gsm610.c
+++ b/src/codec/gsm610.c
@@ -404,6 +404,35 @@
return OSMO_GSM631_SID_CLASS_VALID;
}
+/*! Reset the SID field and the unused bits of a potentially corrupted,
+ * but still valid GSM-FR SID frame in RTP encoding to their pristine state.
+ * \param[in] rtp_payload Buffer with RTP payload - must be writable!
+ *
+ * Per GSM 06.12 section 5.2, a freshly minted SID frame carries 60 bits
+ * of comfort noise parameters (LARc and 4 times Xmaxc), while the remaining
+ * 200 bits are all zeros; the latter 200 all-0 bits further break down into
+ * 95 bits of SID field (checked by receivers to detect SID) and 105 unused
+ * bits which receivers are told to ignore. Network elements that receive
+ * SID frames from call leg A uplink and need to retransmit them on leg B
+ * downlink should "rejuvenate" received SID frames prior to retransmission;
+ * this function does the job.
+ */
+void osmo_fr_sid_reset(uint8_t *rtp_payload)
+{
+ uint8_t *p, sub;
+
+ p = rtp_payload + 5; /* skip magic+LARc */
+ for (sub = 0; sub < 4; sub++) {
+ *p++ = 0;
+ *p++ &= 0x1F; /* upper 5 bits of Xmaxc field */
+ *p++ &= 0x80; /* and the lsb spilling into the next byte */
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ }
+}
+
/*! Preen potentially-SID FR codec frame in RTP format, ensuring that it is
* either a speech frame or a valid SID, and if the latter, making it a
* perfect, error-free SID frame.
@@ -413,7 +442,6 @@
bool osmo_fr_sid_preen(uint8_t *rtp_payload)
{
enum osmo_gsm631_sid_class sidc;
- uint8_t *p, sub;
sidc = osmo_fr_sid_classify(rtp_payload);
switch (sidc) {
@@ -422,20 +450,8 @@
case OSMO_GSM631_SID_CLASS_INVALID:
return false;
case OSMO_GSM631_SID_CLASS_VALID:
- /* "Rejuvenate" this SID frame, correcting any errors:
- * zero out all bits that aren't LARc or Xmaxc, thereby
- * clearing all SID code word bits and all unused/reserved
- * bits. */
- p = rtp_payload + 5; /* skip magic+LARc */
- for (sub = 0; sub < 4; sub++) {
- *p++ = 0;
- *p++ &= 0x1F;
- *p++ &= 0x80;
- *p++ = 0;
- *p++ = 0;
- *p++ = 0;
- *p++ = 0;
- }
+ /* "Rejuvenate" this SID frame, correcting any errors */
+ osmo_fr_sid_reset(rtp_payload);
return true;
default:
/* There are only 3 possible SID classifications per GSM 06.31
diff --git a/src/codec/gsm660.c b/src/codec/gsm660.c
index 9b5c55a..b15bdf3 100644
--- a/src/codec/gsm660.c
+++ b/src/codec/gsm660.c
@@ -352,6 +352,42 @@
return OSMO_GSM631_SID_CLASS_VALID;
}
+/*! Reset the SID field of a potentially corrupted, but still valid GSM-EFR
+ * SID frame in RTP encoding to its pristine state (full SID code word).
+ * \param[in] rtp_payload Buffer with RTP payload - must be writable!
+ *
+ * Per GSM 06.62 section 5.3, a freshly minted SID frame consists of 58 bits
+ * of comfort noise parameters (LSF and 4 times fixed codebook gain), 95 bits
+ * of SID code word (all 1s) and 91 unused bits (all 0s). Network elements
+ * that receive SID frames from call leg A uplink and need to retransmit them
+ * on leg B downlink should "rejuvenate" received SID frames prior to
+ * retransmission by resetting the SID field to its pristine state of all 1s;
+ * this function does the job.
+ *
+ * Potential TODO: it would be nice to also zero out the remaining 91 bits
+ * which the spec leaves as reserved, clearing out leg A radio bit errors -
+ * but do we really need to?
+ */
+void osmo_efr_sid_reset(uint8_t *rtp_payload)
+{
+ /* set all 95 SID code word bits to 1 */
+ rtp_payload[6] |= 0x6F;
+ rtp_payload[7] = 0xFF;
+ rtp_payload[8] = 0xFF;
+ rtp_payload[9] |= 0x80;
+ rtp_payload[12] |= 0x3B;
+ rtp_payload[13] = 0xFF;
+ rtp_payload[14] = 0xFF;
+ rtp_payload[15] |= 0xE0;
+ rtp_payload[19] = 0xFF;
+ rtp_payload[20] = 0xFF;
+ rtp_payload[21] = 0xFF;
+ rtp_payload[25] = 0xFF;
+ rtp_payload[26] |= 0xFC;
+ rtp_payload[27] = 0xFF;
+ rtp_payload[28] |= 0xC0;
+}
+
/*! Preen potentially-SID EFR codec frame in RTP format, ensuring that it is
* either a speech frame or a valid SID, and if the latter, making it a
* perfect, error-free SID frame.
@@ -369,23 +405,8 @@
case OSMO_GSM631_SID_CLASS_INVALID:
return false;
case OSMO_GSM631_SID_CLASS_VALID:
- /* "Rejuvenate" this SID frame, correcting any errors:
- * set all 95 SID code word bits to 1. */
- rtp_payload[6] |= 0x6F;
- rtp_payload[7] = 0xFF;
- rtp_payload[8] = 0xFF;
- rtp_payload[9] |= 0x80;
- rtp_payload[12] |= 0x3B;
- rtp_payload[13] = 0xFF;
- rtp_payload[14] = 0xFF;
- rtp_payload[15] |= 0xE0;
- rtp_payload[19] = 0xFF;
- rtp_payload[20] = 0xFF;
- rtp_payload[21] = 0xFF;
- rtp_payload[25] = 0xFF;
- rtp_payload[26] |= 0xFC;
- rtp_payload[27] = 0xFF;
- rtp_payload[28] |= 0xC0;
+ /* "Rejuvenate" this SID frame, correcting any errors */
+ osmo_efr_sid_reset(rtp_payload);
return true;
default:
/* There are only 3 possible SID classifications per GSM 06.81
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33059
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1d6dd867a358bdda8850cd8c959d0f361c0a5b6d
Gerrit-Change-Number: 33059
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-MessageType: newchange
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/32989
to look at the new patch set (#2).
Change subject: add doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
......................................................................
add doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
We have not a single example yet showing point code and SCCP address
configuration. Add this example, which will also show how the config
file syntax changes while introducing CN pooling in upcoming patches.
Related: SYS#6412
Change-Id: I42c3b434a7339cc3efb27b43c893cfb734de9ca4
---
M contrib/osmo-hnbgw.spec.in
M debian/osmo-hnbgw.install
A doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
3 files changed, 43 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/89/32989/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32989
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I42c3b434a7339cc3efb27b43c893cfb734de9ca4
Gerrit-Change-Number: 32989
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/33054
to look at the new patch set (#3).
Change subject: gmm: Initial implementation of T3166, rx Auth & Ciph Reject
......................................................................
gmm: Initial implementation of T3166, rx Auth & Ciph Reject
As specified in 3GPP TS 24.008 Table 11.3/3.
Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f
---
M include/osmocom/gprs/gmm/gmm_private.h
M src/gmm/gmm.c
M src/gmm/gmm_ms_fsm.c
M src/gmm/gmm_prim.c
M tests/gmm/gmm_prim_test.err
5 files changed, 85 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/54/33054/3
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33054
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f
Gerrit-Change-Number: 33054
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset