-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathREADME
133 lines (98 loc) · 3.22 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
smpp34pdu is an erlang library for the SMPP 3.4 wire protocol
Brief History
--------------
This library is a take two of a ad-hoc implementation of just
the wire protocol packing and unpacking routines. It is inspired
in part by OSERL's approach and my desire to implement this from
first principles after the lessons learnt implementing this in an
ad-hoc style, it will eventually replace the version used in my
SMPP library.
Another goal of this library is to be fully tested and provably
"trustworthy".
The hidden goal of this library is to serve as boiler plate on
my research into binary protocol compiler compilers, which is
one of my current areas of interest, as I want to implement this
from first principles without too much refactorings, so I can see
how easy it would be to autogenerate all this code based on an EBNF
type grammar.
I choosen to support SMPP 3.4 since its the most widely deployed
variant of the protocol currently, and SMPP is designed to be backwardly
compatible, so any compliant system speaking SMPP 5 will accept and work
with SMPP 3.4 systems.
Note that this library assumes a familiarity with the SMPP 3.4 PDU
specification, and is a one-to-one mapping of the PDUs onto erlang.
Uhh... typically, this familarity comes from reading the spec :)
Building
--------
smpp34pdu is built with rebar, the awesome erlang build tool.
There is a Makefile wrapping up its use, so it plays nice with other
build environments.
First clone the sources from git hub:
$ git clone git://github.com/essiene/smpp34pdu.git
Then build:
$ cd smpp34pdu
$ make
To run the unittests:
$ make tests
To run dialyzer analysis:
$ make analyze
Installation
------------
Deploy like any other erlang library
Usage/Examples
--------------
-module(smpp34pdu_example).
-export([start/0]).
% Include the resource file defining all the
% Records
-include_lib("smpp34pdu/include/smpp34pdu.hrl").
start() ->
% Create a bind_receiver PDU record
BindReceiverBody = #bind_receiver{system_id="abcdefghij",
password="abcd", system_type="",
interface_version=?VERSION, addr_ton=2,
addr_npi=1,address_range=""},
% Pack this PDU into binary
% Note that this calculates all the neccessary header fields
% like command_id, command_length, command_status and builds a complete
% PDU
PackedBinary = smpp34pdu:pack(?ESME_ROK, 1, BindReceiverBody),
{ok, [Pdu], <<>>} = smpp34pdu:unpack(PackedBinary),
Pdu#pdu.body = BindReceiverBody,
io:format("PDU packing/unpacking works properly").
Docs
-----
A more complete documentation will be included soon
Current Status
--------------
This is currently pre-alpha software and is not yet feature complete.
I am working through an earlier implementation and reimplementing here.
This situation shouldn't last for too long though.
Supported PDUs:
GENERIC_NACK
BIND_RECEIVER
BIND_RECEIVER_RESP
BIND_TRANSMITTER
BIND_TRANSMITTER_RESP
QUERY_SM
QUERY_SM_RESP
SUBMIT_SM
SUBMIT_SM_RESP
DELIVER_SM
DELIVER_SM_RESP
UNBIND
UNBIND_RESP
REPLACE_SM
REPLACE_SM_RESP
CANCEL_SM
CANCEL_SM_RESP
BIND_TRANSCEIVER
BIND_TRANSCEIVER_RESP
OUTBIND
ENQUIRE_LINK
ENQUIRE_LINK_RESP
ALERT_NOTIFICATION
Unsupported PDUs:
SUBMIT_MULTI
SUBMIT_MULTI_RESP
DATA_SM