Thread properties

A thread is a piece of code that executes to accomplish a specific task or set of tasks. There are several types of Open Server threads. Thread properties define aspects of a thread’s behavior and set limits on its resources.

For more details on Open Server threads, see “Multithread programming”.

Only a few thread properties can be set, but all are retrievable. An application calls srv_thread_props to retrieve and set a thread property value. Properties that can be set are noted as such in the srv_thread_props reference page. An application can retrieve and set thread properties at any point after initialization.

Open Server assigns defaults for each thread property that can be set when it creates threads at initialization time. See srv_thread_props for a list of defaults.

Table 2-28: Thread properties

Property name

Definition

Notes

SRV_T_APPLNAME

The client application’s name.

SRV_T_BYTEORDER

The client’s requested byte-ordering scheme. SRV_LITTLE_ENDIAN indicates that the least significant byte is the high byte. SRV_BIG_ENDIAN indicates that the least significant byte is the low byte.

SRV_T_BULKTYPE

The type of bulk transfer being sent by the client.

See “SRV_T_BULKTYPE” for a list of legal values.

SRV_T_CHARTYPE

The type of character data representation.

See “SRV_T_CHARTYPE” for a list of legal values.

SRV_T_CIPHER_SUITE

CS_CHAR* The CipherSuite that is used to encrypt and decrypt data exchanged during the SSL-based session. The CipherSuite is negotiated during the connection handshake.

SRV_T_CLIB

The name of the library product used by the client to connect to the Open Server application.

SRV_T_CLIBVERS

The version of the library product used by the client to connect to the Open Server application.

SRV_T_CLIENTLOGOUT

A Boolean. Indicates whether the client completed an orderly or aborted logout, where CS_TRUE indicates an orderly logout.

This property can only be retrieved from inside the SRV_DISCONNECT event handler.

SRV_T_CONVERTSHORT

A Boolean. Indicates whether to automatically convert 4-byte datetime, 4-byte floating point, and 4-byte money datatypes to their 8-byte counterparts.

SRV_T_DUMPLOAD

A Boolean. Indicates whether to disallow the use of dump/load and bulk insert for this client connection.

SRV_T_ENDPOINT

The file descriptor or file handle of the connected client. For subchannels, the site handler end point value is returned. SRV_T_ENDPOINT is equivalent to the CS_ENDPOINT value in Client-Library.

Valid for client threads, site handlers and subchannels. Not valid for service threads.

See “SRV_T_ENDPOINT” for an example of using SRV_T_ENDPOINT.

SRV_T_EVENT

The Open Server event the thread is currently in.

See “SRV_T_EVENT” for a list of legal values.

SRV_T_EVENTDATA

A generic data address associated with a particular event raised by the Open Server application.

Data address set using srv_event.

SRV_T_FULLPASSTHRU

A Boolean. When set to CS_TRUE, the SRV_FULLPASSTHRU event handler is activated for the thread.

Can only be set inside the Open Server application’s connect handler.

The value of the SRV_T_EVENT property is SRV_FULLPASSTHRU when retrieved inside the full-passthrough event handler.

SRV_T_FLTTYPE

The type of floating point representation used by the client.

See “SRV_T_FLTTYPE” for a list of legal values.

SRV_T_GOTATTENTION

A Boolean. Indicates whether the client thread has received an attention.

SRV_T_HOSTNAME

The name of the host machine from which the client connection originated.

SRV_T_HOSTPROCID

The process ID of the client program.

This is the operating system process ID received in the client login record.

SRV_T_IODEAD

A Boolean. Indicates whether a thread’s I/O channel is valid.

CS_TRUE means a thread cannot successfully perform I/O, CS_FALSE means it can. Open Server always returns CS_FALSE for service threads.

SRV_T_LOCALE

A pointer to a CS_LOCALE structure allocated by the Open Server application.

Use this property to retrieve or set localization information.

SRV_T_LOGINTYPE

The type of login record received.

See “SRV_T_LOGINTYPE” for a list of legal values.

SRV_T_MIGRATED

A Boolean. Indicates whether a connection is a new or a migrated connection. This read-only property is set to true when the client is migrating or has migrated to the server.

See “SRV_T_MIGRATED” for more details.

SRV_T_MIGRATE_STATE

Indicates the migration state of the client. It is a read-only property that any thread can access.

See “SRV_T_MIGRATE_STATE” for more details.

SRV_T_MACHINE

The host name of the machine the client thread is running on.

SRV_T_NEGLOGIN

The type of negotiated login, if any, the client has requested.

This property is a bitmask that can take any of five values:

  • SRV_CHALLENGE signals the client’s intent to negotiate through a challenge/response exchange.

  • SRV_ENCRYPT signals the client’s intent to pass a symmetrically encrypted password.

  • SRV_SECLABEL indicates that the client will send security labels.

  • SRV_APPDEFINED indicates that an application-defined login handshake is in use.

  • SRV_EXTENDED_ENCRYPT signals the client’s intent to pass an assymetrically encrypted password.

SRV_T_NOTIFYCHARSET

A Boolean. Indicates whether the client should be notified when the character set in use has changed.

SRV_T_NOTIFYDB

A Boolean. Indicates whether the client should be notified of the outcome of a use db Transact-SQL command.

SRV_T_NOTIFYLANG

A Boolean. Indicates whether the client should be notified when the national language in use has changed.

SRV_T_NOTIFYPND

The number of pending notifications to be delivered to the client.

This property is retrieve-only.

SRV_T_NUMRMTPWDS

The number of remote passwords.

SRV_T_PACKETSIZE

The negotiated packet size used to communicate with the client.

The packet size is negotiated transparently at login time.

SRV_T_PASSTHRU

A Boolean. Indicates whether the client thread is operating in passthrough mode.

With version 11.1, this property can be set inside the application’s connect handler.

When set to CS_TRUE, the srv_getloginfo and ct_setloginfo routines negotiate the client connection’s capabilities independently of the Open Server’s capabilities. Since a full-passthrough gateway does not recognize different command and result types, this is the desired behavior.

SRV_T_PRIORITY

The priority level at which Open Server should schedule the thread.

This property is retrieve-only. To set a thread’s priority, call srv_setpri.

SRV_T_PWD

The password string the client sent in the login record.

For remote server connections, this property returns the remote server password.

SRV_T_RETPARAMS

Return parameters are sent if an error occurs during execution.

If the SRV_S_RETPARAMS is set the RPC return behavior applies to all threads.

SRV_T_RMTCERTIFICATE

CS_SSLCERT * A pointer that describes the client certificate.

SRV_T_RMTPWDS

An array of SRV_RMTPWDs.

See “SRV_T_RMTPWDS” for the structure’s definition.

SRV_T_RMTSERVER

The local server name for client connections. The remote server name for server-to-server connections.

SRV_T_ROWSENT

The number of rows returned to the client in this event.

SRV_T_SEC_CHANBIND

A Boolean indicating whether channel binding is being used on the client/server connection associated with this thread.

SRV_T_SEC_CONFIDENTIALITY

A Boolean indicating whether data confidentiality is being used on the client/server connection associated with this thread.

This is usually implemented using data encryption.

SRV_T_SEC_CREDTIMEOUT

The number of seconds remaining for which the credentials remain valid on the client/server connection associated with this thread.

Possible values are:

  • CS_NO_LIMIT – never expires

  • CS_UNEXPIRED – unexpired

  • 0 – expired

  • A positive number – the number of seconds remaining

SRV_T_SEC_DATAORIGIN

A Boolean indicating whether data origination service is being used on the client/server connection associated with this thread.

SRV_T_SEC_DELEGATION

A Boolean indicating whether delegation is enabled by the client.

All work done in this thread should use the client’s authorization level. Use the SRV_T_USER property to access the principal name. Use the SRV_T_SEC_DELEGCRED property to obtain the delegated credentials to use in initiating a security session with another security peer.

SRV_T_SEC_DELEGCRED

The delegated credentials (if any) of the client in the current security session.

The SRV_T_SEC_DELEGATION property indicates whether delegation is enabled by the client. If it is enabled, the Open Server application may obtain the delegated credentials using the SRV_T_SEC_DELEGCRED property.

SRV_T_SEC_DETECTREPLAY

A Boolean indicating whether detection of message replay is being used on the client/server connection associated with this thread.

SRV_T_SEC_DETECTSEQ

A Boolean indicating whether detection of out-of-sequence messages is being used on the client/server connection associated with this thread.

SRV_T_SEC_INTEGRITY

A Boolean indicating whether integrity service is being used on the client/server connection associated with this thread.

This is usually implemented using a cryptographic signature.

SRV_T_SEC_MECHANISM

The local name of the security mechanism being used on the client/server connection associated with this thread.

SRV_T_SEC_MUTUALAUTH

A Boolean indicating whether mutual authentication was performed on the client/server connection associated with this thread.

SRV_T_SEC_NETWORKAUTH

A Boolean indicating whether network authentication was performed on the client/server connection associated with this thread.

SRV_T_SEC_SESSTIMEOUT

The number of seconds remaining for which the security session remains valid on the client/server connection associated with this thread.

Possible values are:

  • CS_NO_LIMIT – never expires

  • CS_UNEXPIRED – unexpired

  • 0 – expired

  • A positive number – the number of seconds remaining

SRV_T_SESSIONID

Retrieves the session ID that the client sends to Open Server. Also, sets the session ID to be sent to the client in the SRV_CONNECT handler.

See “SRV_T_SESSIONID” for more details.

SRV_T_SSL_VERSION

The SSL/TLS protocol version that was negotiated during the connection handshake.

SRV_T_SPID

The thread’s process identifier.

This is the unique ID assigned to this thread. Thread IDs are reused once a thread has exited.

SRV_T_STACKLEFT

The size of unused stack available to the thread.

SRV_T_TDSVERSION

The version of TDS the client thread is using.

Setting this thread in the SRV_CONNECT event handler allows an Open Server application to negotiate the TDS version to some value other than Open Server’s default for the thread. See “SRV_T_TDSVERSION” for a list of legal values.

SRV_T_TYPE

The thread type.

See “SRV_T_TYPE” for a list of legal types.

SRV_T_USER

The user name the client thread logged on with.

SRV_T_USERDATA

A generic data address used for application-specific purposes.

Can be set.

SRV_T_USESRVLANG

A Boolean. Set to CS_TRUE if error messages should be in the server’s national language, CS_FALSE if in the client’s.

Set this to override the server-wide SRV_S_USESRVLANG property for a thread.

SRV_T_USTATE

A string describing the current state of the thread.

Can be set.