iu_client: introduce a guard around global_iu_event_cb

As preparation to enable and disable notifications for a specific ue connection,
add a slim proxy before calling global_iu_event_cb

Change-Id: I49a3402a871d6dccd343cda49f8a7f82bffe150b
diff --git a/src/iu_client.c b/src/iu_client.c
index 7a0a78e..ec5290f 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -109,6 +109,16 @@
 	{ 0, NULL }
 };
 
+static int global_iu_event(struct ranap_ue_conn_ctx *ue_ctx,
+			   enum ranap_iu_event_type type,
+			   void *data)
+{
+	if (!global_iu_event_cb)
+		return 0;
+
+	return global_iu_event_cb(ue_ctx, type, data);
+}
+
 static struct ranap_ue_conn_ctx *ue_conn_ctx_alloc(struct ranap_iu_rnc *rnc, uint32_t conn_id)
 {
 	struct ranap_ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ranap_ue_conn_ctx);
@@ -501,7 +511,7 @@
 			return rc;
 		}
 
-		rc = global_iu_event_cb(ctx, RANAP_IU_EVENT_RAB_ASSIGN, &setup_ies);
+		rc = global_iu_event(ctx, RANAP_IU_EVENT_RAB_ASSIGN, &setup_ies);
 
 		ranap_free_rab_setupormodifieditemies(&setup_ies);
 	}
@@ -567,11 +577,11 @@
 		switch (message->procedureCode) {
 		case RANAP_ProcedureCode_id_SecurityModeControl:
 			/* Security Mode Complete */
-			rc = global_iu_event_cb(ctx, RANAP_IU_EVENT_SECURITY_MODE_COMPLETE, NULL);
+			rc = global_iu_event(ctx, RANAP_IU_EVENT_SECURITY_MODE_COMPLETE, NULL);
 			break;
 		case RANAP_ProcedureCode_id_Iu_Release:
 			/* Iu Release Complete */
-			rc = global_iu_event_cb(ctx, RANAP_IU_EVENT_IU_RELEASE, NULL);
+			rc = global_iu_event(ctx, RANAP_IU_EVENT_IU_RELEASE, NULL);
 			if (rc) {
 				LOGPIU(LOGL_ERROR, "Iu Release event: Iu Event callback returned %d\n",
 				       rc);
@@ -818,7 +828,7 @@
 		if (!ue)
 			break;
 
-		global_iu_event_cb(ue, RANAP_IU_EVENT_LINK_INVALIDATED, NULL);
+		global_iu_event(ue, RANAP_IU_EVENT_LINK_INVALIDATED, NULL);
 		break;
 	case OSMO_PRIM(OSMO_SCU_PRIM_N_DATA, PRIM_OP_INDICATION):
 		/* connection-oriented data received */