- //bool res_encode = msg.encode_subscription_request(data, &data_size);
- //if(!res_encode) exit(0);
- char *strMsg = "HelloWorld\0";
- strncpy((char *)data,strMsg,strlen(strMsg));
- data_size = sizeof(data);
+ mdclog_write(MDCLOG_INFO,"Preparing to send subscription in file= %s, line=%d",__FILE__,__LINE__);
+
+ auto gnblist = get_rnib_gnblist();
+
+ int sz = gnblist.size();
+
+ if(sz <= 0)
+ mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL");
+
+ for(int i = 0; i<sz; i++){
+
+ //give the message to subscription handler, along with the transmitter.
+ strcpy((char*)meid,gnblist[i].c_str());
+
+ // char *strMsg = "Subscription Request from HelloWorld XApp\0";
+ // strncpy((char *)data,strMsg,strlen(strMsg));
+ // data_size = strlen(strMsg);
+
+ subscription_helper din;
+ subscription_helper dout;
+
+ subscription_request sub_req;
+ subscription_request sub_recv;
+
+ unsigned char buf[BUFFER_SIZE];
+ size_t buf_size = BUFFER_SIZE;
+ bool res;
+
+
+ //Random Data for request
+ int request_id = 1;
+ int function_id = 0;
+ std::string event_def = "HelloWorld Event Definition";
+
+ din.set_request(request_id);
+ din.set_function_id(function_id);
+ din.set_event_def(event_def.c_str(), event_def.length());
+
+ std::string act_def = "HelloWorld Action Definition";
+
+ din.add_action(1,1,(void*)act_def.c_str(), act_def.length(), 0);
+
+ res = sub_req.encode_e2ap_subscription(&buf[0], &buf_size, din);