RAW_NS: add support for an incoming SNS ADD procedure

Change-Id: I937b654d377e189ee811145474683b638153179e
diff --git a/library/RAW_NS.ttcnpp b/library/RAW_NS.ttcnpp
index 93c43f0..d601ccd 100644
--- a/library/RAW_NS.ttcnpp
+++ b/library/RAW_NS.ttcnpp
@@ -427,6 +427,27 @@
 }
 
 
+/* perform inbound SNS-ADD procedure */
+function f_incoming_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0, template (omit) NsCause cause := omit)
+runs on RAW_NS_CT {
+	log("f_incoming_sns_add(idx=", idx, ")");
+	var PDU_NS rx;
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_add];
+
+	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
+		var template (omit) IP4_Elements v4_elem := { ts_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip,
+								     nsvc_cfg.provider.ip.remote_udp_port,
+								     w_sig, w_user) };
+		rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, v4 := v4_elem), idx);
+	} else {
+		var template (omit) IP6_Elements v6_elem := { ts_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip,
+								     nsvc_cfg.provider.ip.remote_udp_port,
+								     w_sig, w_user) };
+		rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, omit, v6_elem), idx);
+	}
+	NSCP[idx].send(ts_SNS_ACK(g_nsconfig.nsei, rx.pDU_SNS_Add.transactionID));
+}
+
 function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0, template (omit) NsCause cause := omit)
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_add(idx_add=", idx_add, ")");