Ronnie Sahlberg wrote:
>
> I was thinking something along the line of adding code to packet-nfs.c to
> scan for
> special packets where one can determine the mapping between filehandles and
> filenames,
> say LOOKUP and similar packets.
> The code could then build a dynamic linked list holding all these mappings.
If you use a balanced tree or a hash table, lookup time would be
minimal. For a balanced tree with 100,000 elements (the number of files
in a typical desktop computer's filesystem), the tree will only be 17
levels deep. These days, with STL available for virtually every
compiler, you could just use a map container, rather than implement your
own tree algorithm.
100,000 files in a single capture session is a pretty far-out scenario.
Assuming that each file's record takes 300 bytes to store in memory (256
bytes per file plus some associated data) you're talking about 28.6 MB
of memory. That's a lot, but within reach of any current computer. In
more likely scenarios, you won't need to use 300 bytes per file, and
you'll probably see much less than 100,000 files in a single capture
session.
--
= Warren Young, maintainer of the Winsock Programmer's FAQ at:
= http://www.cyberport.com/~tangent/programming/winsock/
=
= ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m