/* ** File name: GETSYI_PROC_S.C ** ** Copyright (c) 1991, by ** Process Software Corporation ** Framingham, Massachusetts */ /* ** Include files */ #include "TCPWARE_INCLUDE:RPC.H" #include "GETSYI.H" #include "GETSYI_DEF.H" /* ** Declare Functions */ extern thread_info *parse_rpc_args(); extern void encode_rpc_res(); /* **************************************** ** ** Function: getsyi_proc_1_1() ** ** Abstract: ** This routine converts the VAX format RPC arguments into the form that ** GETSYI expects, calls SYS$GETSYIW, converts the results into VAX ** format RPC results, and returns the address of these results to the ** dispatch routine. ** ** Return value: ** The address of the results or 0 if a severe error occurred. */ getsyi_res *getsyi_proc_1_1( argsp, rqstp) getsyi_args *argsp; struct svc_req *rqstp; { int i; DSC *node; thread_info *ti; /* ** These variables are used to contain the results that will be sent to the ** client. They must be static. */ static getsyi_res results; static char message[ 256+1]; static char rslt_str[ MAX_ITEM_CODES][ MAX_STRING_LEN+1]; static result rslt_array[ MAX_ITEM_CODES] = {0}; /* ** The first time that the server is called it will set up the array rslt_str ** to contain the addresses of all of the result strings in the array ** rslt_array. */ if( rslt_array[0] == 0) for( i = MAX_ITEM_CODES-1; i >= 0; --i) rslt_array[i] = rslt_str[i]; /* ** Convert the strings that the client sent into the integers that SYS$GETSYI ** expects. This function also sets up other information that will be used ** when converting the results into string to send to the client. */ if( (ti = parse_rpc_args( argsp)) == 0) { svcerr_systemerr( rqstp->rq_xprt); /* ran out of memory */ return( 0); } ti->ti_xprt = rqstp->rq_xprt; /* save the server handle for later */ ti->ti_rqstp = rqstp; /* save the request pointer */ ti->ti_args = argsp; /* save the arguments */ /* ** parse_rpc_args returns errors in ti->ti_results.gsr_status. */ _error( ti->ti_results.gsr_status) { results = ti->ti_results; goto all_done; } /* ** If the client did not send a node string, pass a NULL pointer to SYS$GETSYI. */ if( ti->ti_node.dsc$w_length == 0) node = 0; else node = &ti->ti_node; results.gsr_status = sys$getsyiw( 0, 0, node, ti->ti_getsyi_args, &ti->ti_iosb, 0, 0); /* ** If the call was successful, get the status from the iosb. */ _success( results.gsr_status) results.gsr_status = ti->ti_iosb.val[0]; all_done: /* ** The status code determines whether a message or an array of results will be ** sent to the client. */ _success( results.gsr_status) results.getsyi_res_u.gsr_info.gsi_results.gsi_results_val = rslt_array; else results.getsyi_res_u.gsr_msg = message; encode_rpc_res( ti, &results); /* ** Free the thread information that parse_rpc_args allocated. */ free_vm( ti); return( &results); } /* end function getsyi_proc_1_1() */ /* end file GETSYI_PROC_S.C */