0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include <stdio.h>
0037 #include <stdlib.h>
0038 #include <ndebug.h>
0039 #include <atmi.h>
0040 #include <ndrstandard.h>
0041 #include <ubf.h>
0042 #include <test.fd.h>
0043 #include <string.h>
0044 #include <unistd.h>
0045 #include <exassert.h>
0046 #include "test76.h"
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 exprivate int add_tx_flag(UBFH *p_ub)
0062 {
0063 int ret = EXSUCCEED;
0064
0065 if (tpgetlev())
0066 {
0067 NDRX_ASSERT_UBF_OUT((EXSUCCEED==Badd(p_ub, T_STRING_FLD, "INTX", 0)),
0068 "Failed to add T_STRING_FLD");
0069 }
0070 else
0071 {
0072 NDRX_ASSERT_UBF_OUT((EXSUCCEED==Badd(p_ub, T_STRING_FLD, "NOTX", 0)),
0073 "Failed to add T_STRING_FLD");
0074 }
0075
0076 out:
0077 return ret;
0078 }
0079
0080
0081
0082
0083 void SVC2 (TPSVCINFO *p_svc)
0084 {
0085 int ret=EXSUCCEED;
0086 UBFH *p_ub = (UBFH *)p_svc->data;
0087
0088 NDRX_LOG(log_debug, "%s got call", __func__);
0089
0090
0091 p_ub = (UBFH *)tprealloc((char *)p_ub, 1024);
0092
0093 NDRX_ASSERT_TP_OUT((NULL!=p_ub), "Failed to realloc");
0094
0095
0096 if (EXSUCCEED!=add_tx_flag(p_ub))
0097 {
0098 EXFAIL_OUT(ret);
0099 }
0100
0101
0102
0103 if (NULL!=strstr(p_svc->name, "FAIL"))
0104 {
0105 ret=EXFAIL;
0106 }
0107
0108 out:
0109
0110 tpreturn( EXSUCCEED==ret?TPSUCCESS:TPFAIL,
0111 0L,
0112 (char *)p_ub,
0113 0L,
0114 0L);
0115 }
0116
0117
0118
0119
0120
0121 void SVC1 (TPSVCINFO *p_svc)
0122 {
0123 int ret=EXSUCCEED;
0124 UBFH *p_ub = (UBFH *)p_svc->data;
0125 char svcnm2[MAXTIDENT+1];
0126 long rsplen;
0127
0128 NDRX_LOG(log_debug, "%s got call", __func__);
0129
0130
0131
0132 p_ub = (UBFH *)tprealloc((char *)p_ub, 1024);
0133
0134 NDRX_ASSERT_TP_OUT((NULL!=p_ub), "Failed to realloc");
0135
0136
0137 if (EXSUCCEED!=add_tx_flag(p_ub))
0138 {
0139 EXFAIL_OUT(ret);
0140 }
0141
0142
0143
0144
0145
0146 snprintf(svcnm2, sizeof(svcnm2), "%s2", p_svc->name);
0147 tpcall(svcnm2, (char *)p_ub, 0, (char **)&p_ub, &rsplen, 0);
0148
0149 out:
0150
0151 tpreturn( EXSUCCEED==ret?TPSUCCESS:TPFAIL,
0152 0L,
0153 (char *)p_ub,
0154 0L,
0155 0L);
0156 }
0157
0158
0159 expublic struct tmdsptchtbl_t ndrx_G_tmdsptchtbl[] = {
0160 { "TXOK", "SVC1", SVC1, 0, 0 }
0161 ,{ "TXFAIL", "SVC1", SVC1, 0, 0 }
0162 ,{ "NOTX", "SVC1", SVC1, 0, 0 }
0163 ,{ "TXOK2", "SVC2", SVC2, 0, 0 }
0164 ,{ "TXFAIL2", "SVC2", SVC2, 0, 0 }
0165 ,{ "NOTX2", "SVC2", SVC2, 0, 0 }
0166 ,{ NULL, NULL, NULL, 0, 0 }
0167 };
0168
0169
0170
0171
0172 int main( int argc, char** argv )
0173 {
0174 _tmbuilt_with_thread_option=EXTRUE;
0175 struct tmsvrargs_t tmsvrargs =
0176 {
0177 &tmnull_switch,
0178 &ndrx_G_tmdsptchtbl[0],
0179 0,
0180 tpsvrinit,
0181 tpsvrdone,
0182 NULL,
0183 NULL,
0184 NULL,
0185 NULL,
0186 NULL,
0187 tpsvrthrinit,
0188 tpsvrthrdone
0189 };
0190
0191 return( _tmstartserver( argc, argv, &tmsvrargs ));
0192
0193 }
0194
0195