laforge has submitted this change. (
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38295?usp=email )
Change subject: s1ap_proxy: add types for S1AP PDU and IE tuples
......................................................................
s1ap_proxy: add types for S1AP PDU and IE tuples
Change-Id: I39e0a12aade5e31c414cb639dbf333af2a5b7be4
---
M src/s1ap_proxy.erl
1 file changed, 13 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index c985601..c386f29 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -50,6 +50,12 @@
-include("S1AP-IEs.hrl").
+-type s1ap_pdu() :: {initiatingMessage, #'InitiatingMessage'{}} |
+ {successfulOutcome, #'SuccessfulOutcome'{}} |
+ {unsuccessfulOutcome, #'UnsuccessfulOutcome'{}}.
+-type s1ap_ie() :: #'ProtocolIE-Field'{}.
+-type s1ap_ie_val() :: tuple().
+
-type mme_ue_id() :: 0..16#ffffffff.
-type enb_ue_id() :: 0..16#ffffff.
-type erab_id() :: 0..16#ff.
@@ -102,14 +108,14 @@
%% ------------------------------------------------------------------
%% Encode an S1AP PDU
--spec encode_pdu(tuple()) -> {ok, binary()} |
- {error, {asn1, tuple()}}.
+-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, tuple()} |
+-spec decode_pdu(binary()) -> {ok, s1ap_pdu()} |
{error, {asn1, tuple()}}.
decode_pdu(Data) ->
'S1AP-PDU-Descriptions':decode('S1AP-PDU', Data).
@@ -118,6 +124,7 @@
%% Helper function for handle_pdu/3.
%% Attempt to encode a new (modified) S1AP PDU,
%% return a new binary() on success or Data on error.
+-spec handle_pdu_new(binary(), s1ap_pdu(), proxy_state()) -> {binary(),
proxy_state()}.
handle_pdu_new(Data, NewPdu, S) ->
case encode_pdu(NewPdu) of
{ok, NewData} ->
@@ -128,6 +135,8 @@
end.
+-spec handle_pdu(binary(), s1ap_pdu(), proxy_state()) -> {binary(), proxy_state()}.
+
%% 9.1.3.1 E-RAB SETUP REQUEST
handle_pdu(Data, {Outcome = initiatingMessage,
#'InitiatingMessage'{procedureCode = ?'id-E-RABSetup',
@@ -216,7 +225,7 @@
%% Handle a single IE (Information Element)
--spec handle_ie(tuple(), proxy_state()) -> {tuple(), proxy_state()}.
+-spec handle_ie(s1ap_ie(), proxy_state()) -> {s1ap_ie_val(), proxy_state()}.
%% E-RAB SETUP REQUEST related IEs
handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABToBeSetupListBearerSUReq',
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38295?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I39e0a12aade5e31c414cb639dbf333af2a5b7be4
Gerrit-Change-Number: 38295
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>