Chapter 10. First Contact: Reaching the Server

Getting there is half the fun.

Unknown

We are approaching this thing in layers . A little history, a quick introductory tour... and now this. It may seem like a bit of a diversion , but the goal in this section is to figure out how a client finds the server and initiates a connection. No, we're not dealing with SMB protocol yet, but we can't send SMB messages until we can talk to a server.

Think of a telephone call. If you want to call your cousin in New York, the first thing you need to know is the telephone number. You could ask your uncle for the number or look it up in the telephone book, or perhaps you have it written on a scrap of paper somewhere in the kitchen with your favorite tofu recipes. If you dial the wrong number you will annoy some guy in a gas station in Brooklyn. When you dial the correct number, the underlying system will go through a complex process to set up the connection so that you can start talking to your cousin (or, more likely, to the answering machine).

Similarly, if you want to connect to an SMB server you might need to resolve a NetBIOS or DNS name to an IP address. Once you have the address, you can attempt to open a session with the server.

Consider this simple SMB URL:

 smb://server/ 

From the user 's perspective, that should be enough to build an initial connection to an SMB server named " server ".

From an implementation point of view, the first thing to do with this example is to parse out the " server " substring. In URI parlance, the field we are looking for is called the "host non-terminal," [1] and it contains the name or address of the server to which we are trying to connect. Our term for the parsed-out string is "Server Identifier." Once we have extracted it, the next thing we need to know how to do is interpret it so that we can use the information to create the session.

[1] The "host" field is not really a field, but the name of a non-terminal in the BNF grammar presented in RFC 2396. That grammar has been amended to support IP version 6 (IPv6) addressing in RFC 2732. The SMB URL format adds support for the use of NetBIOS names and Scope IDs, so it is a further extension of the syntax.



Implementing CIFS. The Common Internet File System
Implementing CIFS: The Common Internet File System
ISBN: 013047116X
EAN: 2147483647
Year: 2002
Pages: 210

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net