From 4a973145aa74bd26cfd15fe4a4782c140716d70d Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 17 Apr 2015 23:37:22 +0200 Subject: [PATCH] Improve help and programmed answers output. --- example/diameter/launcher/main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 7baab28..35b283c 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -180,10 +180,14 @@ typedef std::map < int /* message code */, codec_messages_deque* >::const_iterat std::string asString() const throw() { std::string result = "No ocurrences found\n\n"; + std::string s_code; if(a_deques.size() != 0) { + result = ""; for(reacting_answers_const_iterator it = a_deques.begin(); it != a_deques.end(); it++) { - result += "Answer code .............................................................. "; - result += anna::functions::asString(it->first); result += "\n"; + + s_code = "Answer code "; + s_code += anna::functions::asString(it->first); + result += anna::functions::highlightJustify(s_code); for(codec_messages_deque_const_iterator itm = it->second->begin(); itm != it->second->end(); itm++) { result += (*itm)->asXMLString(); result += "\n"; @@ -849,7 +853,7 @@ std::string Launcher::help() const throw() { result += "\n as many queues as different message codes have been received."; result += "\nanswerxml|[source_file] Same as 'answerxml2c'."; result += "\nanswerxml(2e/2c) List programmed answers (to entity/client) if no parameter provided."; - result += "\nanswerxml(2e/2c)|dump Write programmed answers (to entity/client) to file 'programmed_answer..',"; + result += "\nanswerxml(2e/2c)|dump Write programmed answers (to entity/client) to file 'programmed_answer..',"; result += "\n where 'sequence' is the order of the answer in each FIFO code-queue of programmed answers."; result += "\nanswerxml(2e/2c)|clear Clear programmed answers (to entity/client)."; result += "\n"; @@ -861,8 +865,8 @@ std::string Launcher::help() const throw() { result += "\nsendhex| Same as 'sendhex2e'."; result += "\n"; result += "\nAnswer programming in hexadecimal is not really neccessary (you could use send primitives) and also"; - result += "\nis intended to be used with decoded messages in order to replace things like hop by hop, end to end,"; - result += "\nsubscriber id, session id, etc. Anyway you could use 'decode' operation and then program the xml created."; + result += "\n is intended to be used with decoded messages in order to replace things like hop by hop, end to end,"; + result += "\n subscriber id, session id, etc. Anyway you could use 'decode' operation and then program the xml created."; result += "\n"; result += "\nIf a request is received, answer map (built with 'answerxml<[2c] or 2e>' operations) will be"; result += "\n checked to find a corresponding programmed answer to be replied(*). If no ocurrence is found,"; @@ -870,6 +874,11 @@ std::string Launcher::help() const throw() { result += "\n or nothing but trace when no peer at that side is configured. Answer to client have sense when"; result += "\n diameter server socket is configured, answer to entity have sense when entity does."; result += "\n"; + result += "\nIn the most complete situation (process with both client and server side) there are internally"; + result += "\n two maps with N FIFO queues, one for each different message code within programmed answers."; + result += "\nOne map is for answers towards the client, and the other is to react entity requests. Then in"; + result += "\n each one we could program different answers corresponding to different request codes received."; + result += "\n"; result += "\n(*) sequence values (hop-by-hop and end-to-end), Session-Id and Subscription-Id avps, are mirrored"; result += "\n to the peer which sent the request. If user wants to test a specific answer without changing it,"; result += "\n use sendxml/sendhex operations better than programming."; -- 2.20.1