Next: Camera Pan-Tilt Controller Up: Under the Hood Previous: Getting Started

The sniffle Interpreter

This section describes the operation of the interpreter at the core of the sniffle system. It assumes a basic knowledge of the WinHTTPD server, the cgi-win interface, and Visual Basic.

The easiest way to learn how the interpreter works is to follow a string of commands on its journey from the client's Web browser through execution at the server and back to the client, in the form of diagnostic output. The discussion that follows will be much clearer if you simultaneously read the Visual Basic code listed in an appendix. Start reading in module webrti.bas at subroutine Main.

The process begins when a client-end user enters a set of sniffle commands in his/her Web browser as described in the ``User's Guide'' section of this document. The Web client URL-encodes the contents of the and POSTs it to the WinHTTPD server. Alternately, the client may use the somewhat outmoded GET method, appending a query string to the URL it submits to the server; this method is used with clickable imagemaps. In either case a URL-encoded string is sent to the WEBRTI.EXE cgi-win program at the server end.

The URL-encoded string consists of a series of key-value pairs, and one of the keys must be ``commandstring.'' WEBRTI.EXE looks for this key in two places. It first checks GET-method query strings, then POST-method data bodies. It extracts the value corresponding to key ``commandstring,'' decodes it, strips out comments and translates newlines to semicolons, then passes the resulting string along to subroutine Interp.

Interp splits the command string on semicolons and passes each individual command to subroutine Exec. Exec decides what sort of command it has received (e.g. TEK, DIN, etc.) and passes the buck to subroutines which execute the appropriate Visual Basic commands. These subroutines return strings containing either error messages or, in the case of input commands, feedback from the oscilloscope or I/O board, which Exec appends to a global log string. This string is eventually returned to the client as part of the session log.



Next: Camera Pan-Tilt Controller Up: Under the Hood Previous: Getting Started


tpkelly@cs.CS.Princeton.EDU
Thu Sep 14 02:35:48 EDT 1995