-
- unsigned char header_buf[128];
- size_t header_buf_len = 128;
-
- unsigned char msg_buf[128];
- size_t msg_buf_len = 128;
-
- bool res;
- asn_dec_rval_t retval;
-
-
- e2sm_indication_helper e2sm_inddata;
- e2sm_indication e2sm_inds;
-
- unsigned char msg[20] = "HelloWorld";
-
- e2sm_inddata.header = 1001;
- e2sm_inddata.message = msg;
- e2sm_inddata.message_len = strlen((const char*)e2sm_inddata.message);
-
-
- // Encode the indication header
- res = e2sm_inds.encode_indication_header(&header_buf[0], &header_buf_len, e2sm_inddata);
- if(!res)
- std::cout << e2sm_inds.get_error() << std::endl;
-
- ASSERT_TRUE(res);
-
- // Encode the indication message
- res = e2sm_inds.encode_indication_message(&msg_buf[0], &msg_buf_len, e2sm_inddata);
- if(!res)
- std::cout << e2sm_inds.get_error() << std::endl;
- ASSERT_TRUE(res);
-
- //decode the indication header
- e2sm_indication_helper e2sm_decodedata;
-
-
- E2SM_HelloWorld_IndicationHeader_t *header = 0; // used for decoding
- retval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_IndicationHeader, (void**)&(header), &header_buf[0], header_buf_len);
-
- ASSERT_TRUE(retval.code == RC_OK);
- res = e2sm_inds.get_fields(header, e2sm_decodedata);
-
- //decode the indication message
-
- E2SM_HelloWorld_IndicationMessage_t *mesg = 0; // used for decoding
- retval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_IndicationMessage, (void**)&(mesg), &msg_buf[0], msg_buf_len);
-
- ASSERT_TRUE(retval.code == RC_OK);
- res = e2sm_inds.get_fields(mesg, e2sm_decodedata);
-
-
- std::cout << "Indication Header:" << e2sm_decodedata.header << std::endl;
- std::cout << "Indication Message:" << e2sm_decodedata.message << std::endl;
- std::cout << "Indication Message Len:" << e2sm_decodedata.message_len << std::endl;
-
- ASSERT_EQ(e2sm_inddata.header, e2sm_decodedata.header);
- ASSERT_EQ(e2sm_inddata.message_len, e2sm_decodedata.message_len);
- for (int i = 0; i < e2sm_inddata.message_len; ++i) {
- EXPECT_EQ(e2sm_inddata.message[i], e2sm_decodedata.message[i]) << "Encoded and Decoded Msg differ at index " << i;
+ unsigned char e2ap_buff[4096];
+ char filename[100] = "indication2.per";
+ FILE *fp;
+ fp = fopen(filename,"rb");
+ if(!fp) {
+ perror(filename);
+ exit(1); }
+
+ size_t e2ap_buff_size = fread(e2ap_buff, 1, 4096, fp);
+ fclose(fp);
+ if(!e2ap_buff_size){
+ fprintf(stderr, "%s: Empty or broken\n", filename);
+ exit(1);
+ } else {
+ fprintf(stderr, "e2ap buffer size: %ld \n", e2ap_buff_size);
+ }
+
+ bool decode_status = true;
+ try{
+ E2APIndication<HWIndicationHeader,HWIndicationMessage> e2obj(&e2ap_buff[0],&e2ap_buff_size);
+ E2APIndication<HWIndicationHeader,HWIndicationMessage>::IndicationIEs indIEs = e2obj.getIndicationIEs();
+ std::cout << indIEs.get_ricRequestorID() << std::endl;
+
+ size_t hsize = indIEs.get_ricIndicationHeader_size();
+ unsigned char* hvalue = (unsigned char*)indIEs.get_ricIndicationHeader();
+ HWIndicationHeader headerObj(&hvalue[0], &hsize);
+
+ size_t msize = indIEs.get_ricIndicationMessage_size();
+ auto mvalue = (unsigned char*)indIEs.get_ricIndicationMessage();
+ HWIndicationMessage msgObj(&mvalue[0], &msize);
+
+ } catch(const char* e){
+ decode_status = false;
+ std::cout << "Error Message: " << e << std::endl;