Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

f_ut_status.c

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "typedefs.h"
00017 #include <stdlib.h>
00018 #include <stdio.h>
00019 #include <errno.h>
00020 #include <string.h>
00021 #include <memory.h>
00022 #include <sys/types.h>
00023 #include <ctype.h>
00024 #include "sbs_def.h"
00025 #include "sys_def.h"
00026 #include "ml_def.h"
00027 #include "s_daqst.h"
00028 #include "s_setup.h"
00029 #include "s_set_ml.h"
00030 #include "s_set_mo.h"
00031 #include "f_stccomm.h"
00032 
00033 #define VERSION__DAQST  2
00034 #define VERSION__SETUP  1
00035 #define VERSION__SET_ML 1
00036 #define VERSION__SET_MO 1
00037 /*****************+***********+****************************************/
00038 /*                                                                    */
00039 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00040 /*   Postfach 11 05 52                                                */
00041 /*   D-64220 Darmstadt                                                */
00042 /*                                                                    */
00043 /*1+ C Procedure *************+****************************************/
00044 /*                                                                    */
00045 /*+ Module      : f_ut_status_ini                                     */
00046 /*                                                                    */
00047 /*--------------------------------------------------------------------*/
00048 /*+ CALLING     : l_status=f_ut_status_ini(s_daqst)                   */
00049 /*--------------------------------------------------------------------*/
00050 /*                                                                    */
00051 /*+ PURPOSE     : Initialize s_daqst.                                 */
00052 /*                                                                    */
00053 /*+ ARGUMENTS   :                                                     */
00054 /*+  s_daqst    : pointer to s_daqst                                  */
00055 /*2+Implementation************+****************************************/
00056 /*+ File name   : f_ut_status.c                                       */
00057 /*+ Home direct.: /mbs/prod/src                                       */
00058 /*+ Version     : 2.01                                                */
00059 /*+ Author      : H.G.Essel                                           */
00060 /*+ Created     : 14-Nov-1998                                         */
00061 /*+ Object libr.: mbslib.a                                            */
00062 /*+ Updates     : Date        Purpose                                 */
00063 /*1- C Procedure *************+****************************************/
00064 INTS4 f_ut_status_ini(s_daqst *ps_daqst)
00065 {
00066  if(ps_daqst == NULL) return -1;
00067 
00068  ps_daqst->l_endian            = 1;
00069  ps_daqst->l_version           = VERSION__DAQST;
00070  ps_daqst->l_daqst_lw          = sizeof(s_daqst)/4;
00071  ps_daqst->l_fix_lw            = ((long)&ps_daqst->c_pname[0][0]-(long)ps_daqst)/4;
00072  ps_daqst->l_sys__n_max_procs  = SYS__N_MAX_PROCS;
00073  ps_daqst->l_sbs__str_len_64   = SBS__STR_LEN_64;
00074  ps_daqst->l_sbs__n_trg_typ    = SBS__N_TRG_TYP;
00075  ps_daqst->bh_daqst_initalized = 1;
00076 
00077  return 0;
00078 }
00079 
00080 /*****************+***********+****************************************/
00081 /*                                                                    */
00082 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00083 /*   Postfach 11 05 52                                                */
00084 /*   D-64220 Darmstadt                                                */
00085 /*                                                                    */
00086 /*1+ C Procedure *************+****************************************/
00087 /*                                                                    */
00088 /*+ Module      : f_ut_status                                         */
00089 /*                                                                    */
00090 /*--------------------------------------------------------------------*/
00091 /*+ CALLING     : l_status=f_ut_status(s_daqst, socket)               */
00092 /*--------------------------------------------------------------------*/
00093 /*                                                                    */
00094 /*+ PURPOSE     : Send s_daqst to socket.                             */
00095 /*                                                                    */
00096 /*+ ARGUMENTS   :                                                     */
00097 /*+  s_daqst    : pointer to s_daqst                                  */
00098 /*+  socket     : Tcp socket from accept                              */
00099 /*2+Implementation************+****************************************/
00100 /*+ File name   : f_ut_status.c                                       */
00101 /*+ Home direct.: /mbs/prod/src                                       */
00102 /*+ Version     : 2.01                                                */
00103 /*+ Author      : H.G.Essel                                           */
00104 /*+ Created     : 14-Nov-1998                                         */
00105 /*+ Object libr.: mbslib.a                                            */
00106 /*+ Updates     : Date        Purpose                                 */
00107 /*1- C Procedure *************+****************************************/
00108 INTS4 f_ut_status(s_daqst *ps_daqst, INTS4 l_tcp)
00109 {
00110 INTS4 l,l_status;
00111 
00112 l = ps_daqst->l_fix_lw * 4 + ps_daqst->l_procs_run * ps_daqst->l_sbs__str_len_64;
00113 /*printf("daqst Send %d LW + %d LW",ps_daqst->l_fix_lw,ps_daqst->l_procs_run * ps_daqst->l_sbs__str_len_64/4);*/
00114 l_status = f_stc_write (ps_daqst, l, l_tcp);
00115 return l_status;
00116 }
00117 
00118 /*****************+***********+****************************************/
00119 /*                                                                    */
00120 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00121 /*   Postfach 11 05 52                                                */
00122 /*   D-64220 Darmstadt                                                */
00123 /*                                                                    */
00124 /*1+ C Procedure *************+****************************************/
00125 /*                                                                    */
00126 /*+ Module      : f_ut_status_r                                       */
00127 /*                                                                    */
00128 /*--------------------------------------------------------------------*/
00129 /*+ CALLING     : l_status=f_ut_status_r(s_daqst, socket)             */
00130 /*--------------------------------------------------------------------*/
00131 /*                                                                    */
00132 /*+ PURPOSE     : Read s_daqst from socket.                           */
00133 /*                                                                    */
00134 /*+ ARGUMENTS   :                                                     */
00135 /*+  s_daqst    : pointer to s_daqst                                  */
00136 /*+  socket     : Tcp socket from connect                             */
00137 /*2+Implementation************+****************************************/
00138 /*+ File name   : f_ut_status.c                                       */
00139 /*+ Home direct.: /mbs/prod/src                                       */
00140 /*+ Version     : 2.01                                                */
00141 /*+ Author      : H.G.Essel                                           */
00142 /*+ Created     : 14-Nov-1998                                         */
00143 /*+ Object libr.: mbslib.a                                            */
00144 /*+ Updates     : Date        Purpose                                 */
00145 /*1- C Procedure *************+****************************************/
00146 INTS4 f_ut_status_r(s_daqst *ps_daqst, INTS4 l_tcp)
00147 {
00148   INTS4 l_swap=0;
00149   INTS4 l_cmd;
00150   INTS4 i,k;
00151   INTS4 l_status;
00152   INTU4 *pc;
00153 
00154   memset((void *)ps_daqst,0,sizeof(s_daqst));
00155   l_cmd=1;
00156   l_status = f_stc_write (&l_cmd,4,l_tcp);                 if (l_status != STC__SUCCESS) return(-1);
00157   l_status = f_stc_read (&ps_daqst->l_endian,28,l_tcp,-1); if (l_status != STC__SUCCESS) return(-1);
00158   if(ps_daqst->l_endian != 1) l_swap = 1;
00159   if(l_swap == 1) l_status = f_swaplw(&ps_daqst->l_endian,7,NULL);
00160   if(ps_daqst->l_version == 1)
00161     {
00162   if(ps_daqst->l_daqst_lw > 1000) // or version > 1 (MBS v44)
00163     { // read till maxcli
00164       k=(ps_daqst->l_fix_lw-7)*4-16 * SBS__STR_LEN_64;
00165       l_status = f_stc_read (&ps_daqst->bh_daqst_initalized, k , l_tcp,-1);
00166       if(l_swap == 1) l_status = f_swaplw(&ps_daqst->bh_daqst_initalized, k/4,NULL);
00167       // read from c_user
00168       l_status = f_stc_read (&ps_daqst->c_user, 16 * SBS__STR_LEN_64 , l_tcp,-1);
00169     }
00170   else // (MBS v43)
00171     { // bh_verbose_flg to bl_esosrv_maxcli is 17 LWs. fix_lw is 526 LWs for MBS v44, 476 for v43
00172       k = 17 + 5*ps_daqst->l_sys__n_max_procs + 3*ps_daqst->l_sbs__n_trg_typ + 16*ps_daqst->l_sbs__str_len_64/4;
00173       l_status = f_stc_read (&ps_daqst->bh_daqst_initalized,(ps_daqst->l_fix_lw-7-k)*4 , l_tcp,-1);
00174       l_status = f_stc_read (&ps_daqst->bl_n_trig[0],        ps_daqst->l_sbs__n_trg_typ*4 , l_tcp,-1);
00175       l_status = f_stc_read (&ps_daqst->bl_n_si  [0],        ps_daqst->l_sbs__n_trg_typ*4 , l_tcp,-1);
00176       l_status = f_stc_read (&ps_daqst->bl_n_evt [0],        ps_daqst->l_sbs__n_trg_typ*4 , l_tcp,-1);
00177       l_status = f_stc_read (&ps_daqst->bh_running[0],       ps_daqst->l_sys__n_max_procs*4 , l_tcp,-1);
00178       l_status = f_stc_read (&ps_daqst->l_pid[0],            ps_daqst->l_sys__n_max_procs*4 , l_tcp,-1);
00179       l_status = f_stc_read (&ps_daqst->l_type[0],           ps_daqst->l_sys__n_max_procs*4 , l_tcp,-1);
00180       l_status = f_stc_read (&ps_daqst->l_pprio[0],          ps_daqst->l_sys__n_max_procs*4 , l_tcp,-1);
00181       l_status = f_stc_read (&ps_daqst-> bh_pact[0],         ps_daqst->l_sys__n_max_procs*4 , l_tcp,-1);
00182       l_status = f_stc_read (&ps_daqst->bh_verbose_flg,      17*4 , l_tcp,-1);
00183       k = 17 + 5*SYS__N_MAX_PROCS + 3*SBS__N_TRG_TYP + 55 -7; // for swapping we need actual structure sizes
00184       if(l_swap == 1) l_status = f_swaplw(&ps_daqst->bh_daqst_initalized,k,NULL);
00185       l_status = f_stc_read (&ps_daqst->c_user, 16 * SBS__STR_LEN_64 , l_tcp,-1);
00186     }
00187     }
00188   if(ps_daqst->l_version == 2)
00189     {
00190       l_status = f_stc_read (&ps_daqst->bh_daqst_initalized, (ps_daqst->l_fix_lw-7)*4 , l_tcp,-1);
00191       if(l_swap == 1) l_status = f_swaplw(&ps_daqst->bh_daqst_initalized, (ps_daqst->l_fix_lw-7) - (16 * SBS__STR_LEN_64/4),NULL);
00192     }
00193 
00194 
00195   l_status = f_stc_read (&ps_daqst->c_pname[0], ps_daqst->l_procs_run * ps_daqst->l_sbs__str_len_64 , l_tcp,-1);
00196   return l_status;
00197 }
00198 
00199 /*****************+***********+****************************************/
00200 /*                                                                    */
00201 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00202 /*   Postfach 11 05 52                                                */
00203 /*   D-64220 Darmstadt                                                */
00204 /*                                                                    */
00205 /*1+ C Procedure *************+****************************************/
00206 /*                                                                    */
00207 /*+ Module      : f_ut_setup_ini                                      */
00208 /*                                                                    */
00209 /*--------------------------------------------------------------------*/
00210 /*+ CALLING     : l_status=f_ut_setup_ini(s_setup)                    */
00211 /*--------------------------------------------------------------------*/
00212 /*                                                                    */
00213 /*+ PURPOSE     : Initialize s_setup.                                 */
00214 /*                                                                    */
00215 /*+ ARGUMENTS   :                                                     */
00216 /*+  s_setup    : pointer to s_setup                                  */
00217 /*2+Implementation************+****************************************/
00218 /*+ File name   : f_ut_status.c                                       */
00219 /*+ Home direct.: /mbs/prod/src                                       */
00220 /*+ Version     : 2.01                                                */
00221 /*+ Author      : H.G.Essel                                           */
00222 /*+ Created     : 14-Nov-1998                                         */
00223 /*+ Object libr.: mbslib.a                                            */
00224 /*+ Updates     : Date        Purpose                                 */
00225 /*1- C Procedure *************+****************************************/
00226 INTS4 f_ut_setup_ini(s_setup *ps_setup)
00227 {
00228 if(ps_setup == NULL) return -1;
00229 ps_setup->l_endian     = 1;
00230 ps_setup->l_version    = VERSION__SETUP;
00231 ps_setup->bl_struc_len = sizeof(s_setup)/4;
00232 ps_setup->l_fix_lw     = ((long)&ps_setup->lp_rem_mem_base[0]-(long)ps_setup)/4;
00233 ps_setup->bl_sbs__n_cr = SBS__N_CR;
00234 ps_setup->bl_sbs__n_trg_typ = SBS__N_TRG_TYP;
00235 return 0;
00236 }
00237 
00238 /*****************+***********+****************************************/
00239 /*                                                                    */
00240 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00241 /*   Postfach 11 05 52                                                */
00242 /*   D-64220 Darmstadt                                                */
00243 /*                                                                    */
00244 /*1+ C Procedure *************+****************************************/
00245 /*                                                                    */
00246 /*+ Module      : f_ut_setup                                          */
00247 /*                                                                    */
00248 /*--------------------------------------------------------------------*/
00249 /*+ CALLING     : l_status=f_ut_setup(s_setup, s_setup, socket)       */
00250 /*--------------------------------------------------------------------*/
00251 /*                                                                    */
00252 /*+ PURPOSE     : Write s_setup to socket.                            */
00253 /*                                                                    */
00254 /*+ ARGUMENTS   :                                                     */
00255 /*+  s_setup    : pointer to s_setup                                  */
00256 /*+  s_setup    : pointer to copy of s_setup                          */
00257 /*+  socket     : Tcp socket from accept                              */
00258 /*2+Implementation************+****************************************/
00259 /*+ File name   : f_ut_status.c                                       */
00260 /*+ Home direct.: /mbs/prod/src                                       */
00261 /*+ Version     : 2.01                                                */
00262 /*+ Author      : H.G.Essel                                           */
00263 /*+ Created     : 14-Nov-1998                                         */
00264 /*+ Object libr.: mbslib.a                                            */
00265 /*+ Updates     : Date        Purpose                                 */
00266 /*1- C Procedure *************+****************************************/
00267 INTS4 f_ut_setup(s_setup *ps_setup, INTU4 *pl_o, INTS4 l_tcp)
00268 {
00269 INTS4 i,l,k,n=0,l_status;
00270 INTU4 *pl_count,*pl_s,*pl_size;
00271 
00272 l_status = f_ut_setup_ini(ps_setup);
00273 
00274 /*printf("setup Send %d LW + ",ps_setup->l_fix_lw);*/
00275 l_status = f_stc_write (ps_setup, ps_setup->l_fix_lw*4, l_tcp);
00276 pl_count = pl_o++;
00277 pl_size = pl_o++;
00278 l = 0;
00279 for(i=0; i<ps_setup->bl_sbs__n_cr; i++)
00280 {
00281   if(ps_setup->bh_rd_flg[i] != 0)
00282   {
00283     n=0;
00284     l++;
00285     *pl_o++ = i; n++;
00286     *pl_o++ = (INTU4) ps_setup->lp_rem_mem_base[i]; n++;
00287     *pl_o++ = (INTU4) ps_setup->bl_rem_mem_off[i]; n++;
00288     *pl_o++ = (INTU4) ps_setup->bl_rem_mem_len[i]; n++;
00289     *pl_o++ = (INTU4) ps_setup->lp_rem_cam_base[i]; n++;
00290     *pl_o++ = (INTU4) ps_setup->bl_rem_cam_off[i]; n++;
00291     *pl_o++ = (INTU4) ps_setup->bl_rem_cam_len[i]; n++;
00292     *pl_o++ = (INTU4) ps_setup->lp_loc_mem_base[i]; n++;
00293     *pl_o++ = (INTU4) ps_setup->bl_loc_mem_len[i]; n++;
00294     *pl_o++ = (INTU4) ps_setup->lp_loc_pipe_base[i]; n++;
00295     *pl_o++ = (INTU4) ps_setup->bl_pipe_off[i]; n++;
00296     *pl_o++ = (INTU4) ps_setup->bl_pipe_seg_len[i]; n++;
00297     *pl_o++ = (INTU4) ps_setup->bl_pipe_len[i]; n++;
00298     *pl_o++ = (INTU4) ps_setup->bh_controller_id[i]; n++;
00299     *pl_o++ = (INTU4) ps_setup->bh_sy_asy_flg[i]; n++;
00300     *pl_o++ = (INTU4) ps_setup->bh_trig_stat_nr[i]; n++;
00301     *pl_o++ = (INTU4) ps_setup->bl_trig_cvt[i]; n++;
00302     *pl_o++ = (INTU4) ps_setup->bl_trig_fct[i]; n++;
00303     *pl_o++ = (INTU4) ps_setup->i_se_typ[i]; n++;
00304     *pl_o++ = (INTU4) ps_setup->i_se_subtyp[i]; n++;
00305     *pl_o++ = (INTU4) ps_setup->i_se_procid[i]; n++;
00306     *pl_o++ = (INTU4) ps_setup->bh_rd_flg[i]; n++;
00307     *pl_o++ = (INTU4) ps_setup->bl_init_tab_off[i]; n++;
00308     *pl_o++ = (INTU4) ps_setup->bi_init_tab_len[i]; n++;
00309     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++)
00310     *pl_o++ = (INTU4) ps_setup->bl_max_se_len[i][k];
00311     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++)
00312     *pl_o++ = (INTU4) ps_setup->bl_rd_tab_off[i][k];
00313     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++)
00314     *pl_o++ = (INTU4) ps_setup->bi_rd_tab_len[i][k];
00315     n = n + 3 * ps_setup->bl_sbs__n_trg_typ;
00316   }
00317 }
00318 *pl_count=l;
00319 *pl_size=n;
00320 l = l * n + 2;
00321 /*printf("%d \n",l);*/
00322 l_status = f_stc_write (pl_count, l * 4, l_tcp);
00323 return l_status;
00324 }
00325 
00326 /*****************+***********+****************************************/
00327 /*                                                                    */
00328 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00329 /*   Postfach 11 05 52                                                */
00330 /*   D-64220 Darmstadt                                                */
00331 /*                                                                    */
00332 /*1+ C Procedure *************+****************************************/
00333 /*                                                                    */
00334 /*+ Module      : f_ut_setup_r                                        */
00335 /*                                                                    */
00336 /*--------------------------------------------------------------------*/
00337 /*+ CALLING     : l_status=f_ut_setup_r(s_setup, socket)              */
00338 /*--------------------------------------------------------------------*/
00339 /*                                                                    */
00340 /*+ PURPOSE     : Read s_setup from socket.                           */
00341 /*                                                                    */
00342 /*+ ARGUMENTS   :                                                     */
00343 /*+  s_setup    : pointer to s_setup                                  */
00344 /*+  socket     : Tcp socket from connect                             */
00345 /*2+Implementation************+****************************************/
00346 /*+ File name   : f_ut_status.c                                       */
00347 /*+ Home direct.: /mbs/prod/src                                       */
00348 /*+ Version     : 2.01                                                */
00349 /*+ Author      : H.G.Essel                                           */
00350 /*+ Created     : 14-Nov-1998                                         */
00351 /*+ Object libr.: mbslib.a                                            */
00352 /*+ Updates     : Date        Purpose                                 */
00353 /*1- C Procedure *************+****************************************/
00354 INTS4 f_ut_setup_r(s_setup *ps_setup, INTS4 l_tcp)
00355 {
00356 INTS4 l_swap=0;
00357 INTS4 l_cmd;
00358 INTS4 i,k,l_items,l_size,l_crate;
00359 INTS4 *pl_b,*pl_o;
00360 INTS4 l_status;
00361 
00362  memset(ps_setup,0,sizeof(s_setup));
00363 l_cmd=2;
00364 l_status = f_stc_write (&l_cmd,4,l_tcp);                 if (l_status != STC__SUCCESS) return(-1);
00365 l_status = f_stc_read (&ps_setup->l_endian,16,l_tcp,-1); if (l_status != STC__SUCCESS) return(-1);
00366 if(ps_setup->l_endian != 1) l_swap = 1;
00367 if(l_swap == 1) l_status = f_swaplw(&ps_setup->l_endian,4,NULL);
00368 if(ps_setup->l_version != VERSION__SETUP) return -1;
00369              l_status = f_stc_read (&ps_setup->bl_sbs__n_cr, (ps_setup->l_fix_lw-4)*4 , l_tcp,-1);
00370              l_status = f_stc_read (&l_items,4 , l_tcp,-1);
00371              l_status = f_stc_read (&l_size,4 , l_tcp,-1);
00372 if(l_swap == 1) l_status = f_swaplw(&ps_setup->bl_sbs__n_cr, (ps_setup->l_fix_lw-4),NULL);
00373 if(l_swap == 1) l_status = f_swaplw(&l_items,1,NULL);
00374 if(l_swap == 1) l_status = f_swaplw(&l_size,1,NULL);
00375 pl_b = (INTS4 *) malloc(l_size * l_items * 4);
00376              l_status = f_stc_read (pl_b,l_size * l_items * 4, l_tcp,-1);
00377 if(l_swap == 1) l_status = f_swaplw(pl_b,l_size * l_items,NULL);
00378 
00379 pl_o = pl_b;
00380 for(i=0;i<l_items;i++)
00381 {
00382     l_crate = *pl_o++;
00383      ps_setup->lp_rem_mem_base[l_crate] = *pl_o++;
00384      ps_setup->bl_rem_mem_off[l_crate] = *pl_o++;
00385      ps_setup->bl_rem_mem_len[l_crate] = *pl_o++;
00386      ps_setup->lp_rem_cam_base[l_crate] = *pl_o++;
00387      ps_setup->bl_rem_cam_off[l_crate] = *pl_o++;
00388      ps_setup->bl_rem_cam_len[l_crate] = *pl_o++;
00389      ps_setup->lp_loc_mem_base[l_crate] = *pl_o++;
00390      ps_setup->bl_loc_mem_len[l_crate] = *pl_o++;
00391      ps_setup->lp_loc_pipe_base[l_crate] = *pl_o++;
00392      ps_setup->bl_pipe_off[l_crate] = *pl_o++;
00393      ps_setup->bl_pipe_seg_len[l_crate] = *pl_o++;
00394      ps_setup->bl_pipe_len[l_crate] = *pl_o++;
00395      ps_setup->bh_controller_id[l_crate] = *pl_o++;
00396      ps_setup->bh_sy_asy_flg[l_crate] = *pl_o++;
00397      ps_setup->bh_trig_stat_nr[l_crate] = *pl_o++;
00398      ps_setup->bl_trig_cvt[l_crate] = *pl_o++;
00399      ps_setup->bl_trig_fct[l_crate] = *pl_o++;
00400      ps_setup->i_se_typ[l_crate] = *pl_o++;
00401      ps_setup->i_se_subtyp[l_crate] = *pl_o++;
00402      ps_setup->i_se_procid[l_crate] = *pl_o++;
00403      ps_setup->bh_rd_flg[l_crate] = *pl_o++;
00404      ps_setup->bl_init_tab_off[l_crate] = *pl_o++;
00405      ps_setup->bi_init_tab_len[l_crate] = *pl_o++;
00406     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++) ps_setup->bl_max_se_len[l_crate][k] = *pl_o++;
00407     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++) ps_setup->bl_rd_tab_off[l_crate][k] = *pl_o++;
00408     for(k=0;k<ps_setup->bl_sbs__n_trg_typ;k++) ps_setup->bi_rd_tab_len[l_crate][k] = *pl_o++;
00409 } /* setup */
00410 free(pl_b);
00411 return 0;
00412 }
00413 
00414 /*****************+***********+****************************************/
00415 /*                                                                    */
00416 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00417 /*   Postfach 11 05 52                                                */
00418 /*   D-64220 Darmstadt                                                */
00419 /*                                                                    */
00420 /*1+ C Procedure *************+****************************************/
00421 /*                                                                    */
00422 /*+ Module      : f_ut_set_ml_ini                                     */
00423 /*                                                                    */
00424 /*--------------------------------------------------------------------*/
00425 /*+ CALLING     : l_status=f_ut_set_ml_ini(s_set_ml)                  */
00426 /*--------------------------------------------------------------------*/
00427 /*                                                                    */
00428 /*+ PURPOSE     : Initialize s_set_ml.                                */
00429 /*                                                                    */
00430 /*+ ARGUMENTS   :                                                     */
00431 /*+  s_set_ml   : pointer to s_set_ml                                 */
00432 /*2+Implementation************+****************************************/
00433 /*+ File name   : f_ut_status.c                                       */
00434 /*+ Home direct.: /mbs/prod/src                                       */
00435 /*+ Version     : 2.01                                                */
00436 /*+ Author      : H.G.Essel                                           */
00437 /*+ Created     : 14-Nov-1998                                         */
00438 /*+ Object libr.: mbslib.a                                            */
00439 /*+ Updates     : Date        Purpose                                 */
00440 /*1- C Procedure *************+****************************************/
00441 INTS4 f_ut_set_ml_ini(s_set_ml *ps_set_ml)
00442 {
00443 if(ps_set_ml == NULL) return -1;
00444 ps_set_ml->l_endian        = 1;
00445 ps_set_ml->l_version       = VERSION__SET_ML;
00446 ps_set_ml->l_set_ml_lw     = sizeof(s_set_ml)/4;
00447 ps_set_ml->l_fix_lw        = ((long)&ps_set_ml->c_rd_hostname[0][0]-(long)ps_set_ml)/4;
00448 ps_set_ml->l_ml__n_rd_pipe = ML__N_RD_PIPE;
00449 ps_set_ml->l_short_len     = 16;
00450 ps_set_ml->l_long_len      = 128;
00451 return 0;
00452 }
00453 
00454 /*****************+***********+****************************************/
00455 /*                                                                    */
00456 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00457 /*   Postfach 11 05 52                                                */
00458 /*   D-64220 Darmstadt                                                */
00459 /*                                                                    */
00460 /*1+ C Procedure *************+****************************************/
00461 /*                                                                    */
00462 /*+ Module      : f_ut_set_ml                                         */
00463 /*                                                                    */
00464 /*--------------------------------------------------------------------*/
00465 /*+ CALLING     : l_status=f_ut_set_ml(s_set_ml, s_set_ml, socket)    */
00466 /*--------------------------------------------------------------------*/
00467 /*                                                                    */
00468 /*+ PURPOSE     : Write s_set_ml to socket.                           */
00469 /*                                                                    */
00470 /*+ ARGUMENTS   :                                                     */
00471 /*+  s_set_ml   : pointer to s_set_ml                                 */
00472 /*+  s_set_ml   : pointer to copy of s_set_ml                         */
00473 /*+  socket     : Tcp socket from accept                              */
00474 /*2+Implementation************+****************************************/
00475 /*+ File name   : f_ut_status.c                                       */
00476 /*+ Home direct.: /mbs/prod/src                                       */
00477 /*+ Version     : 2.01                                                */
00478 /*+ Author      : H.G.Essel                                           */
00479 /*+ Created     : 14-Nov-1998                                         */
00480 /*+ Object libr.: mbslib.a                                            */
00481 /*+ Updates     : Date        Purpose                                 */
00482 /*1- C Procedure *************+****************************************/
00483 INTS4 f_ut_set_ml(s_set_ml *ps_set_ml, INTU4 *pl_o, INTS4 l_tcp)
00484 {
00485 INTS4 i,l,k,n=0,l_status;
00486 INTU4 *pl_count,*pl_s,*pl_size;
00487 
00488 l_status = f_ut_set_ml_ini(ps_set_ml);
00489 
00490 pl_count = pl_o;
00491 /*printf("MLset Send %d LW + ",ps_set_ml->l_fix_lw);*/
00492 l_status = f_stc_write (ps_set_ml, ps_set_ml->l_fix_lw*4, l_tcp);
00493 l = 0;
00494 for(i=0; i<ps_set_ml->l_n_rd_pipe; i++)
00495 {
00496     l++;
00497     pl_s = (INTU4 *)&ps_set_ml->c_rd_hostname[i];
00498     for(k=0;k<ps_set_ml->l_short_len/4;k++)*pl_o++ = *pl_s++;
00499     pl_s = (INTU4 *)&ps_set_ml->c_sbs_setup_path[i];
00500     for(k=0;k<ps_set_ml->l_long_len/4;k++)*pl_o++ = *pl_s++;
00501 }
00502 l = l * (ps_set_ml->l_short_len + ps_set_ml->l_long_len);
00503 /*printf("%d \n",l);*/
00504 l_status = f_stc_write (pl_count, l , l_tcp);
00505 return l_status;
00506 }
00507 
00508 /*****************+***********+****************************************/
00509 /*                                                                    */
00510 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00511 /*   Postfach 11 05 52                                                */
00512 /*   D-64220 Darmstadt                                                */
00513 /*                                                                    */
00514 /*1+ C Procedure *************+****************************************/
00515 /*                                                                    */
00516 /*+ Module      : f_ut_set_ml_r                                       */
00517 /*                                                                    */
00518 /*--------------------------------------------------------------------*/
00519 /*+ CALLING     : l_status=f_ut_set_ml_r(s_set_ml, socket)            */
00520 /*--------------------------------------------------------------------*/
00521 /*                                                                    */
00522 /*+ PURPOSE     : Read s_set_ml from socket.                          */
00523 /*                                                                    */
00524 /*+ ARGUMENTS   :                                                     */
00525 /*+  s_set_ml   : pointer to s_set_ml                                 */
00526 /*+  socket     : Tcp socket from connect                             */
00527 /*2+Implementation************+****************************************/
00528 /*+ File name   : f_ut_status.c                                       */
00529 /*+ Home direct.: /mbs/prod/src                                       */
00530 /*+ Version     : 2.01                                                */
00531 /*+ Author      : H.G.Essel                                           */
00532 /*+ Created     : 14-Nov-1998                                         */
00533 /*+ Object libr.: mbslib.a                                            */
00534 /*+ Updates     : Date        Purpose                                 */
00535 /*1- C Procedure *************+****************************************/
00536 INTS4 f_ut_set_ml_r(s_set_ml *ps_set_ml, INTS4 l_tcp)
00537 {
00538 INTS4 l_swap=0;
00539 INTS4 l_cmd;
00540 INTS4 i;
00541 INTS4 l_status;
00542 
00543 l_cmd=3;
00544 l_status = f_stc_write (&l_cmd,4, l_tcp);                 if (l_status != STC__SUCCESS) return(-1);
00545 l_status = f_stc_read (&ps_set_ml->l_endian,16,l_tcp,-1); if (l_status != STC__SUCCESS) return(-1);
00546 if(ps_set_ml->l_endian != 1) l_swap = 1;
00547 if(l_swap == 1) l_status = f_swaplw(&ps_set_ml->l_endian,4,NULL);
00548 if(ps_set_ml->l_version != VERSION__SET_ML) return -1;
00549              l_status = f_stc_read (&ps_set_ml->l_ml__n_rd_pipe,(ps_set_ml->l_fix_lw-4)*4 , l_tcp,-1);
00550 if(l_swap == 1) l_status = f_swaplw(&ps_set_ml->l_ml__n_rd_pipe,(ps_set_ml->l_fix_lw-4)-4,NULL); /* last 16 byte are char */
00551 for(i=0;i<ps_set_ml->l_n_rd_pipe;i++)
00552 {
00553    l_status = f_stc_read (&ps_set_ml->c_rd_hostname[i],   ps_set_ml->l_short_len, l_tcp,-1);
00554    l_status = f_stc_read (&ps_set_ml->c_sbs_setup_path[i],ps_set_ml->l_long_len,  l_tcp,-1);
00555 }
00556 return 0;
00557 }
00558 /*****************+***********+****************************************/
00559 /*                                                                    */
00560 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00561 /*   Postfach 11 05 52                                                */
00562 /*   D-64220 Darmstadt                                                */
00563 /*                                                                    */
00564 /*1+ C Procedure *************+****************************************/
00565 /*                                                                    */
00566 /*+ Module      : f_ut_set_mo_ini                                     */
00567 /*                                                                    */
00568 /*--------------------------------------------------------------------*/
00569 /*+ CALLING     : l_status=f_ut_set_mo_ini(s_set_mo)                  */
00570 /*--------------------------------------------------------------------*/
00571 /*                                                                    */
00572 /*+ PURPOSE     : Initialize s_set_mo.                                */
00573 /*                                                                    */
00574 /*+ ARGUMENTS   :                                                     */
00575 /*+  s_set_mo   : pointer to s_set_mo                                 */
00576 /*2+Implementation************+****************************************/
00577 /*+ File name   : f_ut_status.c                                       */
00578 /*+ Home direct.: /mbs/prod/src                                       */
00579 /*+ Version     : 2.01                                                */
00580 /*+ Author      : H.G.Essel                                           */
00581 /*+ Created     : 24-Oct-2005                                         */
00582 /*+ Object libr.: mbslib.a                                            */
00583 /*+ Updates     : Date        Purpose                                 */
00584 /*1- C Procedure *************+****************************************/
00585 INTS4 f_ut_set_mo_ini(s_set_mo *ps_set_mo)
00586 {
00587   INTS4 i;
00588 if(ps_set_mo == NULL) return -1;
00589 ps_set_mo->l_endian        = 1;
00590 ps_set_mo->l_version       = VERSION__SET_MO;
00591 ps_set_mo->l_set_mo_lw     = sizeof(s_set_mo)/4;
00592 ps_set_mo->l_swap_lw       = ((long)&ps_set_mo->c_ds_hostname[0][0]-(long)ps_set_mo)/4;
00593 ps_set_mo->l_max_nodes     = MO__N_NODE;
00594 ps_set_mo->l_no_senders    = 0;
00595 ps_set_mo->l_no_receivers  = 0;
00596  for(i=0;i<MO__N_NODE;i++)if(strlen(&ps_set_mo->c_ds_hostname[i][0]) > 0) ps_set_mo->l_no_senders++;
00597  for(i=0;i<MO__N_NODE;i++)if(strlen(&ps_set_mo->c_dr_hostname[i][0]) > 0) ps_set_mo->l_no_receivers++;
00598 return 0;
00599 }
00600 /*1+ C Procedure *************+****************************************/
00601 /*                                                                    */
00602 /*+ Module      : f_ut_set_mo                                         */
00603 /*                                                                    */
00604 /*--------------------------------------------------------------------*/
00605 /*+ CALLING     : l_status=f_ut_set_mo(s_set_mo, socket)               */
00606 /*--------------------------------------------------------------------*/
00607 /*                                                                    */
00608 /*+ PURPOSE     : Send s_set_mo to socket.                             */
00609 /*                                                                    */
00610 /*+ ARGUMENTS   :                                                     */
00611 /*+  s_daqst    : pointer to s_set_mo                                  */
00612 /*+  socket     : Tcp socket from accept                              */
00613 /*2+Implementation************+****************************************/
00614 /*+ File name   : f_ut_status.c                                       */
00615 /*+ Home direct.: /mbs/prod/src                                       */
00616 /*+ Version     : 2.01                                                */
00617 /*+ Author      : H.G.Essel                                           */
00618 /*+ Created     : 25.Oct.2005                                         */
00619 /*+ Object libr.: mbslib.a                                            */
00620 /*+ Updates     : Date        Purpose                                 */
00621 /*1- C Procedure *************+****************************************/
00622 INTS4 f_ut_set_mo(s_set_mo *ps_set_mo, INTS4 l_tcp)
00623 {
00624 INTS4 l,l_status;
00625 
00626  l_status=f_ut_set_mo_ini(ps_set_mo);
00627  if(l_status != 0) return l_status;
00628 l_status = f_stc_write (ps_set_mo, ps_set_mo->l_set_mo_lw*4, l_tcp);
00629 return l_status;
00630 }
00631 
00632 
00633 /*1+ C Procedure *************+****************************************/
00634 /*                                                                    */
00635 /*+ Module      : f_ut_set_mo_r                                       */
00636 /*                                                                    */
00637 /*--------------------------------------------------------------------*/
00638 /*+ CALLING     : l_status=f_ut_set_mo_r(s_set_mo, socket)            */
00639 /*--------------------------------------------------------------------*/
00640 /*                                                                    */
00641 /*+ PURPOSE     : Read s_set_mo from socket.                          */
00642 /*                                                                    */
00643 /*+ ARGUMENTS   :                                                     */
00644 /*+  s_set_mo   : pointer to s_set_mo                                 */
00645 /*+  socket     : Tcp socket from connect                             */
00646 /*2+Implementation************+****************************************/
00647 /*+ File name   : f_ut_status.c                                       */
00648 /*+ Home direct.: /mbs/prod/src                                       */
00649 /*+ Version     : 2.01                                                */
00650 /*+ Author      : H.G.Essel                                           */
00651 /*+ Created     : 25.Oct.2005                                         */
00652 /*+ Object libr.: mbslib.a                                            */
00653 /*+ Updates     : Date        Purpose                                 */
00654 /*1- C Procedure *************+****************************************/
00655 INTS4 f_ut_set_mo_r(s_set_mo *ps_set_mo, INTS4 l_tcp)
00656 {
00657 INTS4 l_swap=0;
00658 INTS4 l_cmd;
00659 INTS4 l_status;
00660 
00661 l_cmd=4;
00662 l_status = f_stc_write (&l_cmd,4, l_tcp);  if (l_status != STC__SUCCESS) return(-1);
00663 l_status = f_stc_read (ps_set_mo,16,l_tcp,-1); if (l_status != STC__SUCCESS) return(-1);
00664 if(ps_set_mo->l_endian != 1) l_swap=1;
00665 if(l_swap) l_status = f_swaplw(ps_set_mo,4,NULL);
00666 
00667 l_status = f_stc_read (&ps_set_mo->l_max_nodes,(ps_set_mo->l_set_mo_lw-4)*4,  l_tcp,-1);
00668 if(l_swap) l_status = f_swaplw(&ps_set_mo->l_max_nodes,ps_set_mo->l_swap_lw-4,NULL);
00669 
00670 return 0;
00671 }
00672 
00673 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:33 2008 for Go4-v3.04-1 by  doxygen 1.4.2