aboutsummaryrefslogtreecommitdiff
path: root/src/nssync.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@nxc.no>2017-08-14 15:47:09 +0300
committerSergey Poznyakoff <gray@nxc.no>2017-08-14 16:15:07 +0300
commitd5757191d8b6102b522709ad042188f8ba318ba5 (patch)
tree8836ba74b7d412e5fb484640829b6db2f9881522 /src/nssync.h
parentd6abbc52cbed879c77e422a465773366d35c6043 (diff)
downloadnssync-d5757191d8b6102b522709ad042188f8ba318ba5.tar.gz
nssync-d5757191d8b6102b522709ad042188f8ba318ba5.tar.bz2
Start implementing server mode.
This commit adds a small HTTP server (using GNU libmicrohttpd), which can be used to trigger the synchronization on demand. * .gitmodules (runcap): New submodule. * Makefile.am (SUBDIRS): Add runcap. * configure.ac: Check for libmicrohttpd. * src/Makefile.am [COND_MICROHTTPD](nssync_SOURCES): Add server.c (LDADDD,AM_CPPFLAGS): Add runcap * src/server.c: New file. * src/nssync.h (DEFAULT_NSSYNC_ADDR): New define. (nssync) <new_nodes>: New member. Keeps a list of temporary nodes added to the tree during synchronization. The registered nodes (and their sub-trees) are unlinked and freed when the synch phase is finished. * src/bindcf.c (filetab_clear,nssync_node_bind): New functions. (new_zone,bindcf_lookup): Use nssync_node_bind to insert new nodes. This makes sure they can be cleaned up later. (flush_zone_list): Remove added nodes when done. * src/cmdline.opt: New option --server (-s) * src/config.c (cb_sync): Initialize new_nodes member. Set up the free_entry pointer to unlink and destroy the node it refers to. (nssync_kw): Remove compare-command. Add the "server" block statement. (config_init): Request the implicit quoted string concatenation feature. * src/nssync.c (compare_command): Remove. (compare): Rewrite without use of external command. (check_slave_status): Return status instead of exiting. (nssync): New function (main): Run as a server if requested from command line. * src/sqlop.c (sql_connect): Don't set sql_disconnect to be run at exit.
Diffstat (limited to 'src/nssync.h')
-rw-r--r--src/nssync.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nssync.h b/src/nssync.h
index 69149e8..be3a364 100644
--- a/src/nssync.h
+++ b/src/nssync.h
@@ -1,5 +1,5 @@
/* This file is part of NSsync
- Copyright (C) 2011 Sergey Poznyakoff
+ Copyright (C) 2011, 2017 Sergey Poznyakoff
NSsync is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,10 +35,14 @@ extern char *config_file;
extern char *slave_status_file;
extern char *pidfile;
extern char *tempdir;
-extern char *compare_command;
extern char *reload_command;
extern int check_ns;
+extern struct grecs_sockaddr *server_addr;
+#ifndef DEFAULT_NSSYNC_ADDR
+# define DEFAULT_NSSYNC_ADDR "0.0.0.0:8080"
+#endif
+
extern unsigned changed_zones;
extern char *sql_config_file;
@@ -105,6 +109,7 @@ struct nssync {
char *zone_file_pattern;
char *zone_add_stmt;
struct grecs_node *zone_tree;
+ struct grecs_list *new_nodes;
char *soa_query;
char *rr_query;

Return to:

Send suggestions and report system problems to the System administrator.