diff options
author | Micael Karlberg <[email protected]> | 2011-10-11 10:38:48 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-10-11 10:38:48 +0200 |
commit | 8490c3a413ca4a89c0a2f37e8723b2105cbe2406 (patch) | |
tree | 8dbae16e97b8f5872f7feae2c983ef8e43b0903e /lib/diameter/src/app/diameter_codec.erl | |
parent | adacb706e77b90a9284c3f4d8c828992c9acebf8 (diff) | |
parent | 6ca6dd3c670fb8185ebb9a20c2a731a7375c1cac (diff) | |
download | otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.tar.gz otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.tar.bz2 otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.zip |
Merge branch 'master' of super:otp into bmk/inets/inets58_integration
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 |