Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 2
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sun, 17 May 2020 07:32:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..

gsm0808: Implement helper functions for CONFUSION BSSMAP message decoding.

Also add a test for an actual CONFUSION message parsing.

Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
6 files changed, 113 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 5a33f60..34cec3c 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -319,6 +319,9 @@
  * \returns Cause value */
 enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp);

+const char *gsm0808_diagnostics_octet_location_str(uint8_t pointer);
+const char *gsm0808_diagnostics_bit_location_str(uint8_t bit_pointer);
+
 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/protocol/gsm_08_08.h 
b/include/osmocom/gsm/protocol/gsm_08_08.h
index d8a7773..1390f0e 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -663,3 +663,16 @@
GSM0808_LCLS_STS_LOCALLY_SWITCHED   = 0x04,
GSM0808_LCLS_STS_NA = 0xFF
 };
+
+/* 3GPP TS 48.008 3.2.2.32 Diagnostics */
+struct gsm0808_diagnostics {
+   uint8_t error_pointer_octet;
+#if OSMO_IS_LITTLE_ENDIAN
+   uint8_t error_pointer_bit_spare:4,
+   error_pointer_bit:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above 
(libosmocore/contrib/struct_endianess.py) */
+   uint8_t error_pointer_bit:4, error_pointer_bit_spare:4;
+#endif
+   uint8_t msg[0]; /*! received message which provoked the error */
+} __attribute__((packed));
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 788f6c3..23468c3 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -21,6 +21,8 @@
  *
  */

+#include 
+
 #include 
 #include 
 #include 
@@ -34,6 +36,9 @@
  *  message generation/encoding.
  */

+/*! Char buffer to return strings from functions */
+static __thread char str_buff[512];
+
 /*! Create "Complete L3 Info" for AoIP, legacy implementation.
  * Instead use gsm0808_create_layer3_aoip2(), which is capable of three-digit 
MNC with leading zeros.
  *  \param[in] msg_l3 msgb containing Layer 3 Message
@@ -1670,6 +1675,39 @@
return buf[0];
 }

+const char *gsm0808_diagnostics_octet_location_str(uint8_t pointer)
+{
+   switch (pointer) {
+   case 0:
+   return "Error location not determined";
+   case 1:
+   return "The first octet of the message received (i.e. the 
message type) was found erroneous (unknown)";
+   case 0xfd:
+   return  "The first octet of the BSSAP header (Discrimination) 
was found erroneous";
+   case 0xfe:
+   return  "(DTAP only) The DLCI (second) octet of the BSSAP 
header was found erroneous";
+   case 0xff:
+   return  "The last octet of the BSSAP header (length indicator) 
was found erroneous";
+   default:
+   snprintf(str_buff, sizeof(str_buff), "The %d octet of the 
message received was found erroneous", pointer);
+   return str_buff;
+   }
+}
+
+const char *gsm0808_diagnostics_bit_location_str(uint8_t bit_pointer)
+{
+   if (bit_pointer == 0) {
+   return "No particular part of the octet is indicated";
+   } else if (bit_pointer > 8) {
+   return "Reserved value";
+   }
+
+   snprintf(str_buff, sizeof(str_buff),
+"An error was provoked by the field whose most significant bit 
is in bit position %d",
+bit_pointer);
+   return str_buff;
+}
+
 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/libosmogsm.map b/src/gsm/libosmogsm.map
index ce55746..70b3916 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -159,6 +159,8 @@
 gsm0808_cause_name;
 gsm0808_cause_class_name;
 gsm0808_get_cause;
+gsm0808_diagnostics_octet_location_str;
+gsm0808_diagnostics_bit_location_str;
 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 ce73390..d9640aa 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -379,6 +379,55 @@
 

Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c
File src/gsm/gsm0808.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c@40
PS1, Line 40: static __thread char str_buff[512];
> Is this really critical? Using a caller allocated but makes the user code 
> quite ugly
I can see both lines of argument here.  But especially since we have the 
buffers in thread-local storage now, I think the biggest concern has been 
elimiteated, i.e. we don't need to go for dynamica allocation.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 2
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sun, 17 May 2020 07:31:30 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: ipse 
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 2: Code-Review+1


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 2
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sat, 16 May 2020 19:52:48 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

2020-05-14 Thread ipse
Hello laforge, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmocore/+/18231

to look at the new patch set (#2).

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..

gsm0808: Implement helper functions for CONFUSION BSSMAP message decoding.

Also add a test for an actual CONFUSION message parsing.

Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
6 files changed, 113 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/18231/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18231
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 2
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 1:

(5 comments)

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/gsm0808.h
File include/osmocom/gsm/gsm0808.h:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/gsm0808.h@322
PS1, Line 322: diagnostics
> Could be shortened to '_diag_oct_loc_str'. Not critical.
Why speak in riddles and make reading the code hard?


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h
File include/osmocom/gsm/protocol/gsm_08_08.h:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h@674
PS1, Line 674: struct gsm0808_diagnostics {
> Hint: Probably better to generate bigendian/littleendian with 
> ./contrib/struct_endianess. […]
Done


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c
File src/gsm/gsm0808.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c@40
PS1, Line 40: static __thread char str_buff[512];
> As Usual, I don't really like adding more and more static buffers every time 
> we add some function. […]
Is this really critical? Using a caller allocated but makes the user code quite 
ugly


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c@1682
PS1, Line 1682: else if (pointer == 1)
> If possible, would be nice to use a 'value_string' here, or at least the 
> 'switch' statement.
Makes sense


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/tests/gsm0808/gsm0808_test.c
File tests/gsm0808/gsm0808_test.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/tests/gsm0808/gsm0808_test.c@393
PS1, Line 393:
> whitespace
Ack



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 14 May 2020 17:53:41 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/gsm0808.h
File include/osmocom/gsm/gsm0808.h:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/gsm0808.h@322
PS1, Line 322: diagnostics
Could be shortened to '_diag_oct_loc_str'. Not critical.


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h
File include/osmocom/gsm/protocol/gsm_08_08.h:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h@674
PS1, Line 674: diagnostics
Same here, can be just '_diag'.


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c
File src/gsm/gsm0808.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c@1682
PS1, Line 1682: else if (pointer == 1)
If possible, would be nice to use a 'value_string' here, or at least the 
'switch' statement.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Wed, 13 May 2020 11:52:00 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h
File include/osmocom/gsm/protocol/gsm_08_08.h:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/include/osmocom/gsm/protocol/gsm_08_08.h@674
PS1, Line 674: struct gsm0808_diagnostics {
Hint: Probably better to generate bigendian/littleendian with 
./contrib/struct_endianess.py, to make sure when run afterwards it won't 
generate a different output.


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c
File src/gsm/gsm0808.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/src/gsm/gsm0808.c@40
PS1, Line 40: static __thread char str_buff[512];
As Usual, I don't really like adding more and more static buffers every time we 
add some function. Let's change the APIs to use caller allocated buf.


https://gerrit.osmocom.org/c/libosmocore/+/18231/1/tests/gsm0808/gsm0808_test.c
File tests/gsm0808/gsm0808_test.c:

https://gerrit.osmocom.org/c/libosmocore/+/18231/1/tests/gsm0808/gsm0808_test.c@393
PS1, Line 393:
whitespace



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
Gerrit-Change-Number: 18231
Gerrit-PatchSet: 1
Gerrit-Owner: ipse 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Wed, 13 May 2020 11:40:35 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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

Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..


Patch Set 1: Code-Review+1


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

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


Change in libosmocore[master]: gsm0808: Implement helper functions for CONFUSION BSSMAP message deco...

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


Change subject: gsm0808: Implement helper functions for CONFUSION BSSMAP 
message decoding.
..

gsm0808: Implement helper functions for CONFUSION BSSMAP message decoding.

Also add a test for an actual CONFUSION message parsing.

Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
6 files changed, 111 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/18231/1

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 5a33f60..34cec3c 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -319,6 +319,9 @@
  * \returns Cause value */
 enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp);

+const char *gsm0808_diagnostics_octet_location_str(uint8_t pointer);
+const char *gsm0808_diagnostics_bit_location_str(uint8_t bit_pointer);
+
 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/protocol/gsm_08_08.h 
b/include/osmocom/gsm/protocol/gsm_08_08.h
index e791b07..8b7ed8c 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -669,3 +669,16 @@
GSM0808_LCLS_STS_LOCALLY_SWITCHED   = 0x04,
GSM0808_LCLS_STS_NA = 0xFF
 };
+
+/* 3GPP TS 48.008 3.2.2.32 Diagnostics */
+struct gsm0808_diagnostics {
+   uint8_t error_pointer_octet;
+#if OSMO_IS_LITTLE_ENDIAN
+   uint8_t error_pointer_bit_spare:4,
+   error_pointer_bit:4;
+#elif OSMO_IS_BIG_ENDIAN
+   uint8_t error_pointer_bit:4,
+   error_pointer_bit_spare:4;
+#endif
+   uint8_t msg[0]; /*! received message which provoked the error */
+} __attribute__((packed));
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 788f6c3..28f487e 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -21,6 +21,8 @@
  *
  */

+#include 
+
 #include 
 #include 
 #include 
@@ -34,6 +36,9 @@
  *  message generation/encoding.
  */

+/*! Char buffer to return strings from functions */
+static __thread char str_buff[512];
+
 /*! Create "Complete L3 Info" for AoIP, legacy implementation.
  * Instead use gsm0808_create_layer3_aoip2(), which is capable of three-digit 
MNC with leading zeros.
  *  \param[in] msg_l3 msgb containing Layer 3 Message
@@ -1670,6 +1675,37 @@
return buf[0];
 }

+const char *gsm0808_diagnostics_octet_location_str(uint8_t pointer)
+{
+   if (pointer == 0)
+   return "Error location not determined";
+   else if (pointer == 1)
+   return "The first octet of the message received (i.e. the 
message type) was found erroneous (unknown)";
+   else if (pointer == 0xfd)
+   return  "The first octet of the BSSAP header (Discrimination) 
was found erroneous";
+   else if (pointer == 0xfe)
+   return  "(DTAP only) The DLCI (second) octet of the BSSAP 
header was found erroneous";
+   else if (pointer == 0xff)
+   return  "The last octet of the BSSAP header (length indicator) 
was found erroneous";
+
+   snprintf(str_buff, sizeof(str_buff), "The %d octet of the message 
received was found erroneous", pointer);
+   return str_buff;
+}
+
+const char *gsm0808_diagnostics_bit_location_str(uint8_t bit_pointer)
+{
+   if (bit_pointer == 0) {
+   return "No particular part of the octet is indicated";
+   } else if (bit_pointer > 8) {
+   return "Reserved value";
+   }
+
+   snprintf(str_buff, sizeof(str_buff),
+"An error was provoked by the field whose most significant bit 
is in bit position %d",
+bit_pointer);
+   return str_buff;
+}
+
 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/libosmogsm.map b/src/gsm/libosmogsm.map
index 1ff1286..bf0cc01 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -158,6 +158,8 @@
 gsm0808_cause_name;
 gsm0808_cause_class_name;
 gsm0808_get_cause;
+gsm0808_diagnostics_octet_location_str;
+gsm0808_diagnostics_bit_location_str;
 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 ce73390..9e1e52e 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -379,6 +379,55 @@
msgb_free(msg);
 }

+static void test_dec_confusion()
+{