update to RMR 4.8.5
[ric-plt/e2.git] / RIC-E2-TERMINATION / sctpThread.h
index 6e22f7b..3b0f203 100644 (file)
@@ -41,6 +41,8 @@
 #include <atomic>
 #include <sys/param.h>
 #include <sys/file.h>
+#include <sys/types.h>
+#include <ifaddrs.h>
 #include <ctime>
 #include <netdb.h>
 #include <sys/epoll.h>
@@ -148,6 +150,7 @@ typedef struct sctp_params {
     string prometheusPort {"8088"};
     Family<Counter> *prometheusFamily;
     Exposer *prometheusExposer = nullptr;
+    Counter *e2tCounters[6][2][ProcedureCode_id_RICsubscriptionDeleteRequired + 1] {};
 } sctp_params_t;
 
 // RAN to RIC
@@ -163,6 +166,8 @@ typedef struct sctp_params {
 #define MSG_COUNTER 0
 #define BYTES_COUNTER 1
 
+#define INVALID_STREAM_ID -1
+
 typedef struct ConnectedCU {
     int fileDescriptor = 0;
     char hostName[NI_MAXHOST] {};
@@ -174,7 +179,9 @@ typedef struct ConnectedCU {
     bool isConnected = false;
     bool gotSetup = false;
     sctp_params_t *sctpParams = nullptr;
-    Counter *counters[6][2][ProcedureCode_id_RICsubscriptionDelete + 1] {};
+    Counter *counters[6][2][ProcedureCode_id_RICsubscriptionDeleteRequired + 1] {};
+    bool isSingleStream = false;
+    int singleStreamId = 0;
 } ConnectedCU_t ;
 
 
@@ -343,7 +350,7 @@ int sendDirectionalSctpMsg(RmrMessagesBuffer_t &messageBuffer,
 void asnInitiatingRequest(E2AP_PDU_t *pdu,
                           Sctp_Map_t *sctpMap,
                           ReportingMessages_t &message,
-                          RmrMessagesBuffer_t &rmrMessageBuffer);
+                          RmrMessagesBuffer_t &rmrMessageBuffer,int streamId);
 /**
  *
  * @param pdu
@@ -411,6 +418,15 @@ void buildJsonMessage(ReportingMessages_t &message);
  */
 string translateRmrErrorMessages(int state);
 
+int buildConfiguration(sctp_params_t &sctpParams);
+void startPrometheus(sctp_params_t &sctpParams);
+static int enable_log_change_notify(const char* fileName);
+static int register_log_change_notify(const char *fileName);
+static void * monitor_loglevel_change_handler(void* arg);
+void  update_mdc_log_level_severity(char* log_level);
+char* getinterfaceip();
+static char* parse_file(char* filename);
+
 
 static inline uint64_t rdtscp(uint32_t &aux) {
     uint64_t rax,rdx;
@@ -421,4 +437,12 @@ static inline uint64_t rdtscp(uint32_t &aux) {
 #define RIC_SCTP_CONNECTION_FAILURE  10080
 #endif
 
+#ifdef UNIT_TEST
+    #define FILE_DESCRIPTOR 53424 /*Dummy value for file descriptor only when UT is defined*/
+#endif
+
+int buildListeningPort(sctp_params_t &sctpParams);
+void buildE2TPrometheusCounters(sctp_params_t &sctpParams);
+
+int fetchStreamId(ConnectedCU_t *peerInfo, ReportingMessages_t &message);
 #endif //X2_SCTP_THREAD_H