summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-16 21:40:22 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-16 21:40:22 +0100
commit958c6448344cc052445cd8017bb1cc19c9000191 (patch)
tree378097183d9c9e8c2b62d780ff2d918865e19852
parent092443629b7de87f4cd2d0fc0de13da3e5a50203 (diff)
M2PA: fix parsing of MTP3 portion of M2PA user messages
-rw-r--r--src/m2pa_codec.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/m2pa_codec.erl b/src/m2pa_codec.erl
index 585b9c9..0165447 100644
--- a/src/m2pa_codec.erl
+++ b/src/m2pa_codec.erl
@@ -37,8 +37,8 @@ parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_LINK, Len, Remain) ->
{undefined, Ret}
end;
parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Len, RemainIn) ->
- <<Pri:1, _:7, SIO:8, SIF/binary>> = RemainIn,
- Mtp3 = #mtp3_msg{service_ind = SIO, m3ua_mp = Pri, payload = SIF},
+ <<Pri:1, _:7, Mtp3Bin/binary>> = RemainIn,
+ Mtp3 = mtp3_codec:parse_mtp3_msg(Mtp3Bin),
{Mtp3, []}.
parse_msg(DataBin) when is_binary(DataBin) ->
@@ -49,8 +49,11 @@ parse_msg(DataBin) when is_binary(DataBin) ->
fwd_seq_nr = FSN, back_seq_nr = BSN,
mtp3 = Mtp3, parameters = Params}}.
-encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, _Params) ->
+encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, _Params) when is_binary(Mtp3) ->
<<Mtp3/binary>>;
+encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, Params) when is_record(Mtp3, mtp3_msg) ->
+ Mtp3bin = mtp3_codec:encode_mtp3_msg(Mtp3),
+ encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3bin, Params);
encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_LINK, _, Params) ->
State = proplists:get_value(link_state, Params),
% FIXME: filler