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