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 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <ndebug.h>
0038 #include <atmi.h>
0039 #include <ndrstandard.h>
0040 #include <ubf.h>
0041 #include <test.fd.h>
0042 #include <string.h>
0043
0044 void CONVSV (TPSVCINFO *p_svc)
0045 {
0046 int ret=EXSUCCEED;
0047 long revent;
0048 static double d = 55.66;
0049 int i;
0050 int cd;
0051 UBFH *p_ub = (UBFH *)p_svc->data;
0052 char tmp[128];
0053 NDRX_LOG(log_debug, "CONVSV got call");
0054
0055
0056 Bprint(p_ub);
0057
0058 if (NULL==(p_ub = (UBFH *)tprealloc((char *)p_ub, 6000)))
0059 {
0060 ret=EXFAIL;
0061 goto out;
0062 }
0063
0064 d+=1;
0065
0066 for (i=0; i<100; i++)
0067 {
0068 sprintf(tmp, "SRV SND: %d", i);
0069 if (EXFAIL==Badd(p_ub, T_STRING_FLD, (char *)tmp, 0))
0070 {
0071 ret=EXFAIL;
0072 goto out;
0073 }
0074
0075 if (p_svc->flags & TPSENDONLY)
0076 {
0077 NDRX_LOG(log_debug, "Doing some send!");
0078
0079 if (EXFAIL==tpsend(p_svc->cd, (char *)p_ub, 0L, 0L, &revent))
0080 {
0081 NDRX_LOG(log_error, "Failed to send to client!");
0082 }
0083 }
0084
0085
0086
0087 if (strcmp(p_svc->name, "CONVSV2"))
0088 {
0089 NDRX_LOG(log_info, "Try to connect to CONVSV!!!");
0090 if (EXFAIL==(cd=tpconnect("CONVSV", (char *)p_ub, 0L, TPRECVONLY)))
0091 {
0092 NDRX_LOG(log_error, "TESTERROR: connect failed!: %s",
0093 tpstrerror(tperrno));
0094 ret=EXFAIL;
0095 goto out;
0096 }
0097 }
0098
0099 sleep(999);
0100 }
0101
0102
0103 if (EXFAIL==tpsend(p_svc->cd, (char *)p_ub, 0L, TPRECVONLY, &revent))
0104 {
0105 NDRX_LOG(log_error, "Failed to send to client!");
0106 goto out;
0107 }
0108
0109
0110 while (EXSUCCEED==tprecv(p_svc->cd, (char **)&p_ub, 0L, 0L, &revent))
0111 {
0112 NDRX_LOG(log_debug, "Sent MSG OK!");
0113 }
0114
0115
0116 Bfprint(p_ub, stderr);
0117
0118 if (TPEEVENT==tperrno)
0119 {
0120 if (TPEV_SENDONLY==revent)
0121 {
0122 NDRX_LOG(log_debug, "We are senders - FINISH UP!");
0123 }
0124 else
0125 {
0126 NDRX_LOG(log_debug, "Did not get TPEV_SENDONLY!!!");
0127 ret=EXFAIL;
0128 }
0129 }
0130
0131 out:
0132 tpreturn( ret==EXSUCCEED?TPSUCCESS:TPFAIL,
0133 0L,
0134 (char *)p_ub,
0135 0L,
0136 0L);
0137 }
0138
0139
0140
0141
0142 int NDRX_INTEGRA(tpsvrinit)(int argc, char **argv)
0143 {
0144 int ret = EXSUCCEED;
0145 NDRX_LOG(log_debug, "tpsvrinit called");
0146
0147 if (EXSUCCEED!=tpadvertise("CONVSV", CONVSV))
0148 {
0149 NDRX_LOG(log_error, "Failed to initialize CONVSV!");
0150 ret=EXFAIL;
0151 }
0152
0153
0154 return ret;
0155 }
0156
0157
0158
0159
0160 void NDRX_INTEGRA(tpsvrdone)(void)
0161 {
0162 NDRX_LOG(log_debug, "tpsvrdone called");
0163 }
0164