Skip to content

Instantly share code, notes, and snippets.

@deadc0de6
Created December 8, 2017 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deadc0de6/69e0d56f338a93ff60c2a96fb34af01c to your computer and use it in GitHub Desktop.
Save deadc0de6/69e0d56f338a93ff60c2a96fb34af01c to your computer and use it in GitHub Desktop.
parse_header(Args,
<<
Pldlen:24/little, % 3 bytes payload length
_:8, % 1 byte sequence id or packet nb
Pld/binary % content
>>) ->
case byte_size(Pld) == Pldlen of
true ->
parse_content(Args, Pld);
false ->
{{error, up}, unexpected_data}
end;
parse_header(Args, _) ->
{{error, up}, unexpected_data}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment