summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-18 00:25:05 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-18 00:25:05 +0100
commit8ed441d72d99611f8cff64a0c9004d0705a7271b (patch)
treeae7bcf83b69e341509aaebb458745e913e42d99e
parent042a579c0240f200339980066aea531e013a936b (diff)
sua_codec: Make sure we can re-encode options with {length, data} tuple
-rw-r--r--src/sua_codec.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sua_codec.erl b/src/sua_codec.erl
index bb34ed6..0365939 100644
--- a/src/sua_codec.erl
+++ b/src/sua_codec.erl
@@ -76,6 +76,10 @@ encode_xua_opts([{Iei, Attr}|Tail], Bin) ->
OptBin = encode_sua_opt(Iei, Attr),
encode_xua_opts(Tail, <<Bin/binary, OptBin/binary>>).
+encode_sua_opt(Iei, {LenIn, Data}) when is_integer(Iei), is_binary(Data) ->
+ Length = LenIn + 4,
+ PadLen = get_num_pad_bytes(Length),
+ <<Iei:16/big, Length:16/big, Data/binary, 0:PadLen/integer-unit:8>>;
encode_sua_opt(Iei, Data) when is_integer(Iei), is_binary(Data) ->
Length = byte_size(Data) + 4,
PadLen = get_num_pad_bytes(Length),