2 Unix SMB/CIFS implementation.
4 structures for WINS replication client library
6 Copyright (C) Andrew Tridgell 2005
7 Copyright (C) Stefan Metzmacher 2005-2010
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "librpc/gen_ndr/nbt.h"
24 #include "librpc/gen_ndr/winsrepl.h"
27 main context structure for the wins replication client library
30 struct socket_context
*sock
;
31 struct packet_context
*packet
;
34 struct tevent_context
*ctx
;
35 struct tevent_fd
*fde
;
38 /* a queue of replies waiting to be received */
39 struct wrepl_request
*recv_queue
;
41 /* the default timeout for requests, 0 means no timeout */
42 #define WREPL_SOCKET_REQUEST_TIMEOUT (60)
43 uint32_t request_timeout
;
45 /* counter for request timeouts, after 2 timeouts the socket is marked as dead */
46 uint32_t timeout_count
;
48 /* remember is the socket is dead */
51 /* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */
54 struct smb_iconv_convenience
*iconv_convenience
;
57 struct wrepl_send_ctrl
{
59 bool disconnect_after_send
;
62 enum wrepl_request_state
{
63 WREPL_REQUEST_INIT
= 0,
64 WREPL_REQUEST_RECV
= 1,
65 WREPL_REQUEST_DONE
= 2,
66 WREPL_REQUEST_ERROR
= 3
70 a WINS replication request
72 struct wrepl_request
{
73 struct wrepl_request
*next
, *prev
;
74 struct wrepl_socket
*wrepl_socket
;
76 enum wrepl_request_state state
;
80 struct tevent_timer
*te
;
82 struct wrepl_packet
*packet
;
85 void (*fn
)(struct wrepl_request
*);
94 struct wrepl_associate
{
97 uint16_t major_version
;
104 struct wrepl_associate_stop
{
112 pull the partner table
114 struct wrepl_pull_table
{
119 uint32_t num_partners
;
120 struct wrepl_wins_owner
*partners
;
124 #define WREPL_NAME_TYPE(flags) (flags & WREPL_FLAGS_RECORD_TYPE)
125 #define WREPL_NAME_STATE(flags) ((flags & WREPL_FLAGS_RECORD_STATE)>>2)
126 #define WREPL_NAME_NODE(flags) ((flags & WREPL_FLAGS_NODE_TYPE)>>5)
127 #define WREPL_NAME_IS_STATIC(flags) ((flags & WREPL_FLAGS_IS_STATIC)?true:false)
129 #define WREPL_NAME_FLAGS(type, state, node, is_static) \
130 (type | (state << 2) | (node << 5) | \
131 (is_static ? WREPL_FLAGS_IS_STATIC : 0))
133 struct wrepl_address
{
139 struct nbt_name name
;
140 enum wrepl_name_type type
;
141 enum wrepl_name_state state
;
142 enum wrepl_name_node node
;
147 uint32_t num_addresses
;
148 struct wrepl_address
*addresses
;
152 a full pull replication
154 struct wrepl_pull_names
{
157 struct wrepl_wins_owner partner
;
161 struct wrepl_name
*names
;
165 struct resolve_context
;
167 #include "libcli/wrepl/winsrepl_proto.h"