Bugfix for SIM-63
[sim/o1-interface.git] / ntsimulator / ntsim-ng / utils / nts_utils.c
index 60fa015..f1a71ac 100644 (file)
 #define NTS_NETWORK_FUNCTION_VES_SCHEMA_XPATH               "/nts-network-function:simulation/network-function/ves"
 
 
-cJSON* ves_create_common_event_header(const char *domain, const char *event_type, const char *source_name, const char *priority, int seq_id) {
+cJSON* ves_create_common_event_header(const char *domain, const char *event_type, const char *hostname, int port, const char *priority, int seq_id) {
     assert(domain);
     assert(event_type);
-    assert(source_name);
+    assert(hostname);
     assert(priority);
 
     char *eventId = 0;
@@ -100,6 +100,14 @@ cJSON* ves_create_common_event_header(const char *domain, const char *event_type
         return 0;
     }
 
+    char source_name[512];
+    if(port) {
+        sprintf(source_name, "%s-%d", hostname, port);
+    }
+    else {
+        sprintf(source_name, "%s", hostname);
+    }
+
     if(cJSON_AddStringToObject(common_event_header, "reportingEntityName", source_name) == 0) {
         log_error("cJSON AddStringToObject error\n");
         cJSON_Delete(common_event_header);