aboutsummaryrefslogtreecommitdiffstats
path: root/library/SMPP_CodecPort.ttcn
blob: b415c091e6072c72187888ec24f0a01d529de1aa (plain)
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
module SMPP_CodecPort {

/* Simple SMPP Codec Port, translating between raw TCP octetstring payload
 * towards the IPL4asp port provider, and SMPP primitives
 * which carry the decoded SMPP data types as payload.
 *
 * (C) 2018 by Harald Welte <laforge@gnumonks.org>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */


import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from SMPP_Types all;

type record SMPP_RecvFrom {
	ConnectionId	connId,
	SMPP_PDU	msg
}

type record SMPP_Send {
	ConnectionId	connId,
	SMPP_PDU	msg
}

template (value) SMPP_Send ts_SMPP_Send(ConnectionId conn_id, template (value) SMPP_PDU msg) := {
	connId := conn_id,
	msg := msg
}

template SMPP_RecvFrom tr_SMPP_Recv(template ConnectionId conn_id, template SMPP_PDU msg) := {
	connId := conn_id,
	msg := msg
}

private function IPL4_to_SMPP_RecvFrom(in ASP_RecvFrom pin, out SMPP_RecvFrom pout) {
	var integer rc;
	pout.connId := pin.connId;
	rc := f_decode_SMPP(pin.msg, pout.msg);
} with { extension "prototype(fast)" }

private function SMPP_to_IPL4_Send(in SMPP_Send pin, out ASP_Send pout) {
	pout.connId := pin.connId;
	pout.proto := { tcp := {} };
	f_encode_SMPP(pin.msg, pout.msg);
} with { extension "prototype(fast)" }

type port SMPP_CODEC_PT message {
	out	SMPP_Send;
	in	SMPP_RecvFrom,
		ASP_ConnId_ReadyToRelease,
		ASP_Event;
} with { extension "user IPL4asp_PT
	out(SMPP_Send -> ASP_Send: function(SMPP_to_IPL4_Send))
	in(ASP_RecvFrom -> SMPP_RecvFrom: function(IPL4_to_SMPP_RecvFrom);
	   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
	   ASP_Event -> ASP_Event: simple)"
}



}