+ // we have the XML
+ pugi::xml_document doc;
+ pugi::xml_parse_result result = doc.load_string((const char *)buffer);
+ if (result) {
+ unsigned int index = 0;
+ for (auto tool : doc.child("E2AP-PDU")
+ .child("initiatingMessage")
+ .child("value")
+ .child("E2setupRequest")
+ .child("protocolIEs")
+ .children("E2setupRequestIEs")) {
+ for (auto n : tool.child("value").child("RANfunctions-List").child(
+ "ProtocolIE-SingleContainer").children()) {
+ //ProtocolIE-SingleContainer
+ //cout << "\t1 " << n.name() << endl;
+ if (strcmp(n.name(), "value") == 0) {
+ for (auto l : tool.child("value").children()) {
+ //cout << "\t\t2 " << l.name() << endl;
+ for (auto f : l.children()) {
+ //cout << "\t\t\t3 " << f.name() << endl;
+ for (auto g : f.child("value").children()) {
+ //cout << "\t\t\t\t4 " << g.name() << endl;
+ for (auto a : g.children()) {
+ if (strcmp(a.name(), "ranFunctionDefinition") == 0) {
+ if (repValues.size() > index) {
+ a.remove_children();
+ string val = repValues.at(index++);
+ // here we get vector with counter
+ a.append_child(pugi::node_pcdata).set_value(val.c_str());
+
+ }
+ }
+ //cout << "\t\t\t\t\t5 " << a.name() << " " << a.child_value() << endl;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+// memstream strinBuf(buffer, RECEIVE_SCTP_BUFFER_SIZE * 2);
+//
+// strinBuf.read(, RECEIVE_SCTP_BUFFER_SIZE * 2);
+
+ streambuf *oldCout = cout.rdbuf();
+ ostringstream memCout;
+ // create new cout
+ cout.rdbuf(memCout.rdbuf());
+ doc.save(std::cout);
+ //return to the normal cout
+ cout.rdbuf(oldCout);
+ memcpy(buffer, memCout.str().c_str(), memCout.str().length());
+ }