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