Add optional NUM_VECTORS_REQ IE to send_auth_info_req

Change-Id: Ifb338cb849c0c9b2ce338eaa8ead6ac307188d3b
changes/36/16936/2
Alexander Couzens 3 years ago committed by fixeria
parent 657fee93f6
commit b656fc1965
  1. 4
      include/gsup_protocol.hrl
  2. 9
      src/gsup_protocol.erl
  3. 9
      test/gsup_encode_decode_test.erl

@ -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]},

@ -159,6 +159,10 @@ decode_ie(<<?IMEI_CHECK_RESULT, Len, IMEIResult:Len/unit:8, Tail/binary>>, Map)
?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 @@ encode_ie(#{imei_check_result := Value} = GSUPMessage, Head) ->
?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>>);

@ -44,6 +44,15 @@ sai_req_test() ->
?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,

Loading…
Cancel
Save