source: trunk/server/source3/nmbd/nmbd_proto.h

Last change on this file was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 18.6 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * NBT netbios routines and daemon - version 2
4 *
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
12 *
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.
17 *
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.
22 *
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/>.
25 */
26
27/* The following definitions come from nmbd/asyncdns.c */
28
29int asyncdns_fd(void);
30void kill_async_dns_child(void);
31void start_async_dns(void);
32void run_dns_queue(void);
33bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
34bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
35void kill_async_dns_child(void);
36
37/* The following definitions come from nmbd/nmbd.c */
38
39struct event_context *nmbd_event_context(void);
40struct messaging_context *nmbd_messaging_context(void);
41
42/* The following definitions come from nmbd/nmbd_become_dmb.c */
43
44void add_domain_names(time_t t);
45
46/* The following definitions come from nmbd/nmbd_become_lmb.c */
47
48void insert_permanent_name_into_unicast( struct subnet_record *subrec,
49 struct nmb_name *nmbname, uint16 nb_type );
50void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
51 bool force_new_election);
52void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
53void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
54
55/* The following definitions come from nmbd/nmbd_browserdb.c */
56
57void update_browser_death_time( struct browse_cache_record *browc );
58struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
59 const char *browser_name,
60 struct in_addr ip );
61struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
62void expire_lmb_browsers( time_t t );
63
64/* The following definitions come from nmbd/nmbd_browsesync.c */
65
66void dmb_expire_and_sync_browser_lists(time_t t);
67void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
68 struct work_record *work);
69void collect_all_workgroup_names_from_wins_server(time_t t);
70void sync_all_dmbs(time_t t);
71
72/* The following definitions come from nmbd/nmbd_elections.c */
73
74void check_master_browser_exists(time_t t);
75void run_elections(time_t t);
76void process_election(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
77bool check_elections(void);
78void nmbd_message_election(struct messaging_context *msg,
79 void *private_data,
80 uint32_t msg_type,
81 struct server_id server_id,
82 DATA_BLOB *data);
83
84/* The following definitions come from nmbd/nmbd_incomingdgrams.c */
85
86void tell_become_backup(void);
87void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
88void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
89void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
90void process_master_browser_announce(struct subnet_record *subrec,
91 struct packet_struct *p,const char *buf);
92void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
93void process_get_backup_list_request(struct subnet_record *subrec,
94 struct packet_struct *p,const char *buf);
95void process_reset_browser(struct subnet_record *subrec,
96 struct packet_struct *p,const char *buf);
97void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
98void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
99
100/* The following definitions come from nmbd/nmbd_incomingrequests.c */
101
102void process_name_release_request(struct subnet_record *subrec,
103 struct packet_struct *p);
104void process_name_refresh_request(struct subnet_record *subrec,
105 struct packet_struct *p);
106void process_name_registration_request(struct subnet_record *subrec,
107 struct packet_struct *p);
108void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
109void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
110
111/* The following definitions come from nmbd/nmbd_lmhosts.c */
112
113void load_lmhosts_file(const char *fname);
114bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
115
116/* The following definitions come from nmbd/nmbd_logonnames.c */
117
118void add_logon_names(void);
119
120/* The following definitions come from nmbd/nmbd_mynames.c */
121
122void register_my_workgroup_one_subnet(struct subnet_record *subrec);
123bool register_my_workgroup_and_names(void);
124void release_wins_names(void);
125void refresh_my_names(time_t t);
126
127/* The following definitions come from nmbd/nmbd_namelistdb.c */
128
129void set_samba_nb_type(void);
130void remove_name_from_namelist(struct subnet_record *subrec,
131 struct name_record *namerec );
132struct name_record *find_name_on_subnet(struct subnet_record *subrec,
133 const struct nmb_name *nmbname,
134 bool self_only);
135struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
136 bool self_only);
137void update_name_ttl( struct name_record *namerec, int ttl );
138bool add_name_to_subnet( struct subnet_record *subrec,
139 const char *name,
140 int type,
141 uint16 nb_flags,
142 int ttl,
143 enum name_source source,
144 int num_ips,
145 struct in_addr *iplist);
146void standard_success_register(struct subnet_record *subrec,
147 struct userdata_struct *userdata,
148 struct nmb_name *nmbname, uint16 nb_flags, int ttl,
149 struct in_addr registered_ip);
150void standard_fail_register( struct subnet_record *subrec,
151 struct nmb_name *nmbname );
152bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
153void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
154void remove_ip_from_name_record( struct name_record *namerec,
155 struct in_addr remove_ip );
156void standard_success_release( struct subnet_record *subrec,
157 struct userdata_struct *userdata,
158 struct nmb_name *nmbname,
159 struct in_addr released_ip );
160void expire_names(time_t t);
161void add_samba_names_to_subnet( struct subnet_record *subrec );
162void dump_name_record( struct name_record *namerec, XFILE *fp);
163void dump_all_namelists(void);
164
165/* The following definitions come from nmbd/nmbd_namequery.c */
166
167bool query_name(struct subnet_record *subrec, const char *name, int type,
168 query_name_success_function success_fn,
169 query_name_fail_function fail_fn,
170 struct userdata_struct *userdata);
171bool query_name_from_wins_server(struct in_addr ip_to,
172 const char *name, int type,
173 query_name_success_function success_fn,
174 query_name_fail_function fail_fn,
175 struct userdata_struct *userdata);
176
177/* The following definitions come from nmbd/nmbd_nameregister.c */
178
179void register_name(struct subnet_record *subrec,
180 const char *name, int type, uint16 nb_flags,
181 register_name_success_function success_fn,
182 register_name_fail_function fail_fn,
183 struct userdata_struct *userdata);
184void wins_refresh_name(struct name_record *namerec);
185
186/* The following definitions come from nmbd/nmbd_namerelease.c */
187
188void release_name(struct subnet_record *subrec, struct name_record *namerec,
189 release_name_success_function success_fn,
190 release_name_fail_function fail_fn,
191 struct userdata_struct *userdata);
192
193/* The following definitions come from nmbd/nmbd_nodestatus.c */
194
195bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
196 struct in_addr send_ip, node_status_success_function success_fn,
197 node_status_fail_function fail_fn, struct userdata_struct *userdata);
198
199/* The following definitions come from nmbd/nmbd_packets.c */
200
201bool nmbd_init_packet_server(void);
202
203uint16 get_nb_flags(char *buf);
204void set_nb_flags(char *buf, uint16 nb_flags);
205struct response_record *queue_register_name( struct subnet_record *subrec,
206 response_function resp_fn,
207 timeout_response_function timeout_fn,
208 register_name_success_function success_fn,
209 register_name_fail_function fail_fn,
210 struct userdata_struct *userdata,
211 struct nmb_name *nmbname,
212 uint16 nb_flags);
213void queue_wins_refresh(struct nmb_name *nmbname,
214 response_function resp_fn,
215 timeout_response_function timeout_fn,
216 uint16 nb_flags,
217 struct in_addr refresh_ip,
218 const char *tag);
219struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
220 response_function resp_fn,
221 timeout_response_function timeout_fn,
222 register_name_success_function success_fn,
223 register_name_fail_function fail_fn,
224 struct userdata_struct *userdata,
225 struct nmb_name *nmbname,
226 uint16 nb_flags,
227 struct in_addr register_ip,
228 struct in_addr wins_ip);
229struct response_record *queue_release_name( struct subnet_record *subrec,
230 response_function resp_fn,
231 timeout_response_function timeout_fn,
232 release_name_success_function success_fn,
233 release_name_fail_function fail_fn,
234 struct userdata_struct *userdata,
235 struct nmb_name *nmbname,
236 uint16 nb_flags,
237 struct in_addr release_ip,
238 struct in_addr dest_ip);
239struct response_record *queue_query_name( struct subnet_record *subrec,
240 response_function resp_fn,
241 timeout_response_function timeout_fn,
242 query_name_success_function success_fn,
243 query_name_fail_function fail_fn,
244 struct userdata_struct *userdata,
245 struct nmb_name *nmbname);
246struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
247 response_function resp_fn,
248 timeout_response_function timeout_fn,
249 query_name_success_function success_fn,
250 query_name_fail_function fail_fn,
251 struct userdata_struct *userdata,
252 struct nmb_name *nmbname);
253struct response_record *queue_node_status( struct subnet_record *subrec,
254 response_function resp_fn,
255 timeout_response_function timeout_fn,
256 node_status_success_function success_fn,
257 node_status_fail_function fail_fn,
258 struct userdata_struct *userdata,
259 struct nmb_name *nmbname,
260 struct in_addr send_ip);
261void reply_netbios_packet(struct packet_struct *orig_packet,
262 int rcode, enum netbios_reply_type_code rcv_code, int opcode,
263 int ttl, char *data,int len);
264void queue_packet(struct packet_struct *packet);
265void run_packet_queue(void);
266void retransmit_or_expire_response_records(time_t t);
267bool listen_for_packets(bool run_election);
268bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
269 const char *srcname, int src_type,
270 const char *dstname, int dest_type,
271 struct in_addr dest_ip,struct in_addr src_ip,
272 int dest_port);
273
274/* The following definitions come from nmbd/nmbd_processlogon.c */
275
276bool initialize_nmbd_proxy_logon(void);
277
278void process_logon_packet(struct packet_struct *p, const char *buf,int len,
279 const char *mailslot);
280
281/* The following definitions come from nmbd/nmbd_responserecordsdb.c */
282
283void remove_response_record(struct subnet_record *subrec,
284 struct response_record *rrec);
285struct response_record *make_response_record( struct subnet_record *subrec,
286 struct packet_struct *p,
287 response_function resp_fn,
288 timeout_response_function timeout_fn,
289 success_function success_fn,
290 fail_function fail_fn,
291 struct userdata_struct *userdata);
292struct response_record *find_response_record(struct subnet_record **ppsubrec,
293 uint16 id);
294bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
295
296/* The following definitions come from nmbd/nmbd_sendannounce.c */
297
298void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
299void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
300void announce_my_server_names(time_t t);
301void announce_my_lm_server_names(time_t t);
302void reset_announce_timer(void);
303void announce_myself_to_domain_master_browser(time_t t);
304void announce_my_servers_removed(void);
305void announce_remote(time_t t);
306void browse_sync_remote(time_t t);
307
308/* The following definitions come from nmbd/nmbd_serverlistdb.c */
309
310void remove_all_servers(struct work_record *work);
311struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
312void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
313struct server_record *create_server_on_workgroup(struct work_record *work,
314 const char *name,int servertype,
315 int ttl, const char *comment);
316void update_server_ttl(struct server_record *servrec, int ttl);
317void expire_servers(struct work_record *work, time_t t);
318void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
319 const char *local_master_browser_name, const char *description);
320void write_browse_list(time_t t, bool force_write);
321
322/* The following definitions come from nmbd/nmbd_subnetdb.c */
323
324void close_subnet(struct subnet_record *subrec);
325struct subnet_record *make_normal_subnet(const struct interface *iface);
326bool create_subnets(void);
327bool we_are_a_wins_client(void);
328struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
329struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
330
331/* The following definitions come from nmbd/nmbd_synclists.c */
332
333void sync_browse_lists(struct work_record *work,
334 char *name, int nm_type,
335 struct in_addr ip, bool local, bool servers);
336void sync_check_completion(void);
337
338/* The following definitions come from nmbd/nmbd_winsproxy.c */
339
340void make_wins_proxy_name_query_request( struct subnet_record *subrec,
341 struct packet_struct *incoming_packet,
342 struct nmb_name *question_name);
343
344/* The following definitions come from nmbd/nmbd_winsserver.c */
345
346struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
347bool wins_store_changed_namerec(const struct name_record *namerec);
348bool add_name_to_wins_subnet(const struct name_record *namerec);
349bool remove_name_from_wins_namelist(struct name_record *namerec);
350void dump_wins_subnet_namelist(XFILE *fp);
351bool packet_is_for_wins_server(struct packet_struct *packet);
352bool initialise_wins(void);
353void wins_process_name_refresh_request( struct subnet_record *subrec,
354 struct packet_struct *p );
355void wins_process_name_registration_request(struct subnet_record *subrec,
356 struct packet_struct *p);
357void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
358 struct packet_struct *p);
359void fetch_all_active_wins_1b_names(void);
360void send_wins_name_query_response(int rcode, struct packet_struct *p,
361 struct name_record *namerec);
362void wins_process_name_query_request(struct subnet_record *subrec,
363 struct packet_struct *p);
364void wins_process_name_release_request(struct subnet_record *subrec,
365 struct packet_struct *p);
366void initiate_wins_processing(time_t t);
367void wins_write_name_record(struct name_record *namerec, XFILE *fp);
368void wins_write_database(time_t t, bool background);
369void nmbd_wins_new_entry(struct messaging_context *msg,
370 void *private_data,
371 uint32_t msg_type,
372 struct server_id server_id,
373 DATA_BLOB *data);
374
375/* The following definitions come from nmbd/nmbd_workgroupdb.c */
376
377struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
378 const char *name);
379struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
380 const char *name, int ttl);
381void update_workgroup_ttl(struct work_record *work, int ttl);
382void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
383void dump_workgroups(bool force_write);
384void expire_workgroups_and_servers(time_t t);
Note: See TracBrowser for help on using the repository browser.