(联动北方技术论坛 - Powered by Landingbj) [网际游航]ATMI:Application-to-Transaction Monitor Interface。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]1.tpchkauth
(联动北方技术论坛 - Powered by Landingbj) [网际游航]int tpchkauth();
(联动北方技术论坛 - Powered by Landingbj) [网际游航]在调用tpinit()之前检查是否需要认证和认证的级别。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]返回值:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPNOAUTH:不需要认证;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPSYSAUTH:系统认证,需要密码;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPAPPAUTH:应用认证,需要密码和特殊应用数据;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]当返回值为TPSYSAUTH和TPAPPAUTH时,我们必须使用tpalloc()分配一个TPINIT结构,在该结构中填入认证数据,然后用该结构作为参数调用tpinit()。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]失败原因主要有:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]协议错;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]操作系统错;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]tuxedo底层错。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]2.tpinit
(联动北方技术论坛 - Powered by Landingbj) [网际游航]在使用tuxedo其他服务之前,必须调用tpinit加入到应用中。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]int tpinit(TPINIT *tpinfo);
(联动北方技术论坛 - Powered by Landingbj) [网际游航]参数说明:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]tpinfo:指向TPINIT类型的指针。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPINIT类型在atmi.h中有定义,如以下几个域:
(联动北方技术论坛 - Powered by Landingbj) [网际游航] char usrname [32]; (32 characters significant)
(联动北方技术论坛 - Powered by Landingbj) [网际游航] char cltname [32]; (32 characters significant)
(联动北方技术论坛 - Powered by Landingbj) [网际游航] char passwd [32]; (8 characters significant)
(联动北方技术论坛 - Powered by Landingbj) [网际游航] char grpname [32]; (32 characters significant)
(联动北方技术论坛 - Powered by Landingbj) [网际游航] long flags;
(联动北方技术论坛 - Powered by Landingbj) [网际游航] long datalen;
(联动北方技术论坛 - Powered by Landingbj) [网际游航] long data;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]usrname:用户名或login名;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]cltname:应用定义;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]passwd:应用密码;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]grpname:在事务中使用,必须在配置文件定义的组列表中;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]flags:定义请求/通知类型和系统存取方法,其中TPU_SIG、TPU_DIP和TPU_IGN不能同时指定;TPSA_FASTPATH和TPSA_PROTECTED不能同时指定。有如下的值:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPU_SIG:选择信号通知;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPU_DIP:选择dip-in通知;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPU_IGN:忽略通知;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPSA_FASTPATH:选择fastpath方式系统存取;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPSA_PROTECTED:选择protected方式系统存取;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]datalen:应用特殊数据的长度;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]data:应用特殊数据;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]域flags���值覆盖���统的缺省定义,前提是在配置文件中没有指定NO_OVERRIDE。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]如果参数使用(TPINIT*)NULL,则client使用系统缺省的通知设置和系统存取设置,若需要认证,则出错返回TPEPERM。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]tpinit()调用失败返回-1,失败原因有:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]参数错;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]没有空间在BB;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]没有权限;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]协议错;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]操作系统错;
(联动北方技术论坛 - Powered by Landingbj) [网际游��]tuxedo底层错。
(联动北方技术论坛 - Powered by Landingbj) [网际游航]示例:
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPINIT *tpinfo;
(联动北方技术论坛 - Powered by Landingbj) [网际游航]char password[9];
(联动北方技术论坛 - Powered by Landingbj) [网际游航](联动北方技术论坛 - Powered by Landingbj) [网际游航]if ((tpinfo = (TPINIT *)tpalloc(“TPINIT”, NULL,
(联动北方技术论坛 - Powered by Landingbj) [网际游航]TPINITNEED(0))) == NULL) {
(联动北方技术论坛 - Powered by Landingbj) [网际游航] (void)userlog(“unable to allocate TPINIT buffer”);
(联动北方技术论坛 - Powered by Landingbj) [网际游航] exit(1);
(联动��方技术论坛 - Powered by Landingbj) [网际游航]}
(联动北方技术论坛 - Powered by Landingbj) [网际游航](void)strcpy(tpinfo->passwd, password);
(联动北方技术论坛 - Powered by Landingbj) [网际游航](void)strcpy(tpinfo->usrname, “Smith”);
(联动北方技术论坛 - Powered by Landingbj) [网际游航](void)strcpy(tpinfo->cltname, “Teller”);
(联动北方技术论坛 - Powered by Landingbj) [网际游航]tpinfo->flags = (TPU_DIP|TPSA_PROTECTED);
(联动北方技术论坛 - Powered by Landingbj) [网际游航]if (tpinit(tpinfo) == -1) {
(联动北方技术论坛 - Powered by Landingbj) [网际游航] (void)userlog(“failed to join application”);
(联动北方技术论坛 - Powered by Landingbj) [网际游航] tpfree((char*)tpinfo);
(联动北方技术论坛 - Powered by Landingbj) [网际游航] exit(1);
(联动北方技术论坛 - Powered by Landingbj) [网际游航]}
(联动北方技术论坛 - Powered by Landingbj) [网际游航]