struct wreplsrv_in_connection *wreplconn;
struct wrepl_packet req_packet;
struct wrepl_packet rep_packet;
+ BOOL terminate_after_send;
};
/*
struct wreplsrv_in_connection {
struct wreplsrv_in_connection *prev,*next;
struct stream_connection *conn;
+ struct packet_context *packet;
/* our global service context */
struct wreplsrv_service *service;
uint32_t our_ctx;
uint32_t peer_ctx;
} assoc_ctx;
-
- /* the partial input on the connection */
- DATA_BLOB partial;
- size_t partial_read;
-
- /*
- * are we currently processing a request?
- * this prevents loops, with half async code
- */
- BOOL processing;
-
- /*
- * if this is set we no longer accept incoming packets
- * and terminate the connection after we have send all packets
- */
- BOOL terminate;
-
- /* the list of outgoing DATA_BLOB's that needs to be send */
- struct data_blob_list_item *send_queue;
};
/*
state of an outcoming wrepl connection
*/
struct wreplsrv_out_connection {
+ /* our global service context */
+ struct wreplsrv_service *service;
+
+ /*
+ * the partner that connects us,
+ * can be NULL, when we got a connection
+ * from an unknown address
+ */
struct wreplsrv_partner *partner;
+
+ /* keep track of the assoc_ctx's */
+ struct {
+ uint32_t our_ctx;
+ uint32_t peer_ctx;
+ } assoc_ctx;
+
+ /*
+ * the client socket to the partner,
+ * NULL if not yet connected
+ */
+ struct wrepl_socket *sock;
};
enum winsrepl_partner_type {
+ WINSREPL_PARTNER_NONE = 0x0,
WINSREPL_PARTNER_PULL = 0x1,
WINSREPL_PARTNER_PUSH = 0x2,
WINSREPL_PARTNER_BOTH = (WINSREPL_PARTNER_PULL | WINSREPL_PARTNER_PUSH)
};
#define WINSREPL_DEFAULT_PULL_INTERVAL (30*60)
+#define WINSREPL_DEFAULT_PULL_RETRY_INTERVAL (30)
+
+#define WINSREPL_DEFAULT_PUSH_CHANGE_COUNT (0)
/*
this represents one of our configured partners
struct wreplsrv_partner {
struct wreplsrv_partner *prev,*next;
+ /* our global service context */
+ struct wreplsrv_service *service;
+
/* the netbios name of the partner, mostly just for debugging */
const char *name;
struct {
/* the interval between 2 pull replications to the partner */
uint32_t interval;
+
+ /* the retry_interval if a pull cycle failed to the partner */
+ uint32_t retry_interval;
+
+ /* the error count till the last success */
+ uint32_t error_count;
+
+ /* the status of the last pull cycle */
+ NTSTATUS last_status;
+
+ /* this is a list of each wins_owner the partner knows about */
+ struct wreplsrv_owner *table;
+
+ /* the outgoing connection to the partner */
+ struct wreplsrv_out_connection *wreplconn;
+
+ /* the current pending pull cycle request */
+ struct composite_context *creq;
+
+ /* the pull cycle io params */
+ struct wreplsrv_pull_cycle_io *cycle_io;
+
+ /* the current timed_event to the next pull cycle */
+ struct timed_event *te;
} pull;
+
+ /* push specific options */
+ struct {
+ /* change count till push notification */
+ uint32_t change_count;
+
+ /* we should use WREPL_REPL_INFORM* messages to this partner */
+ BOOL use_inform;
+
+ /* the error count till the last success */
+ uint32_t error_count;
+
+ /* the status of the last push cycle */
+ NTSTATUS last_status;
+
+ /* the timestamp of the last run */
+ struct timeval last_run;
+
+ /* the outgoing connection to the partner */
+ struct wreplsrv_out_connection *wreplconn;
+
+ /* the current push notification */
+ struct composite_context *creq;
+
+ /* the pull cycle io params */
+ struct wreplsrv_push_notify_io *notify_io;
+ } push;
};
struct wreplsrv_owner {
/* the winsdb handle */
struct ldb_context *wins_db;
+ /* some configuration */
+ struct {
+ /*
+ * the interval (in secs) till an active record will be marked as RELEASED
+ */
+ uint32_t renew_interval;
+
+ /*
+ * the interval (in secs) a record remains in RELEASED state,
+ * before it will be marked as TOMBSTONE
+ * (also known as extinction interval)
+ */
+ uint32_t tombstone_interval;
+
+ /*
+ * the interval (in secs) a record remains in TOMBSTONE state,
+ * before it will be removed from the database.
+ * (also known as extinction timeout)
+ */
+ uint32_t tombstone_timeout;
+
+ /*
+ * the interval (in secs) till a replica record will be verified
+ * with the owning wins server
+ */
+ uint32_t verify_interval;
+
+ /*
+ * the interval (in secs) to the next periodic processing
+ * (this is the maximun interval)
+ */
+ uint32_t periodic_interval;
+ } config;
+
/* all incoming connections */
struct wreplsrv_in_connection *in_connections;
/* this is a list of each wins_owner we know about in our database */
struct wreplsrv_owner *table;
+
+ /* some stuff for periodic processing */
+ struct {
+ /*
+ * the timestamp for the current event,
+ */
+ struct timeval current_event;
+
+ /*
+ * the timestamp for the next event,
+ * this is the timstamp passed to event_add_timed()
+ */
+ struct timeval next_event;
+
+ /* here we have a reference to the timed event the schedules the periodic stuff */
+ struct timed_event *te;
+ } periodic;
};