File: DnsUpdate02.cpp

package info (click to toggle)
dibbler 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,352 kB
  • sloc: cpp: 60,323; ansic: 12,235; sh: 11,951; yacc: 3,418; lex: 969; makefile: 940; perl: 319; xml: 116; python: 74
file content (36 lines) | stat: -rw-r--r-- 958 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include "DNSUpdate.h"
#include "Logger.h"

using namespace std;

bool DnsUpdate_test(DNSUpdate::DnsUpdateProtocol proto, bool dhcid, bool tsig) {

    string dnsAddr   = "2000::1";
    string zonename  = "example.org.";
    string hostname  = "troi.example.org.";
    string hostip    = "2000::dead:beef";

    char duid[]="this is my duid";
    int duidLen = strlen(duid);

    DNSUpdate *act = new DNSUpdate(dnsAddr, zonename, hostname, hostip, 
				   DNSUPDATE_AAAA, proto);
    if (dhcid)
        act->addDHCID(duid, duidLen);

    int result = act->run(5);
    delete act;
    Log(Debug) << "RESULT: PTR=" << result << LogEnd;

    return true;
}

int main(int argc, const char *argv[]) {

    DnsUpdate_test(DNSUpdate::DNSUPDATE_UDP, false, false);
    DnsUpdate_test(DNSUpdate::DNSUPDATE_TCP, false, false);

    DnsUpdate_test(DNSUpdate::DNSUPDATE_UDP, true, false);
    DnsUpdate_test(DNSUpdate::DNSUPDATE_UDP, false, true);
}