summaryrefslogtreecommitdiff
path: root/source3/include/nameserv.h
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-06-29 18:49:20 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-06-29 18:49:20 +0000
commited2639ebe21dde49af816a96ec6ea1e40f76e768 (patch)
tree969aa897016d8e4f29d846cf23c5fa832ae6cf58 /source3/include/nameserv.h
parent851ee418b499df481b765286405cd761e91dcaaf (diff)
downloadsamba-ed2639ebe21dde49af816a96ec6ea1e40f76e768.tar.gz
samba-ed2639ebe21dde49af816a96ec6ea1e40f76e768.tar.bz2
samba-ed2639ebe21dde49af816a96ec6ea1e40f76e768.zip
luke's first attempt at using cvs
accidentally updated the Makefile updated the name database structure (again!). this time, there is one name database per local interface. there is also a pseudo-interface on ip 255.255.255.255. its purpose is to store WINS name entries. all the local interface name databases store SELF names only. the WINS name database stores non-special browser names. added wins.dat file: records WINS entries in ascii format. this is reloaded when nmbd restarts. added repeating code for response packets. timer is in seconds only at the moment. updated the response queue code to deal with samba registering with a WINS server a bit better (added more cases when a response isn't received). tidied up the response packet processing code and expire_response_queue() code. added cross references between response received and await-response expired code. added over-zealous code that checks all machines that register with samba as a WINS server (every 10 minutes i think): to see whether they are still alive or not (see rfc1001.txt) bug reported by terry@ren.pc.athabascau.ca: DNSFAILed names _stay_ as DNSFAIL, even though the machine may come back up and REGISTER. removed update_from_reg() function. it's not necessary, and it does too much. added code that announces on each local interface samba's ttl as zero and servertype as zero when nmbd is kill -TERMed first attempt at putting the first functionality of samba browsing back in (remote subnets should have samba appear in a workgroup specified through the lmhosts file) lots of other miscellaneous tidying up / chopping about. (This used to be commit 7e8c60cfe54060860e5ce20b1c3b8ec6aa5c54da)
Diffstat (limited to 'source3/include/nameserv.h')
-rw-r--r--source3/include/nameserv.h109
1 files changed, 75 insertions, 34 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h
index 8882948ff4..03bb521558 100644
--- a/source3/include/nameserv.h
+++ b/source3/include/nameserv.h
@@ -29,8 +29,12 @@
#define NMB_QUERY 0x20
#define NMB_STATUS 0x21
-#define NMB_REG 0x05
-#define NMB_REL 0x06
+
+#define NMB_REG 0x05 /* see rfc1002.txt 4.2.2,3,5,6,7,8 */
+#define NMB_REG_REFRESH 0x09 /* see rfc1002.txt 4.2.4 */
+#define NMB_REL 0x06 /* see rfc1002.txt 4.2.9,10,11 */
+#define NMB_WAIT_ACK 0x07 /* see rfc1002.txt 4.2.17 */
+/* XXXX what about all the other types?? 0x1, 0x2, 0x3, 0x4, 0x8? */
#define NB_GROUP 0x80
#define NB_PERM 0x02
@@ -44,6 +48,8 @@
#define NB_FLGMSK 0x60
#define REFRESH_TIME (15*60)
+#define NAME_POLL_REFRESH_TIME (5*60)
+#define NAME_POLL_INTERVAL 15
#define NAME_PERMANENT(p) ((p) & NB_PERM)
#define NAME_ACTIVE(p) ((p) & NB_ACTIVE)
@@ -58,7 +64,6 @@
#define MSBROWSE "\001\002__MSBROWSE__\002"
-enum name_search { FIND_SELF, FIND_GLOBAL };
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};
@@ -66,13 +71,14 @@ enum cmd_type
{
NAME_STATUS_MASTER_CHECK,
NAME_STATUS_CHECK,
- MASTER_SERVER_CHECK,
- SERVER_CHECK,
- FIND_MASTER,
- CHECK_MASTER,
NAME_REGISTER,
NAME_RELEASE,
- NAME_CONFIRM_QUERY
+ NAME_QUERY_CONFIRM,
+ NAME_QUERY_SYNC,
+ NAME_QUERY_MST_SRV_CHK,
+ NAME_QUERY_SRV_CHK,
+ NAME_QUERY_FIND_MST,
+ NAME_QUERY_MST_CHK
};
/* a netbios name structure */
@@ -87,11 +93,15 @@ struct name_record
{
struct name_record *next;
struct name_record *prev;
- struct nmb_name name;
- time_t death_time;
- struct in_addr ip;
- int nb_flags;
- enum name_source source;
+
+ struct nmb_name name; /* the netbios name */
+ struct in_addr ip; /* ip address of host that owns this name */
+ int nb_flags; /* netbios flags */
+
+ enum name_source source; /* where the name came from */
+
+ time_t death_time; /* time record must be removed (do not remove if 0) */
+ time_t refresh_time; /* time record should be refreshed */
};
/* browse and backup server cache for synchronising browse list */
@@ -144,13 +154,63 @@ struct work_record
uint32 ElectionCriterion;
};
-/* a subnet structure. it contains a list of workgroups */
+/* initiated name queries recorded in this list to track any responses... */
+struct response_record
+{
+ struct response_record *next;
+ struct response_record *prev;
+
+ uint16 response_id;
+ enum cmd_type cmd_type;
+
+ int fd;
+ int quest_type;
+ struct nmb_name name;
+ int nb_flags;
+ time_t ttl;
+
+ BOOL bcast;
+ BOOL recurse;
+ struct in_addr to_ip;
+
+ int num_msgs;
+
+ time_t repeat_time;
+ time_t repeat_interval;
+ int repeat_count;
+};
+
+/* a subnet structure. it contains a list of workgroups and netbios names*/
+
+/* note that a subnet of 255.255.255.255 contains all the WINS netbios names.
+ all communication from such nodes are on a non-broadcast basis: they
+ are point-to-point (P nodes) or mixed point-to-point and broadcast
+ (M nodes). M nodes use point-to-point as a preference, and will use
+ broadcasting for certain activities, or will resort to broadcasting as a
+ last resort, if the WINS server fails (users of wfwg will notice that their
+ machine often freezes for 30 seconds at a time intermittently, if the WINS
+ server is down).
+
+ B nodes will have their own, totally separate subnet record, with their
+ own netbios name set. these do NOT interact with other subnet records'
+ netbios names, INCLUDING the WINS one (with an ip "address", so called,
+ of 255.255.255.255)
+
+ there is a separate response list for each subnet record. in the case of
+ the 255.255.255.255 subnet record (WINS), the WINS server will be able to
+ use this to poll (infrequently!) each of its entries, to ensure that the
+ names are still in use.
+ XXXX this polling is a planned feature for a really over-cautious WINS server
+*/
+
struct subnet_record
{
struct subnet_record *next;
struct subnet_record *prev;
- struct work_record *workgrouplist;
+ struct work_record *workgrouplist; /* list of workgroups */
+ struct name_record *namelist; /* list of netbios names */
+ struct response_record *responselist; /* list of responses expected */
struct in_addr bcast_ip;
struct in_addr mask_ip;
@@ -202,25 +262,6 @@ struct nmb_packet
};
-/* initiated name queries recorded in this list to track any responses... */
-struct name_response_record
-{
- struct name_response_record *next;
- struct name_response_record *prev;
-
- uint16 response_id;
- enum cmd_type cmd_type;
-
- int fd;
- struct nmb_name name;
- BOOL bcast;
- BOOL recurse;
- struct in_addr to_ip;
-
- time_t start_time;
- int num_msgs;
-};
-
/* a datagram - this normally contains SMB data in the data[] array */
struct dgram_packet {
struct {