Configurable HTTP(S) support for VES messaging
[sim/o1-interface.git] / ntsimulator / inc / utils / utils.h
index c049c66..61ce1e3 100644 (file)
@@ -31,7 +31,9 @@
 #define TRUE 1
 #define FALSE 0
 
-#define NETCONF_CONNECTIONS_PER_DEVICE 10
+#define NETCONF_CONNECTIONS_PER_DEVICE (getSshConnectionsFromConfigJson() + getTlsConnectionsFromConfigJson())
+#define SSH_CONNECTIONS_PER_DEVICE getSshConnectionsFromConfigJson()
+#define TLS_CONNECTIONS_PER_DEVICE getTlsConnectionsFromConfigJson()
 
 #define PREPARE_ADD_NEW_VALUE(v, num)  {\
                                                                                num++;\
                                                                                num++;\
                                                                                }
 
+typedef struct
+{
+       int normal;
+       int warning;
+       int minor;
+       int major;
+       int critical;
+} counterAlarms;
+
 void           set_curl_common_info_ves(CURL *curl);
 
 long           random_at_most(long max);
@@ -63,16 +74,34 @@ cJSON*      vesCreateFaultFields(char *alarm_condition, char *alarm_object, char *sev
 
 char*  readConfigFileInString(void);
 void   writeConfigFile(char *config);
+int    writeSkeletonConfigFile(void);
 
-int    getFaultNotificationDelayPeriodFromConfigJson(void);
+int    getFaultNotificationDelayPeriodFromConfigJson(int *period_array, int *count);
 int    getVesHeartbeatPeriodFromConfigJson(void);
 char*  getVesAuthMethodFromConfigJson(void);
 char*  getVesIpFromConfigJson(void);
+char*  getVesUsernameFromConfigJson(void);
+char*  getVesPasswordFromConfigJson(void);
 int    getVesPortFromConfigJson(void);
 int    getVesRegistrationFromConfigJson(void);
 int    getNetconfAvailableFromConfigJson(void);
 int    getVesAvailableFromConfigJson(void);
+int     getSshConnectionsFromConfigJson(void);
+int     getTlsConnectionsFromConfigJson(void);
 
 void   generateRandomMacAddress(char *mac_address);
 
+int    writeSkeletonStatusFile(void);
+char*  readStatusFileInString(void);
+
+int     writeStatusNotificationCounters(counterAlarms ves_counter, counterAlarms netconf_counter);
+void    writeStatusFile(char *status);
+int     removeDeviceEntryFromStatusFile(char *deviceName);
+
+cJSON*  getDeviceListFromStatusFile(void);
+int     compute_notifications_count(counterAlarms *ves_counter, counterAlarms *netconf_counter);
+int     getDeviceCounters(char *containerId, counterAlarms *ves_counter, counterAlarms *netconf_counter);
+
+int     getIntFromString(char *string, int def_value);
+
 #endif /* EXAMPLES_NTSIMULATOR_UTILS_H_ */