2 Unix SMB/CIFS implementation.
4 WINS Replication server
6 Copyright (C) Stefan Metzmacher 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 struct wreplsrv_service;
24 struct wreplsrv_in_connection;
25 struct wreplsrv_out_connection;
26 struct wreplsrv_partner;
28 #define WREPLSRV_VALID_ASSOC_CTX 0x12345678
29 #define WREPLSRV_INVALID_ASSOC_CTX 0x0000000a
32 state of an incoming wrepl call
34 struct wreplsrv_in_call {
35 struct wreplsrv_in_connection *wreplconn;
36 struct wrepl_packet req_packet;
37 struct wrepl_packet rep_packet;
41 state of an incoming wrepl connection
43 struct wreplsrv_in_connection {
44 struct wreplsrv_in_connection *prev,*next;
45 struct stream_connection *conn;
47 /* our global service context */
48 struct wreplsrv_service *service;
51 * the partner that connects us,
52 * can be NULL, when we got a connection
53 * from an unknown address
55 struct wreplsrv_partner *partner;
58 * we need to take care of our own ip address,
59 * as this is the WINS-Owner ID the peer expect
64 /* keep track of the assoc_ctx's */
71 /* the partial input on the connection */
76 * are we currently processing a request?
77 * this prevents loops, with half async code
82 * if this is set we no longer accept incoming packets
83 * and terminate the connection after we have send all packets
87 /* the list of outgoing DATA_BLOB's that needs to be send */
88 struct data_blob_list_item *send_queue;
92 state of an outcoming wrepl connection
94 struct wreplsrv_out_connection {
95 struct wreplsrv_partner *partner;
98 enum winsrepl_partner_type {
99 WINSREPL_PARTNER_PULL = 0x1,
100 WINSREPL_PARTNER_PUSH = 0x2,
101 WINSREPL_PARTNER_BOTH = (WINSREPL_PARTNER_PULL | WINSREPL_PARTNER_PUSH)
104 #define WINSREPL_DEFAULT_PULL_INTERVAL (30*60)
107 this represents one of our configured partners
109 struct wreplsrv_partner {
110 struct wreplsrv_partner *prev,*next;
112 /* the netbios name of the partner, mostly just for debugging */
115 /* the ip-address of the partner */
119 * as wins partners identified by ip-address, we need to use a specific source-ip
120 * when we want to connect to the partner
122 const char *our_address;
124 /* the type of the partner, pull, push or both */
125 enum winsrepl_partner_type type;
127 /* pull specific options */
129 /* the interval between 2 pull replications to the partner */
132 /* this is a list of each wins_owner the partner knows about */
133 struct wreplsrv_owner *table;
135 /* the outgoing connection to the partner */
136 struct wreplsrv_out_connection *wreplconn;
140 struct wreplsrv_owner {
141 struct wreplsrv_owner *prev,*next;
143 /* this hold the owner_id (address), min_version, max_version and partner_type */
144 struct wrepl_wins_owner owner;
146 /* can be NULL if this owner isn't a configure partner */
147 struct wreplsrv_partner *partner;
151 state of the whole wrepl service
153 struct wreplsrv_service {
154 /* the whole wrepl service is in one task */
155 struct task_server *task;
157 /* the winsdb handle */
158 struct ldb_context *wins_db;
160 /* all incoming connections */
161 struct wreplsrv_in_connection *in_connections;
163 /* all partners (pull and push) */
164 struct wreplsrv_partner *partners;
166 /* this is a list of each wins_owner we know about in our database */
167 struct wreplsrv_owner *table;