There should be a discussion of the global variables used by the server.
Name2Cmd // StatusMsg // Tcl_LoadLibrary // bartospace // copyString // createTclInterp // deleteTclInterp // emitData // emitLog // errorExit // escape_inplace // escape_shell_cmd // escape_tcl // escape_url // fatalError // ind // outstrBin // outstrC // outstrD // outstrL // outstrInit // outstrResize // outstrVC // outstrVD // outstrnC // outstrnD // rover_ctime // sendServerHeader // set_serverID // unescape_url // x2c MIME-Compliant Base 64 Encoding and Decoding Library Routines: b64init // b64towrite // b64towriteend // b64fromreadinit // b64fromread // b64fromfgets // b64fromfgets Fault-tolerant hash table functions stableHashInit // stableHashFetch // stableHashSetEntryReturns the CMDtype enumeration value associated with the name.
Returns a statically allocated string.
Returns the text string associated with a status code from the Codes enumeration.
Returns a statically allocated string.
Loads a Tcl file into the interpreter.
No return value.
Unescapes any spaces (encoded as underscores `_') in str, inplace.
Returns the unescaped string.
Copies a string, allocating a new string.
Returns a copy of the string. The user is responsible for freeing the string.
Creates a Tcl interpreter, or if the Rover server is running standalone, looks for an interpreter in the tuple consisting of: <Host, user, service>. If an interpreter is created, it runs the local configuration file (which among other things should remove any commands we don't want downloaded programs to use), and then installs some Rover commands.
Returns 0, if a new interpreter was created; 1, if an existing interpreter was found, and -1, if an error occurred.
Deletes the current interpreter (for the standalone server, also deletes the saved copy).
No return value.
Begins a data segment in the output buffer. The buffer previously must have been in the code segment mode, otherwise an errorExit will occur.
No return value.
Begins a log suffix segment in the output buffer. The buffer previously must have been in the code or data segment mode, otherwise an errorExit will occur.
No return value.
Indicates that the server has encountered a recoverable error. Sends an error object back to the client.
No return value.
Escapes a TCL string in place (the string must be in a buffer with a minimum size of 2n). This table lists the characters that are escaped.
No return value.
Caution should be exercised in using this command to escape strings that are going to be passed to the shell (e.g., using system). Potential security holes may still exist.
Escapes a string for the purpose of using it as a shell command by inserting a \ before any special shell characters. Allocates a new string if any escaping occurs. This table lists the characters that are escaped.
If the string is escaped, returns a newly allocated string (the caller is responsible for freeing the string). Otherwise, the original string is returned.
Escapes a string for the purpose of using it within Tcl by inserting a \ before any special Tcl characters. Allocates a new string if any escaping occurs. This table lists the characters that are escaped.
If the string is escaped, returns a newly allocated string (the caller is responsible for freeing the string). Otherwise, the original string is returned.
Escapes a URL for transmission by substituting a '%' followed by a two digit hexadecimal code for any characters that cannot be transmitted raw. This table lists the characters that are escaped. The inverse function is unescape_url.
Returns the escaped string, the caller is responsible for freeing the string.
Indicates that the server has encountered an unrecoverable error. Terminates the server.
No return value.
Returns the index of ch in string str.
Returns the index of of the leftmost matching character, or -1 if the character is not found.
Outputs count bytes of binary data from bin to the output buffer (the buffer must not be in code, data, or log suffix segment mode or an errorExit will occur).
No return value.
Outputs string to the code segment of the output buffer (the buffer must be in code segment mode or an errorExit will occur).
No return value.
Outputs string to the data segment of the output buffer (the buffer must be in data segment mode or an errorExit will occur).
No return value.
Generates a log suffix record and inserts the record into the log suffix segment of the output buffer (the buffer must be in log suffix segment mode or an errorExit will occur). The operation is not escaped.
No return value.
Initialize the output buffer and all related variables. The buffer will be at least size bytes in size.
No return value.
Resizes the output buffer to be at least size bytes in size.
No return value.
Outputs text to the code segement, applying substitutions first (the buffer must be in code segment mode or an errorExit will occur). count specifies the number of values (up to 9) provided for substitution in template. Each substition within template is specified as `%n', where n refers to the nth provided value.
No return value.
Outputs text to the data segement, applying substitutions first (the buffer must be in data segment mode or an errorExit will occur). count specifies the number of values (up to 9) provided for substitution in template. Each substition within template is specified as `%n', where n refers to the nth provided value.
No return value.
Outputs count bytes of string to the code segment of the output buffer (the buffer must be in code segment mode or an errorExit will occur).
No return value.
Outputs count bytes of string to the data segment of the output buffer (the buffer must be in data segment mode or an errorExit will occur).
No return value.
Similar to the C library function ctime, converts a time_t time into it's ASCII representation (e.g., "Wed Jun 30 21:49:08 1993"). Differs in that it strips the trailing newline.
Returns the ASCII representation of time in a statically allocated string.
Constructs and sends a status header to the client, followed by the output buffer and any dependency information. Sets extra to the number of bytes of dependency vector information sent to the client.
Returns the number of bytes sent to the client from the output buffer.
Sets the server's unique server identifier.
Unescapes an escaped URL, substituting the equivalent ASCII character for three-character `%XX' hexadecimal sequences. This reverses the escaping performed by escape_url This table lists the affected characters.
No return value.
Returns the ASCII character associated with a 2-digit hexadecimal value.
Returns the ASCII character representation of hex.
Routines for writing and reading MIME-compliant base 64 encoded data to and from a stream.
To encode a stream, first call b64toinit to initialize the encoder. Then call b64towrite to write and encode data to the stream. Finish by calling b64towriteend (this operation does not close file).
To decode a stream, first call b64fromreadinit on an open stream to initialize the decoder. Then call b64fromread and/or b64fromfgets (similar in function to the fread and fgets functions to read blocks or lines. Finish by calling b64fromend when done.
Initializes an encoder structure to begin encoding.
No return value.
Writes n bytes from ptr to the stream f, encoded in base 64.
No return value.
Flushes any leftover bytes to the stream f, then adds an extra newline for luck. Does not close the stream.
No return value.
Initializes a decoder structure to decoding.
No return value.
Reads and decodes up to n bytes from stream f, placing them in buf.
Returns the number of bytes actually read.
Reads and decodes up to n bytes from stream f, placing them in buf. Stops if a newline is read.
Returns the number of bytes actually read.
Clean up after decoding.
No return value.
These Standalone Daemon server functions implement stable hash table services. These procedures can be used to create long-running RDOs that will survive (reasonable) failures of the server process or machine.
Declares and initializes a stable hash table named tableName and logs the information to a stable log. Upon restart after a server failure, the stable hash table will be recreated and reinitialized. Note: There is a 256 character limit on table names.
Returns 1 if the table was created; otherwise, returns 0.
Fetches the entry with the key entryName in the stable hash table tableName.
Returns the entry if one is found; otherwise, returns NULL.
Creates or updates the entry with the key entryName in the stable hash table tableName.
Returns 0 if the entry was successfully updated; otherwise, returns -1.
Saves the current output buffer to the stable log.
No return value.