Autodocs for `Grid Engine Communication Library'


Next: , Up: (dir)


1 cl_commlib


1.1 cl_com_messages_in_send_queue

NAME
          cl_com_messages_in_send_queue() -- Returns the number of messages in the
                                             send queue of the communication library

SYNOPSIS
          unsigned long cl_com_messages_in_send_queue(cl_com_handle_t *handle)

FUNCTION
          Returns the number of messages in the send queue of the commlib
          library, i.e. the messages that were placed into the send queue
          using the cl_commlib_send_message() function but were not
          immediately sent.

INPUTS
          cl_com_handle_t *handle - Handle of the commlib instance.

RESULT
          unsigned long - Number of messages in send queue.

NOTES
          MT-NOTE: cl_com_messages_in_send_queue() is MT safe

SEE ALSO


1.2 cl_com_setup_commlib_complete

NAME
          cl_com_setup_commlib_complete() -- check whether commlib setup was called

SYNOPSIS
          bool cl_com_setup_commlib_complete(void)

FUNCTION
          This function returns true when cl_com_setup_commlib() was called
          at least one time.

RESULT
          bool - true:  cl_com_setup_commlib() was done
                      false: There was no commlib setup till now

NOTES
          MT-NOTE: cl_com_setup_commlib_complete() is MT safe

SEE ALSO


2 cl_communication


2.1 cl_com_close_connection

NAME
          cl_com_close_connection() -- cleanup a connection

SYNOPSIS
          int cl_com_close_connection(cl_com_connection_t* connection)

FUNCTION
          This wrapper function will call the correct cl_com_xxx_close_connection()
          function for the selected framework. The called function must free
          the memory for the connection->com_private pointer.

INPUTS
          cl_com_connection_t* connection - pointer to a cl_com_connection_t
                                            structure

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


2.2 cl_com_connection_request_handler

NAME
          cl_com_connection_request_handler() -- Get new incomming connections

SYNOPSIS
          int cl_com_connection_request_handler(cl_com_connection_t* connection,
          cl_com_connection_t** new_connection, int timeout_val_sec, int
          timeout_val_usec)

FUNCTION
          This wrapper function will call the correct
          cl_com_xxx_connection_request_handler() function for the selected
          framework.
          
          It will create a new connection pointer and sets new_connection to the
          new connection when connection requests are queueing. new_connection
          must point to NULL when calling this function.
          
          The new connection must be handled (and erased) by the caller of this
          function.

INPUTS
          cl_com_connection_t* connection      - pointer to service connection
                                                 struct. (Created with a call to
                                                 cl_com_connection_request_handler_setup())
          cl_com_connection_t** new_connection - pointer to an address of a cl_com_connection_t
                                                 struct. (will be set to a new
                                                 connection)
          int timeout_val_sec                  - timeout in sec
          int timeout_val_usec                 - timeout in usec

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


2.3 cl_com_connection_request_handler_cleanup

NAME
          cl_com_connection_request_handler_cleanup() -- cleanup service

SYNOPSIS
          int cl_com_connection_request_handler_cleanup(cl_com_connection_t*
          connection)

FUNCTION
          This wrapper function calls the correct
          cl_com_xxx_connection_request_handler_cleanup() function to shutdown a
          server connection.

INPUTS
          cl_com_connection_t* connection - open service connection struct

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


2.4 cl_com_connection_request_handler_setup

NAME
          cl_com_connection_request_handler_setup() -- Setup service

SYNOPSIS
          int cl_com_connection_request_handler_setup(cl_com_connection_t*
          connection)

FUNCTION
          This function is used to setup a connection service handler. All service
          specific setup is done here. When the setup was done the connection can
          be used to call cl_com_connection_request_handler(). To shutdown the
          service a call to cl_com_connection_request_handler_cleanup() must be done.
          
          This function is only a wrapper for the correct
          cl_com_xxx_connection_request_handler_setup() function of the selected
          framework.

INPUTS
          cl_com_connection_t* connection - pointer to a inizialized connection

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


2.5 cl_com_open_connection

NAME
          cl_com_open_connection() -- open a connection to a service handler

SYNOPSIS
          int cl_com_open_connection(cl_com_connection_t* connection, const char*
          comp_host, const char* comp_name, int comp_id, int timeout)

FUNCTION
          This function is called to setup a connection to a service handler. The
          connection object (cl_com_connection_t) must be initalized with a call
          to cl_com_setup_xxx_connection (e.g. cl_com_setup_tcp_connection() for
          a CL_CT_TCP connection which is using tcp/ip for transport)

INPUTS
          cl_com_connection_t* connection - pointer to a connection object
          const char* comp_host           - host of service
          const char* comp_name           - component name of service
          int comp_id                     - component id of service
          int timeout                     - timeout for connection establishment

RESULT
          int - CL_COMM_XXXX error value or CL_RETVAL_OK for no errors

SEE ALSO


2.6 cl_com_open_connection_request_handler

NAME
          cl_com_open_connection_request_handler() -- Check for incomming data

SYNOPSIS
          int cl_com_open_connection_request_handler(int framework_type,
          cl_raw_list_t* connection_list, int timeout)

FUNCTION
          This function is a wrapper for the correct
          cl_com_xxx_open_connection_request_handler() function of the selected
          framework.
          
          This function will set the connection data_read_flag if there is any
          data to read from this connection.

INPUTS
          int framework_type             - framework type of connection list
          cl_raw_list_t* connection_list - list of connections to check
          int timeout                    - timeout

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


2.7 cl_com_tcp_setup_connection

NAME
          cl_com_tcp_setup_connection() -- setup a connection type

SYNOPSIS
          int cl_com_tcp_setup_connection(cl_com_connection_t* connection, int
          server_port, int connect_port)

FUNCTION
          This function is used to setup the connection type. It will malloc
          a cl_com_tcp_private_t structure and set the pointer
          connection->com_private to this structure.
          
          When the connection structure is used to provide a service the server_port
          must be specified. If the connection is used to be a client to a service
          the connect_port must be specified.
          
          The memory obtained by the malloc() call for the cl_com_tcp_private_t structure
          is released by a call to cl_com_tcp_close_connection()

INPUTS
          cl_com_connection_t* connection - empty connection structure
          int server_port                 - port to provide a tcp service
          int connect_port                - port to connect to
          int data_flow_type              - CL_COM_STREAM or CL_COM_MESSAGE

RESULT
          int - CL_COMM_XXXX error value or CL_RETVAL_OK for no errors

SEE ALSO


3 cl_tcp_framework


3.1 cl_com_tcp_close_connection

NAME
          cl_com_tcp_close_connection() -- close and shutdown a tcp connection

SYNOPSIS
          int cl_com_tcp_close_connection(cl_com_connection_t* connection)

FUNCTION
          This function will shutdown and close the connection (if open) and free
          the connection->com_private pointer for a tcp connection.

INPUTS
          cl_com_connection_t* connection - connection pointer

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


3.2 cl_com_tcp_connection_request_handler

NAME
          cl_com_tcp_connection_request_handler() -- Check for connection requests

SYNOPSIS
          int cl_com_tcp_connection_request_handler(cl_com_connection_t*
          connection, cl_com_connection_t** new_connection, int timeout_val_sec,
          int timeout_val_usec)

FUNCTION
          This function will do a select call for the service connection file de-
          scriptor. If the select returns with no error the connection is accepted
          (via accept()) and a new connection structure ( cl_com_connection_t )
          is malloced. The new connection will get all default settings from the
          service connection struct.
          
          This function has to fill all struct information for the new connection
          ( cl_com_connection_t type)

INPUTS
          cl_com_connection_t* connection      - pointer to service connection
          cl_com_connection_t** new_connection - NULL
          int timeout_val_sec                  - timeout value in sec (for select)
          int timeout_val_usec                 - timeout value in usec (for select)

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success
          an address to a new connection in new_connection parameter

SEE ALSO


3.3 cl_com_tcp_connection_request_handler_cleanup

NAME
          cl_com_tcp_connection_request_handler_cleanup() -- shutdown service

SYNOPSIS
          int cl_com_tcp_connection_request_handler_cleanup(cl_com_connection_t*
          connection)

FUNCTION
          This function will shutdown a service connection, created with the
          cl_com_tcp_connection_request_handler_setup() function. Free the connection
          with cl_tcp_close_connection() has to be done by caller.

INPUTS
          cl_com_connection_t* connection - Connection to shutdown

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


3.4 cl_com_tcp_connection_request_handler_setup

NAME
          cl_com_tcp_connection_request_handler_setup() -- bind tcp/ip socket

SYNOPSIS
          int cl_com_tcp_connection_request_handler_setup(cl_com_connection_t*
          connection)

FUNCTION
          This function creates a new stream socket and sets SO_REUSEADDR socket
          option. After that the socket is bind to the server_port. A final listen
          enables connection requests on that socket.

INPUTS
          cl_com_connection_t* connection - pointer to connection

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


3.5 cl_com_tcp_free_com_private

NAME
          cl_com_tcp_free_com_private() -- free private struct of a tcp connection

SYNOPSIS
          int cl_com_tcp_free_com_private(cl_com_connection_t* connection)

FUNCTION
          This function will free the com_private struct pointer of a tcp connection
          struct

INPUTS
          cl_com_connection_t* connection - pointer to tcp/ip connection

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success


3.6 cl_com_tcp_get_private

NAME
          cl_com_tcp_get_private() -- get cl_com_tcp_private_t struct of a connection

SYNOPSIS
          static cl_com_tcp_private_t* cl_com_tcp_get_private(cl_com_connection_t*
          connection)

FUNCTION
          This function returns the com_private pointer of the connection and does
          a type cast.

INPUTS
          cl_com_connection_t* connection - tcp connection to get private struct

RESULT
          static cl_com_tcp_private_t* - pointer to private tcp data of tcp connection


3.7 cl_com_tcp_open_connection

NAME
          cl_com_tcp_open_connection() -- open a tcp/ip connection

SYNOPSIS
          int cl_com_tcp_open_connection(cl_com_connection_t* connection, const
          char* comp_host, const char* comp_name, int comp_id, int timeout)

FUNCTION
          This function will create a new socket file descriptor and set the
          SO_REUSEADDR socket option and the O_NONBLOCK file descriptor flag.
          After that the socket will try to connect the service handler on the
          given connect_port (set with cl_com_tcp_setup_connection()) on the
          host specified with comp_host. After a successful connect the
          TCP_NODELAY socket option is set.

INPUTS
          cl_com_connection_t* connection - pointer to a connection struct
          const char* comp_host           - host where a service is available
          const char* comp_name           - component name of service
          int comp_id                     - component id of service
          int timeout                     - timeout for connect

RESULT
          int - CL_COMM_XXXX error value or CL_RETVAL_OK for no errors

SEE ALSO


3.8 cl_com_tcp_open_connection_request_handler

NAME
          cl_com_tcp_open_connection_request_handler() -- ???

SYNOPSIS
          int cl_com_tcp_open_connection_request_handler(cl_raw_list_t*
          connection_list, int timeout_val)

FUNCTION
          First action of this function is do set the data_read_flag of each
          connection in the list to CL_COM_DATA_NOT_READY.
          
          After that this function will do a select on all file descriptors in
          the list for reading. If the select returns that there is data for a
          connection the data_read_flag of the connection
          ( struct cl_com_connection_t ) is set.

INPUTS
          cl_raw_list_t* connection_list - connection list
          int timeout_val                - timeout for select

RESULT
          int - CL_RETVAL_XXXX error or CL_RETVAL_OK on success

SEE ALSO


4 commlib


4.1 cl_xml_parsing


4.1.1 cl_com_transformString2XML

NAME
          cl_com_transformString2XML() -- convert special chars to escape sequences

SYNOPSIS
          int cl_com_transformString2XML(const char* input, char** output)

FUNCTION
          This function will parse the input char string and replace characters
          by escape sequences in the output string where necessary. The user has
          to sge_free() the output string.

INPUTS
          const char* input - input string without xml escape sequences
          char** output     - pointer to empty string pointer. The function will
                              malloc() memory for the output string and return
                              the input string with xml escape sequences.
          
          Character      XML escape sequence        name
          
            '\n'         "
"                   carriage return
            '\r'         "
"                   linefeed
            '\t'         "	"                   tab
            '&'          "&"                    amp
            '<'          "&lt;"                     lower than
            '>'          "&gt;"                     greater than
            '"'          "&quot;"                   quote
            '\''         "&apos;"                   apostrophe

RESULT
          int - CL_RETVAL_OK     - no errors
                CL_RETVAL_PARAMS - input or output are not correctly initialized
                CL_RETVAL_MALLOC - can't malloc() memory for output string

NOTES
          MT-NOTE: cl_com_transformString2XML() is MT safe

SEE ALSO


4.1.2 cl_com_transformXML2String

NAME
          cl_com_transformXML2String() -- convert XML escape sequences to string

SYNOPSIS
          int cl_com_transformXML2String(const char* input, char** output)

FUNCTION
          Converts an XML string into standard string without XML escape sequences.
          
          
          Character      XML escape sequence        name
          
            '\n'         "&#x0D;"                   carriage return
            '\r'         "&#x0A;"                   linefeed
            '\t'         "&#x09;"                   tab
            '&'          "&amp;"                    amp
            '<'          "&lt;"                     lower than
            '>'          "&gt;"                     greater than
            '"'          "&quot;"                   quote
            '\''         "&apos;"                   apostrophe

INPUTS
          const char* input - xml sequence string
          char** output     - pointer to empty string pointer. The function will
                              malloc() memory for the output string and return
                              the input string with xml escape sequences converted to
                              standard string characters.

RESULT
          int - CL_RETVAL_OK     - no errors
                CL_RETVAL_PARAMS - input or output are not correctly initialized
                CL_RETVAL_MALLOC - can't malloc() memory for output string

NOTES
          MT-NOTE: cl_com_transformXML2String() is MT safe

SEE ALSO


Function Index

Table of Contents