Options


SmartSockets uses options to control run-time configuration parameters that affect the operation of a process. You can create your own options that perform in a way similar to standard SmartSockets options, and you can write code to access and manipulate standard SmartSockets options. The types of options that are supported are defined in this way:

Type
Data Type
Restrictions
Boolean
T_OPT_TYPE_BOOLEAN
TRUE or FALSE only
Enumerated
T_OPT_TYPE_ENUM
One of a set of possible identifiers
Numeric
T_OPT_TYPE_NUMERIC
Floating point numeric value
String
T_OPT_TYPE_STRING
Any null-terminated string value
Enumerated List
T_OPT_TYPE_LIST_ENUM
List of enumerated values
Numeric List
T_OPT_TYPE_LIST_NUMERIC
List of numeric values
Enumerated String List
T_OPT_TYPE_LIST_STRING
List of string values

The option code provides a mechanism to verify a new option value before it is accepted. This is accomplished by specifying an option verify function that allows or disallows a new setting for an option value. It is defined in this way:

T_BOOL (*T_OPTION_VERIFY_FUNC) (T_OPTION opt, T_PTR new_value,  
         T_PTR arg); 

This function definition is used by TutOptionSetVerifyFunc and TutOptionGetVerifyFunc. There can only be one verify function for each option.

Occasionally, you may want to receive notification when the value of an option is changed. This is accomplished using an option change callback. These callbacks are called whenever the value of an option changes. There can be multiple option change callbacks for an option. The option callbacks are:

void (*T_OPTION_CHANGE_CB_FUNC)(T_OPTION option, 
       T_OPTION_CHANGE_CB_DATA data, T_CB_ARG arg); 

The callback function is called with an option change callback data structure, defined in this way:

typedef struct T_OPTION_CHANGE_CB_DATA_STRUCT { 
  T_CB cb; 
  T_PTR value; 
} T_OPTION_CHANGE_CB_DATA_STRUCT, *T_OPTION_CHANGE_CB_DATA; 

Option change callbacks are managed with the functions TutOptionChangeCbCreate and TutOptionChangeCbLookup.


TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com