s4:libcli/wrepl: add my copyright
[Samba/gebeck_regimport.git] / source4 / libcli / wrepl / winsrepl.h
blob2586cea2be7c384fb8451b54f106c511108f311e
1 /*
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
29 struct wrepl_socket {
30 struct socket_context *sock;
31 struct packet_context *packet;
33 struct {
34 struct tevent_context *ctx;
35 struct tevent_fd *fde;
36 } event;
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 */
49 bool dead;
51 /* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */
52 bool free_skipped;
54 struct smb_iconv_convenience *iconv_convenience;
57 struct wrepl_send_ctrl {
58 bool send_only;
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;
77 bool trigger;
78 NTSTATUS status;
80 struct tevent_timer *te;
82 struct wrepl_packet *packet;
84 struct {
85 void (*fn)(struct wrepl_request *);
86 void *private_data;
87 } async;
92 setup an association
94 struct wrepl_associate {
95 struct {
96 uint32_t assoc_ctx;
97 uint16_t major_version;
98 } out;
102 setup an association
104 struct wrepl_associate_stop {
105 struct {
106 uint32_t assoc_ctx;
107 uint32_t reason;
108 } in;
112 pull the partner table
114 struct wrepl_pull_table {
115 struct {
116 uint32_t assoc_ctx;
117 } in;
118 struct {
119 uint32_t num_partners;
120 struct wrepl_wins_owner *partners;
121 } out;
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 {
134 const char *owner;
135 const char *address;
138 struct wrepl_name {
139 struct nbt_name name;
140 enum wrepl_name_type type;
141 enum wrepl_name_state state;
142 enum wrepl_name_node node;
143 bool is_static;
144 uint32_t raw_flags;
145 uint64_t version_id;
146 const char *owner;
147 uint32_t num_addresses;
148 struct wrepl_address *addresses;
152 a full pull replication
154 struct wrepl_pull_names {
155 struct {
156 uint32_t assoc_ctx;
157 struct wrepl_wins_owner partner;
158 } in;
159 struct {
160 uint32_t num_names;
161 struct wrepl_name *names;
162 } out;
165 struct resolve_context;
167 #include "libcli/wrepl/winsrepl_proto.h"