Attention is currently required from: fixeria, pespin.
daniel has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ci/+/41587?usp=email )
Change subject: scripts: Add libosmo-asn1-tcap to OSMO_RELEASE_REPOS
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/41587?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I76703ed5c648eb50574166f8459fd0bde1720902
Gerrit-Change-Number: 41587
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 05 Dec 2025 16:03:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/41618?usp=email )
Change subject: s1ap_proxy: move {en,de}code_pdu/1 to s1ap_utils
......................................................................
s1ap_proxy: move {en,de}code_pdu/1 to s1ap_utils
This API will be used by other modules in follow-up patches.
Change-Id: I582824a4cac5013ba65a6dd0772f05d49dc14b57
Related: SYS#7052
---
M src/s1ap_proxy.erl
A src/s1ap_utils.erl
2 files changed, 75 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/18/41618/1
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index a241611..b5abad5 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -58,9 +58,6 @@
-include("S1AP-IEs.hrl").
--type s1ap_pdu() :: {initiatingMessage, #'InitiatingMessage'{}} |
- {successfulOutcome, #'SuccessfulOutcome'{}} |
- {unsuccessfulOutcome, #'UnsuccessfulOutcome'{}}.
-type s1ap_ie_id() :: non_neg_integer().
-type s1ap_ie_val() :: tuple().
@@ -309,30 +306,16 @@
inet:ntoa(TLA1).
-%% Encode an S1AP PDU
--spec encode_pdu(s1ap_pdu()) -> {ok, binary()} |
- {error, {asn1, tuple()}}.
-encode_pdu(Pdu) ->
- 'S1AP-PDU-Descriptions':encode('S1AP-PDU', Pdu).
-
-
-%% Decode an S1AP PDU
--spec decode_pdu(binary()) -> {ok, s1ap_pdu()} |
- {error, {asn1, tuple()}}.
-decode_pdu(Data) ->
- 'S1AP-PDU-Descriptions':decode('S1AP-PDU', Data).
-
-
%% Process an S1AP PDU (binary)
-spec handle_pdu_bin(binary(), proxy_state()) -> {process_pdu_result(), proxy_state()}.
handle_pdu_bin(OrigData, S0) ->
ctr_inc(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, S0),
- try decode_pdu(OrigData) of
+ try s1ap_utils:decode_pdu(OrigData) of
{ok, PDU} ->
?LOG_DEBUG("Rx S1AP PDU: ~p", [PDU]),
try handle_pdu(PDU, S0) of
{{Action, NewPDU}, S1} ->
- {ok, NewData} = encode_pdu(NewPDU),
+ {ok, NewData} = s1ap_utils:encode_pdu(NewPDU),
?LOG_DEBUG("Tx (~p) S1AP PDU: ~p", [Action, NewPDU]),
case Action of
forward ->
@@ -376,10 +359,10 @@
%% Process an S1AP PDU (decoded)
-spec handle_pdu(PDU, S0) -> {Result, S1}
- when PDU :: s1ap_pdu(),
+ when PDU :: s1ap_utils:s1ap_pdu(),
S0 :: proxy_state(),
S1 :: proxy_state(),
- Result :: {forward | reply, s1ap_pdu()} | forward | drop.
+ Result :: {forward | reply, s1ap_utils:s1ap_pdu()} | forward | drop.
%% 9.1.8.4 S1 SETUP REQUEST
handle_pdu({initiatingMessage,
diff --git a/src/s1ap_utils.erl b/src/s1ap_utils.erl
new file mode 100644
index 0000000..ab7180c
--- /dev/null
+++ b/src/s1ap_utils.erl
@@ -0,0 +1,71 @@
+%% Copyright (C) 2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+%% Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>
+%%
+%% All Rights Reserved
+%%
+%% SPDX-License-Identifier: AGPL-3.0-or-later
+%%
+%% This program is free software; you can redistribute it and/or modify
+%% it under the terms of the GNU Affero General Public License as
+%% published by the Free Software Foundation; either version 3 of the
+%% License, or (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU Affero General Public License
+%% along with this program. If not, see <https://www.gnu.org/licenses/>.
+%%
+%% Additional Permission under GNU AGPL version 3 section 7:
+%%
+%% If you modify this Program, or any covered work, by linking or
+%% combining it with runtime libraries of Erlang/OTP as released by
+%% Ericsson on https://www.erlang.org (or a modified version of these
+%% libraries), containing parts covered by the terms of the Erlang Public
+%% License (https://www.erlang.org/EPLICENSE), the licensors of this
+%% Program grant you additional permission to convey the resulting work
+%% without the need to license the runtime libraries of Erlang/OTP under
+%% the GNU Affero General Public License. Corresponding Source for a
+%% non-source form of such a combination shall include the source code
+%% for the parts of the runtime libraries of Erlang/OTP used as well as
+%% that of the covered work.
+
+-module(s1ap_utils).
+
+-export([encode_pdu/1,
+ decode_pdu/1]).
+
+-include_lib("kernel/include/logger.hrl").
+
+-include("S1AP-PDU-Descriptions.hrl").
+
+
+%% S1AP PDU (decoded)
+-type s1ap_pdu() :: {initiatingMessage, #'InitiatingMessage'{}} |
+ {successfulOutcome, #'SuccessfulOutcome'{}} |
+ {unsuccessfulOutcome, #'UnsuccessfulOutcome'{}}.
+
+-export_type([s1ap_pdu/0]).
+
+
+%% ------------------------------------------------------------------
+%% public API
+%% ------------------------------------------------------------------
+
+%% Encode an S1AP PDU
+-spec encode_pdu(s1ap_pdu()) -> {ok, binary()} |
+ {error, {asn1, tuple()}}.
+encode_pdu(PDU) ->
+ 'S1AP-PDU-Descriptions':encode('S1AP-PDU', PDU).
+
+
+%% Decode an S1AP PDU
+-spec decode_pdu(binary()) -> {ok, s1ap_pdu()} |
+ {error, {asn1, tuple()}}.
+decode_pdu(Data) ->
+ 'S1AP-PDU-Descriptions':decode('S1AP-PDU', Data).
+
+
+%% vim:set ts=4 sw=4 et:
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/41618?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I582824a4cac5013ba65a6dd0772f05d49dc14b57
Gerrit-Change-Number: 41618
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>