diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-01-16 22:20:35 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-01-16 22:20:35 +0100 |
commit | f14ef9ffd758430de676c85ee6b91f7748fcd69c (patch) | |
tree | 3873a5c8d6a514abbea2cf6043e2a9b032723849 | |
parent | e3b02edba15be077205e9295ded096a731defe4c (diff) |
M2PA: deal with empty M2PA messages that don't contain MTP3
-rw-r--r-- | src/m2pa_codec.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/m2pa_codec.erl b/src/m2pa_codec.erl index 974ffd8..71caf7c 100644 --- a/src/m2pa_codec.erl +++ b/src/m2pa_codec.erl @@ -36,6 +36,8 @@ parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_LINK, Len, Remain) -> true -> {undefined, Ret} end; +parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, 16, <<>>) -> + {empty, []}; parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Len, RemainIn) -> <<Pri:1, _:7, Mtp3Bin/binary>> = RemainIn, Mtp3 = mtp3_codec:parse_mtp3_msg(Mtp3Bin), @@ -49,6 +51,8 @@ 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, empty, _Params) -> + <<>>; encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, _Params) when is_binary(Mtp3) -> <<0:1, 0:7, Mtp3/binary>>; encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, Params) when is_record(Mtp3, mtp3_msg) -> |