library/M3UA: support TCP transport, implement desegmentation

Change-Id: If1dcdb185d08a08dc5a06c37d9d6ffe7d6da9325
Related: libosmo-sccp.git I8c76d271472befacbeb998a93bbdc9e8660d9b5d
Related: SYS#5424
This commit is contained in:
Vadim Yanitskiy 2024-02-18 19:26:35 +07:00 committed by fixeria
parent 020a8fc281
commit f197ed2dfd
3 changed files with 37 additions and 9 deletions

View File

@ -15,6 +15,7 @@ module M3UA_CodecPort {
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from M3UA_CodecPort_CtrlFunct all;
import from M3UA_Types all;
type record M3UA_RecvFrom {
@ -37,7 +38,7 @@ module M3UA_CodecPort {
type record M3UA_Send {
ConnectionId connId,
integer stream,
integer stream optional,
PDU_M3UA msg
}
@ -59,14 +60,18 @@ module M3UA_CodecPort {
private function M3UA_to_IPL4_Send(in M3UA_Send pin, out ASP_Send pout) {
pout.connId := pin.connId;
pout.proto := {
sctp := {
sinfo_stream := pin.stream,
sinfo_ppid := 3,
remSocks := omit,
assocId := omit
}
};
if (ispresent(pin.stream)) {
pout.proto := {
sctp := {
sinfo_stream := pin.stream,
sinfo_ppid := 3,
remSocks := omit,
assocId := omit
}
};
} else {
pout.proto := { tcp := { } };
}
pout.msg := enc_PDU_M3UA(pin.msg);
} with { extension "prototype(fast)" };
@ -80,5 +85,12 @@ module M3UA_CodecPort {
in(ASP_RecvFrom -> M3UA_RecvFrom: function(IPL4_to_M3UA_RecvFrom);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)"
};
function f_set_tcp_segmentation(M3UA_CODEC_PT pt, ConnectionId connId) {
/* Set function for dissecting the binary stream into packets */
var f_IPL4_getMsgLen vl_f := refers(f_IPL4_fixedMsgLen);
/* Offset: 4, size of length: 4, delta: 0, multiplier: 1, big-endian */
M3UA_CodecPort_CtrlFunct.f_IPL4_setGetMsgLen(pt, connId, vl_f, {4, 4, 0, 1, 0});
}
}

View File

@ -40,5 +40,12 @@ module M3UA_CodecPort_CtrlFunct {
out UserData userData
) return Result;
external function f_IPL4_setGetMsgLen(
inout M3UA_CODEC_PT portRef,
in ConnectionId id,
inout f_IPL4_getMsgLen f,
in ro_integer msgLenArgs
)
}

View File

@ -51,6 +51,15 @@ namespace M3UA__CodecPort__CtrlFunct {
{
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
}
void f__IPL4__setGetMsgLen(
M3UA__CodecPort::M3UA__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);
}
}