Estetic changes, option to display program version.

git-svn-id: http://voip.null.ro/svn/yate@400 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-06-13 12:08:56 +00:00
parent f39493029d
commit 4658eb3b15
5 changed files with 35 additions and 9 deletions

View File

@ -31,7 +31,7 @@
using namespace TelEngine;
SIPHeaderLine::SIPHeaderLine(const char* name, const String& value, char sep)
: NamedString(name), m_separator(sep)
: NamedString(name), m_separator(sep ? sep : ';')
{
if (value.null())
return;

View File

@ -179,7 +179,7 @@ protected:
class YSIP_API SIPHeaderLine : public NamedString
{
public:
SIPHeaderLine(const char* name, const String& value, char sep = ';');
SIPHeaderLine(const char* name, const String& value, char sep = 0);
SIPHeaderLine(const SIPHeaderLine& original);
virtual ~SIPHeaderLine();
virtual void* getObject(const String& name) const;

View File

@ -160,7 +160,7 @@ bool EngineStatusHandler::received(Message &msg)
if (sel && ::strcmp(sel,"engine"))
return false;
msg.retValue() << "name=engine,type=system";
msg.retValue() << ",version=" << YATE_MAJOR << "." << YATE_MINOR << "." << YATE_BUILD;
msg.retValue() << ",version=" << YATE_VERSION;
msg.retValue() << ";plugins=" << plugins.count();
msg.retValue() << ",inuse=" << Engine::self()->usedPlugins();
msg.retValue() << ",handlers=" << Engine::self()->handlerCount();
@ -760,7 +760,8 @@ static void usage(bool client, FILE* f)
{
::fprintf(f,
"Usage: yate [options] [commands ...]\n"
" -h Help message (this one)\n"
" -h, --help Display help message (this one) and exit\n"
" -V, --version Display program version and exit\n"
" -v Verbose debugging (you can use more than once)\n"
" -q Quieter debugging (you can use more than once)\n"
"%s"
@ -806,6 +807,11 @@ static void noarg(bool client, const char* opt)
usage(client,stderr);
}
static void version()
{
::fprintf(stdout,"Yate " YATE_VERSION "\n");
}
int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bool fail)
{
#ifdef _WINDOWS
@ -846,6 +852,10 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
usage(client,stdout);
return 0;
}
else if (!::strcmp(pc,"version")) {
version();
return 0;
}
#ifdef _WINDOWS
else if (!(client ||::strcmp(pc,"service"))) {
service |= YSERV_RUN;
@ -961,6 +971,9 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
pc = 0;
break;
#endif
case 'V':
version();
return 0;
default:
badopt(client,*pc,argv[i]);
return EINVAL;

View File

@ -350,10 +350,19 @@ YateUDPParty::~YateUDPParty()
void YateUDPParty::transmit(SIPEvent* event)
{
Debug(&plugin,DebugAll,"Sending to %s:%d",m_addr.host().c_str(),m_addr.port());
const SIPMessage* msg = event->getMessage();
if (!msg)
return;
String tmp;
if (msg->isAnswer())
tmp << "code " << msg->code;
else
tmp << "'" << msg->method << " " << msg->uri << "'";
Debug(&plugin,DebugAll,"Sending %s %p to %s:%d",
tmp.c_str(),msg,m_addr.host().c_str(),m_addr.port());
m_sock->sendTo(
event->getMessage()->getBuffer().data(),
event->getMessage()->getBuffer().length(),
msg->getBuffer().data(),
msg->getBuffer().length(),
m_addr
);
}
@ -540,10 +549,11 @@ void YateSIPEndPoint::run()
Debug(DebugGoOn,"SIP error on read: %d\n", m_sock->error());
}
} else if (res >= 72) {
Debug(&plugin,DebugAll,"Received %d bytes SIP message from %s:%d",
res,addr.host().c_str(),addr.port());
// we got already the buffer and here we start to do "good" stuff
buf[res]=0;
m_engine->addMessage(new YateUDPParty(m_sock,addr,m_port),buf,res);
// Output("res %d buf %s",res,buf);
}
#ifdef DEBUG
else

5
yate.8
View File

@ -30,7 +30,10 @@ is a telephony engine that supports client, PBX and IVR functions trough plugins
.SS General
.TP
.B \-h, \-\-help
Display a short help message
Display a short help message and exit
.TP
.B \-V, \-\-version
Display program version and exit
.TP
.B \-v
Verbose debugging (you can use more than once)