dsdb-schema: make schema_subclasses_order_recurse() static
[Samba/gbeck.git] / source3 / nmbd / nmbd_proto.h
blob59ad423f03508fb4a2fc0071c504418780995cb3
1 /*
2 * Unix SMB/CIFS implementation.
3 * NBT netbios routines and daemon - version 2
5 * Copyright (C) Andrew Tridgell 1994-1998
6 * Copyright (C) Jeremy Allison 1994-2005
7 * Copyright (C) Luke Kenneth Casson Leighton 1994-1998
8 * Copyright (C) John H Terpstra 1995-1998
9 * Copyright (C) Christopher R. Hertel 1998
10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
11 * Copyright (C) Jelmer Vernooij 2002,2003
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 /* The following definitions come from nmbd/asyncdns.c */
29 int asyncdns_fd(void);
30 void kill_async_dns_child(void);
31 void start_async_dns(struct messaging_context *msg);
32 void run_dns_queue(struct messaging_context *msg);
33 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
34 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
35 void kill_async_dns_child(void);
37 /* The following definitions come from nmbd/nmbd.c */
39 struct event_context *nmbd_event_context(void);
41 /* The following definitions come from nmbd/nmbd_become_dmb.c */
43 void add_domain_names(time_t t);
45 /* The following definitions come from nmbd/nmbd_become_lmb.c */
47 void insert_permanent_name_into_unicast( struct subnet_record *subrec,
48 struct nmb_name *nmbname, uint16 nb_type );
49 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
50 bool force_new_election);
51 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
52 void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
54 /* The following definitions come from nmbd/nmbd_browserdb.c */
56 void update_browser_death_time( struct browse_cache_record *browc );
57 struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
58 const char *browser_name,
59 struct in_addr ip );
60 struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
61 void expire_lmb_browsers( time_t t );
63 /* The following definitions come from nmbd/nmbd_browsesync.c */
65 void dmb_expire_and_sync_browser_lists(time_t t);
66 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
67 struct work_record *work);
68 void collect_all_workgroup_names_from_wins_server(time_t t);
69 void sync_all_dmbs(time_t t);
71 /* The following definitions come from nmbd/nmbd_elections.c */
73 void check_master_browser_exists(time_t t);
74 void run_elections(time_t t);
75 void process_election(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
76 bool check_elections(void);
77 void nmbd_message_election(struct messaging_context *msg,
78 void *private_data,
79 uint32_t msg_type,
80 struct server_id server_id,
81 DATA_BLOB *data);
83 /* The following definitions come from nmbd/nmbd_incomingdgrams.c */
85 void tell_become_backup(void);
86 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
87 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
88 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
89 void process_master_browser_announce(struct subnet_record *subrec,
90 struct packet_struct *p,const char *buf);
91 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
92 void process_get_backup_list_request(struct subnet_record *subrec,
93 struct packet_struct *p,const char *buf);
94 void process_reset_browser(struct subnet_record *subrec,
95 struct packet_struct *p,const char *buf);
96 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
97 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
99 /* The following definitions come from nmbd/nmbd_incomingrequests.c */
101 void process_name_release_request(struct subnet_record *subrec,
102 struct packet_struct *p);
103 void process_name_refresh_request(struct subnet_record *subrec,
104 struct packet_struct *p);
105 void process_name_registration_request(struct subnet_record *subrec,
106 struct packet_struct *p);
107 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
108 void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
110 /* The following definitions come from nmbd/nmbd_lmhosts.c */
112 void load_lmhosts_file(const char *fname);
113 bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
115 /* The following definitions come from nmbd/nmbd_logonnames.c */
117 void add_logon_names(void);
119 /* The following definitions come from nmbd/nmbd_mynames.c */
121 void register_my_workgroup_one_subnet(struct subnet_record *subrec);
122 bool register_my_workgroup_and_names(void);
123 void release_wins_names(void);
124 void refresh_my_names(time_t t);
126 /* The following definitions come from nmbd/nmbd_namelistdb.c */
128 void set_samba_nb_type(void);
129 void remove_name_from_namelist(struct subnet_record *subrec,
130 struct name_record *namerec );
131 struct name_record *find_name_on_subnet(struct subnet_record *subrec,
132 const struct nmb_name *nmbname,
133 bool self_only);
134 struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
135 bool self_only);
136 void update_name_ttl( struct name_record *namerec, int ttl );
137 bool add_name_to_subnet( struct subnet_record *subrec,
138 const char *name,
139 int type,
140 uint16 nb_flags,
141 int ttl,
142 enum name_source source,
143 int num_ips,
144 struct in_addr *iplist);
145 void standard_success_register(struct subnet_record *subrec,
146 struct userdata_struct *userdata,
147 struct nmb_name *nmbname, uint16 nb_flags, int ttl,
148 struct in_addr registered_ip);
149 void standard_fail_register( struct subnet_record *subrec,
150 struct nmb_name *nmbname );
151 bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
152 void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
153 void remove_ip_from_name_record( struct name_record *namerec,
154 struct in_addr remove_ip );
155 void standard_success_release( struct subnet_record *subrec,
156 struct userdata_struct *userdata,
157 struct nmb_name *nmbname,
158 struct in_addr released_ip );
159 void expire_names(time_t t);
160 void add_samba_names_to_subnet( struct subnet_record *subrec );
161 void dump_name_record( struct name_record *namerec, XFILE *fp);
162 void dump_all_namelists(void);
164 /* The following definitions come from nmbd/nmbd_namequery.c */
166 bool query_name(struct subnet_record *subrec, const char *name, int type,
167 query_name_success_function success_fn,
168 query_name_fail_function fail_fn,
169 struct userdata_struct *userdata);
170 bool query_name_from_wins_server(struct in_addr ip_to,
171 const char *name, int type,
172 query_name_success_function success_fn,
173 query_name_fail_function fail_fn,
174 struct userdata_struct *userdata);
176 /* The following definitions come from nmbd/nmbd_nameregister.c */
178 void register_name(struct subnet_record *subrec,
179 const char *name, int type, uint16 nb_flags,
180 register_name_success_function success_fn,
181 register_name_fail_function fail_fn,
182 struct userdata_struct *userdata);
183 void wins_refresh_name(struct name_record *namerec);
185 /* The following definitions come from nmbd/nmbd_namerelease.c */
187 void release_name(struct subnet_record *subrec, struct name_record *namerec,
188 release_name_success_function success_fn,
189 release_name_fail_function fail_fn,
190 struct userdata_struct *userdata);
192 /* The following definitions come from nmbd/nmbd_nodestatus.c */
194 bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
195 struct in_addr send_ip, node_status_success_function success_fn,
196 node_status_fail_function fail_fn, struct userdata_struct *userdata);
198 /* The following definitions come from nmbd/nmbd_packets.c */
200 bool nmbd_init_packet_server(void);
202 uint16 get_nb_flags(char *buf);
203 void set_nb_flags(char *buf, uint16 nb_flags);
204 struct response_record *queue_register_name( struct subnet_record *subrec,
205 response_function resp_fn,
206 timeout_response_function timeout_fn,
207 register_name_success_function success_fn,
208 register_name_fail_function fail_fn,
209 struct userdata_struct *userdata,
210 struct nmb_name *nmbname,
211 uint16 nb_flags);
212 void queue_wins_refresh(struct nmb_name *nmbname,
213 response_function resp_fn,
214 timeout_response_function timeout_fn,
215 uint16 nb_flags,
216 struct in_addr refresh_ip,
217 const char *tag);
218 struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
219 response_function resp_fn,
220 timeout_response_function timeout_fn,
221 register_name_success_function success_fn,
222 register_name_fail_function fail_fn,
223 struct userdata_struct *userdata,
224 struct nmb_name *nmbname,
225 uint16 nb_flags,
226 struct in_addr register_ip,
227 struct in_addr wins_ip);
228 struct response_record *queue_release_name( struct subnet_record *subrec,
229 response_function resp_fn,
230 timeout_response_function timeout_fn,
231 release_name_success_function success_fn,
232 release_name_fail_function fail_fn,
233 struct userdata_struct *userdata,
234 struct nmb_name *nmbname,
235 uint16 nb_flags,
236 struct in_addr release_ip,
237 struct in_addr dest_ip);
238 struct response_record *queue_query_name( struct subnet_record *subrec,
239 response_function resp_fn,
240 timeout_response_function timeout_fn,
241 query_name_success_function success_fn,
242 query_name_fail_function fail_fn,
243 struct userdata_struct *userdata,
244 struct nmb_name *nmbname);
245 struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
246 response_function resp_fn,
247 timeout_response_function timeout_fn,
248 query_name_success_function success_fn,
249 query_name_fail_function fail_fn,
250 struct userdata_struct *userdata,
251 struct nmb_name *nmbname);
252 struct response_record *queue_node_status( struct subnet_record *subrec,
253 response_function resp_fn,
254 timeout_response_function timeout_fn,
255 node_status_success_function success_fn,
256 node_status_fail_function fail_fn,
257 struct userdata_struct *userdata,
258 struct nmb_name *nmbname,
259 struct in_addr send_ip);
260 void reply_netbios_packet(struct packet_struct *orig_packet,
261 int rcode, enum netbios_reply_type_code rcv_code, int opcode,
262 int ttl, char *data,int len);
263 void queue_packet(struct packet_struct *packet);
264 void run_packet_queue(void);
265 void retransmit_or_expire_response_records(time_t t);
266 bool listen_for_packets(struct messaging_context *msg, bool run_election);
267 bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
268 const char *srcname, int src_type,
269 const char *dstname, int dest_type,
270 struct in_addr dest_ip,struct in_addr src_ip,
271 int dest_port);
273 /* The following definitions come from nmbd/nmbd_processlogon.c */
275 bool initialize_nmbd_proxy_logon(void);
277 void process_logon_packet(struct packet_struct *p, const char *buf,int len,
278 const char *mailslot);
280 /* The following definitions come from nmbd/nmbd_responserecordsdb.c */
282 void remove_response_record(struct subnet_record *subrec,
283 struct response_record *rrec);
284 struct response_record *make_response_record( struct subnet_record *subrec,
285 struct packet_struct *p,
286 response_function resp_fn,
287 timeout_response_function timeout_fn,
288 success_function success_fn,
289 fail_function fail_fn,
290 struct userdata_struct *userdata);
291 struct response_record *find_response_record(struct subnet_record **ppsubrec,
292 uint16 id);
293 bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
295 /* The following definitions come from nmbd/nmbd_sendannounce.c */
297 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
298 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
299 void announce_my_server_names(time_t t);
300 void announce_my_lm_server_names(time_t t);
301 void reset_announce_timer(void);
302 void announce_myself_to_domain_master_browser(time_t t);
303 void announce_my_servers_removed(void);
304 void announce_remote(time_t t);
305 void browse_sync_remote(time_t t);
307 /* The following definitions come from nmbd/nmbd_serverlistdb.c */
309 void remove_all_servers(struct work_record *work);
310 struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
311 void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
312 struct server_record *create_server_on_workgroup(struct work_record *work,
313 const char *name,int servertype,
314 int ttl, const char *comment);
315 void update_server_ttl(struct server_record *servrec, int ttl);
316 void expire_servers(struct work_record *work, time_t t);
317 void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
318 const char *local_master_browser_name, const char *description);
319 void write_browse_list(time_t t, bool force_write);
321 /* The following definitions come from nmbd/nmbd_subnetdb.c */
323 void close_subnet(struct subnet_record *subrec);
324 struct subnet_record *make_normal_subnet(const struct interface *iface);
325 bool create_subnets(void);
326 bool we_are_a_wins_client(void);
327 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
328 struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
330 /* The following definitions come from nmbd/nmbd_synclists.c */
332 void sync_browse_lists(struct work_record *work,
333 char *name, int nm_type,
334 struct in_addr ip, bool local, bool servers);
335 void sync_check_completion(void);
337 /* The following definitions come from nmbd/nmbd_winsproxy.c */
339 void make_wins_proxy_name_query_request( struct subnet_record *subrec,
340 struct packet_struct *incoming_packet,
341 struct nmb_name *question_name);
343 /* The following definitions come from nmbd/nmbd_winsserver.c */
345 struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
346 bool wins_store_changed_namerec(const struct name_record *namerec);
347 bool add_name_to_wins_subnet(const struct name_record *namerec);
348 bool remove_name_from_wins_namelist(struct name_record *namerec);
349 void dump_wins_subnet_namelist(XFILE *fp);
350 bool packet_is_for_wins_server(struct packet_struct *packet);
351 bool initialise_wins(void);
352 void wins_process_name_refresh_request( struct subnet_record *subrec,
353 struct packet_struct *p );
354 void wins_process_name_registration_request(struct subnet_record *subrec,
355 struct packet_struct *p);
356 void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
357 struct packet_struct *p);
358 void fetch_all_active_wins_1b_names(void);
359 void send_wins_name_query_response(int rcode, struct packet_struct *p,
360 struct name_record *namerec);
361 void wins_process_name_query_request(struct subnet_record *subrec,
362 struct packet_struct *p);
363 void wins_process_name_release_request(struct subnet_record *subrec,
364 struct packet_struct *p);
365 void initiate_wins_processing(time_t t);
366 void wins_write_name_record(struct name_record *namerec, XFILE *fp);
367 void wins_write_database(time_t t, bool background);
368 void nmbd_wins_new_entry(struct messaging_context *msg,
369 void *private_data,
370 uint32_t msg_type,
371 struct server_id server_id,
372 DATA_BLOB *data);
374 /* The following definitions come from nmbd/nmbd_workgroupdb.c */
376 struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
377 const char *name);
378 struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
379 const char *name, int ttl);
380 void update_workgroup_ttl(struct work_record *work, int ttl);
381 void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
382 void dump_workgroups(bool force_write);
383 void expire_workgroups_and_servers(time_t t);