summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h357
-rw-r--r--source3/nmbd/asyncdns.c1
-rw-r--r--source3/nmbd/nmbd.c1
-rw-r--r--source3/nmbd/nmbd.h2
-rw-r--r--source3/nmbd/nmbd_become_dmb.c1
-rw-r--r--source3/nmbd/nmbd_become_lmb.c1
-rw-r--r--source3/nmbd/nmbd_browserdb.c1
-rw-r--r--source3/nmbd/nmbd_browsesync.c1
-rw-r--r--source3/nmbd/nmbd_elections.c1
-rw-r--r--source3/nmbd/nmbd_incomingdgrams.c1
-rw-r--r--source3/nmbd/nmbd_incomingrequests.c1
-rw-r--r--source3/nmbd/nmbd_lmhosts.c1
-rw-r--r--source3/nmbd/nmbd_logonnames.c1
-rw-r--r--source3/nmbd/nmbd_mynames.c1
-rw-r--r--source3/nmbd/nmbd_namelistdb.c1
-rw-r--r--source3/nmbd/nmbd_namequery.c1
-rw-r--r--source3/nmbd/nmbd_nameregister.c1
-rw-r--r--source3/nmbd/nmbd_namerelease.c1
-rw-r--r--source3/nmbd/nmbd_nodestatus.c1
-rw-r--r--source3/nmbd/nmbd_packets.c1
-rw-r--r--source3/nmbd/nmbd_processlogon.c1
-rw-r--r--source3/nmbd/nmbd_proto.h357
-rw-r--r--source3/nmbd/nmbd_responserecordsdb.c1
-rw-r--r--source3/nmbd/nmbd_sendannounce.c1
-rw-r--r--source3/nmbd/nmbd_serverlistdb.c1
-rw-r--r--source3/nmbd/nmbd_subnetdb.c1
-rw-r--r--source3/nmbd/nmbd_synclists.c1
-rw-r--r--source3/nmbd/nmbd_winsproxy.c1
-rw-r--r--source3/nmbd/nmbd_winsserver.c1
-rw-r--r--source3/nmbd/nmbd_workgroupdb.c1
30 files changed, 386 insertions, 357 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c1e471886c6..7728af3ff5e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3235,363 +3235,6 @@ ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, c
ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
NTSTATUS vfs_default_init(void);
-/* The following definitions come from nmbd/asyncdns.c */
-
-int asyncdns_fd(void);
-void kill_async_dns_child(void);
-void start_async_dns(void);
-void run_dns_queue(void);
-bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
-bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
-void kill_async_dns_child(void);
-
-/* The following definitions come from nmbd/nmbd.c */
-
-struct event_context *nmbd_event_context(void);
-struct messaging_context *nmbd_messaging_context(void);
-
-/* The following definitions come from nmbd/nmbd_become_dmb.c */
-
-void add_domain_names(time_t t);
-
-/* The following definitions come from nmbd/nmbd_become_lmb.c */
-
-void insert_permanent_name_into_unicast( struct subnet_record *subrec,
- struct nmb_name *nmbname, uint16 nb_type );
-void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
- bool force_new_election);
-void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
-void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
-
-/* The following definitions come from nmbd/nmbd_browserdb.c */
-
-void update_browser_death_time( struct browse_cache_record *browc );
-struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
- const char *browser_name,
- struct in_addr ip );
-struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
-void expire_lmb_browsers( time_t t );
-
-/* The following definitions come from nmbd/nmbd_browsesync.c */
-
-void dmb_expire_and_sync_browser_lists(time_t t);
-void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
- struct work_record *work);
-void collect_all_workgroup_names_from_wins_server(time_t t);
-void sync_all_dmbs(time_t t);
-
-/* The following definitions come from nmbd/nmbd_elections.c */
-
-void check_master_browser_exists(time_t t);
-void run_elections(time_t t);
-void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
-bool check_elections(void);
-void nmbd_message_election(struct messaging_context *msg,
- void *private_data,
- uint32_t msg_type,
- struct server_id server_id,
- DATA_BLOB *data);
-
-/* The following definitions come from nmbd/nmbd_incomingdgrams.c */
-
-void tell_become_backup(void);
-void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
-void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
-void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
-void process_master_browser_announce(struct subnet_record *subrec,
- struct packet_struct *p,char *buf);
-void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
-void process_get_backup_list_request(struct subnet_record *subrec,
- struct packet_struct *p,char *buf);
-void process_reset_browser(struct subnet_record *subrec,
- struct packet_struct *p,char *buf);
-void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
-void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
-
-/* The following definitions come from nmbd/nmbd_incomingrequests.c */
-
-void process_name_release_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void process_name_refresh_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void process_name_registration_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
-void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
-
-/* The following definitions come from nmbd/nmbd_lmhosts.c */
-
-void load_lmhosts_file(const char *fname);
-bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
-
-/* The following definitions come from nmbd/nmbd_logonnames.c */
-
-void add_logon_names(void);
-
-/* The following definitions come from nmbd/nmbd_mynames.c */
-
-void register_my_workgroup_one_subnet(struct subnet_record *subrec);
-bool register_my_workgroup_and_names(void);
-void release_wins_names(void);
-void refresh_my_names(time_t t);
-
-/* The following definitions come from nmbd/nmbd_namelistdb.c */
-
-void set_samba_nb_type(void);
-void remove_name_from_namelist(struct subnet_record *subrec,
- struct name_record *namerec );
-struct name_record *find_name_on_subnet(struct subnet_record *subrec,
- const struct nmb_name *nmbname,
- bool self_only);
-struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
- bool self_only);
-void update_name_ttl( struct name_record *namerec, int ttl );
-bool add_name_to_subnet( struct subnet_record *subrec,
- const char *name,
- int type,
- uint16 nb_flags,
- int ttl,
- enum name_source source,
- int num_ips,
- struct in_addr *iplist);
-void standard_success_register(struct subnet_record *subrec,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname, uint16 nb_flags, int ttl,
- struct in_addr registered_ip);
-void standard_fail_register( struct subnet_record *subrec,
- struct nmb_name *nmbname );
-bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
-void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
-void remove_ip_from_name_record( struct name_record *namerec,
- struct in_addr remove_ip );
-void standard_success_release( struct subnet_record *subrec,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname,
- struct in_addr released_ip );
-void expire_names(time_t t);
-void add_samba_names_to_subnet( struct subnet_record *subrec );
-void dump_name_record( struct name_record *namerec, XFILE *fp);
-void dump_all_namelists(void);
-
-/* The following definitions come from nmbd/nmbd_namequery.c */
-
-bool query_name(struct subnet_record *subrec, const char *name, int type,
- query_name_success_function success_fn,
- query_name_fail_function fail_fn,
- struct userdata_struct *userdata);
-bool query_name_from_wins_server(struct in_addr ip_to,
- const char *name, int type,
- query_name_success_function success_fn,
- query_name_fail_function fail_fn,
- struct userdata_struct *userdata);
-
-/* The following definitions come from nmbd/nmbd_nameregister.c */
-
-void register_name(struct subnet_record *subrec,
- const char *name, int type, uint16 nb_flags,
- register_name_success_function success_fn,
- register_name_fail_function fail_fn,
- struct userdata_struct *userdata);
-void wins_refresh_name(struct name_record *namerec);
-
-/* The following definitions come from nmbd/nmbd_namerelease.c */
-
-void release_name(struct subnet_record *subrec, struct name_record *namerec,
- release_name_success_function success_fn,
- release_name_fail_function fail_fn,
- struct userdata_struct *userdata);
-
-/* The following definitions come from nmbd/nmbd_nodestatus.c */
-
-bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
- struct in_addr send_ip, node_status_success_function success_fn,
- node_status_fail_function fail_fn, struct userdata_struct *userdata);
-
-/* The following definitions come from nmbd/nmbd_packets.c */
-
-uint16 get_nb_flags(char *buf);
-void set_nb_flags(char *buf, uint16 nb_flags);
-struct response_record *queue_register_name( struct subnet_record *subrec,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- register_name_success_function success_fn,
- register_name_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname,
- uint16 nb_flags);
-void queue_wins_refresh(struct nmb_name *nmbname,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- uint16 nb_flags,
- struct in_addr refresh_ip,
- const char *tag);
-struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- register_name_success_function success_fn,
- register_name_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname,
- uint16 nb_flags,
- struct in_addr register_ip,
- struct in_addr wins_ip);
-struct response_record *queue_release_name( struct subnet_record *subrec,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- release_name_success_function success_fn,
- release_name_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname,
- uint16 nb_flags,
- struct in_addr release_ip,
- struct in_addr dest_ip);
-struct response_record *queue_query_name( struct subnet_record *subrec,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- query_name_success_function success_fn,
- query_name_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname);
-struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- query_name_success_function success_fn,
- query_name_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname);
-struct response_record *queue_node_status( struct subnet_record *subrec,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- node_status_success_function success_fn,
- node_status_fail_function fail_fn,
- struct userdata_struct *userdata,
- struct nmb_name *nmbname,
- struct in_addr send_ip);
-void reply_netbios_packet(struct packet_struct *orig_packet,
- int rcode, enum netbios_reply_type_code rcv_code, int opcode,
- int ttl, char *data,int len);
-void queue_packet(struct packet_struct *packet);
-void run_packet_queue(void);
-void retransmit_or_expire_response_records(time_t t);
-bool listen_for_packets(bool run_election);
-bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
- const char *srcname, int src_type,
- const char *dstname, int dest_type,
- struct in_addr dest_ip,struct in_addr src_ip,
- int dest_port);
-
-/* The following definitions come from nmbd/nmbd_processlogon.c */
-
-bool initialize_nmbd_proxy_logon(void);
-
-void process_logon_packet(struct packet_struct *p, char *buf,int len,
- const char *mailslot);
-
-/* The following definitions come from nmbd/nmbd_responserecordsdb.c */
-
-void remove_response_record(struct subnet_record *subrec,
- struct response_record *rrec);
-struct response_record *make_response_record( struct subnet_record *subrec,
- struct packet_struct *p,
- response_function resp_fn,
- timeout_response_function timeout_fn,
- success_function success_fn,
- fail_function fail_fn,
- struct userdata_struct *userdata);
-struct response_record *find_response_record(struct subnet_record **ppsubrec,
- uint16 id);
-bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
-
-/* The following definitions come from nmbd/nmbd_sendannounce.c */
-
-void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
-void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
-void announce_my_server_names(time_t t);
-void announce_my_lm_server_names(time_t t);
-void reset_announce_timer(void);
-void announce_myself_to_domain_master_browser(time_t t);
-void announce_my_servers_removed(void);
-void announce_remote(time_t t);
-void browse_sync_remote(time_t t);
-
-/* The following definitions come from nmbd/nmbd_serverlistdb.c */
-
-void remove_all_servers(struct work_record *work);
-struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
-void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
-struct server_record *create_server_on_workgroup(struct work_record *work,
- const char *name,int servertype,
- int ttl, const char *comment);
-void update_server_ttl(struct server_record *servrec, int ttl);
-void expire_servers(struct work_record *work, time_t t);
-void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
- const char *local_master_browser_name, const char *description);
-void write_browse_list(time_t t, bool force_write);
-
-/* The following definitions come from nmbd/nmbd_subnetdb.c */
-
-void close_subnet(struct subnet_record *subrec);
-struct subnet_record *make_normal_subnet(const struct interface *iface);
-bool create_subnets(void);
-bool we_are_a_wins_client(void);
-struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
-struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
-
-/* The following definitions come from nmbd/nmbd_synclists.c */
-
-void sync_browse_lists(struct work_record *work,
- char *name, int nm_type,
- struct in_addr ip, bool local, bool servers);
-void sync_check_completion(void);
-
-/* The following definitions come from nmbd/nmbd_winsproxy.c */
-
-void make_wins_proxy_name_query_request( struct subnet_record *subrec,
- struct packet_struct *incoming_packet,
- struct nmb_name *question_name);
-
-/* The following definitions come from nmbd/nmbd_winsserver.c */
-
-struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
-bool wins_store_changed_namerec(const struct name_record *namerec);
-bool add_name_to_wins_subnet(const struct name_record *namerec);
-bool remove_name_from_wins_namelist(struct name_record *namerec);
-void dump_wins_subnet_namelist(XFILE *fp);
-bool packet_is_for_wins_server(struct packet_struct *packet);
-bool initialise_wins(void);
-void wins_process_name_refresh_request( struct subnet_record *subrec,
- struct packet_struct *p );
-void wins_process_name_registration_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
- struct packet_struct *p);
-void fetch_all_active_wins_1b_names(void);
-void send_wins_name_query_response(int rcode, struct packet_struct *p,
- struct name_record *namerec);
-void wins_process_name_query_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void wins_process_name_release_request(struct subnet_record *subrec,
- struct packet_struct *p);
-void initiate_wins_processing(time_t t);
-void wins_write_name_record(struct name_record *namerec, XFILE *fp);
-void wins_write_database(time_t t, bool background);
-void nmbd_wins_new_entry(struct messaging_context *msg,
- void *private_data,
- uint32_t msg_type,
- struct server_id server_id,
- DATA_BLOB *data);
-
-/* The following definitions come from nmbd/nmbd_workgroupdb.c */
-
-struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
- const char *name);
-struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
- const char *name, int ttl);
-void update_workgroup_ttl(struct work_record *work, int ttl);
-void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
-void dump_workgroups(bool force_write);
-void expire_workgroups_and_servers(time_t t);
-
/* The following definitions come from param/loadparm.c */
char *lp_smb_ports(void);
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 2701c96dd79..9e7707b4102 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/***************************************************************************
Add a DNS result to the name cache.
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 16a4d7d8166..5678c8e848c 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "popt_common.h"
#include "librpc/gen_ndr/messaging.h"
+#include "nmbd/nmbd.h"
int ClientNMB = -1;
int ClientDGRAM = -1;
diff --git a/source3/nmbd/nmbd.h b/source3/nmbd/nmbd.h
new file mode 100644
index 00000000000..0e8d12edf8d
--- /dev/null
+++ b/source3/nmbd/nmbd.h
@@ -0,0 +1,2 @@
+
+#include "nmbd/nmbd_proto.h"
diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c
index 337eae85f5b..160bcb3c339 100644
--- a/source3/nmbd/nmbd_become_dmb.c
+++ b/source3/nmbd/nmbd_become_dmb.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index 45476f9bfd6..ffd92cf0d8f 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
#include "../librpc/gen_ndr/svcctl.h"
extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */
diff --git a/source3/nmbd/nmbd_browserdb.c b/source3/nmbd/nmbd_browserdb.c
index a2793649787..b7c99005bbf 100644
--- a/source3/nmbd/nmbd_browserdb.c
+++ b/source3/nmbd/nmbd_browserdb.c
@@ -27,6 +27,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/* -------------------------------------------------------------------------- **
* Variables...
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index 73d953e7269..3dc89b50261 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/* This is our local master browser list database. */
extern struct browse_cache_record *lmb_browserlist;
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index 1ed64f4059f..4c9c9d9151d 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/* Election parameters. */
extern time_t StartupTime;
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 5216e1a90b5..cc657e39625 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
extern bool found_lm_clients;
diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c
index 6d8436d9e38..d0138ddd4a9 100644
--- a/source3/nmbd/nmbd_incomingrequests.c
+++ b/source3/nmbd/nmbd_incomingrequests.c
@@ -25,6 +25,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Send a name release response.
diff --git a/source3/nmbd/nmbd_lmhosts.c b/source3/nmbd/nmbd_lmhosts.c
index 227d7a3c8d8..c3eb2b58dd4 100644
--- a/source3/nmbd/nmbd_lmhosts.c
+++ b/source3/nmbd/nmbd_lmhosts.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "../libcli/nbt/libnbt.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Load a lmhosts file.
diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c
index 5f21ea0cd01..f99092055bb 100644
--- a/source3/nmbd/nmbd_logonnames.c
+++ b/source3/nmbd/nmbd_logonnames.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index ed48095f230..e3798507c21 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c
index 6570fd4ec76..9c5d0efde2a 100644
--- a/source3/nmbd/nmbd_namelistdb.c
+++ b/source3/nmbd/nmbd_namelistdb.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
uint16 samba_nb_type = 0; /* samba's NetBIOS name type */
diff --git a/source3/nmbd/nmbd_namequery.c b/source3/nmbd/nmbd_namequery.c
index c1c5f5238a6..ae50a232987 100644
--- a/source3/nmbd/nmbd_namequery.c
+++ b/source3/nmbd/nmbd_namequery.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Deal with a response packet when querying a name.
diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index d4359aab37d..71c4751d7c1 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/* forward declarations */
static void wins_next_registration(struct response_record *rrec);
diff --git a/source3/nmbd/nmbd_namerelease.c b/source3/nmbd/nmbd_namerelease.c
index 4be7396f2e3..4f34a458471 100644
--- a/source3/nmbd/nmbd_namerelease.c
+++ b/source3/nmbd/nmbd_namerelease.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Deal with a response packet when releasing one of our names.
diff --git a/source3/nmbd/nmbd_nodestatus.c b/source3/nmbd/nmbd_nodestatus.c
index 168ccf1ad43..1f3e1cf91a0 100644
--- a/source3/nmbd/nmbd_nodestatus.c
+++ b/source3/nmbd/nmbd_nodestatus.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Deal with a successful node status response.
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 8e46efe2d06..2dd218aece0 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
extern int ClientNMB;
extern int ClientDGRAM;
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 607260b230a..273f3d308a9 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -29,6 +29,7 @@
#include "../lib/tsocket/tsocket.h"
#include "../libcli/security/dom_sid.h"
#include "secrets.h"
+#include "nmbd/nmbd.h"
struct sam_database_info {
uint32 index;
diff --git a/source3/nmbd/nmbd_proto.h b/source3/nmbd/nmbd_proto.h
new file mode 100644
index 00000000000..e90a90ee7f1
--- /dev/null
+++ b/source3/nmbd/nmbd_proto.h
@@ -0,0 +1,357 @@
+
+/* The following definitions come from nmbd/asyncdns.c */
+
+int asyncdns_fd(void);
+void kill_async_dns_child(void);
+void start_async_dns(void);
+void run_dns_queue(void);
+bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
+bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
+void kill_async_dns_child(void);
+
+/* The following definitions come from nmbd/nmbd.c */
+
+struct event_context *nmbd_event_context(void);
+struct messaging_context *nmbd_messaging_context(void);
+
+/* The following definitions come from nmbd/nmbd_become_dmb.c */
+
+void add_domain_names(time_t t);
+
+/* The following definitions come from nmbd/nmbd_become_lmb.c */
+
+void insert_permanent_name_into_unicast( struct subnet_record *subrec,
+ struct nmb_name *nmbname, uint16 nb_type );
+void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
+ bool force_new_election);
+void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
+void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
+
+/* The following definitions come from nmbd/nmbd_browserdb.c */
+
+void update_browser_death_time( struct browse_cache_record *browc );
+struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
+ const char *browser_name,
+ struct in_addr ip );
+struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
+void expire_lmb_browsers( time_t t );
+
+/* The following definitions come from nmbd/nmbd_browsesync.c */
+
+void dmb_expire_and_sync_browser_lists(time_t t);
+void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
+ struct work_record *work);
+void collect_all_workgroup_names_from_wins_server(time_t t);
+void sync_all_dmbs(time_t t);
+
+/* The following definitions come from nmbd/nmbd_elections.c */
+
+void check_master_browser_exists(time_t t);
+void run_elections(time_t t);
+void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
+bool check_elections(void);
+void nmbd_message_election(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data);
+
+/* The following definitions come from nmbd/nmbd_incomingdgrams.c */
+
+void tell_become_backup(void);
+void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
+void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
+void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
+void process_master_browser_announce(struct subnet_record *subrec,
+ struct packet_struct *p,char *buf);
+void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
+void process_get_backup_list_request(struct subnet_record *subrec,
+ struct packet_struct *p,char *buf);
+void process_reset_browser(struct subnet_record *subrec,
+ struct packet_struct *p,char *buf);
+void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
+void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
+
+/* The following definitions come from nmbd/nmbd_incomingrequests.c */
+
+void process_name_release_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void process_name_refresh_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void process_name_registration_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
+void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
+
+/* The following definitions come from nmbd/nmbd_lmhosts.c */
+
+void load_lmhosts_file(const char *fname);
+bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
+
+/* The following definitions come from nmbd/nmbd_logonnames.c */
+
+void add_logon_names(void);
+
+/* The following definitions come from nmbd/nmbd_mynames.c */
+
+void register_my_workgroup_one_subnet(struct subnet_record *subrec);
+bool register_my_workgroup_and_names(void);
+void release_wins_names(void);
+void refresh_my_names(time_t t);
+
+/* The following definitions come from nmbd/nmbd_namelistdb.c */
+
+void set_samba_nb_type(void);
+void remove_name_from_namelist(struct subnet_record *subrec,
+ struct name_record *namerec );
+struct name_record *find_name_on_subnet(struct subnet_record *subrec,
+ const struct nmb_name *nmbname,
+ bool self_only);
+struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
+ bool self_only);
+void update_name_ttl( struct name_record *namerec, int ttl );
+bool add_name_to_subnet( struct subnet_record *subrec,
+ const char *name,
+ int type,
+ uint16 nb_flags,
+ int ttl,
+ enum name_source source,
+ int num_ips,
+ struct in_addr *iplist);
+void standard_success_register(struct subnet_record *subrec,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname, uint16 nb_flags, int ttl,
+ struct in_addr registered_ip);
+void standard_fail_register( struct subnet_record *subrec,
+ struct nmb_name *nmbname );
+bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
+void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
+void remove_ip_from_name_record( struct name_record *namerec,
+ struct in_addr remove_ip );
+void standard_success_release( struct subnet_record *subrec,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname,
+ struct in_addr released_ip );
+void expire_names(time_t t);
+void add_samba_names_to_subnet( struct subnet_record *subrec );
+void dump_name_record( struct name_record *namerec, XFILE *fp);
+void dump_all_namelists(void);
+
+/* The following definitions come from nmbd/nmbd_namequery.c */
+
+bool query_name(struct subnet_record *subrec, const char *name, int type,
+ query_name_success_function success_fn,
+ query_name_fail_function fail_fn,
+ struct userdata_struct *userdata);
+bool query_name_from_wins_server(struct in_addr ip_to,
+ const char *name, int type,
+ query_name_success_function success_fn,
+ query_name_fail_function fail_fn,
+ struct userdata_struct *userdata);
+
+/* The following definitions come from nmbd/nmbd_nameregister.c */
+
+void register_name(struct subnet_record *subrec,
+ const char *name, int type, uint16 nb_flags,
+ register_name_success_function success_fn,
+ register_name_fail_function fail_fn,
+ struct userdata_struct *userdata);
+void wins_refresh_name(struct name_record *namerec);
+
+/* The following definitions come from nmbd/nmbd_namerelease.c */
+
+void release_name(struct subnet_record *subrec, struct name_record *namerec,
+ release_name_success_function success_fn,
+ release_name_fail_function fail_fn,
+ struct userdata_struct *userdata);
+
+/* The following definitions come from nmbd/nmbd_nodestatus.c */
+
+bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
+ struct in_addr send_ip, node_status_success_function success_fn,
+ node_status_fail_function fail_fn, struct userdata_struct *userdata);
+
+/* The following definitions come from nmbd/nmbd_packets.c */
+
+uint16 get_nb_flags(char *buf);
+void set_nb_flags(char *buf, uint16 nb_flags);
+struct response_record *queue_register_name( struct subnet_record *subrec,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ register_name_success_function success_fn,
+ register_name_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname,
+ uint16 nb_flags);
+void queue_wins_refresh(struct nmb_name *nmbname,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ uint16 nb_flags,
+ struct in_addr refresh_ip,
+ const char *tag);
+struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ register_name_success_function success_fn,
+ register_name_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname,
+ uint16 nb_flags,
+ struct in_addr register_ip,
+ struct in_addr wins_ip);
+struct response_record *queue_release_name( struct subnet_record *subrec,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ release_name_success_function success_fn,
+ release_name_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname,
+ uint16 nb_flags,
+ struct in_addr release_ip,
+ struct in_addr dest_ip);
+struct response_record *queue_query_name( struct subnet_record *subrec,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ query_name_success_function success_fn,
+ query_name_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname);
+struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ query_name_success_function success_fn,
+ query_name_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname);
+struct response_record *queue_node_status( struct subnet_record *subrec,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ node_status_success_function success_fn,
+ node_status_fail_function fail_fn,
+ struct userdata_struct *userdata,
+ struct nmb_name *nmbname,
+ struct in_addr send_ip);
+void reply_netbios_packet(struct packet_struct *orig_packet,
+ int rcode, enum netbios_reply_type_code rcv_code, int opcode,
+ int ttl, char *data,int len);
+void queue_packet(struct packet_struct *packet);
+void run_packet_queue(void);
+void retransmit_or_expire_response_records(time_t t);
+bool listen_for_packets(bool run_election);
+bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
+ const char *srcname, int src_type,
+ const char *dstname, int dest_type,
+ struct in_addr dest_ip,struct in_addr src_ip,
+ int dest_port);
+
+/* The following definitions come from nmbd/nmbd_processlogon.c */
+
+bool initialize_nmbd_proxy_logon(void);
+
+void process_logon_packet(struct packet_struct *p, char *buf,int len,
+ const char *mailslot);
+
+/* The following definitions come from nmbd/nmbd_responserecordsdb.c */
+
+void remove_response_record(struct subnet_record *subrec,
+ struct response_record *rrec);
+struct response_record *make_response_record( struct subnet_record *subrec,
+ struct packet_struct *p,
+ response_function resp_fn,
+ timeout_response_function timeout_fn,
+ success_function success_fn,
+ fail_function fail_fn,
+ struct userdata_struct *userdata);
+struct response_record *find_response_record(struct subnet_record **ppsubrec,
+ uint16 id);
+bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
+
+/* The following definitions come from nmbd/nmbd_sendannounce.c */
+
+void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
+void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
+void announce_my_server_names(time_t t);
+void announce_my_lm_server_names(time_t t);
+void reset_announce_timer(void);
+void announce_myself_to_domain_master_browser(time_t t);
+void announce_my_servers_removed(void);
+void announce_remote(time_t t);
+void browse_sync_remote(time_t t);
+
+/* The following definitions come from nmbd/nmbd_serverlistdb.c */
+
+void remove_all_servers(struct work_record *work);
+struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
+void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
+struct server_record *create_server_on_workgroup(struct work_record *work,
+ const char *name,int servertype,
+ int ttl, const char *comment);
+void update_server_ttl(struct server_record *servrec, int ttl);
+void expire_servers(struct work_record *work, time_t t);
+void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
+ const char *local_master_browser_name, const char *description);
+void write_browse_list(time_t t, bool force_write);
+
+/* The following definitions come from nmbd/nmbd_subnetdb.c */
+
+void close_subnet(struct subnet_record *subrec);
+struct subnet_record *make_normal_subnet(const struct interface *iface);
+bool create_subnets(void);
+bool we_are_a_wins_client(void);
+struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
+struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
+
+/* The following definitions come from nmbd/nmbd_synclists.c */
+
+void sync_browse_lists(struct work_record *work,
+ char *name, int nm_type,
+ struct in_addr ip, bool local, bool servers);
+void sync_check_completion(void);
+
+/* The following definitions come from nmbd/nmbd_winsproxy.c */
+
+void make_wins_proxy_name_query_request( struct subnet_record *subrec,
+ struct packet_struct *incoming_packet,
+ struct nmb_name *question_name);
+
+/* The following definitions come from nmbd/nmbd_winsserver.c */
+
+struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
+bool wins_store_changed_namerec(const struct name_record *namerec);
+bool add_name_to_wins_subnet(const struct name_record *namerec);
+bool remove_name_from_wins_namelist(struct name_record *namerec);
+void dump_wins_subnet_namelist(XFILE *fp);
+bool packet_is_for_wins_server(struct packet_struct *packet);
+bool initialise_wins(void);
+void wins_process_name_refresh_request( struct subnet_record *subrec,
+ struct packet_struct *p );
+void wins_process_name_registration_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
+ struct packet_struct *p);
+void fetch_all_active_wins_1b_names(void);
+void send_wins_name_query_response(int rcode, struct packet_struct *p,
+ struct name_record *namerec);
+void wins_process_name_query_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void wins_process_name_release_request(struct subnet_record *subrec,
+ struct packet_struct *p);
+void initiate_wins_processing(time_t t);
+void wins_write_name_record(struct name_record *namerec, XFILE *fp);
+void wins_write_database(time_t t, bool background);
+void nmbd_wins_new_entry(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data);
+
+/* The following definitions come from nmbd/nmbd_workgroupdb.c */
+
+struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
+ const char *name);
+struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
+ const char *name, int ttl);
+void update_workgroup_ttl(struct work_record *work, int ttl);
+void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
+void dump_workgroups(bool force_write);
+void expire_workgroups_and_servers(time_t t);
diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c
index b042fb41edb..78d4cc95d90 100644
--- a/source3/nmbd/nmbd_responserecordsdb.c
+++ b/source3/nmbd/nmbd_responserecordsdb.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
int num_response_packets = 0;
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index 4140040b2b8..e04e1f6fe3c 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
extern int updatecount;
extern bool found_lm_clients;
diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
index f9b55d298d4..acb5310a640 100644
--- a/source3/nmbd/nmbd_serverlistdb.c
+++ b/source3/nmbd/nmbd_serverlistdb.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
int updatecount = 0;
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 4fb14250946..3a60038dcdc 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
extern int global_nmb_port;
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index d1844450227..5c139b31afb 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -28,6 +28,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
struct sync_record {
struct sync_record *next, *prev;
diff --git a/source3/nmbd/nmbd_winsproxy.c b/source3/nmbd/nmbd_winsproxy.c
index ff80c15ffff..66725fc9b96 100644
--- a/source3/nmbd/nmbd_winsproxy.c
+++ b/source3/nmbd/nmbd_winsproxy.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
/****************************************************************************
Function called when the name lookup succeeded.
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index be2c6a24438..4232afc18c6 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
#define WINS_LIST "wins.dat"
#define WINS_VERSION 1
diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c
index 17cd21b58c5..5ce10e64d46 100644
--- a/source3/nmbd/nmbd_workgroupdb.c
+++ b/source3/nmbd/nmbd_workgroupdb.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
extern uint16 samba_nb_type;