2 Unix SMB/CIFS implementation.
4 structures for WINS replication client library
6 Copyright (C) Andrew Tridgell 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 #include "librpc/gen_ndr/ndr_nbt.h"
24 #include "librpc/gen_ndr/ndr_winsrepl.h"
27 main context structure for the wins replication client library
30 struct socket_context *sock;
31 struct event_context *event_ctx;
33 /* a queue of requests pending to be sent */
34 struct wrepl_request *send_queue;
36 /* a queue of replies waiting to be received */
37 struct wrepl_request *recv_queue;
42 /* the default timeout for requests, 0 means no timeout */
43 #define WREPL_SOCKET_REQUEST_TIMEOUT (60)
44 uint32_t request_timeout;
46 /* counter for request timeouts, after 2 timeouts the socket is marked as dead */
47 uint32_t timeout_count;
49 /* remember is the socket is dead */
53 enum wrepl_request_state {
54 WREPL_REQUEST_SEND = 0,
55 WREPL_REQUEST_RECV = 1,
56 WREPL_REQUEST_DONE = 2,
57 WREPL_REQUEST_ERROR = 3
61 a WINS replication request
63 struct wrepl_request {
64 struct wrepl_request *next, *prev;
65 struct wrepl_socket *wrepl_socket;
67 enum wrepl_request_state state;
74 struct timed_event *te;
76 struct wrepl_packet *packet;
79 void (*fn)(struct wrepl_request *);
88 struct wrepl_associate {
95 pull the partner table
97 struct wrepl_pull_table {
102 uint32_t num_partners;
103 struct wrepl_wins_owner *partners;
107 #define WREPL_NAME_TYPE(flags) (flags & WREPL_FLAGS_RECORD_TYPE)
108 #define WREPL_NAME_STATE(flags) ((flags & WREPL_FLAGS_RECORD_STATE)>>2)
109 #define WREPL_NAME_NODE(flags) ((flags & WREPL_FLAGS_NODE_TYPE)>>5)
110 #define WREPL_NAME_IS_STATIC(flags) ((flags & WREPL_FLAGS_IS_STATIC)?True:False)
112 #define WREPL_NAME_FLAGS(type, state, node, is_static) \
113 (type | (state << 2) | (node << 5) | \
114 (is_static ? WREPL_FLAGS_IS_STATIC : 0))
117 a full pull replication
119 struct wrepl_pull_names {
122 struct wrepl_wins_owner partner;
127 struct nbt_name name;
128 enum wrepl_name_type type;
129 enum wrepl_name_state state;
130 enum wrepl_name_node node;
135 uint32_t num_addresses;
136 struct wrepl_address {