Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/MbsAPI/f_ut_status.c

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

Generated on Tue Nov 8 10:56:08 2005 for Go4-v2.10-5 by doxygen1.2.15