![]() | Programming Guide | ![]() |
Attaches a client to the middleware
client_init [connectionOpt]... [authLevel2] [authLevel3]
[NOTIFICATIONnotifyMethod]
connectionOpt- One or more options that supply information about the client:
CLIENTclientName- Specifies the name of the client, where
clientNamecan be up to 30 characters long. If omitted, the default is an empty string.USERuserName- Specifies a user account (login) name, where
userNamecan be up to 30 characters long. If omitted, the default is an empty string.GROUPgroupName- (Oracle Tuxedo only) Specifies the name of a group associated with this client, where
groupNamecan be up to 15 characters long. If omitted, the default is an empty string.You can set
groupNameto associate the client with a resource manager group that is defined in the configuration file. This allows the client to access an XA-compliant resource manager as part of a global transaction.authLevel2- Supply the application password for client access with this syntax:
PASSWORDpasswordpasswordspecifies the application password, a string of up to 30 characters; however, only the first 8 characters are significant. If omitted, the default is an empty string. You set the application password through the JetNet manager; refer to "Application Password" in JetNet/Oracle Tuxedo Guide for more information.authLevel3- (Oracle Tuxedo only) Supply level-3 authentication data with one of these syntax clauses:
DATApassword- Specifies the user-specific password required by the authentication service.
DATAFUNCdataFunc[POSTFUNCpostFunc]- Specifies a function that provides level-3 authentication data and, optionally, a post-connection function that handles successful or failed connections. For the
DATAFUNCfunction's prototype and description, refer to "Authentication Data Function"; for thePOSTFUNCfunction, "Post-Connection Function."Both functions must be installed. For information on installing a
DATAFUNCfunction, refer to "Client Authentication Functions" in Application Development Guide; forPOSTFUNCfunctions, refer to "Client Post-Connection Functions" in Application Development Guide.NOTIFICATIONnotifyMethod- For use by administrator clients only: Specify how the client is notified of unsolicited messages, where
notifyMethodhas one of these values:
POLL—Notify by polling for messages. The default polling interval is 10 seconds. To change the interval, set thetp_unsol_poll_intervalproperty. If you are using Panther, this is the default. For Oracle Tuxedo applications, the default can be set in thetuxconfig.
IGNORE— All unsolicited messages are ignored.
For example, the following code opens a client connection and specifies to ignore all unsolicited messages:
client_init CLIENT "shipping" USER user NOTIFICATION IGNOREThis code specifies that the client be notified of unsolicited messages by polling:
client_init CLIENT last_name USER "Customer" \
NOTIFICATION POLL
JetNet, Oracle Tuxedo
Client
The
client_initcommand opens a client connection to the application middleware–either JetNet or Oracle Tuxedo. Only one connection between client and middleware is allowed. Panther connects a workstation client to the middleware through its settings in configuration variables SMRBHOST and SMRBPORT, which specify the network addresses of one or more server machines; native clients use the settings in the configuration file specified by SMRBCONFIG.
client_initoffers several ways to authorize client access to an application. Level-2 authentication provides a single application-wide password; thePASSWORDoption is required; theUSERandCLIENToptions are for informational purposes only and are not validated.For example, this statement opens a client connection and specifies an application password:
client_init PASSWORDappPasswordLevel-3 authentication, available with Oracle Tuxedo, offers user-specific validation as an additional layer of security. Level-3 authentication uses a Oracle Tuxedo service that validates the user name, client name, and user password, as supplied by the
USER,CLIENT, andDATAoptions, respectively. The Oracle Tuxedo service can be configured to validate different combinations of this data.For example, this command assumes validation at the application and user levels:
client_init USERusernamePASSWORDappPasswordDATAuserPasswordFor more information about setting user-level security in Oracle Tuxedo applications, refer to "Security Administration" in the Oracle Tuxedo Administrator's Guide.
Use the
DATAFUNCoption if the user password data is more complex than a simple string. On return, theDATAFUNC-specified C function supplies all data that is required by the authentication service, including user name, client name, and group name. For example, the following code opens a client connection for a named client, specifying a function that produces the authentication data:
client_initCLIENT"shipping"DATAFUNC"ship_authorize"All
DATAFUNCfunctions must be installed; for more information, refer to "Client Authentication Functions" in Application Development Guide.A
DATAFUNCfunction must conform to this prototype:long DATAFUNC (VOIDPTR *data,
const char *usrname, const char *cltname,
const char *passwd, cons char *grpname);
data- Must be set by the
DATAFUNCfunction to the address of the user data. This address must remain valid on return from the function.srname, cltname, passwd, grpname- Contain the values specified by the corresponding
USER,CLIENT,PASSWORD, andGROUPoptions; otherwiseNULL. These values must not be changed by theDATAFUNCfunction.When successful, the
DATAFUNCfunction returns the length of the data; a negative value indicates that an error occurred. If the function is successful, the output value of data should be the address of the user data. IfdataFuncreturns a negative value, or if the address in data isNULLwhen a positive value is returned,client_initraises aTP_DATAFUNC_FAILEDexception of severityTP_COMMAND.
Use the
POSTFUNCoption to pair a post-connection function with theDATAFUNCfunction. This C function is always called whether or not the connection is successful.Panther installs a built-in
postFuncsm_tp_free, which deallocates any memory allocated by thedataFunc.All
POSTFUNCfunctions must be installed; for more information, refer to "Client Post-Connection Functions" in Application Development Guide.A
POSTFUNCfunction must conform to this prototype:void POSTFUNC (VOIDPTR data, long datalen,
const char *usrname, const char *cltname,
const char *passwd, const char *grpname);
data- Contains the address of the user data as set by the
DATAFUNCfunction.datalen- Contains the length returned by the
DATAFUNCfunction.usrname, cltname, passwd, grpname- Contain the values specified by the corresponding
USER,CLIENT,PASSWORD, andGROUPoptions; otherwiseNULL. These values must not be changed by thePOSTFUNCfunction.
client_initcan raise the following exceptions: