|
reSIProcate/stack
9694
|
#include <iostream>#include <list>#include "rutil/Lock.hxx"#include "rutil/Mutex.hxx"#include "rutil/Socket.hxx"#include "rutil/Logger.hxx"#include "rutil/ThreadIf.hxx"#include "rutil/DnsUtil.hxx"#include "resip/stack/DnsResult.hxx"#include "resip/stack/SipStack.hxx"#include "rutil/dns/RRVip.hxx"#include "rutil/dns/QueryTypes.hxx"#include "rutil/dns/DnsStub.hxx"
Go to the source code of this file.
Classes | |
| class | resip::MyDnsSink |
| class | resip::TestDns |
Namespaces | |
| namespace | resip |
SERNonceHelper implements the makeNonce function in the same way as SIP Express Router (SER) - http://www.iptel.org/ser. | |
Defines | |
| #define | RESIPROCATE_SUBSYSTEM resip::Subsystem::TEST |
Functions | |
| int | main (int argc, const char **argv) |
Variables | |
| const char | bf [] = "\033[01;34m" |
| const char | gf [] = "\033[01;32m" |
| const char | rf [] = "\033[01;31m" |
| const char | ub [] = "\033[01;00m" |
| bool | gComplete = false |
Definition at line 31 of file testDnsStub.cxx.
| int main | ( | int | argc, |
| const char ** | argv | ||
| ) |
Definition at line 171 of file testDnsStub.cxx.
References context, gComplete, initNetwork(), resip::ThreadIf::join(), resip::DnsStub::lookup(), resip::ThreadIf::run(), resip::ThreadIf::shutdown(), resip::Tuple::toGenericIPAddress(), and V4.
{
if (argc < 3)
{
cout << "usage: " << argv[0] << " target" << " type" << endl;
cout << "Valid type values: " << endl;
cout << "A Record - 1" << endl;
cout << "CNAME - 5" << endl;
cout << "SRV - 33" << endl;
cout << "NAPTR - 35" << endl;
cout << "AAAA - 28" << endl;
return 0;
}
DnsStub::NameserverList nameServerList = DnsStub::EmptyNameserverList;
if(argc == 4)
{
Tuple tuple(Data(argv[3]), 0, V4);
nameServerList.push_back(tuple.toGenericIPAddress());
}
char* logType = "cout";
//char* logLevel = "STACK";
char* logLevel = "DEBUG";
#if defined(HAVE_POPT_H)
struct poptOption table[] = {
{"log-type", 'l', POPT_ARG_STRING, &logType, 0, "where to send logging messages", "syslog|cerr|cout"},
{"log-level", 'v', POPT_ARG_STRING, &logLevel, 0, "specify the default log level", "DEBUG|INFO|WARNING|ALERT"},
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 }
};
poptContext context = poptGetContext(NULL, argc, const_cast<const char**>(argv), table, 0);
poptGetNextOpt(context);
#endif
Log::initialize(logType, logLevel, argv[0]);
initNetwork();
TestDns dns(nameServerList);
dns.run();
cerr << "Starting" << endl;
#if defined(HAVE_POPT_H)
const char** args = poptGetArgs(context);
#else
const char** args = argv;
#endif
MyDnsSink sink;
switch (atoi(argv[2]))
{
case 1:
dns.lookup<RR_A>(argv[1], Protocol::Sip, &sink);
break;
case 5:
dns.lookup<RR_CNAME>(argv[1], Protocol::Sip, &sink);
break;
#ifdef USE_IPV6
case 28:
dns.lookup<RR_AAAA>(argv[1], Protocol::Sip, &sink);
break;
#endif
case 33:
dns.lookup<RR_SRV>(argv[1], Protocol::Sip, &sink);
break;
case 35:
dns.lookup<RR_NAPTR>(argv[1], Protocol::Sip, &sink);
break;
default:
cout << "Invalid Dns type" << endl;
return 0;
}
while (!gComplete)
{
#ifdef WIN32
sleep(100);
#else
sleep(1);
#endif
}
dns.shutdown();
dns.join();
return 0;
}

| const char bf[] = "\033[01;34m" |
Definition at line 33 of file testDnsStub.cxx.
| bool gComplete = false |
Definition at line 38 of file testDnsStub.cxx.
Referenced by main(), and resip::MyDnsSink::onDnsResult().
| const char gf[] = "\033[01;32m" |
Definition at line 34 of file testDnsStub.cxx.
| const char rf[] = "\033[01;31m" |
Definition at line 35 of file testDnsStub.cxx.
| const char ub[] = "\033[01;00m" |
Definition at line 36 of file testDnsStub.cxx.
1.7.5.1