[MERGED] osmo-ttcn3-hacks[master]: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

2018-02-16 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types
..


Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

It's a quite frequent requirement in encoding IMSI/BCD numbers, so
let's move it to the more generic GSM_Types module.

Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
---
M library/BSSMAP_Templates.ttcn
M library/GSM_Types.ttcn
2 files changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index cd94ad1..77ff7e4 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -644,14 +644,6 @@
 }
 
 
-function f_hex_is_odd_length(hexstring digits) return bitstring {
-   if (lengthof(digits) rem 2 == 1) {
-   return '1'B;
-   } else {
-   return '0'B;
-   }
-}
-
 template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
elementIdentifier := '08'O,
lengthIndicator := 0, /* overwritten */
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index e1d6b48..e57575d 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -160,4 +160,12 @@
sapi := sapi
};
 
+   function f_hex_is_odd_length(hexstring digits) return bitstring {
+   if (lengthof(digits) rem 2 == 1) {
+   return '1'B;
+   } else {
+   return '0'B;
+   }
+   }
+
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

-- 
To view, visit https://gerrit.osmocom.org/6402
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
Gerrit-PatchSet: 5
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/6402
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

2018-02-12 Thread Harald Welte

Review at  https://gerrit.osmocom.org/6402

Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

It's a quite frequent requirement in encoding IMSI/BCD numbers, so
let's move it to the more generic GSM_Types module.

Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
---
M library/BSSMAP_Templates.ttcn
M library/GSM_Types.ttcn
2 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/02/6402/1

diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index d4e278b..cd1caf2 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -644,14 +644,6 @@
 }
 
 
-function f_hex_is_odd_length(hexstring digits) return bitstring {
-   if (lengthof(digits) rem 2 == 1) {
-   return '1'B;
-   } else {
-   return '0'B;
-   }
-}
-
 template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
elementIdentifier := '08'O,
lengthIndicator := 0, /* overwritten */
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index e1d6b48..e57575d 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -160,4 +160,12 @@
sapi := sapi
};
 
+   function f_hex_is_odd_length(hexstring digits) return bitstring {
+   if (lengthof(digits) rem 2 == 1) {
+   return '1'B;
+   } else {
+   return '0'B;
+   }
+   }
+
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

-- 
To view, visit https://gerrit.osmocom.org/6402
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte