- string curr_key = "";
- shared_ptr<nodeb_t> nodeb = make_shared<nodeb_t>();
-
- bool Key(const Ch* str, SizeType length, bool copy) {
- curr_key = str;
- return true;
- }
-
- bool String(const Ch* str, SizeType length, bool copy) {
- if( curr_key.compare( "ranName" ) == 0 ) {
- nodeb->ran_name = str;
- } else if( curr_key.compare( "plmnId" ) == 0 ) {
- nodeb->global_nb_id.plmn_id = str;
- } else if( curr_key.compare( "nbId" ) == 0 ) {
- nodeb->global_nb_id.nb_id = str;
- } else if( curr_key.compare( "cellId" ) == 0 ) {
- cell_map[str] = nodeb;
- }
- return true;
- }
+ string curr_key = "";
+ shared_ptr<nodeb_t> nodeb = make_shared<nodeb_t>();
+ std::string meid;
+ std::vector<string> cells;
+
+ bool Key(const Ch* str, SizeType length, bool copy) {
+ curr_key = str;
+ return true;
+ }
+
+ bool String(const Ch* str, SizeType length, bool copy) {
+
+ if (curr_key.compare("ranName") == 0) {
+ //std::cout << str << "\n";
+ nodeb->ran_name = str;
+ meid= str;
+ //std::cout << "\n meid = " << meid;
+
+ }
+ else if (curr_key.compare("plmnId") == 0) {
+ //std::cout << str << "\n";
+ nodeb->global_nb_id.plmn_id = str;
+ }
+ else if (curr_key.compare("nbId") == 0) {
+ //std::cout <<str<< "\n";
+ nodeb->global_nb_id.nb_id = str;
+ }
+ else if (curr_key.compare("e2nodeComponentRequestPart") == 0) {
+ //std::cout << str<<"\n";
+ auto message = base64_decode(str);
+ //std::cout << message<<"\n";
+ int len = meid.length();
+ //std::cout << "\n meid = " << meid;
+ int counter = 0;
+ for (int i = 0; i <len; i++ ){
+ if (meid[i] == '_') {
+ counter++;
+ }
+ if( counter == 3) {
+ counter = i + 1;
+ break;
+ }
+ }
+ std::string last_matching_bits = meid.substr(counter, meid.length());
+ len = last_matching_bits.size();
+ char b;
+
+ for (int i = 0; i < len; i++) {
+ b = last_matching_bits[i];
+ b = toupper(b);
+ // b = to lower(b); //alternately
+ last_matching_bits[i] = b;
+ }
+ len = message.length();
+ //std::cout << "\nlast_matching_bits = " << last_matching_bits;
+ int matching_len = last_matching_bits.length();;
+
+ for (int i = 0; i <= len - matching_len; i++ ){
+ //std::cout << "\n" << message.substr(i, matching_len);
+
+ if (message.substr(i,matching_len)== last_matching_bits){
+ //std::cout << "\nmatched!\n";
+ cells.push_back(message.substr(i,10));//cell id is 36 bit long , last 4 bit unused
+
+ }
+ }
+ len = cells.size();
+ for (int i = 0; i < len; i++) {
+ cell_map[cells[i]] = nodeb;
+ }
+
+ }
+ return true;
+ }