blob: 4913d39e0e29f4a87839e165c6dffa722419e62c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
module namedbresp deals with the maintenance of the list of expected
responses - creating, finding and removal.
module nameresp deals with the initial transmission, re-transmission
and time-out of netbios response records.
/*************************************************************************
find_response_record()
*************************************************************************/
this function is responsible for matching the unique response transaction
id with an expected response record. as a side-effect of this search,
it will find the subnet (or the WINS pseudo-subnet) that samba expected
the response to come from.
/*************************************************************************
make_response_queue_record()
*************************************************************************/
this function is responsible for creating a response record, which will
be queued awaiting a response.
the number of retries is set to 3, and the retry period set to 1 second.
if no response is received, then the packet is re-transmitted, which is
why so much information is stored in the response record.
the number of expected responses queued is kept, so listen_for_packets()
knows it must time-out after 1 second if one or more responses are
expected.
/*************************************************************************
remove_response_record()
*************************************************************************/
this function is responsible for removing a response record from the
expected response queue. the number of expected responses is decreased.
/*************************************************************************
add_response_record()
*************************************************************************/
this function is responsible for adding the response record created by
make_response_queue_record() into the appropriate response record queue.
-----------------
NOTE FROM TRIDGE:
namedbresp.c is interesting because it implements a novel way of
getting most of the advantages of a multi-threaded nmbd daemon without
the portability problems.
The NBT specs (rfc1001/1002) talk about the 16 bit IDs in the packets
as being used to ensure that packets are unique, and to stop packets
from being confused. It suggests incrementing the ID by 1 each time.
Instead Luke uses these IDs to identify individual threads of control
in nmbd. So when nmbd sends out a NBT packet as part of some complex
processing, it adds to a linked list the information required to
continue the processing when the reply comes in (or it times
out). When a reply arrives this list can be searched to find the
matching query and the next step in the processing can be carried out.
This is really good stuff, and allows for much more complex behaviour
than was possible with the old nmbd.
----------------
|