SMPPEX.Pdu.Multipart.extract_from_ies

You're seeing just the function extract_from_ies, go back to SMPPEX.Pdu.Multipart module for more information.

Specs

extract_from_ies([SMPPEX.Pdu.UDH.ie()]) :: {:ok, part_info()} | {:error, any()}

Extracts multipart information from already parsed list of UDH IEs.

Return one of the following:

  • {:ok, :single} if IEs do not contain any multipart message related ones;
  • {:ok, {ref_num, count, seq_num}} if there are multipart message related IEs (the first is taken);
  • {:error, reason} in case of errors.

Example

iex> ies = [{0, <<0x03, 0x02, 0x01>>}]
iex> SMPPEX.Pdu.Multipart.extract_from_ies(ies)
{:ok, {3, 2, 1}}

iex> ies = [{0, <<0x03, 0x02, 0x01>>}, {8, <<0x00, 0x04, 0x02, 0x01>>}]
iex> SMPPEX.Pdu.Multipart.extract_from_ies(ies)
{:ok, {3, 2, 1}}

iex> ies = [{8, <<0x00, 0x03, 0x02, 0x01>>}]
iex> SMPPEX.Pdu.Multipart.extract_from_ies(ies)
{:ok, {3, 2, 1}}

iex> ies = [{8, <<0x00, 0x03, 0x02>>}]
iex> SMPPEX.Pdu.Multipart.extract_from_ies(ies)
{:error, "Invalid 16bit refrence number concatenated short messages info"}

iex> ies = []
iex> SMPPEX.Pdu.Multipart.extract_from_ies(ies)
{:ok, :single}