7.2. Routine Descriptions

enscmddriver_connect

/*******************************************************************************
*  Starts up connection to the EnSight client to drive it via commands.
*  Parameters:
*     host_toconnectto       - Character buffer containing hostname
*                              where EnSight is running.
*     sockport               - Port number to use for socket( > 1024).
*     print_error            - if (1) will print errors to stderr when
*                              they occur.
*  Return Values:
*    On Success              - Socket file descriptor to communicate with
*                              EnSight, if success.
*    On Failure
*      ENS_SOCKRANGE         - Port number out of range. Must be > 1024.
*      ENS_CONNECT           - Connection to EnSight failed.  EnSight must
*                              be ready for the external command connection.
*      ENS_HANDSHAKE         - The call to receive the handshake string
*                              from the EnSight client failed.
*      ENS_HOSTTOOLONG       - The hostname specified is too large.
******************************************************************************/ 
int
enscmddriver_connect(char *host_toconnectto,
                     int   sockport, 
                     int   print_error)

enscmddriver_sendmesg

/*******************************************************************************
*  This routine sends the EnSight client a command and waits for an ok (or ERROR).
*  Parameters:
*     comm_socket            - Socket to communicate on.
*     cmd                    - command string being sent
*     print_error            - if (1) will print errors to stderr when
*                              they occur.
*  Return Values:
*      1 - upon success
*     -1 - upon failure
******************************************************************************/ 
int
enscmddriver_sendmesg(int   comm_socket,
                      char *cmd,
                      int   print_error)

Note:  The cmd argument can be basically any of the commands in the EnSight Command language.


enscmddriver_query

/*******************************************************************************
*  This routine sends the EnSight client a query command and waits for the results.
*  Parameters:
*     comm_socket            - Socket to communicate on.
*     query_keyword          - Query keyword
*     param_array_cnt        - Count of parameters in array below.
*     param_array            - Floating point array containing any parameters
*                              for the query operation.  The count above helps
*                              to clarify any changes that might be made to
*                              a particular query in the future.  This will
*                              help to allow forward/backward compatibility
*                              and prevent users from always having to use
*                              the latest library.
*
*     ***NOTE: the next 6 need to be passed in by address(ex. &ret_int_cnt)
*              because return values will be placed in the ...cnt variables
*              and space will be allocated for the others and return
*              information will be placed in this space.
*     ret_charstr_cnt        - Count of strings concatenated into string return
*     ret_char_str           - String(s) returned from query and separated
*                              by NULLs.  When the user finishes with the
*                              information they must use free() to deallocate.
*     ret_int_cnt            - Count of integers in return int array.
*     ret_int_array          - Array of integer return values.   When the user
*                              finishes with the information they must use
*                              free() to deallocate.
*     ret_float_cnt          - Count of floats in return float array.
*     ret_float_array        - Array of float return values.   When the user
*                              finishes with the information they must use
*                              free() to deallocate.
*
*     ret_error_buf          - Buffer for error return string.  This buffer
*                              should be preallocated to 500 characters by
*                              the caller.  It will contain a NULL terminated
*                              error string when the return value is -1.
*
*  Return Values:
*    On Success              - (1)
*    On Failure              - (-1)  (See error_buffer above)
*
******************************************************************************/ 
int
enscmddriver_query(int     comm_socket,
                   char   *query_keyword, 
                   int     param_array_cnt,
                   float  *param_array,
                   int    *ret_charstr_cnt, 
                   char  **ret_char_str, 
                   int    *ret_int_cnt,
                   int   **ret_int_array, 
                   int    *ret_float_cnt, 
                   float **ret_float_array,
                   char    ret_error_buf[500])

enscmddriver_disconnect

/*******************************************************************************
* This routine cleans up the connection to EnSight.  This must
* be done before you exit, especially if your application is dieing
* because it received a signal.  If the socket is not closed properly
* your port may become hung and you won’t be able to use it until
* it is cleared out by a reboot of your system or some other event.
*
*  Parameters:
*     comm_socket            - Socket to communicate on.
*
*   Return Values:
*      None
******************************************************************************/ 
void
enscmddriver_disconnect(int comm_socket)