X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fmessage_processor_class.hpp;h=5ff3961dbab90d35e9bb7e48342bdcf0824037ab;hb=6f5a7b69bb045ed82506e14cef9b0cdc6554a613;hp=bfac5804803dc3a5bf46672963fa4ca679b18764;hpb=b9d7e9c232a4371ddfed51c58e5a57f87b057229;p=ric-app%2Fadmin.git diff --git a/src/message_processor_class.hpp b/src/message_processor_class.hpp index bfac580..5ff3961 100644 --- a/src/message_processor_class.hpp +++ b/src/message_processor_class.hpp @@ -21,6 +21,7 @@ #pragma once #include #include +#include #include #include #include @@ -39,30 +40,52 @@ #define unlikely(x) (x) #endif -#define BUFFER_LENGTH 2048 + +#define MAX_RMR_RECV_SIZE 2<<15 + +typedef enum{ + NO_ERROR=0, + RMR_ERROR, + E2AP_INDICATION_ERROR, + E2AP_CONTROL_ERROR, + E2SM_INDICATION_HEADER_ERROR, + E2SM_CONTROL_HEADER_ERROR, + E2SM_CONTROL_MESSAGE_ERROR, + MISSING_HANDLER_ERROR, + BUFFER_ERROR, + PLUGIN_ERROR +} MessageProcessorStateTypes; + + +typedef enum { + E2AP_PROC_ONLY = 0, + E2SM_PROC_ONLY, + ALL +} ProcessingLevelTypes; + class message_processor { public: - message_processor(); + message_processor(int mode=ALL, bool rep=true, size_t buffer_length = 2048); ~message_processor(void); bool operator() (rmr_mbuf_t *); unsigned long const get_messages (void); - void register_subscription_handler(SubscriptionHandler *); + void register_subscription_handler(subscription_handler *); void register_protector(protector * ); void register_policy_handler (void (*)(int, const char *, int, std::string &, bool)); std::vector & get_metrics(void); - + int get_state (void) {return state;}; private: - E2AP_PDU_t * e2ap_recv_pdu; - E2SM_gNB_X2_indicationHeader_t *e2sm_header; // used for decoding - E2SM_gNB_X2_indicationMessage_t *e2sm_message; // used for decoding + E2N_E2AP_PDU_t * e2ap_recv_pdu; + E2N_E2SM_gNB_X2_indicationHeader_t *e2sm_header; // used for decoding + E2N_E2SM_gNB_X2_indicationMessage_t *e2sm_message; // used for decoding - E2AP_PDU_t * e2ap_gen_pdu; // just a placeholder for now + E2N_E2AP_PDU_t * e2ap_gen_pdu; // just a placeholder for now - E2APRicIndication indication_data; + ric_indication_helper indication_data; ric_indication indication_processor; ric_control_helper control_data; @@ -74,17 +97,21 @@ private: e2sm_indication e2sm_indication_processor; e2sm_control e2sm_control_processor; - SubscriptionHandler * _ref_sub_handler; + subscription_handler * _ref_sub_handler; protector * _ref_protector; void (* _ref_policy_handler) (int, const char *, int, std::string &, bool); unsigned long _num_messages; unsigned char *scratch_buffer; size_t remaining_buffer; - unsigned int current_index; + size_t current_index; unsigned long int num_indications, num_err_indications; + int state = NO_ERROR; + int processing_level; // for debugging purposes + bool report_mode_only; // suppress e2ap control + size_t _buffer_size; // for storing encoding + }; -extern bool report_mode_only; extern int verbose_flag;