laforge
/
openbts-osmo
Archived
1
0
Fork 0

Implemented "trans" CLI command to list all active transacions.

This commit is contained in:
Alexander Chemeris 2010-08-10 19:55:37 +04:00 committed by Thomas Tsou
parent a2d4ed5c71
commit 2ab4ca6648
3 changed files with 29 additions and 0 deletions

View File

@ -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, "<IMSI> <src> -- send SMS to <IMSI>, addressed from <src>, after prompting.");
addCommand("sendrrlp", sendrrlp, "<IMSI> <hexstring> -- send RRLP message <hexstring> to <IMSI>.");

View File

@ -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();

View File

@ -611,6 +611,9 @@ class TransactionTable {
//@}
size_t size();
/** Write entries as text to a stream. */
void dump(std::ostream&) const;
};
//@} // Transaction Table