ct_config

Description

Sets or retrieves context properties.

Syntax

CS_RETCODE (context, action, property, buffer,
             buf_len, outlen);
CS_CONTEXT     *context;
CS_INT         action;
CS_INT         property; 
CS_BYTE        *buffer;
CS_INT         buf_len;
CS_INT         *outlen;

Parameters

context

(I) A context structure. The context structure is defined in the program call cs_ctx_alloc. It corresponds to the IHANDLE structure in the Open ServerConnect Gateway-Library.

If this value is invalid or nonexistent, ct_config fails.

action

(I) Action this call takes. action is an integer variable that indicates the purpose of this call.

Assign action one of the following symbolic values:

Value

Meaning

CS_GET (33)

Retrieves the value of the property.

CS_SET (34)

Sets the value of the property.

CS_CLEAR (35)

Clears the value of the property by resetting the property to its Client-Library default value.

property

(I) Symbolic name of the property for which the value is being set or retrieved. Client-Library properties are listed under “Remote procedure calls (RPCs)”, with descriptions, possible values, and defaults.

buffer

(I/O) Variable (buffer) that contains the specified property value.

If action is CS_SET, the buffer contains the value used by ct_config.

If action is CS_GET, ct_config returns the requested information to this buffer.

If action is CS_CLEAR, the buffer is reset to the default property value.

This argument is typically one of the following datatypes:

	int buffer[n]; char buffer[n]
buf_len

(I) Length, in bytes, of the buffer.

If action is CS_SET and the value in the buffer is a fixed-length or symbolic value, buf_len should have a value of CS_UNUSED.

If action is CS_GET and buffer is too small to hold the requested information, ct_cmd_props sets outlen to the length of the requested information and returns CS_FAIL. To retrieve all the requested information, change the value of buf_len to the length returned in outlen and rerun the application.

If action is CS_CLEAR, set this value to zeroes.

outlen

(O) Length, in bytes, of the retrieved information. outlen is an integer variable where ct_config returns the length of the property value being retrieved.

When the retrieved information is larger than buf_len bytes, an application uses the value of outlen to determine how many bytes it needs to hold the information.

outlen is used only when action is CS_GET.If action is CS_SET or CS_CLEAR, this value is zero.

Returns

ct_config returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

Examples

Example 1

The following code fragment demonstrates how to use ct_config to determine the maximum number of connections. It is taken from the sample program SYCTSAA6 in Appendix A, “Sample Language Application.”

  	/*------------------------------------------------------------*/
  	/* Find out what the maximum number of connections is         */
  	/*------------------------------------------------------------*/
         rc = ct_config (context, CS_GET, CS_MAX_CONNECT,
                         &maxconnect, CS_FALSE, outlen);
          if (rc != CS_SUCCEED)
         {
            strncpy (msgstr, "CT_CONFIG failed", msg_size);
            strncpy (msgtext2, "Please press return to
            continue!", text_size);
            error_out(rc);
            /* reset program flags to move on with the task */
            print_once = TRUE;
            diag_msgs_initialized = TRUE;
            strncpy(msgtext2, "Press Clear To Exit", text_size);
	}

Usage

See also

Related functions

Related topics