-> Hier kostenlos registrieren
Hi
C script genibus ? or OPC Genibus
ich brauche Umfragehilfe für das Genibus-Protokoll..
es gibt Entwicklungen von Drittanbietern, die ich zu integrieren versuche
===
genibus.cpp
1: #include "mpsapi.h"
2: #include "plugin-common.h"
3: #include <dos.h>
4: #include <stdio.h>
5: #include <stdlib.h>
6: #include <string.h>
7:
8: //
9: int Readparam(OpcMP_plugin_t *Plugin, struct request *request);
10:
11: //
12: static byte replyBuffer[80];
13:
14: //
15: static byte requestBuffer[40];
16:
17: // CRC
18: static const WORD Crc_Table16[] = {
19: 0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
20: 0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
21: 0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
22: 0x9339U, 0x8318U, 0xb37bU, 0xa35aU, 0xd3bdU, 0xc39cU, 0xf3ffU, 0xe3deU,
23: 0x2462U, 0x3443U, 0x0420U, 0x1401U, 0x64e6U, 0x74c7U, 0x44a4U, 0x5485U,
24: 0xa56aU, 0xb54bU, 0x8528U, 0x9509U, 0xe5eeU, 0xf5cfU, 0xc5acU, 0xd58dU,
25: 0x3653U, 0x2672U, 0x1611U, 0x0630U, 0x76d7U, 0x66f6U, 0x5695U, 0x46b4U,
26: 0xb75bU, 0xa77aU, 0x9719U, 0x8738U, 0xf7dfU, 0xe7feU, 0xd79dU, 0xc7bcU,
27: 0x48c4U, 0x58e5U, 0x6886U, 0x78a7U, 0x0840U, 0x1861U, 0x2802U, 0x3823U,
28: 0xc9ccU, 0xd9edU, 0xe98eU, 0xf9afU, 0x8948U, 0x9969U, 0xa90aU, 0xb92bU,
29: 0x5af5U, 0x4ad4U, 0x7ab7U, 0x6a96U, 0x1a71U, 0x0a50U, 0x3a33U, 0x2a12U,
30: 0xdbfdU, 0xcbdcU, 0xfbbfU, 0xeb9eU, 0x9b79U, 0x8b58U, 0xbb3bU, 0xab1aU,
31: 0x6ca6U, 0x7c87U, 0x4ce4U, 0x5cc5U, 0x2c22U, 0x3c03U, 0x0c60U, 0x1c41U,
32: 0xedaeU, 0xfd8fU, 0xcdecU, 0xddcdU, 0xad2aU, 0xbd0bU, 0x8d68U, 0x9d49U,
33: 0x7e97U, 0x6eb6U, 0x5ed5U, 0x4ef4U, 0x3e13U, 0x2e32U, 0x1e51U, 0x0e70U,
34: 0xff9fU, 0xefbeU, 0xdfddU, 0xcffcU, 0xbf1bU, 0xaf3aU, 0x9f59U, 0x8f78U,
35: 0x9188U, 0x81a9U, 0xb1caU, 0xa1ebU, 0xd10cU, 0xc12dU, 0xf14eU, 0xe16fU,
36: 0x1080U, 0x00a1U, 0x30c2U, 0x20e3U, 0x5004U, 0x4025U, 0x7046U, 0x6067U,
37: 0x83b9U, 0x9398U, 0xa3fbU, 0xb3daU, 0xc33dU, 0xd31cU, 0xe37fU, 0xf35eU,
38: 0x02b1U, 0x1290U, 0x22f3U, 0x32d2U, 0x4235U, 0x5214U, 0x6277U, 0x7256U,
39: 0xb5eaU, 0xa5cbU, 0x95a8U, 0x8589U, 0xf56eU, 0xe54fU, 0xd52cU, 0xc50dU,
40: 0x34e2U, 0x24c3U, 0x14a0U, 0x0481U, 0x7466U, 0x6447U, 0x5424U, 0x4405U,
41: 0xa7dbU, 0xb7faU, 0x8799U, 0x97b8U, 0xe75fU, 0xf77eU, 0xc71dU, 0xd73cU,
42: 0x26d3U, 0x36f2U, 0x0691U, 0x16b0U, 0x6657U, 0x7676U, 0x4615U, 0x5634U,
43: 0xd94cU, 0xc96dU, 0xf90eU, 0xe92fU, 0x99c8U, 0x89e9U, 0xb98aU, 0xa9abU,
44: 0x5844U, 0x4865U, 0x7806U, 0x6827U, 0x18c0U, 0x08e1U, 0x3882U, 0x28a3U,
45: 0xcb7dU, 0xdb5cU, 0xeb3fU, 0xfb1eU, 0x8bf9U, 0x9bd8U, 0xabbbU, 0xbb9aU,
46: 0x4a75U, 0x5a54U, 0x6a37U, 0x7a16U, 0x0af1U, 0x1ad0U, 0x2ab3U, 0x3a92U,
47: 0xfd2eU, 0xed0fU, 0xdd6cU, 0xcd4dU, 0xbdaaU, 0xad8bU, 0x9de8U, 0x8dc9U,
48: 0x7c26U, 0x6c07U, 0x5c64U, 0x4c45U, 0x3ca2U, 0x2c83U, 0x1ce0U, 0x0cc1U,
49: 0xef1fU, 0xff3eU, 0xcf5dU, 0xdf7cU, 0xaf9bU, 0xbfbaU, 0x8fd9U, 0x9ff8U,
50: 0x6e17U, 0x7e36U, 0x4e55U, 0x5e74U, 0x2e93U, 0x3eb2U, 0x0ed1U, 0x1ef0U};
51:
52: // CRC
53: WORD calculateCRC(byte *array, WORD len) {
54: WORD idx;
55: WORD _accum = 0xffffu;
56:
57: for (idx = (WORD)1u; idx < len; ++idx) {
58: _accum = (_accum << 8) ^ Crc_Table16[((_accum >> 8) ^ array[idx])];
59: }
60: return _accum ^ ((WORD)0xffffu);
61: }
62:
63: //
64: int Read(OpcMP_plugin_t *Plugin, struct request *request, USList *readdev) {
65: // id тега
66: unsigned short int tagID = request->tagID;
67:
68: //
69: unsigned short int tagClass = request->tagClass;
70:
71: //
72: if ((tagClass == 2) &&
73: ((tagID == 48) || (tagID == 6) || (tagID == 81) || (tagID == 83)))
74: return Readparam(Plugin, request);
75: else
76: return 0;
77: }
78:
79: //
80: void Write(OpcMP_plugin_t *Plugin, struct request *request) {
81:
82: //
83: int replyLength = 0;
84:
85: //
86: int requestLength = 0;
87:
88: // id
89: unsigned short int tagID = request->tagID;
90:
91: // pumpAddress
92: unsigned short int pumpAddress = request->pumpAddress;
93:
94: // set
95: unsigned short int setSetpoint = request->setSetpoint;
96:
97: //
98: unsigned short int tagClass = request->tagClass;
99:
100: // (start/stop || remote/local)
101: bool RType = request->RType;
102: bool CType = request->CType;
103:
104: //
105: WORD WORD_CRC;
106:
107: //
108: static byte byte_h, byte_l;
109:
110: //
111: requestBuffer[0] = 0x27;
112:
113: //
114: requestBuffer[2] = pumpAddress;
115:
116: //
117: requestBuffer[4] = tagClass;
118:
119: // switch
120: switch (tagClass) {
121: case 3:
122: requestBuffer[1] = 0x05;
123: requestBuffer[3] = 0x00;
124: requestBuffer[5] = 0x81;
125:
126: // switch
127: switch (tagID) {
128:
129: // start/stop
130: case 6:
131: if (!CType)
132: requestBuffer[6] = 0x06;
133: else
134: requestBuffer[6] = 0x05;
135: break;
136:
137: // remote/local
138: case 7:
139: if (!RType)
140: requestBuffer[6] = 0x07;
141: else
142: requestBuffer[6] = 0x08;
143: break;
144: default:
145: break;
146: }
147: requestLength = 7;
148: break;
149: case 5:
150: requestBuffer[1] = 0x06;
151: requestBuffer[3] = 0x00;
152: requestBuffer[5] = 0x82;
153: requestBuffer[6] = 0x01;
154: requestBuffer[7] = setSetpoint;
155: requestLength = 8;
156: break;
157: default:
158: break;
159: }
160:
161: request->Status = -1;
162:
163: //
164: WORD_CRC = calculateCRC(requestBuffer, requestLength);
165: byte_h = WORD_CRC >> 8;
166: byte_l = WORD_CRC & 0x00FF;
167:
168: //
169: requestBuffer[requestLength] = byte_h;
170: requestBuffer[requestLength + 1] = byte_l;
171:
172: //
173: replyLength = SendBlockToRs(Plugin, request->port, requestBuffer,
174: requestLength + 2, replyBuffer, 57, 3);
175:
176: //
177: if (replyLength <= 2) {
178: mps_DebugMessage(Plugin, "устройство не ответило ");
179: request->Status = -1;
180: }
181:
182: //
183: if (replyLength > 2) {
184: WORD_CRC = calculateCRC(replyBuffer, replyLength - 2);
185: byte_h = WORD_CRC >> 8;
186: byte_l = WORD_CRC & 0x00FF;
187: if ((byte_h == replyBuffer[replyLength - 2]) &&
188: (byte_l == replyBuffer[replyLength - 1])) {
189: request->Status = 1;
190: } else {
191: request->Status = -1;
192: mps_DebugMessage(Plugin, "ошибка контрольной суммы CRC");
193: }
194: }
195:
196: //
197: if (replyLength > 0) {
198: if (replyLength < 170) {
199: for (int i = 0; i < replyLength; i++)
200: request->replyBufferCopy = replyBuffer; // копируем ответ
201: request->replyLengthCopy = replyLength; // длина ответа
202: } else {
203: request->Status = -1;
204: request->replyLengthCopy = 0;
205: }
206: }
207: }
208:
209: //
210: int Readparam(OpcMP_plugin_t *Plugin, struct request *request) {
211: int replyLength = 0;
212: int requestLength = 0;
213: unsigned short int tagID = request->tagID;
214: unsigned short int pumpAddress = request->pumpAddress;
215: unsigned short int tagClass = request->tagClass;
216:
217: //
218: WORD WORD_CRC;
219: static byte byte_h, byte_l;
220:
221: //
222: requestBuffer[0] = 0x27;
223: requestBuffer[1] = 0x05;
224: requestBuffer[2] = pumpAddress;
225: requestBuffer[3] = 0x00;
226: requestBuffer[4] = tagClass;
227: requestBuffer[5] = 0x01;
228: requestBuffer[6] = tagID;
229: requestLength = 7;
230:
231: request->Status = -1;
232:
233: //
234: WORD_CRC = calculateCRC(requestBuffer, requestLength);
235: byte_h = WORD_CRC >> 8;
236: byte_l = WORD_CRC & 0x00FF;
237: requestBuffer[requestLength] = byte_h;
238: requestBuffer[requestLength + 1] = byte_l;
239:
240: //
241: replyLength = SendBlockToRs(Plugin, request->port, requestBuffer,
242: requestLength + 2, replyBuffer, 57, 3);
243:
244: // < 2
245: if (replyLength <= 2) {
246: mps_DebugMessage(Plugin, "устройство не ответило ");
247: request->Status = -1;
248: return 0;
249: };
250:
251: // > 2, CRT
252: if (replyLength > 2) {
253: WORD_CRC = calculateCRC(replyBuffer, replyLength - 2);
254: byte_h = WORD_CRC >> 8;
255: byte_l = WORD_CRC & 0x00FF;
256: if ((byte_h == replyBuffer[replyLength - 2]) &&
257: (byte_l == replyBuffer[replyLength - 1])) {
258: request->Status = 1;
259:
260: } else {
261: request->Status = -1;
262: mps_DebugMessage(Plugin, "ошибка контрольной суммы CRC");
263: }
264: };
265:
266: // > 0
267: if (replyLength > 0) {
268: if (replyLength < 170) {
269: for (int i = 0; i < replyLength; i++)
270: request->replyBufferCopy = replyBuffer;
271: request->replyLengthCopy = replyLength;
272: } else {
273: request->Status = -1;
274: request->replyLengthCopy = 0;
275: }
276: }
277: return 0;
278: }
C script genibus ? or OPC Genibus
ich brauche Umfragehilfe für das Genibus-Protokoll..
es gibt Entwicklungen von Drittanbietern, die ich zu integrieren versuche
===
genibus.cpp
1: #include "mpsapi.h"
2: #include "plugin-common.h"
3: #include <dos.h>
4: #include <stdio.h>
5: #include <stdlib.h>
6: #include <string.h>
7:
8: //
9: int Readparam(OpcMP_plugin_t *Plugin, struct request *request);
10:
11: //
12: static byte replyBuffer[80];
13:
14: //
15: static byte requestBuffer[40];
16:
17: // CRC
18: static const WORD Crc_Table16[] = {
19: 0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
20: 0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
21: 0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
22: 0x9339U, 0x8318U, 0xb37bU, 0xa35aU, 0xd3bdU, 0xc39cU, 0xf3ffU, 0xe3deU,
23: 0x2462U, 0x3443U, 0x0420U, 0x1401U, 0x64e6U, 0x74c7U, 0x44a4U, 0x5485U,
24: 0xa56aU, 0xb54bU, 0x8528U, 0x9509U, 0xe5eeU, 0xf5cfU, 0xc5acU, 0xd58dU,
25: 0x3653U, 0x2672U, 0x1611U, 0x0630U, 0x76d7U, 0x66f6U, 0x5695U, 0x46b4U,
26: 0xb75bU, 0xa77aU, 0x9719U, 0x8738U, 0xf7dfU, 0xe7feU, 0xd79dU, 0xc7bcU,
27: 0x48c4U, 0x58e5U, 0x6886U, 0x78a7U, 0x0840U, 0x1861U, 0x2802U, 0x3823U,
28: 0xc9ccU, 0xd9edU, 0xe98eU, 0xf9afU, 0x8948U, 0x9969U, 0xa90aU, 0xb92bU,
29: 0x5af5U, 0x4ad4U, 0x7ab7U, 0x6a96U, 0x1a71U, 0x0a50U, 0x3a33U, 0x2a12U,
30: 0xdbfdU, 0xcbdcU, 0xfbbfU, 0xeb9eU, 0x9b79U, 0x8b58U, 0xbb3bU, 0xab1aU,
31: 0x6ca6U, 0x7c87U, 0x4ce4U, 0x5cc5U, 0x2c22U, 0x3c03U, 0x0c60U, 0x1c41U,
32: 0xedaeU, 0xfd8fU, 0xcdecU, 0xddcdU, 0xad2aU, 0xbd0bU, 0x8d68U, 0x9d49U,
33: 0x7e97U, 0x6eb6U, 0x5ed5U, 0x4ef4U, 0x3e13U, 0x2e32U, 0x1e51U, 0x0e70U,
34: 0xff9fU, 0xefbeU, 0xdfddU, 0xcffcU, 0xbf1bU, 0xaf3aU, 0x9f59U, 0x8f78U,
35: 0x9188U, 0x81a9U, 0xb1caU, 0xa1ebU, 0xd10cU, 0xc12dU, 0xf14eU, 0xe16fU,
36: 0x1080U, 0x00a1U, 0x30c2U, 0x20e3U, 0x5004U, 0x4025U, 0x7046U, 0x6067U,
37: 0x83b9U, 0x9398U, 0xa3fbU, 0xb3daU, 0xc33dU, 0xd31cU, 0xe37fU, 0xf35eU,
38: 0x02b1U, 0x1290U, 0x22f3U, 0x32d2U, 0x4235U, 0x5214U, 0x6277U, 0x7256U,
39: 0xb5eaU, 0xa5cbU, 0x95a8U, 0x8589U, 0xf56eU, 0xe54fU, 0xd52cU, 0xc50dU,
40: 0x34e2U, 0x24c3U, 0x14a0U, 0x0481U, 0x7466U, 0x6447U, 0x5424U, 0x4405U,
41: 0xa7dbU, 0xb7faU, 0x8799U, 0x97b8U, 0xe75fU, 0xf77eU, 0xc71dU, 0xd73cU,
42: 0x26d3U, 0x36f2U, 0x0691U, 0x16b0U, 0x6657U, 0x7676U, 0x4615U, 0x5634U,
43: 0xd94cU, 0xc96dU, 0xf90eU, 0xe92fU, 0x99c8U, 0x89e9U, 0xb98aU, 0xa9abU,
44: 0x5844U, 0x4865U, 0x7806U, 0x6827U, 0x18c0U, 0x08e1U, 0x3882U, 0x28a3U,
45: 0xcb7dU, 0xdb5cU, 0xeb3fU, 0xfb1eU, 0x8bf9U, 0x9bd8U, 0xabbbU, 0xbb9aU,
46: 0x4a75U, 0x5a54U, 0x6a37U, 0x7a16U, 0x0af1U, 0x1ad0U, 0x2ab3U, 0x3a92U,
47: 0xfd2eU, 0xed0fU, 0xdd6cU, 0xcd4dU, 0xbdaaU, 0xad8bU, 0x9de8U, 0x8dc9U,
48: 0x7c26U, 0x6c07U, 0x5c64U, 0x4c45U, 0x3ca2U, 0x2c83U, 0x1ce0U, 0x0cc1U,
49: 0xef1fU, 0xff3eU, 0xcf5dU, 0xdf7cU, 0xaf9bU, 0xbfbaU, 0x8fd9U, 0x9ff8U,
50: 0x6e17U, 0x7e36U, 0x4e55U, 0x5e74U, 0x2e93U, 0x3eb2U, 0x0ed1U, 0x1ef0U};
51:
52: // CRC
53: WORD calculateCRC(byte *array, WORD len) {
54: WORD idx;
55: WORD _accum = 0xffffu;
56:
57: for (idx = (WORD)1u; idx < len; ++idx) {
58: _accum = (_accum << 8) ^ Crc_Table16[((_accum >> 8) ^ array[idx])];
59: }
60: return _accum ^ ((WORD)0xffffu);
61: }
62:
63: //
64: int Read(OpcMP_plugin_t *Plugin, struct request *request, USList *readdev) {
65: // id тега
66: unsigned short int tagID = request->tagID;
67:
68: //
69: unsigned short int tagClass = request->tagClass;
70:
71: //
72: if ((tagClass == 2) &&
73: ((tagID == 48) || (tagID == 6) || (tagID == 81) || (tagID == 83)))
74: return Readparam(Plugin, request);
75: else
76: return 0;
77: }
78:
79: //
80: void Write(OpcMP_plugin_t *Plugin, struct request *request) {
81:
82: //
83: int replyLength = 0;
84:
85: //
86: int requestLength = 0;
87:
88: // id
89: unsigned short int tagID = request->tagID;
90:
91: // pumpAddress
92: unsigned short int pumpAddress = request->pumpAddress;
93:
94: // set
95: unsigned short int setSetpoint = request->setSetpoint;
96:
97: //
98: unsigned short int tagClass = request->tagClass;
99:
100: // (start/stop || remote/local)
101: bool RType = request->RType;
102: bool CType = request->CType;
103:
104: //
105: WORD WORD_CRC;
106:
107: //
108: static byte byte_h, byte_l;
109:
110: //
111: requestBuffer[0] = 0x27;
112:
113: //
114: requestBuffer[2] = pumpAddress;
115:
116: //
117: requestBuffer[4] = tagClass;
118:
119: // switch
120: switch (tagClass) {
121: case 3:
122: requestBuffer[1] = 0x05;
123: requestBuffer[3] = 0x00;
124: requestBuffer[5] = 0x81;
125:
126: // switch
127: switch (tagID) {
128:
129: // start/stop
130: case 6:
131: if (!CType)
132: requestBuffer[6] = 0x06;
133: else
134: requestBuffer[6] = 0x05;
135: break;
136:
137: // remote/local
138: case 7:
139: if (!RType)
140: requestBuffer[6] = 0x07;
141: else
142: requestBuffer[6] = 0x08;
143: break;
144: default:
145: break;
146: }
147: requestLength = 7;
148: break;
149: case 5:
150: requestBuffer[1] = 0x06;
151: requestBuffer[3] = 0x00;
152: requestBuffer[5] = 0x82;
153: requestBuffer[6] = 0x01;
154: requestBuffer[7] = setSetpoint;
155: requestLength = 8;
156: break;
157: default:
158: break;
159: }
160:
161: request->Status = -1;
162:
163: //
164: WORD_CRC = calculateCRC(requestBuffer, requestLength);
165: byte_h = WORD_CRC >> 8;
166: byte_l = WORD_CRC & 0x00FF;
167:
168: //
169: requestBuffer[requestLength] = byte_h;
170: requestBuffer[requestLength + 1] = byte_l;
171:
172: //
173: replyLength = SendBlockToRs(Plugin, request->port, requestBuffer,
174: requestLength + 2, replyBuffer, 57, 3);
175:
176: //
177: if (replyLength <= 2) {
178: mps_DebugMessage(Plugin, "устройство не ответило ");
179: request->Status = -1;
180: }
181:
182: //
183: if (replyLength > 2) {
184: WORD_CRC = calculateCRC(replyBuffer, replyLength - 2);
185: byte_h = WORD_CRC >> 8;
186: byte_l = WORD_CRC & 0x00FF;
187: if ((byte_h == replyBuffer[replyLength - 2]) &&
188: (byte_l == replyBuffer[replyLength - 1])) {
189: request->Status = 1;
190: } else {
191: request->Status = -1;
192: mps_DebugMessage(Plugin, "ошибка контрольной суммы CRC");
193: }
194: }
195:
196: //
197: if (replyLength > 0) {
198: if (replyLength < 170) {
199: for (int i = 0; i < replyLength; i++)
200: request->replyBufferCopy = replyBuffer; // копируем ответ
201: request->replyLengthCopy = replyLength; // длина ответа
202: } else {
203: request->Status = -1;
204: request->replyLengthCopy = 0;
205: }
206: }
207: }
208:
209: //
210: int Readparam(OpcMP_plugin_t *Plugin, struct request *request) {
211: int replyLength = 0;
212: int requestLength = 0;
213: unsigned short int tagID = request->tagID;
214: unsigned short int pumpAddress = request->pumpAddress;
215: unsigned short int tagClass = request->tagClass;
216:
217: //
218: WORD WORD_CRC;
219: static byte byte_h, byte_l;
220:
221: //
222: requestBuffer[0] = 0x27;
223: requestBuffer[1] = 0x05;
224: requestBuffer[2] = pumpAddress;
225: requestBuffer[3] = 0x00;
226: requestBuffer[4] = tagClass;
227: requestBuffer[5] = 0x01;
228: requestBuffer[6] = tagID;
229: requestLength = 7;
230:
231: request->Status = -1;
232:
233: //
234: WORD_CRC = calculateCRC(requestBuffer, requestLength);
235: byte_h = WORD_CRC >> 8;
236: byte_l = WORD_CRC & 0x00FF;
237: requestBuffer[requestLength] = byte_h;
238: requestBuffer[requestLength + 1] = byte_l;
239:
240: //
241: replyLength = SendBlockToRs(Plugin, request->port, requestBuffer,
242: requestLength + 2, replyBuffer, 57, 3);
243:
244: // < 2
245: if (replyLength <= 2) {
246: mps_DebugMessage(Plugin, "устройство не ответило ");
247: request->Status = -1;
248: return 0;
249: };
250:
251: // > 2, CRT
252: if (replyLength > 2) {
253: WORD_CRC = calculateCRC(replyBuffer, replyLength - 2);
254: byte_h = WORD_CRC >> 8;
255: byte_l = WORD_CRC & 0x00FF;
256: if ((byte_h == replyBuffer[replyLength - 2]) &&
257: (byte_l == replyBuffer[replyLength - 1])) {
258: request->Status = 1;
259:
260: } else {
261: request->Status = -1;
262: mps_DebugMessage(Plugin, "ошибка контрольной суммы CRC");
263: }
264: };
265:
266: // > 0
267: if (replyLength > 0) {
268: if (replyLength < 170) {
269: for (int i = 0; i < replyLength; i++)
270: request->replyBufferCopy = replyBuffer;
271: request->replyLengthCopy = replyLength;
272: } else {
273: request->Status = -1;
274: request->replyLengthCopy = 0;
275: }
276: }
277: return 0;
278: }