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 #include <stdio.h>
0035 #include <stdlib.h>
0036 #include <ndebug.h>
0037 #include <atmi.h>
0038 #include <ndrstandard.h>
0039 #include <ubf.h>
0040 #include <test.fd.h>
0041 #include <string.h>
0042 #include <unistd.h>
0043 #include "test84.h"
0044 #include "exsha1.h"
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 void TESTSV (TPSVCINFO *p_svc)
0058 {
0059 int ret=EXSUCCEED;
0060 UBFH *p_ub = (UBFH *)p_svc->data;
0061
0062 if (NULL==p_ub)
0063 {
0064
0065 goto out;
0066 }
0067
0068
0069 if (NULL==(p_ub = (UBFH *)tprealloc((char *)p_ub, 1024)))
0070 {
0071 NDRX_LOG(log_error, "Failed to realloc: %s", tpstrerror(tperrno));
0072 EXFAIL_OUT(ret);
0073 }
0074
0075 NDRX_LOG(log_debug, "%s got call", __func__);
0076
0077
0078 Bprint(p_ub);
0079
0080 if (EXFAIL==Bchg(p_ub, T_STRING_FLD, 0, p_svc->name, 0))
0081 {
0082 NDRX_LOG(log_error, "TESTERROR: Failed to set T_STRING_FLD to [%s]: %s",
0083 p_svc->name, Bstrerror(Berror));
0084 ret=EXFAIL;
0085 goto out;
0086 }
0087
0088 out:
0089 tpreturn( ret==EXSUCCEED?TPSUCCESS:TPFAIL,
0090 0L,
0091 (char *)p_ub,
0092 0L,
0093 0L);
0094 }
0095
0096
0097 void DYNSV(TPSVCINFO *p_svc)
0098 {
0099 tpreturn( TPSUCCESS,
0100 0L,
0101 (char *)p_svc->data,
0102 0L,
0103 0L);
0104 }
0105
0106 void DYNADV(TPSVCINFO *p_svc)
0107 {
0108 UBFH *p_ub = (UBFH *)p_svc->data;
0109 int ret = EXSUCCEED;
0110 char svcnm[XATMI_SERVICE_NAME_LENGTH+1];
0111 BFLDLEN len;
0112
0113 len = sizeof(svcnm);
0114
0115 if (EXFAIL==Bget(p_ub, T_STRING_2_FLD, 0, svcnm, &len))
0116 {
0117 NDRX_LOG(log_error, "TESTERROR: Failed to get T_STRING_2_FLD: %s", Bstrerror(Berror));
0118 ret=EXFAIL;
0119 goto out;
0120 }
0121
0122 if (0==strcmp(p_svc->name, "DADV"))
0123 {
0124 if (EXSUCCEED!=tpadvertise(svcnm, DYNSV))
0125 {
0126 NDRX_LOG(log_error, "Failed to advertise: %s", tpstrerror(tperrno));
0127 ret=EXFAIL;
0128 goto out;
0129 }
0130 }
0131 else if (0==strcmp(p_svc->name, "DUNA"))
0132 {
0133 if (EXSUCCEED!=tpunadvertise(svcnm))
0134 {
0135 NDRX_LOG(log_error, "Failed to unadvertise: %s", tpstrerror(tperrno));
0136 ret=EXFAIL;
0137 goto out;
0138 }
0139 }
0140
0141 if (EXFAIL==Bchg(p_ub, T_STRING_FLD, 0, p_svc->name, 0))
0142 {
0143 NDRX_LOG(log_error, "TESTERROR: Failed to set T_STRING_FLD to [%s]: %s",
0144 p_svc->name, Bstrerror(Berror));
0145 ret=EXFAIL;
0146 goto out;
0147 }
0148
0149 out:
0150 tpreturn( ret==EXSUCCEED?TPSUCCESS:TPFAIL,
0151 0L,
0152 (char *)p_ub,
0153 0L,
0154 0L);
0155 }
0156
0157
0158
0159
0160
0161 void FWDSV (TPSVCINFO *p_svc)
0162 {
0163 tpforward("TESTSV", p_svc->data, p_svc->len, 0);
0164 }
0165
0166
0167
0168
0169 int NDRX_INTEGRA(tpsvrinit)(int argc, char **argv)
0170 {
0171 int ret = EXSUCCEED;
0172 NDRX_LOG(log_debug, "tpsvrinit called");
0173
0174 if (EXSUCCEED!=tpadvertise("TESTSV", TESTSV))
0175 {
0176 NDRX_LOG(log_error, "Failed to initialise TESTSV!");
0177 EXFAIL_OUT(ret);
0178 }
0179
0180 if (EXSUCCEED!=tpadvertise("FWDSV", FWDSV))
0181 {
0182 NDRX_LOG(log_error, "Failed to initialise FWDSV!");
0183 EXFAIL_OUT(ret);
0184 }
0185
0186
0187 if (EXSUCCEED!=tpadvertise("UNASV", TESTSV))
0188 {
0189 NDRX_LOG(log_error, "Failed to initialise FWDSV!");
0190 EXFAIL_OUT(ret);
0191 }
0192
0193 if (EXSUCCEED!=tpadvertise("DYNADV", DYNADV))
0194 {
0195 NDRX_LOG(log_error, "Failed to initialise DYNADV!");
0196 EXFAIL_OUT(ret);
0197 }
0198
0199 if (EXSUCCEED!=tpunadvertise("UNASV"))
0200 {
0201 NDRX_LOG(log_error, "TESTERROR: failed to unadvertise!");
0202 EXFAIL_OUT(ret);
0203 }
0204
0205
0206 out:
0207 return ret;
0208 }
0209
0210
0211
0212
0213 void NDRX_INTEGRA(tpsvrdone)(void)
0214 {
0215 NDRX_LOG(log_debug, "tpsvrdone called");
0216 }
0217
0218