4 * PWLib application source file for DNSTest
6 * Main program entry point.
8 * Copyright 2003 Equivalence
11 * Revision 1.4 2003/09/26 13:42:16 rjongbloed
12 * Added special test to give more indicative error if try to compile without DNS support.
14 * Revision 1.3 2003/04/22 23:25:13 craigs
15 * Changed help message for SRV records
17 * Revision 1.2 2003/04/15 08:15:16 craigs
18 * Added single string form of GetSRVRecords
20 * Revision 1.1 2003/04/15 04:12:38 craigs
26 #include <ptclib/pdns.h>
31 #error Must have DNS support for this application
35 PCREATE_PROCESS(DNSTest
);
38 : PProcess("Equivalence", "DNSTest", 1, 0, AlphaCode
, 1)
44 PError
<< "usage: dnstest -t MX hostname\n"
45 " dnstest -t SRV service (i.e. _ras._udp._example.com)\n"
51 PArgList
& args
= GetArguments();
55 if (args
.GetCount() < 1) {
60 PString type
= args
.GetOptionString('t');
62 PDNS::SRVRecordList srvRecords
;
63 if (!PDNS::GetSRVRecords(args
[0], srvRecords
))
64 PError
<< "GetSRVRecords failed" << endl
;
66 cout
<< "SRV Returned " << srvRecords
<< endl
;
69 else if (type
*= "MX") {
70 PDNS::MXRecordList mxRecords
;
71 if (!PDNS::GetMXRecords(args
[0], mxRecords
)) {
72 PError
<< "GetMXRecords failed";
74 cout
<< "MX returned " << mxRecords
<< endl
;
79 // End of File ///////////////////////////////////////////////////////////////