ipa: Pull everything together: L3->BSSAP->SCCP->IPA
diff --git a/library/IPA_CodecPort.ttcn b/library/IPA_CodecPort.ttcn
index 70d3ccb..ad94a92 100644
--- a/library/IPA_CodecPort.ttcn
+++ b/library/IPA_CodecPort.ttcn
@@ -16,6 +16,19 @@
 		octetstring	msg
 	}
 
+
+	/* 'stream' contains the octets received so far, we must return the total length */
+	function f_IPA_getMsgLen(in octetstring stream, inout ro_integer args) return integer {
+		var integer stream_len := lengthof(stream);
+		var integer len;
+		if (stream_len < 2) {
+			/* insufficient length to determine the length */
+			return -1;
+		}
+		len := 3 + oct2int(substr(stream, 0, 2));
+		return len;
+	}
+
 	private function IPL4_to_IPA_RecvFrom(in ASP_RecvFrom pin, out IPA_RecvFrom pout) {
 		var PDU_IPA ipa := dec_PDU_IPA(pin.msg);
 		pout.connId := pin.connId;