OSI/FTAM Programming Reference Manual

NonStop FTAM Programming Examples
HP NonStop OSI/FTAM Programming Reference Manual528611-001
G-230
Translation Application Example
319 OpenMsg = (zsys_ddl_smsg_open_def *) saSpiBuffer;
320 /* Only allow #ZSPI openers */
321 if ((OpenMsg->z_qualifier_len != 5) ||
322 !memcmp (OpenMsg->u_z_data.z_qualifier +
323 OpenMsg->z_opener_name.zlen,
324 "#ZSPI", 5))
325 {
326 REPLYX (, , , , 2); /* Don’t allow open! */
327 return;
328 }
329 FILE_GETRECEIVEINFO_ ((short *) &ReceiveInfo);
330 if (PROCESSHANDLE_COMPARE_ ((short *) &ReceiveInfo.z_sender,
331 (short *) &ResponderPhandle) < 1)
332 {
333 /* Don’t allow open other than ’my’ responder! */
334 REPLYX (, , , , 49);
335 return;
336 }
337 /* Count the opener. */
338 sOpenerCount++;
339 break;
340
341 case ZSYS_VAL_SMSG_CLOSE:
342 if ((sSpiFnum < 0) || (sOpenerCount < 1))
343 break;
344 /* Count the closes */
345 sOpenerCount--;
346 if (sOpenerCount < 1)
347 {
348 /* Give responder time to do backup takeover... */
349 DELAY (500);
350 /* The first call to OpenResponderFile(), causes an attempt */
351 /* to send a new translate request to the responder. If the */
352 /* attempt fails, the responder closes. */
353 if (OpenResponderFile())
354 printf ("Opener Backup Gone! Reestablished"
355 " with Primary.\n");
356 else
357 /* The second call to OpenResponderFile() tries to reopen */