diff --git a/public-trunk/CLI/CLI.cpp b/public-trunk/CLI/CLI.cpp index 19fba44..ba3564f 100644 --- a/public-trunk/CLI/CLI.cpp +++ b/public-trunk/CLI/CLI.cpp @@ -290,6 +290,19 @@ int tmsis(int argc, char** argv, ostream& os, istream& is) } +/** Print the transactions table. */ +int trans(int argc, char** argv, ostream& os, istream& is) +{ + if (argc!=1) return BAD_NUM_ARGS; + +// os << "TMSI IMSI IMEI age used" << endl; + gTransactionTable.dump(os); + os << endl << gTransactionTable.size() << " transactions in table" << endl; + return SUCCESS; +} + + + int findimsi(int argc, char** argv, ostream& os, istream& is) { @@ -759,6 +772,7 @@ Parser::Parser() addCommand("help", showHelp, "[command] -- list available commands or gets help on a specific command."); addCommand("exit", exit_function, "[wait] -- exit the application, either immediately, or waiting for existing calls to clear with a timeout in seconds"); addCommand("tmsis", tmsis, "[\"clear\"] or [\"dump\" filename] -- print/clear the TMSI table or dump it to a file."); + addCommand("trans", trans, "-- print the transactions table."); addCommand("findimsi", findimsi, "[IMSIPrefix] -- prints all imsi's that are prefixed by IMSIPrefix"); addCommand("sendsms", sendsms, " -- send SMS to , addressed from , after prompting."); addCommand("sendrrlp", sendrrlp, " -- send RRLP message to ."); diff --git a/public-trunk/Control/ControlCommon.cpp b/public-trunk/Control/ControlCommon.cpp index 66e0be6..918afb4 100644 --- a/public-trunk/Control/ControlCommon.cpp +++ b/public-trunk/Control/ControlCommon.cpp @@ -343,6 +343,18 @@ size_t TransactionTable::size() } +void TransactionTable::dump(ostream& os) const +{ + mLock.lock(); + TransactionMap::const_iterator tp = mTable.begin(); + while (tp != mTable.end()) { + os << hex << "0x" << tp->first << " " << dec << tp->second << endl; + ++tp; + } + mLock.unlock(); +} + + void Control::clearTransactionHistory( TransactionEntry& transaction ) { SIP::SIPEngine& engine = transaction.SIP(); diff --git a/public-trunk/Control/ControlCommon.h b/public-trunk/Control/ControlCommon.h index b763953..ee8a6d2 100644 --- a/public-trunk/Control/ControlCommon.h +++ b/public-trunk/Control/ControlCommon.h @@ -611,6 +611,9 @@ class TransactionTable { //@} size_t size(); + + /** Write entries as text to a stream. */ + void dump(std::ostream&) const; }; //@} // Transaction Table