msc: Add SMPP_CodecPort

Change-Id: I57640ccc5370d6820bc303003e162f27ddc9fcfd
This commit is contained in:
Harald Welte 2018-04-09 22:51:59 +02:00
parent 72199a8be9
commit 384f4fee23
5 changed files with 185 additions and 1 deletions

View File

@ -0,0 +1,65 @@
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.
*/
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)"
}
}

View File

@ -0,0 +1,52 @@
module SMPP_CodecPort_CtrlFunct {
import from SMPP_CodecPort all;
import from IPL4asp_Types all;
external function f_IPL4_listen(
inout SMPP_CODEC_PT portRef,
in HostName locName,
in PortNumber locPort,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
external function f_IPL4_connect(
inout SMPP_CODEC_PT portRef,
in HostName remName,
in PortNumber remPort,
in HostName locName,
in PortNumber locPort,
in ConnectionId connId,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
external function f_IPL4_close(
inout SMPP_CODEC_PT portRef,
in ConnectionId id,
in ProtoTuple proto := { unspecified := {} }
) return Result;
external function f_IPL4_setUserData(
inout SMPP_CODEC_PT portRef,
in ConnectionId id,
in UserData userData
) return Result;
external function f_IPL4_getUserData(
inout SMPP_CODEC_PT portRef,
in ConnectionId id,
out UserData userData
) return Result;
external function f_IPL4_setGetMsgLen(
inout SMPP_CODEC_PT portRef,
in ConnectionId id,
inout f_IPL4_getMsgLen f,
in ro_integer msgLenArgs
);
}

View File

@ -0,0 +1,66 @@
#include "IPL4asp_PortType.hh"
#include "SMPP_CodecPort.hh"
#include "IPL4asp_PT.hh"
namespace SMPP__CodecPort__CtrlFunct {
IPL4asp__Types::Result f__IPL4__listen(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
}
IPL4asp__Types::Result f__IPL4__connect(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::HostName& remName,
const IPL4asp__Types::PortNumber& remPort,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__connect(portRef, remName, remPort,
locName, locPort, connId, proto, options);
}
IPL4asp__Types::Result f__IPL4__close(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::ProtoTuple& proto)
{
return f__IPL4__PROVIDER__close(portRef, connId, proto);
}
IPL4asp__Types::Result f__IPL4__setUserData(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__setUserData(portRef, connId, userData);
}
IPL4asp__Types::Result f__IPL4__getUserData(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
}
void f__IPL4__setGetMsgLen(
SMPP__CodecPort::SMPP__CODEC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
Socket__API__Definitions::f__getMsgLen& f,
const Socket__API__Definitions::ro__integer& msgLenArgs)
{
return f__IPL4__PROVIDER__setGetMsgLen(portRef, connId, f, msgLenArgs);
}
}

View File

@ -78,6 +78,7 @@ FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter
FILES+="BSSMAP_Emulation.ttcn BSSAP_CodecPort.ttcn BSSMAP_Templates.ttcn BSSAP_Adapter.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_Emulation.ttcn "
FILES+="RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunctDef.cc "
FILES+="MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunctDef.cc "
FILES+="SMPP_CodecPort.ttcn SMPP_CodecPort_CtrlFunct.ttcn SMPP_CodecPort_CtrlFunctDef.cc "
gen_links $DIR $FILES
ignore_pp_results

View File

@ -1,6 +1,6 @@
#!/bin/sh
FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc SCTPasp_PT.cc TCCConversion.cc TCCInterface.cc UD_PT.cc MNCC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc SDP_EncDec.cc RTP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc Native_FunctionDefs.cc SMPP_EncDec.cc *.c"
FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc SCTPasp_PT.cc TCCConversion.cc TCCInterface.cc UD_PT.cc MNCC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc SDP_EncDec.cc RTP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc Native_FunctionDefs.cc SMPP_EncDec.cc SMPP_CodecPort_CtrlFunctDef.cc *.c"
export CPPFLAGS_TTCN3="-DIPA_EMULATION_MGCP -DIPA_EMULATION_GSUP -DUSE_MTP3_DISTRIBUTOR"