diff options
author | Anders Svensson <[email protected]> | 2011-09-27 11:49:14 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2011-09-27 11:49:14 +0200 |
commit | 571bc8c6135cb902e7cf9429f1bfad67284f8f23 (patch) | |
tree | 31b618935858320435884a80cf868b7cf22d5d42 /lib/diameter/src/app/diameter_codec.erl | |
parent | 67e216c86754e7076ffdbb87fec8b48ab0d28e56 (diff) | |
parent | 1c9017d8970713a24a36929063bcc76a28ae54c5 (diff) | |
download | otp-571bc8c6135cb902e7cf9429f1bfad67284f8f23.tar.gz otp-571bc8c6135cb902e7cf9429f1bfad67284f8f23.tar.bz2 otp-571bc8c6135cb902e7cf9429f1bfad67284f8f23.zip |
Merge branch 'dev' into major
Diffstat (limited to 'lib/diameter/src/app/diameter_codec.erl')
-rw-r--r-- | lib/diameter/src/app/diameter_codec.erl | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/diameter/src/app/diameter_codec.erl b/lib/diameter/src/app/diameter_codec.erl index f6cbde5446..d88f42fb7c 100644 --- a/lib/diameter/src/app/diameter_codec.erl +++ b/lib/diameter/src/app/diameter_codec.erl @@ -140,10 +140,10 @@ make_flags(Flags0, #diameter_header{is_request = R, mf(undefined, F, _) -> F; mf(B, F, N) -> %% reset the affected bit - (F bxor (F band (1 bsl N))) bor (bit(B) bsl N). + (F bxor (F band (1 bsl N))) bor bit(B, N). -bit(true) -> 1; -bit(false) -> 0. +bit(true, N) -> 1 bsl N; +bit(false, _) -> 0. %% values/1 @@ -199,25 +199,16 @@ msg_header(Mod, MsgName, Header) -> p(Flags, #diameter_header{is_request = true, is_proxiable = P}) -> - Flags bor choose(P, 2#01000000, 0); + Flags band (2#10110000 bor choose(P, 2#01000000, 0)); p(Flags, _) -> Flags. -%% The header below is that of the incoming request being answered, -%% not of the answer (which hasn't been encoded yet). - h(Mod, 'answer-message' = MsgName, Header) -> ?BASE = Mod, - #diameter_header{is_request = true, - cmd_code = Code} - = Header, + #diameter_header{cmd_code = Code} = Header, {_, Flags, ApplId} = ?BASE:msg_header(MsgName), {Code, Flags, ApplId}; -h(Mod, MsgName, #diameter_header{is_request = true, - cmd_code = Code}) -> - {Code, _, _} = Mod:msg_header(MsgName); %% ensure Code - h(Mod, MsgName, _) -> Mod:msg_header(MsgName). @@ -290,7 +281,8 @@ decode_avps(MsgName, Mod, Pkt, {Bs, Avps}) -> %% invalid avp bits ... decode_avps('', Mod, Pkt, Avps) -> %% unknown message ... ?LOG(unknown, {Mod, Pkt#diameter_packet.header}), - Pkt#diameter_packet{errors = lists:reverse(Avps)}; + Pkt#diameter_packet{avps = lists:reverse(Avps), + errors = [3001]}; %% DIAMETER_COMMAND_UNSUPPORTED %% msg = undefined identifies this case. decode_avps(MsgName, Mod, Pkt, Avps) -> %% ... or not |