next up previous contents
Next: Simple Scheduler Up: Program Interface Previous: Time Stamp   Contents

Command Execution

Commands are executed as they are received. Figure 2.9 is a schematic representation of what happens to a command string when it is received by the ZY. When a complete command string is received, the ZY then passes it to a command parsing object, of class CmdParam. This object breaks down the command string into its component, making these available through public member functions. The Command is available through the CmdParam::Cmd() function. The Time Stamp (if provided) is available through the CmdParam::TS() function. The Transaction ID (if provided), through the CmdParam::TID() function. The parameter count is available through the CmdParam::Count() function, and each parameter is available through the CmdParam::operator[] function, where CmdParam::operator[i] would return the ${\rm i}^{th}$ parameter (0 based). Once a command string is placed in the CmdParam object, the command is looked up in a hash table, and the resulting function pointer is then executed, with the CmdParam object as parameter. The hash table will always return a valid function. If the command name is unknown, an error handling function is returned by the hash table. This function simply returns the error string:
  UNKNOWN command <CMD>
where $<$CMD$>$ is the command name that was not found in the table. If a valid command name was given, the ZY will find a pointer to the corresponding command handler in the hash table and execute it. When this handler runs, the first thing it does is to validate all of its parameters. If an error occurs because a parameter is out of range or cannot be converted to the proper numeric value, an appropriate error message is generated by the handler and returned by the ZY. The ZY's user needn't wait for a command to execute successfully before sending a new one. Because of the TCP buffers (and the command buffer in the ZY), many commands can be queued up waiting to be executed. They will all be executed in the sequence in which they were received, however. (Since the communications consist of a TCP socket, for the ZY's client this means that the commands will be executed in the same sequence that they were sent to the ZY).
next up previous contents
Next: Simple Scheduler Up: Program Interface Previous: Time Stamp   Contents
Ramon E. Creager 2002-03-11