Change in libosmocore[master]: gsm0808: Make a function to extract Cause IE publicly available.

2020-05-13 Thread ipse
ipse has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/18229 )

Change subject: gsm0808: Make a function to extract Cause IE publicly available.
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/18229/1/include/osmocom/gsm/gsm0808_utils.h
File include/osmocom/gsm/gsm0808_utils.h:

https://gerrit.osmocom.org/c/libosmocore/+/18229/1/include/osmocom/gsm/gsm0808_utils.h@a158
PS1, Line 158: int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp);
> This commit broke build of osmo-msc, which uses this function since release 
> 1.3.0. […]
See https://gerrit.osmocom.org/c/libosmocore/+/18242



--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18229
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
Gerrit-Change-Number: 18229
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Wed, 13 May 2020 19:39:29 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Make a function to extract Cause IE publicly available.

2020-05-13 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/18229 )

Change subject: gsm0808: Make a function to extract Cause IE publicly available.
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/18229/1/include/osmocom/gsm/gsm0808_utils.h
File include/osmocom/gsm/gsm0808_utils.h:

https://gerrit.osmocom.org/c/libosmocore/+/18229/1/include/osmocom/gsm/gsm0808_utils.h@a158
PS1, Line 158: int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp);
This commit broke build of osmo-msc, which uses this function since release 
1.3.0.

So please submit a patch putting back this function (marking it as deprecated 
if needed).



--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18229
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
Gerrit-Change-Number: 18229
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Wed, 13 May 2020 16:24:06 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Make a function to extract Cause IE publicly available.

2020-05-13 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/18229 )

Change subject: gsm0808: Make a function to extract Cause IE publicly available.
..

gsm0808: Make a function to extract Cause IE publicly available.

Function gsm0808_get_cipher_reject_cause() was previously available
in private gsm0808_utils.h. In practice, the exact same code is useful
to extract Cause IE value from any of the many other BSSMAP messages
which use it.

So let's rename it to gsm0808_get_cause() and make it avilable
to everyone to use.

Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/gsm0808_utils.h
M src/gsm/gsm0808.c
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
6 files changed, 22 insertions(+), 19 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 373b434..5a33f60 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -315,6 +315,10 @@
 const char *gsm0808_cause_name(enum gsm0808_cause cause);
 const char *gsm0808_cause_class_name(enum gsm0808_cause_class class);

+/*! Parse Cause TLV 3GPP TS 08.08 §3.2.2.5
+ * \returns Cause value */
+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp);
+
 extern const struct value_string gsm0808_lcls_config_names[];
 extern const struct value_string gsm0808_lcls_control_names[];
 extern const struct value_string gsm0808_lcls_status_names[];
diff --git a/include/osmocom/gsm/gsm0808_utils.h 
b/include/osmocom/gsm/gsm0808_utils.h
index ccdf5ed..1cdca8c 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -155,8 +155,6 @@
return (cause & 0x80) && !(cause & 0x0F);
 }

-int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp);
-
 /*! \returns 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum 
gsm_chan_t. */
 static inline uint8_t gsm0808_current_channel_type_1(enum gsm_chan_t type)
 {
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 02288e6..788f6c3 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1654,6 +1654,22 @@
return get_value_string(gsm0808_cause_names, cause);
 }

+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp)
+{
+   const uint8_t *buf = TLVP_VAL_MINLEN(tp, GSM0808_IE_CAUSE, 1);
+
+   if (!buf)
+   return -EBADMSG;
+
+   if (TLVP_LEN(tp, GSM0808_IE_CAUSE) > 1) {
+   if (!gsm0808_cause_ext(buf[0]))
+   return -EINVAL;
+   return buf[1];
+   }
+
+   return buf[0];
+}
+
 const struct value_string gsm0808_lcls_config_names[] = {
{ GSM0808_LCLS_CFG_BOTH_WAY, "Connect both-way" },
{ GSM0808_LCLS_CFG_BOTH_WAY_AND_BICAST_UL,
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 7416d8f..6f3c07a 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1563,22 +1563,6 @@
return 0;
 }

-int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp)
-{
-   const uint8_t *buf = TLVP_VAL_MINLEN(tp, GSM0808_IE_CAUSE, 1);
-
-   if (!buf)
-   return -EBADMSG;
-
-   if (TLVP_LEN(tp, GSM0808_IE_CAUSE) > 1) {
-   if (!gsm0808_cause_ext(buf[0]))
-   return -EINVAL;
-   return buf[1];
-   }
-
-   return buf[0];
-}
-
 /*! Print a human readable name of the cell identifier to the char buffer.
  * This is useful both for struct gsm0808_cell_id and struct 
gsm0808_cell_id_list2.
  * See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name().
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index a518b28..1ff1286 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -157,6 +157,7 @@
 gsm0808_bssmap_name;
 gsm0808_cause_name;
 gsm0808_cause_class_name;
+gsm0808_get_cause;
 gsm0808_create_ass;
 gsm0808_create_ass2;
 gsm0808_create_assignment_completed;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index ec24914..ce73390 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -306,7 +306,7 @@
if (rc < 0)
printf("FIXME: failed (%d) to parse created message %s\n", rc, 
msgb_hexdump(msg));

-   rc = gsm0808_get_cipher_reject_cause();
+   rc = gsm0808_get_cause();
if (rc < 0)
printf("FIXME: failed (%s) to extract Cause from created 
message %s\n",
   strerror(-rc), msgb_hexdump(msg));

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18229
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
Gerrit-Change-Number: 18229
Gerrit-PatchSet: 1

Change in libosmocore[master]: gsm0808: Make a function to extract Cause IE publicly available.

2020-05-13 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/18229 )

Change subject: gsm0808: Make a function to extract Cause IE publicly available.
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18229
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
Gerrit-Change-Number: 18229
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Wed, 13 May 2020 09:54:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Make a function to extract Cause IE publicly available.

2020-05-12 Thread ipse
ipse has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/18229 )


Change subject: gsm0808: Make a function to extract Cause IE publicly available.
..

gsm0808: Make a function to extract Cause IE publicly available.

Function gsm0808_get_cipher_reject_cause() was previously available
in private gsm0808_utils.h. In practice, the exact same code is useful
to extract Cause IE value from any of the many other BSSMAP messages
which use it.

So let's rename it to gsm0808_get_cause() and make it avilable
to everyone to use.

Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/gsm0808_utils.h
M src/gsm/gsm0808.c
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
6 files changed, 22 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/29/18229/1

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 373b434..5a33f60 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -315,6 +315,10 @@
 const char *gsm0808_cause_name(enum gsm0808_cause cause);
 const char *gsm0808_cause_class_name(enum gsm0808_cause_class class);

+/*! Parse Cause TLV 3GPP TS 08.08 §3.2.2.5
+ * \returns Cause value */
+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp);
+
 extern const struct value_string gsm0808_lcls_config_names[];
 extern const struct value_string gsm0808_lcls_control_names[];
 extern const struct value_string gsm0808_lcls_status_names[];
diff --git a/include/osmocom/gsm/gsm0808_utils.h 
b/include/osmocom/gsm/gsm0808_utils.h
index ccdf5ed..1cdca8c 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -155,8 +155,6 @@
return (cause & 0x80) && !(cause & 0x0F);
 }

-int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp);
-
 /*! \returns 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum 
gsm_chan_t. */
 static inline uint8_t gsm0808_current_channel_type_1(enum gsm_chan_t type)
 {
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 02288e6..788f6c3 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1654,6 +1654,22 @@
return get_value_string(gsm0808_cause_names, cause);
 }

+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp)
+{
+   const uint8_t *buf = TLVP_VAL_MINLEN(tp, GSM0808_IE_CAUSE, 1);
+
+   if (!buf)
+   return -EBADMSG;
+
+   if (TLVP_LEN(tp, GSM0808_IE_CAUSE) > 1) {
+   if (!gsm0808_cause_ext(buf[0]))
+   return -EINVAL;
+   return buf[1];
+   }
+
+   return buf[0];
+}
+
 const struct value_string gsm0808_lcls_config_names[] = {
{ GSM0808_LCLS_CFG_BOTH_WAY, "Connect both-way" },
{ GSM0808_LCLS_CFG_BOTH_WAY_AND_BICAST_UL,
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 7416d8f..6f3c07a 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1563,22 +1563,6 @@
return 0;
 }

-int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp)
-{
-   const uint8_t *buf = TLVP_VAL_MINLEN(tp, GSM0808_IE_CAUSE, 1);
-
-   if (!buf)
-   return -EBADMSG;
-
-   if (TLVP_LEN(tp, GSM0808_IE_CAUSE) > 1) {
-   if (!gsm0808_cause_ext(buf[0]))
-   return -EINVAL;
-   return buf[1];
-   }
-
-   return buf[0];
-}
-
 /*! Print a human readable name of the cell identifier to the char buffer.
  * This is useful both for struct gsm0808_cell_id and struct 
gsm0808_cell_id_list2.
  * See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name().
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index a518b28..1ff1286 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -157,6 +157,7 @@
 gsm0808_bssmap_name;
 gsm0808_cause_name;
 gsm0808_cause_class_name;
+gsm0808_get_cause;
 gsm0808_create_ass;
 gsm0808_create_ass2;
 gsm0808_create_assignment_completed;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index ec24914..ce73390 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -306,7 +306,7 @@
if (rc < 0)
printf("FIXME: failed (%d) to parse created message %s\n", rc, 
msgb_hexdump(msg));

-   rc = gsm0808_get_cipher_reject_cause();
+   rc = gsm0808_get_cause();
if (rc < 0)
printf("FIXME: failed (%s) to extract Cause from created 
message %s\n",
   strerror(-rc), msgb_hexdump(msg));

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18229
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
Gerrit-Change-Number: 18229