OTOptionManagement
Determines an endpoint's current or default option values or changes
these values.C INTERFACE
OSErr OTOptionManagement (EndpointRef ref, TOptMgmt* req, TOptMgmt* ret);C++ INTERFACES
OSErr TEndpoint::OptionManagement(TOptMgmt* req, TOptMgmt* ret);PARAMETERS
ref- The endpoint reference of the endpoint for which you are checking or setting option values.
req- A pointer to an option management structure (page 5-33), which describes the action to be taken by the function and the options affected.
ret- A pointer to an option management structure (page 5-33), which describes the options that were changed or returned by the function and how successful the negotiation process was.
DESCRIPTION
To use theOTOptionManagementfunction, you must have opened an endpoint using theOTOpenEndpointorOTAsyncOpenEndpointfunctions.You use the
OTOptionManagementfunction to negotiate, retrieve, or verify an endpoint's protocol options. If the endpoint is in asynchronous mode and you have not installed a notifier function, it is not possible to determine when the function completes.The action taken by the
OTOptionManagementfunction is determined by the setting of thereq->flagsfield. The following bulleted items describe the different operations that you can perform and the flag settings that you use to specify these operations.
- To negotiate values for the endpoint, you must call the
OTOptionManagementfunction, specifyingT_NEGOTIATEfor thereq->flagsfield. The endpoint provider evaluates the requested options, negotiates the values, and returns the resulting values in the option management structure pointed to by theret->opt.buffield. Thestatusfield of each returned option is set to a constant that indicates the result of the negotiation. These constants are described by the status codes enumeration (page 5-29).For any protocol specified, you can negotiate for the default values of all options supported by the endpoint by specifying the value
T_ALLOPTfor thenamefield of theTOptionstructure. This might be useful if you want to change current settings or if negotiations for other values have failed. The success of the negotiations depends partly on the state of the endpoint--that is, simply because these are default values does not guarantee a completely successful negotiation. When the function returns, the resulting values are returned, option by option, in the buffer pointed to by theret->opt.buffield.- To retrieve an endpoint's default option values, call the
OTOptionManagementfunction, specifyingT_DEFAULTfor thereq->flagsfield. You must also specify the name of the option (but not its value) in theTOptionstructure that you create for each of the options you are interested in.When the function returns, it passes the default values for the options back to you in the buffer pointed to by the
ret->opt.buffield. For each option, thestatusfield containsT_NOTSUPPORTif the protocol does not support the option,T_READONLYif the option is read-only, andT_SUCCESSin all other cases. The overall result of the request is returned in theret->flagsfield. The meaning of this result is described by the status codes enumeration (page 5-29).When getting an endpoint's default option values, you can specify
T_ALLOPTfor the option name. This returns all supported options for the specified level with their default values. In this case, you must set theopt.maxlenfield to the maximum size required to hold an endpoint's option information. Theinfo.optfield of theTEndpointInfostructure specifies the maximum size of a buffer used to hold option information for an endpoint.- To retrieve an endpoint's current option values, call the
OTOptionManagementfunction, specifyingT_CURRENTfor thereq->flagsfield. For each option in the buffer referenced by thereq->opt.buffield, specify the name of the option you are interested in. The function ignores any option values
you specify.When the function returns, it passes the current values for the options back to you in the buffer referenced by the
ret->opt.buffield. For each option, thestatusfield containsT_NOTSUPPORTif the protocol does not support the option,T_READONLYif the option is read-only, andT_SUCCESSin all other cases. The overall result of the request is returned in theret->flagsfield. The meaning of this result is described by the status codes enumeration (page 5-29).When retrieving an endpoint's current option values, you can specify
T_ALLOPTfor the option name. The function returns all supported options for the specified protocol, with their current values. In this case, you must set theopt.maxlenfield to the maximum size required to hold an endpoint's option information. Theinfo.optfield of theTEndpointInfostructure specifies the maximum size of a buffer used to hold option information for an endpoint.- To check whether an endpoint provider supports certain options or option values, you must call the
OTOptionManagementfunction, specifyingT_CHECKfor thereq->flagsfield. Checking options or their values does not change the current settings of an endpoint's options.
- To check whether an option is supported, set the
namefield of theTOptionstructure to the option name, but do not specify an option value. When the function returns, thestatusfield for the correspondingTOptionstructure in the buffer pointed to by theret->opt.buffield is set toT_SUCCESSif the option is supported,T_NOTSUPPORTif it is not supported or needs additional client privileges, andT_READONLYif it is read-only.- To check whether an option value is supported, set the
namefield of theTOptionstructure to the option name, and set thevaluefield to the value you want to check. When the function returns, thestatusfield for the correspondingTOptionstructure in the buffer pointed to by theret->opt.buffield is set as it would be if you had specified theT_NEGOTIATEflag. The overall result of the option checks is returned in theret->flagsfield, which contains the single worst result of the option checks. The meaning of this result is described by the status codes enumeration (page 5-29).
SPECIAL CONSIDERATIONS
While an option management call is outstanding, any other functions that are called for the same endpoint return with akOTStateChangeErrresult.If the endpoint is in asynchronous mode, the provider might issue the
T_OPTIONMGMTCOMPLETEevent before the function returns the first time.COMPLETION EVENTS
T_OPTMGMTCOMPLETE0x20000006 The OTOptionManagementfunction has completed. Thecookieparameter of the notifier function points to theretparameter.SEE ALSO
Option information is formatted using theTOptionstructure (page 5-32). For additional information about the format of the options buffers, see "Specifying Option Values" (page 5-18).For more information about the
OTOpenEndpointandOTAsyncOpenEndpoint, see the reference section of the chapter "Endpoints" in this book.For additional information about using the
T_ALLOPToption, see "Setting Default Values" (page 5-20) and "Obtaining Current and Default Values" (page 5-21).For more information about creating the buffer referenced by the
req->opt.buffield, see the description of theOTCreateOptionsfunction, next.For information about creating a string referenced by the
ret->opt.buffield, see the description of theOTCreateOptionStringfunction (page 5-42).