use NULL instead of 0
[kai/samba.git] / source3 / include / nameserv.h
index e4876bac57022d7d641556eb7ea8560ccbbb1af1..1aa1075543f2b73f719681ecbb707d11c68b0978 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios header - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -73,7 +73,8 @@
 /* server type identifiers */
 #define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER)
 #define AM_BACKUP(work) (work->ServerType & SV_TYPE_BACKUP_BROWSER)
-#define AM_DOMCTL(work) (work->ServerType & SV_TYPE_DOMAIN_CTRL)
+#define AM_DOMMST(work) (work->ServerType & SV_TYPE_DOMAIN_MASTER)
+#define AM_DOMMEM(work) (work->ServerType & SV_TYPE_DOMAIN_MEMBER)
 
 /* microsoft browser NetBIOS name */
 #define MSBROWSE "\001\002__MSBROWSE__\002"
 enum name_source {STATUS_QUERY, LMHOSTS, REGISTER, SELF, DNS, DNSFAIL};
 enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3};
 enum packet_type {NMB_PACKET, DGRAM_PACKET};
+
 enum master_state
 {
-   MST_NONE,
-   MST_WON,
+   MST_POTENTIAL,
+   MST_BACK,
    MST_MSB,
-   MST_BROWSER,
-   MST_DOMAIN_NONE,
-   MST_DOMAIN_MEM,
-   MST_DOMAIN_TST,
-   MST_DOMAIN
+   MST_BROWSER
+};
+
+enum domain_state
+{
+   DOMAIN_NONE,
+   DOMAIN_WAIT,
+   DOMAIN_MST
+};
+
+enum logon_state
+{
+   LOGON_NONE,
+   LOGON_WAIT,
+   LOGON_SRV
 };
 
 enum state_type
@@ -111,7 +123,8 @@ enum state_type
        NAME_QUERY_DOM_SRV_CHK,
        NAME_QUERY_SRV_CHK,
        NAME_QUERY_FIND_MST,
-       NAME_QUERY_MST_CHK
+       NAME_QUERY_MST_CHK,
+       NAME_QUERY_DOMAIN
 };
 
 /* a netbios name structure */
@@ -145,6 +158,8 @@ struct name_record
   time_t refresh_time; /* time record should be refreshed */
 };
 
+struct subnet_record;
+
 /* browse and backup server cache for synchronising browse list */
 struct browse_cache_record
 {
@@ -158,6 +173,7 @@ struct browse_cache_record
        time_t sync_time;
        BOOL synced;
        BOOL local;
+        struct subnet_record *subnet;
 };
 
 /* this is used to hold the list of servers in my domain, and is */
@@ -179,8 +195,14 @@ struct work_record
 
   struct server_record *serverlist;
 
-  /* stage of development from non-master to master browser / domain master */
-  enum master_state state;
+  /* stage of development from non-local-master up to local-master browser */
+  enum master_state mst_state;
+
+  /* stage of development from non-domain-master to domain master browser */
+  enum domain_state dom_state;
+
+  /* stage of development from non-logon-server to logon server */
+  enum logon_state log_state;
 
   /* work group info */
   fstring work_group;
@@ -367,6 +389,9 @@ struct packet_struct
 
 /* broadcast packet announcement intervals, in minutes */
 
+/* attempt to add domain logon and domain master names */
+#define CHECK_TIME_ADD_DOM_NAMES 5 
+
 /* search for master browsers of workgroups samba knows about, 
    except default */
 #define CHECK_TIME_MST_BROWSE       5 
@@ -387,5 +412,17 @@ struct packet_struct
 #define DFLT_SERVER_TYPE (SV_TYPE_WORKSTATION | SV_TYPE_SERVER | \
                          SV_TYPE_TIME_SOURCE | SV_TYPE_SERVER_UNIX | \
                          SV_TYPE_PRINTQ_SERVER | SV_TYPE_SERVER_NT | \
-                         SV_TYPE_NT)
+                         SV_TYPE_NT )
+
+/* Macro's to enumerate subnets either with or without
+   the WINS subnet. */
+
+extern struct subnet_record *subnetlist;
+extern struct subnet_record *wins_subnet;
+
+#define FIRST_SUBNET subnetlist
+#define NEXT_SUBNET_EXCLUDING_WINS(x) ((x)->next)
+#define NEXT_SUBNET_INCLUDING_WINS(x) ( ((x) == wins_subnet) ? NULL : \
+                                        (((x)->next == NULL) ? wins_subnet : \
+                                         (x)->next))