Packages
smppex
2.3.2
3.3.0
3.2.4
3.2.3
3.2.2
3.2.1
3.2.0
retired
3.1.0
retired
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.4.0
2.3.3
2.3.2
2.3.1
2.3.0
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
1.0.1
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
SMPP 3.4 protocol and framework implemented in Elixir
Current section
Files
Jump to
Current section
Files
lib/smppex/raw_pdu.ex
defmodule SMPPEX.RawPdu do
@moduledoc false
alias SMPPEX.RawPdu
defstruct command_id: 0,
command_status: 0,
sequence_number: 0,
body: ""
@type t :: %RawPdu{}
@type header :: {integer, integer, integer}
@spec new(header, binary) :: t
def new({c_id, c_status, s_number}, pdu_body) do
%RawPdu{
command_id: c_id,
command_status: c_status,
sequence_number: s_number,
body: pdu_body
}
end
@spec command_id(t) :: integer
def command_id(pdu) do
pdu.command_id
end
@spec command_status(t) :: integer
def command_status(pdu) do
pdu.command_status
end
@spec sequence_number(t) :: integer
def sequence_number(pdu) do
pdu.sequence_number
end
@spec header(t) :: header
def header(pdu) do
{pdu.command_id, pdu.command_status, pdu.sequence_number}
end
@spec body(t) :: binary
def body(pdu) do
pdu.body
end
@spec resp?(t) :: boolean
def resp?(pdu), do: command_id(pdu) > 0x80000000
@spec success_resp?(t) :: boolean
def success_resp?(pdu) do
resp?(pdu) and command_status(pdu) == 0
end
end