/************************************************************************************** * Copyright 1998 Compaq Computer Corporation. * Restricted Rights: Use, duplication, or disclosure by the U.S. Government * is subject to restrictions as set forth in subparagraph (c) (1) (ii) of * DFARS 252.227-7013, or in FAR 52.227-19, or in FAR 52.227-14 Alt. III, as * applicable. * This software is proprietary to and embodies the confidential technology of * Compaq Computer Corporation. Possession, use, of copying of this software * and media is authorized only pursuant to a valid written license from Compaq, * Digital or an authorized sublicensor. ***************************************************************************************/ /************************************************************************************** * APPLICATION: RTR Sample Server Application * MODULE NAME: adg_server.c * AUTHOR : Compaq Computer Corporation * DESCRIPTION: This server application receives transactions and receives * transaction status. It is to be used with adg_client.c, * adg_header.h, and adg_shared.c. * DATE : Oct 22, 1998 * * Modification History * 02Feb2009 Deepak/Chinmay QXCR1000780812 [] RTR 64 bit library Support on OpenVMS ***************************************************************************************/ /* adg_server.c Goes with adg_client.c To build on Unix: cc -o adg_server adg_server.c adg_shared.c -lrtr */ #include "adg_header.h" #ifdef VMS typedef __int64 rtr_sgn_64_t; #include /* QXCR1000780812 */ #endif void declare_server (rtr_channel_t *channel, const message_data_t *outmsg); FILE *fpLog; int main( int argc, char *argv[] ) { /* * This program expects 2 parameters : * 1: server number (1 or 2) * 2: partition range */ rtr_msgsb_t msgsb; receive_msg_t receive_msg; message_data_t reply_msg; rtr_timout_t receive_time_out = RTR_NO_TIMOUTMS; char SvrLog[80]; time_t time_val = { 0 }; rtr_channel_t channel; rtr_status_t status = (rtr_status_t)0; rtr_bool_t replay; strcpy( reply_msg.text , "from Server"); /* QXCR1000780812 : The argument passed to main routine is 32 bit pointers on OpenVMS. Copying into 64 bit pointers */ #ifdef VMS rtr_sgn_64_t *tmp_argv; tmp_argv = (rtr_sgn_64_t *) _malloc32(sizeof(rtr_sgn_64_t)*argc); if(!tmp_argv) { printf("out of memory _malloc32 (%lld)", (sizeof(rtr_sgn_64_t)*argc)); exit(-1); } for (int i =0; irouting_key); p_keyseg[0].ks_hi_bound = /* const_cast */ (rtr_uns_8_t *)(&outmsg->routing_key); status = rtr_open_channel( channel, RTR_F_OPE_SERVER,/* | RTR_F_OPE_EXPLICIT_ACCEPT | */ /* RTR_F_OPE_EXPLICIT_PREPARE, */ facility, NULL, /* rpcnam */ RTR_NO_PEVTNUM, NULL, /* access */ numseg, p_keyseg); check_status( "rtr_open_channel", status); status = rtr_receive_message( channel, RTR_NO_FLAGS, RTR_ANYCHAN, &receive_msg, sizeof(receive_msg), receive_time_out, &msgsb); check_status( "rtr_receive_message", status); if ( msgsb.msgtype != rtr_mt_opened ) { fprintf(fpLog, " Error opening rtr channel %s: \n", facility); fprintf(fpLog, "%s\n", rtr_error_text(receive_msg.receive_status_msg.status)); fclose (fpLog); exit(EXIT_FAILURE); } fprintf(fpLog, " Server channel successfully opened \n"); return; }