Sets or retrieves context properties.
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;
(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.
(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. |
(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.
(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]
(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.
(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.
ct_config returns one of the following values:
Value |
Meaning |
---|---|
CS_SUCCEED (-1) |
The routine completed successfully. |
CS_FAIL (-2) |
The routine failed. |
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); }
cs_config sets or retrieves the values of CS_EXTRA_INF and CS_VERSION. All other context properties are set or reset by ct_config. Context properties define aspects of Client-Library behavior at the context level.
All connections created within a context pick up default property values from the parent context. An application can override these default values by calling ct_con_props to set property values at the connection level.
If an application changes context property values after allocating connections for the context, the existing connections do not pick up the new property values. Only new connections allocated after the new context property values are set use the new values as defaults.
Related functions
Related topics