How can i pass the function max and evaluate the expression inside the size option?
auth_plugin_data_part_2::little-binary-size(max(13, auth_plugin_data_len - 8) >> = data
How can i pass the function max and evaluate the expression inside the size option?
auth_plugin_data_part_2::little-binary-size(max(13, auth_plugin_data_len - 8) >> = data
By precalculating it and storing the value in a variable, that should work, can’t currently test though. We have a guest and he’s still sleeping in the digital chamber
I have this binary
<<version::little-integer-size(8), server_version::little-binary-size(6), 0,
connection_id::little-integer-size(32), auth_plugin_data_part_1::little-binary-size(8),
filler::little-integer-size(8), capability_flags_lower::little-integer-size(16),
character_set::little-integer-size(8), status_flags::little-integer-size(16),
capability_flags_upper::little-integer-size(16),
auth_plugin_data_len::little-integer-size(8), reserved::little-binary-size(10),
auth_plugin_data_part_2::little-binary-size(13),
auth_plugin_name::binary>> = body
auth_plugin_data_part_2
length is max(13, auth_plugin_data_len - 8)
so does the variable auth_plugin_data_len
will exits
I do not understand.
But I tested it right now, precalculating the size and saving it in a variable works.
s = max(13, foo - 8)
<<x::size(s), _::binary>> = body
oh sorry,
what i meant is that i extract a part from the binary which gives the length of other binary
i.e << length::integer-size(8), data::integer-size(length-2)>>
length encoded packets
Then you need to split the match in multiples, or use appropriate net opts which can handle 1, 2 or 4 byte lengths. But it’s not always possible to use those as they will be fixed for the entire communication.