sccp: Introduce test TC_tiar_timeout

Existing templates are moved to SCPP_Templates.ttcn and new ones
required for the test are added there.

Related: OS#4343
Change-Id: I7b56fe77ac3b350d722c74b043e6ecabc48dcf31
diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn
index 7c2ffa6..b3e3392 100644
--- a/library/SCCP_Templates.ttcn
+++ b/library/SCCP_Templates.ttcn
@@ -9,6 +9,8 @@
 
 module SCCP_Templates {
 
+import from General_Types all;
+
 import from SCCP_Types all;
 import from SCCPasp_Types all;
 import from SCCP_Emulation all;
@@ -66,5 +68,134 @@
 	}
 }
 
+/* connection oriented SCCP */
+const SCCP_param_ProtocolClass c_class2 := { class:='0010'B, messageHandling:='0000'B };//class 2
+
+function ts_SCCP_CR(OCT3 source_lref, SCCP_PAR_Address calling, SCCP_PAR_Address called)
+return template (value) PDU_SCCP {
+	var SCCP_param_CPartyAddressEnc calling_enc := ConvertASPAddressToEncodedAddress_itu(calling);
+
+	var template (value) PDU_SCCP ret := {
+		connrequest := {
+			messageType := cr,
+			sourceLocRef := source_lref,
+			protClass := c_class2,
+			pointer1 := 2,
+			pointer2 := 0, /* overwritten */
+			calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
+			optionalPart := {
+				credit := omit,
+				callingPAddress := {
+					paramName := con_SCCP_cgPA,
+					paramLength := calling_enc.paramLength, /* overwritten */
+					addr := calling_enc.addr
+				},
+				data := omit,
+				hopCounter := omit,
+				importance := omit
+			},
+			eop := { paramName:= con_SCCP_eop }
+		}
+	}
+	return ret;
+}
+
+template (present) PDU_SCCP tr_SCCP_CC(template (present) OCT3 source_lref,
+				       template (present) OCT3 dest_lref) := {
+	connconfirm := {
+		messageType := cc,
+		destLocRef := dest_lref,
+		sourceLocRef := source_lref,
+		protClass := c_class2,
+		pointer1 := ?,
+		optionalPart := *,
+		eop := *
+	}
+}
+
+template (value) PDU_SCCP ts_SCCP_UDT(SCCP_PAR_Address calling, SCCP_PAR_Address called,
+				      template (value) octetstring data,
+				      template (value) BIT4 msg_hdl := '0000'B) := {
+	unitdata := {
+		messageType := udt,
+		protClass := {'0000'B, msg_hdl},
+		pointer1 := 0,  /* overwritten */
+		pointer2 := 0,  /* overwritten */
+		pointer3 := 0,  /* overwritten */
+		calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
+		callingPAddress := ConvertASPAddressToEncodedAddress_itu(calling),
+		data := {
+			paramLength := 0,
+			data := data
+		}
+	}
+}
+
+template PDU_SCCP tr_SCCP_UDT(SCCP_PAR_Address calling, SCCP_PAR_Address called,
+			      template octetstring data := ?,
+			      template BIT4 msg_hdl := '0000'B) := {
+	unitdata := {
+		messageType := udt,
+		protClass := {'0000'B, msg_hdl},
+		pointer1 := ?,
+		pointer2 := ?,
+		pointer3 := ?,
+		calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
+		callingPAddress := ConvertASPAddressToEncodedAddress_itu(calling),
+		data := {
+			paramLength := lengthof(data),
+			data := data
+		}
+	}
+}
+
+template PDU_SCCP tr_SCCP_IT(template (present) OCT3 source_lref := ?,
+			     template (present) OCT3 dest_lref := ?) := {
+	inacttest := {
+		messageType := it,
+		destLocRef := dest_lref,
+		sourceLocRef := source_lref,
+		protClass := c_class2,
+		sequencingSegmenting := {
+			reserved := ?,
+			p_s := ?,
+			more := ?,
+			pr := ?
+		},
+		credit := ?
+	}
+}
+
+template PDU_SCCP tr_SCCP_RLSD(template (present) OCT3 source_lref := ?,
+			       template (present) OCT3 dest_lref := ?,
+			       template (present) SCCP_param_ReleaseCause relcause := ?) := {
+	released := {
+		messageType := rlsd,
+		destLocRef := dest_lref,
+		sourceLocRef := source_lref,
+		releaseCause := relcause,
+		pointer1 := ?,
+		optionalPart := *,
+		eop := *
+	}
+}
+
+template PDU_SCCP ts_SCCP_RLC(OCT3 source_lref, OCT3 dest_lref) := {
+	relcomp := {
+		messageType := rlc,
+		destLocRef := dest_lref,
+		sourceLocRef := source_lref
+	}
+}
+
+template PDU_SCCP tr_SCCP_RLC(template (present) OCT3 source_lref := ?,
+			      template (present) OCT3 dest_lref := ?) := {
+	relcomp := {
+		messageType := rlc,
+		destLocRef := dest_lref,
+		sourceLocRef := source_lref
+	}
+}
+
 
 }