s3:auth/server_info: the primary rid should be in the groups rid array (bug #8798)
[Samba.git] / source3 / nmbd / nmbd_proto.h
blob0258b4a478bd581de84c408d2e06669268304834
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(void);
32 void run_dns_queue(void);
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);
40 struct messaging_context *nmbd_messaging_context(void);
42 /* The following definitions come from nmbd/nmbd_become_dmb.c */
44 void add_domain_names(time_t t);
46 /* The following definitions come from nmbd/nmbd_become_lmb.c */
48 void insert_permanent_name_into_unicast( struct subnet_record *subrec,
49 struct nmb_name *nmbname, uint16 nb_type );
50 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
51 bool force_new_election);
52 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
53 void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
55 /* The following definitions come from nmbd/nmbd_browserdb.c */
57 void update_browser_death_time( struct browse_cache_record *browc );
58 struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
59 const char *browser_name,
60 struct in_addr ip );
61 struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
62 void expire_lmb_browsers( time_t t );
64 /* The following definitions come from nmbd/nmbd_browsesync.c */
66 void dmb_expire_and_sync_browser_lists(time_t t);
67 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
68 struct work_record *work);
69 void collect_all_workgroup_names_from_wins_server(time_t t);
70 void sync_all_dmbs(time_t t);
72 /* The following definitions come from nmbd/nmbd_elections.c */
74 void check_master_browser_exists(time_t t);
75 void run_elections(time_t t);
76 void process_election(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
77 bool check_elections(void);
78 void 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);
84 /* The following definitions come from nmbd/nmbd_incomingdgrams.c */
86 void tell_become_backup(void);
87 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
88 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
89 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
90 void process_master_browser_announce(struct subnet_record *subrec,
91 struct packet_struct *p,const char *buf);
92 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
93 void process_get_backup_list_request(struct subnet_record *subrec,
94 struct packet_struct *p,const char *buf);
95 void process_reset_browser(struct subnet_record *subrec,
96 struct packet_struct *p,const char *buf);
97 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf);
98 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, const char *buf, int len);
100 /* The following definitions come from nmbd/nmbd_incomingrequests.c */
102 void process_name_release_request(struct subnet_record *subrec,
103 struct packet_struct *p);
104 void process_name_refresh_request(struct subnet_record *subrec,
105 struct packet_struct *p);
106 void process_name_registration_request(struct subnet_record *subrec,
107 struct packet_struct *p);
108 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
109 void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
111 /* The following definitions come from nmbd/nmbd_lmhosts.c */
113 void load_lmhosts_file(const char *fname);
114 bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
116 /* The following definitions come from nmbd/nmbd_logonnames.c */
118 void add_logon_names(void);
120 /* The following definitions come from nmbd/nmbd_mynames.c */
122 void register_my_workgroup_one_subnet(struct subnet_record *subrec);
123 bool register_my_workgroup_and_names(void);
124 void release_wins_names(void);
125 void refresh_my_names(time_t t);
127 /* The following definitions come from nmbd/nmbd_namelistdb.c */
129 void set_samba_nb_type(void);
130 void remove_name_from_namelist(struct subnet_record *subrec,
131 struct name_record *namerec );
132 struct name_record *find_name_on_subnet(struct subnet_record *subrec,
133 const struct nmb_name *nmbname,
134 bool self_only);
135 struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
136 bool self_only);
137 void update_name_ttl( struct name_record *namerec, int ttl );
138 bool 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);
146 void 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);
150 void standard_fail_register( struct subnet_record *subrec,
151 struct nmb_name *nmbname );
152 bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
153 void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
154 void remove_ip_from_name_record( struct name_record *namerec,
155 struct in_addr remove_ip );
156 void standard_success_release( struct subnet_record *subrec,
157 struct userdata_struct *userdata,
158 struct nmb_name *nmbname,
159 struct in_addr released_ip );
160 void expire_names(time_t t);
161 void add_samba_names_to_subnet( struct subnet_record *subrec );
162 void dump_name_record( struct name_record *namerec, XFILE *fp);
163 void dump_all_namelists(void);
165 /* The following definitions come from nmbd/nmbd_namequery.c */
167 bool 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);
171 bool 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);
177 /* The following definitions come from nmbd/nmbd_nameregister.c */
179 void 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);
184 void wins_refresh_name(struct name_record *namerec);
186 /* The following definitions come from nmbd/nmbd_namerelease.c */
188 void 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);
193 /* The following definitions come from nmbd/nmbd_nodestatus.c */
195 bool 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);
199 /* The following definitions come from nmbd/nmbd_packets.c */
201 bool nmbd_init_packet_server(void);
203 uint16 get_nb_flags(char *buf);
204 void set_nb_flags(char *buf, uint16 nb_flags);
205 struct 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);
213 void 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);
219 struct 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);
229 struct 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);
239 struct 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);
246 struct 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);
253 struct 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);
261 void 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);
264 void queue_packet(struct packet_struct *packet);
265 void run_packet_queue(void);
266 void retransmit_or_expire_response_records(time_t t);
267 bool listen_for_packets(bool run_election);
268 bool 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);
274 /* The following definitions come from nmbd/nmbd_processlogon.c */
276 bool initialize_nmbd_proxy_logon(void);
278 void process_logon_packet(struct packet_struct *p, const char *buf,int len,
279 const char *mailslot);
281 /* The following definitions come from nmbd/nmbd_responserecordsdb.c */
283 void remove_response_record(struct subnet_record *subrec,
284 struct response_record *rrec);
285 struct 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);
292 struct response_record *find_response_record(struct subnet_record **ppsubrec,
293 uint16 id);
294 bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
296 /* The following definitions come from nmbd/nmbd_sendannounce.c */
298 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
299 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
300 void announce_my_server_names(time_t t);
301 void announce_my_lm_server_names(time_t t);
302 void reset_announce_timer(void);
303 void announce_myself_to_domain_master_browser(time_t t);
304 void announce_my_servers_removed(void);
305 void announce_remote(time_t t);
306 void browse_sync_remote(time_t t);
308 /* The following definitions come from nmbd/nmbd_serverlistdb.c */
310 void remove_all_servers(struct work_record *work);
311 struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
312 void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
313 struct server_record *create_server_on_workgroup(struct work_record *work,
314 const char *name,int servertype,
315 int ttl, const char *comment);
316 void update_server_ttl(struct server_record *servrec, int ttl);
317 void expire_servers(struct work_record *work, time_t t);
318 void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
319 const char *local_master_browser_name, const char *description);
320 void write_browse_list(time_t t, bool force_write);
322 /* The following definitions come from nmbd/nmbd_subnetdb.c */
324 void close_subnet(struct subnet_record *subrec);
325 struct subnet_record *make_normal_subnet(const struct interface *iface);
326 bool create_subnets(void);
327 bool we_are_a_wins_client(void);
328 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
329 struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
331 /* The following definitions come from nmbd/nmbd_synclists.c */
333 void sync_browse_lists(struct work_record *work,
334 char *name, int nm_type,
335 struct in_addr ip, bool local, bool servers);
336 void sync_check_completion(void);
338 /* The following definitions come from nmbd/nmbd_winsproxy.c */
340 void make_wins_proxy_name_query_request( struct subnet_record *subrec,
341 struct packet_struct *incoming_packet,
342 struct nmb_name *question_name);
344 /* The following definitions come from nmbd/nmbd_winsserver.c */
346 struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
347 bool wins_store_changed_namerec(const struct name_record *namerec);
348 bool add_name_to_wins_subnet(const struct name_record *namerec);
349 bool remove_name_from_wins_namelist(struct name_record *namerec);
350 void dump_wins_subnet_namelist(XFILE *fp);
351 bool packet_is_for_wins_server(struct packet_struct *packet);
352 bool initialise_wins(void);
353 void wins_process_name_refresh_request( struct subnet_record *subrec,
354 struct packet_struct *p );
355 void wins_process_name_registration_request(struct subnet_record *subrec,
356 struct packet_struct *p);
357 void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
358 struct packet_struct *p);
359 void fetch_all_active_wins_1b_names(void);
360 void send_wins_name_query_response(int rcode, struct packet_struct *p,
361 struct name_record *namerec);
362 void wins_process_name_query_request(struct subnet_record *subrec,
363 struct packet_struct *p);
364 void wins_process_name_release_request(struct subnet_record *subrec,
365 struct packet_struct *p);
366 void initiate_wins_processing(time_t t);
367 void wins_write_name_record(struct name_record *namerec, XFILE *fp);
368 void wins_write_database(time_t t, bool background);
369 void 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);
375 /* The following definitions come from nmbd/nmbd_workgroupdb.c */
377 struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
378 const char *name);
379 struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
380 const char *name, int ttl);
381 void update_workgroup_ttl(struct work_record *work, int ttl);
382 void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
383 void dump_workgroups(bool force_write);
384 void expire_workgroups_and_servers(time_t t);