00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef DNSBIND_H
00017 #define DNSBIND_H
00018
00019 #ifdef HAVE_CONFIG_H
00020 #include "config.h"
00021 #endif
00022
00023 #include <string>
00024 #include <stdlib.h>
00025 #include <netinet/in.h>
00026
00027 #undef __P
00028 #define __P(args) args
00029
00030 extern "C" {
00031 #include <res_update.h>
00032 }
00033
00034
00035 #undef INIT_LINK
00036 #define INIT_LINK(elt, link) \
00037 do { \
00038 (elt)->link.prev = NULL; \
00039 (elt)->link.next = NULL; \
00040 } while (0)
00041
00042
00043 #include "Logger.h"
00044 #include "Exception.h"
00045 #include "Db.h"
00046 #include "Dns.h"
00047 #include "global.h"
00048
00053 class DnsBind : public Dns
00054 {
00055 public:
00057 DnsBind(Logger *log);
00058
00060 ~DnsBind();
00061
00062 void addDnsRecord(int id, const char *dname, DnsRecordType type,
00063 const char *data);
00064
00065 void delDnsRecords(char *dname);
00066
00067 void delDnsRecord(int id, const char *dname, DnsRecordType type,
00068 const char *data);
00069
00070 void updateDnsRecord(int id, const char *dname, DnsRecordType type,
00071 const char *data);
00072
00073 private:
00075 int updateRecord(ns_sect r_section, const char *dname, const char *data,
00076 int r_opcode, ns_type r_type);
00077
00079 int flush();
00080
00081 protected:
00083 DnsBind() { };
00084
00085 private:
00086 res_state statp;
00087 ns_updque listupdrec;
00088 ns_updrec *rrecp_in;
00089 Logger *log;
00090 };
00091
00092 #endif // DNSBIND_H