Change in ...osmo_gsup[master]: Add optional NUM_VECTORS_REQ IE to send_auth_info_req

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Jan 19 13:03:37 UTC 2020


Hello lynxis lazus,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/erlang/osmo_gsup/+/16936

to review the following change.


Change subject: Add optional NUM_VECTORS_REQ IE to send_auth_info_req
......................................................................

Add optional NUM_VECTORS_REQ IE to send_auth_info_req

Change-Id: Ifb338cb849c0c9b2ce338eaa8ead6ac307188d3b
---
M include/gsup_protocol.hrl
M src/gsup_protocol.erl
M test/gsup_encode_decode_test.erl
3 files changed, 21 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_gsup refs/changes/36/16936/1

diff --git a/include/gsup_protocol.hrl b/include/gsup_protocol.hrl
index 3f04ece..a08b934 100644
--- a/include/gsup_protocol.hrl
+++ b/include/gsup_protocol.hrl
@@ -107,6 +107,7 @@
   sm_alert_reason => integer(),
   imei => binary(),
   imei_check_result => integer(),
+  num_vectors_req => integer(),
   message_class => integer(),
   source_name => binary(),
   destination_name => binary(),
@@ -158,6 +159,7 @@
 -define(SM_ALERT_REASON, 16#46).
 -define(IMEI, 16#50).
 -define(IMEI_CHECK_RESULT, 16#51).
+-define(NUM_VECTORS_REQ, 16#52).
 -define(SOURCE_NAME, 16#60).
 -define(DESTINATION_NAME, 16#61).
 -define(AN_APDU, 16#62).
@@ -173,7 +175,7 @@
   16#04 => #{message_type => location_upd_req, mandatory => [], optional => [cn_domain]},
   16#05 => #{message_type => location_upd_err, mandatory => [cause]},
   16#06 => #{message_type => location_upd_res, mandatory => [], optional => [msisdn, hlr_number, pdp_info_complete, pdp_info_list, pdp_charging]},
-  16#08 => #{message_type => send_auth_info_req, mandatory => [], optional => [cn_domain, auts, rand, supported_rat_types, current_rat_type]},
+  16#08 => #{message_type => send_auth_info_req, mandatory => [], optional => [cn_domain, auts, rand, supported_rat_types, current_rat_type, num_vectors_req]},
   16#09 => #{message_type => send_auth_info_err, mandatory => [cause]},
   16#0a => #{message_type => send_auth_info_res, mandatory => [], optional => [auth_tuples, auts, rand]},
   16#0b => #{message_type => auth_failure_report, mandatory => [], optional => [cn_domain]},
diff --git a/src/gsup_protocol.erl b/src/gsup_protocol.erl
index 30d5574..5dd4bda 100644
--- a/src/gsup_protocol.erl
+++ b/src/gsup_protocol.erl
@@ -159,6 +159,10 @@
   ?CHECK_LEN(imei_check_result, Len, 1, 1),
   decode_ie(Tail, Map#{imei_check_result => IMEIResult});
 
+decode_ie(<<?NUM_VECTORS_REQ, Len, NumVectorsRequest:Len/unit:8, Tail/binary>>, Map) ->
+  ?CHECK_LEN(num_vectors_req, Len, 1, 1),
+  decode_ie(Tail, Map#{num_vectors_req => NumVectorsRequest});
+
 decode_ie(<<?SOURCE_NAME, Len, SourceName:Len/binary, Tail/binary>>, Map) ->
   decode_ie(Tail, Map#{source_name => SourceName});
 
@@ -467,6 +471,11 @@
   ?CHECK_SIZE(imei_check_result, Len, Value),
   encode_ie(maps:without([imei_check_result], GSUPMessage), <<Head/binary, ?IMEI_CHECK_RESULT, Len, Value:Len/unit:8>>);
 
+encode_ie(#{num_vectors_req := Value} = GSUPMessage, Head) ->
+  Len = 1,
+  ?CHECK_SIZE(num_vectors_req, Len, Value),
+  encode_ie(maps:without([num_vectors_req], GSUPMessage), <<Head/binary, ?NUM_VECTORS_REQ, Len, Value:Len/unit:8>>);
+
 encode_ie(#{source_name := Value} = GSUPMessage, Head) ->
   Len = size(Value),
   encode_ie(maps:without([source_name], GSUPMessage), <<Head/binary, ?SOURCE_NAME, Len, Value/binary>>);
diff --git a/test/gsup_encode_decode_test.erl b/test/gsup_encode_decode_test.erl
index c0d3a21..2153707 100644
--- a/test/gsup_encode_decode_test.erl
+++ b/test/gsup_encode_decode_test.erl
@@ -44,6 +44,15 @@
   ?assertEqual(Map, gsup_protocol:decode(Bin)),
   ?assertEqual(Bin, gsup_protocol:encode(Map)).
 
+sai_req_num_test() ->
+  Bin = <<16#08, ?TEST_IMSI_IE, ?TEST_CLASS_SUBSCR_IE, 16#52, 16#01, 16#02>>,
+  Map = #{imsi => <<"123456789012345">>,
+          message_class => 1,
+          message_type => send_auth_info_req,
+          num_vectors_req => 2},
+  ?assertEqual(Map, gsup_protocol:decode(Bin)),
+  ?assertEqual(Bin, gsup_protocol:encode(Map)).
+
 sai_req_eps_test() ->
   Bin = <<16#08, ?TEST_IMSI_IE, ?TEST_CLASS_SUBSCR_IE, ?TEST_SUPP_RAT_TYPES_IE, ?TEST_CURR_RAT_TYPE_LTE_IE>>,
   Map = #{imsi => <<"123456789012345">>, message_class => 1, message_type => send_auth_info_req,

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

Gerrit-Project: erlang/osmo_gsup
Gerrit-Branch: master
Gerrit-Change-Id: Ifb338cb849c0c9b2ce338eaa8ead6ac307188d3b
Gerrit-Change-Number: 16936
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200119/cb049647/attachment.htm>


More information about the gerrit-log mailing list