Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DNSUpdate.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Adrien CLERC, Bahattin DEMIRPLAK, Gaëtant ELEOUET
5  * Mickaël GUÉRIN, Lionel GUILMIN, Lauréline PROVOST
6  * from ENSEEIHT, Toulouse, France
7  *
8  * released under GNU GPL v2 licence
9  *
10  */
11 
12 #ifdef WIN32
13 #include <winsock2.h>
14 #endif
15 
16 #include <string>
17 #include <stdint.h>
18 
20 #include "poslib.h"
21 
22 /* used in config. file */
27 };
28 
29 /* return values of method run*/
36 };
37 
38 /* used in DNSUpdate constructor */
44 };
45 
46 class DNSUpdate {
47 
48  public:
53  };
54 
55 private:
56 
57  void splitHostDomain(std::string fqdnName);
58 
59  void createSOAMsg();
60  void addinMsg_newPTR();
61  void addinMsg_newAAAA();
62  void addinMsg_delOldRR();
65  bool DnsRR_avail(DnsMessage *msg, DnsRR& RemoteDnsRR);
67  void sendMsgTCP(unsigned int timeout);
68  void sendMsgUDP(unsigned int timeout);
69 
70  std::string protoToString();
71 protected: // used to be private, but is now protected for testing
72  virtual void sendMsg(unsigned int timeout);
73 
75  std::string DnsAddr_;
76  std::string Hostname_;
77  std::string Hostip_;
79  std::string TTL_;
82 
83  // TSIG stuff
84  std::string Keyname_;
85  std::string Key_;
86  std::string Algorithm_;
88 
89  public:
90  DNSUpdate(const std::string& dns_address, const std::string& zonename, const std::string& hostname,
91  std::string hostip, DnsUpdateMode updateMode,
92  DnsUpdateProtocol proto /*= DNSUPDATE_TCP*/ );
93  void addDHCID(const char* duid, int duidlen);
94  void setTSIG(const std::string& keyname, const std::string& base64encoded,
95  const std::string& algro, uint32_t fudge = 600);
96  virtual ~DNSUpdate();
97  DnsUpdateResult run(int timeout);
98  void showResult(int result);
99 };
100