Changeset 3757 in Sophya for trunk


Ignore:
Timestamp:
Apr 30, 2010, 12:54:25 AM (15 years ago)
Author:
ansari
Message:

Ajout classes de transfert DMA vers Ethernet et lecture ethernet, Reza 29/04/2010

Location:
trunk/AddOn/TAcq
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/acqparam_exemple.d

    r3681 r3757  
    4040#  @reducpaqsz ReducedSize Offset
    4141reducpaqsz 1024 0
     42#### cartes de controle pour le mode transfert sur Ethernet
     43#  Liste des machines cibles pour les envois de paquets
     44#  @ethrtargets Target1 [ Target2 ... ]
     45ethrtargets machine1 machine2 ...
     46#  Activation du mode transfert direct DMA -> Ethernet , sans decoupage/verification en paquet a la source
     47#  @pci2ethdirect
     48#  Sur la machine destination, nombre total de liens (connexions) ethernet = NbTotalFibre
     49#  @ethrnlink 4
     50ethrnlink 4
    4251#  Pour desactiver l'ecriture des fichiers FITS
    4352#  @nosavesigfits
  • trunk/AddOn/TAcq/bracqvers.h

    r3683 r3757  
    55   Software version     LAL - 2008-2010
    66*/
    7 #define BAOR_ACQ_VER 6.6
    8 #define BAOR_ACQ_VER_STR "BaoAcq_v6r6_Nov09 "
     7#define BAOR_ACQ_VER 7.1
     8#define BAOR_ACQ_VER_STR "BaoAcq_v7r1_Avr10 "
    99
    1010#endif
  • trunk/AddOn/TAcq/brparam.cc

    r3704 r3757  
    44#include "strutilxx.h"
    55#include "bracqvers.h"
     6
     7#ifndef BRSPORTID
     8#define BRSPORTID 6912
     9#endif
    610
    711/* --Methode-- */
     
    129133  reducoffset=0;
    130134
     135  tcpportid=BRSPORTID;
     136  pci2eth_fgdirect=false;
     137  ethr_nlink = 0;
     138
    131139  skysource="";
    132140
     
    181189  redpqsize=p.redpqsize;
    182190  reducoffset=p.reducoffset;
     191
     192  pci2eth_fgdirect=p.pci2eth_fgdirect;
     193  eths_targets=p.eths_targets;
     194  ethr_nlink=p.ethr_nlink;
    183195
    184196  skysource=p.skysource;
     
    215227    reducoffset=(uint_4)conf.IParam("reducpaqsz",1,0);
    216228  }
     229  // Mot cle pour le mode envoi-reception sur ethernet
     230  tcpportid=conf.IParam("tcpportid",0,BRSPORTID);
     231  if (conf.HasKey("pci2ethdirect"))  pci2eth_fgdirect = true;   // Transfer direct DMA -> Ethernet
     232  if (conf.HasKey("ethrtargets")) {    // Machines destinations des paquets
     233    for(int it=0; it<conf.NbParam("ethrtargets"); it++)
     234      eths_targets.push_back(conf.SParam("ethrtargets",it));
     235  }
     236  ethr_nlink=conf.IParam("ethrnlink",0,0);   // Nombre de sources de paquets en reception ethernet
     237
     238
    217239  if (conf.HasKey("monitor")) {
    218240    fgdoProc=true;
     
    222244  }
    223245  nopciLossRate=conf.DParam("nopcilossrate",0,0.);
    224 
    225246  fg_hard_ctrlc=conf.HasKey("hard_ctrlc");
    226247  if (conf.HasKey("nosavesigfits"))  savesigfits=false;
     
    322343    os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl;
    323344  }
     345  if (eths_targets.size()>0)   {
     346    cout << " DMA->Ethernet NbTargets=" << eths_targets.size() << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :" << endl;
     347    for(size_t it=0; it<eths_targets.size(); it++) cout << eths_targets[it] << " , ";
     348    cout << endl;
     349  }
     350  cout << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
    324351  if (fgdoProc>0)
    325352    os << " Monitoring  NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl;
  • trunk/AddOn/TAcq/brparam.h

    r3681 r3757  
    9797  // Taille des paquets apres reduction eventuelle (donc ds memory manager)
    9898  inline uint_4 MMgrPaquetSize() { return (fgreducpsize)?redpqsize:PaqSize; }
     99  // Nombre de paquets dans chaque bloc de MMgr
     100  inline uint_4 MMgrNbPaquet() { return nPaqZone; }
    99101  // Operation de conversion/mise en ordre des donnees a la reception
    100102  inline BRDataFmtConv GetDataConvFg() { return swapall; };
     
    105107  inline uint_4 BlocPerFile() { return NBlocPerFile; }
    106108  // Nombre maximum de blocs MMgr traites
    107   inline uint_4 MaxNbBlocs() { return NbFiles*NBlocPerFile; }
     109  inline uint_8 MaxNbBlocs() { return (uint_8)NbFiles*(uint_8)NBlocPerFile; }
     110  // Nombre maximum paquets traites
     111  inline uint_8 MaxNbPaquets() { return MaxNbBlocs()*(uint_8)nPaqZone; }
    108112
    109113  // Taille des paquets recus sur PCIExpress
    110114  inline uint_4 PatternSize() { return ((PaqSize-(BRHDRSIZE+BRTRLSIZE))/4); }
     115
     116  // Liste des machines cibles pour transfert sur ethernet
     117  inline void SetEthTargets(vector<string>& targs) { eths_targets=targs; return; }
     118  inline vector<string>& GetEthTargets() { return eths_targets; }
     119  // Nombre de liens ethernet comme source de donnees (paquets)
     120  inline int NbEthLinks() { return ethr_nlink; }
    111121
    112122  // Identification source ciel
     
    147157  uint_4 redpqsize;
    148158  uint_4 reducoffset;
     159
     160  // ---- Variables specifiques em mode transfert DMA vers Ethernet
     161  int tcpportid;
     162  // Cote Send DMA -> Ethernet
     163  bool pci2eth_fgdirect;   // true -> direct transfer DMA to Ethernet 
     164  vector< string > eths_targets;   // Liste des machines cibles pour les transferts DMA -> ethernet
     165  // Cote reception
     166  int ethr_nlink;    // Nombre total de source d'envoi (= nb total de fibre de fibre)
    149167
    150168  // Identification source observee dans le ciel
     
    209227  // Taille des paquets apres reduction eventuelle (donc ds memory manager)
    210228  inline uint_4 MMgrPaquetSize() { return param_->MMgrPaquetSize(); }
     229  // Nombre de paquets dans chaque bloc de MMgr
     230  inline uint_4 MMgrNbPaquet() { return param_->MMgrNbPaquet(); }
    211231  // Operation de conversion/mise en ordre des donnees a la reception
    212232  inline BRDataFmtConv GetDataConvFg() { return param_->GetDataConvFg(); };
     
    217237  inline uint_4 BlocPerFile() { return param_->BlocPerFile(); }
    218238  // Nombre maximum de blocs MMgr traites
    219   inline uint_4 MaxNbBlocs() { return param_->MaxNbBlocs(); }
     239  inline uint_8 MaxNbBlocs() { return param_->MaxNbBlocs(); }
     240  // Nombre maximum paquets traites
     241  inline uint_8 MaxNbPaquets() { return param_->MaxNbPaquets(); }
    220242
    221243  // Identification source ciel
  • trunk/AddOn/TAcq/makefile

    r3715 r3757  
    2121        echo '---mfacq made'
    2222
    23 $(EXE)mfacq : $(OBJ)mfacq.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)racqurw.o $(OBJ)racquproc.o \
    24                $(OBJ)brpaqu.o $(OBJ)pciewrap.o $(OBJ)minifits.o
    25         $(CXXLINK) -o $(EXE)mfacq $(OBJ)mfacq.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)racqurw.o \
    26               $(OBJ)racquproc.o $(OBJ)brpaqu.o $(OBJ)pciewrap.o $(OBJ)minifits.o $(SOPHYAALLSLBLIST)
    27 
    28 $(OBJ)mfacq.o : mfacq.cc brparam.h racquproc.h racqurw.h racqumem.h brpaqu.h
     23$(EXE)mfacq : $(OBJ)mfacq.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)racqurw.o  $(OBJ)racqueth.o \
     24        $(OBJ)racquproc.o $(OBJ)brpaqu.o $(OBJ)pciewrap.o $(OBJ)minifits.o $(OBJ)swrapsock.o
     25        $(CXXLINK) -o $(EXE)mfacq $(OBJ)mfacq.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)racqurw.o $(OBJ)racqueth.o \
     26              $(OBJ)racquproc.o $(OBJ)brpaqu.o $(OBJ)pciewrap.o $(OBJ)minifits.o $(OBJ)swrapsock.o $(SOPHYAALLSLBLIST)
     27
     28$(OBJ)mfacq.o : mfacq.cc brparam.h racquproc.h racqurw.h racqueth.h racqumem.h brpaqu.h
    2929        $(CXXCOMPILE) -c -DNOPCIECARD -o $(OBJ)mfacq.o mfacq.cc
    3030
     
    5050        $(CXXCOMPILE) -c -o $(OBJ)racqurw.o racqurw.cc
    5151
     52$(OBJ)racqueth.o : racqueth.cc racqueth.h racqurw.h racqumem.h brpaqu.h
     53        $(CXXCOMPILE) -c -o $(OBJ)racqueth.o racqueth.cc
     54
    5255$(OBJ)racquproc.o : racquproc.cc racquproc.h racqurw.h racqumem.h brpaqu.h
    5356        $(CXXCOMPILE) -c -o $(OBJ)racquproc.o racquproc.cc
  • trunk/AddOn/TAcq/mfacq.cc

    r3683 r3757  
    99static RAcqMemZoneMgr* pMmgr=NULL;
    1010static  PCIEMultiReader* pPcierThr=NULL;
     11static  PCIEToEthernet* pPcie2Eth=NULL;
     12static  EthernetReader* pEthRdr=NULL;
    1113
    1214void Stop(int s)
     
    1517  else printf("............. MAIN ... receive signal %d \n",s);
    1618  if (pMmgr != NULL) pMmgr->Stop();
     19  if (pPcie2Eth !=NULL) pPcie2Eth->Stop();
    1720  if (pPcierThr !=NULL) pPcierThr->Stop();
    18 
     21  if (pEthRdr !=NULL) pEthRdr->Stop();
    1922}
    2023
     
    4043
    4144
    42   if ((narg < 2)||(strcmp(arg[1],"-h"))==0) {
     45  if ((narg > 1)&&(strcmp(arg[1],"-h"))==0) {
    4346    Usage(false);
    4447    return 1;
    4548  }
    46  
    47   string pardcfile=arg[1];
     49  if (narg < 3) {
     50    Usage(true);
     51    return 3;
     52  }
     53 
     54  const char* desact[3] = {"PCIE_To_Ethernet", "Ethernet_To_Disk", "PCIE_DMA_To_Disk"};
     55  string action=arg[1];
     56  int act = 0;
     57  if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")) {
     58    cout << " mfacq/Error , Bad action argument : " << action << endl;
     59    return 2;
     60  }
     61  if (action == "-pci2eth")  act=0;
     62  else if (action == "-eth2disk") act=1;
     63  else if (action == "-pci2disk")  act=2;
     64
     65  string pardcfile=arg[2];
    4866#ifndef NOPCIECARD 
    4967  string basedir="/Raid";
     
    5169  string basedir="./";
    5270#endif
    53   if (narg>2)  basedir=arg[2];
     71  vector<string> oargs;
     72  if (narg>3)  {
     73    basedir=arg[2];
     74    for(int jj=2; jj<narg; jj++)  oargs.push_back(arg[jj]);
     75  }
    5476  try {
    5577    // Creation/initialisation parametres Acq
    5678    BRAcqConfig acpar;
    57     acpar.ReadParamFile(arg[1]);
     79    acpar.ReadParamFile(pardcfile);
    5880    acpar.GetConfig().SetBaseDirectory(basedir);
     81    if ((act==0)&&(oargs.size()>0))
     82      acpar.GetParams().SetEthTargets(oargs);
    5983    // Creation des repertoires
    60     if (acpar.CreateOutputDirectories()!=0)  return 9;
     84    if (act > 0)
     85      if (acpar.CreateOutputDirectories()!=0)  return 9;
    6186    acpar.Print(cout);
    62     struct sigaction act; 
     87    struct sigaction siact; 
    6388    if (!acpar.GetParams().fg_hard_ctrlc) {
    64       act.sa_handler=Stop;
    65       sigaction(SIGINT,&act,NULL);       
     89      siact.sa_handler=Stop;
     90      sigaction(SIGINT,&siact,NULL);       
    6691    }
    67     rc = MultiFibreAcq();   
     92    switch (act) {
     93    case 0:
     94      rc = PCIEToEthernetTransfer();
     95      break;
     96    case 1:
     97      rc = EthernetToMemoryAcq();
     98      break;
     99    case 2:
     100      rc = MultiFibreAcq();
     101      break;
     102    }   
    68103  }
    69104  catch (MiniFITSException& exc) {
     
    97132void Usage(bool fgshort)
    98133{
    99   if (fgshort) {
    100     cout << " Usage: mfacq DataCardFile [BaseDirectory] \n" << endl;
    101     cout << "   Parameters in DataCard : \n"
    102          << "       fibres outpathname skysource paqsize dmasizekb nbfiles \n"
    103          << "       nblocperfile acqmode memmgr monitor reducpaqsz "<< endl;
    104     cout << "   BaseDirectory (default= /Raid ) " << endl;
    105     return;
    106   }
     134  cout << " Usage: mfacq Action DataCardFile [BaseDirectory / TargetMachines] \n" << endl;
     135  if (fgshort) return;
     136  cout << "   Action = -pci2disk , -pci2mem -eth2disk \n "
     137       << "   Parameters in DataCard : \n"
     138       << "       fibres outpathname skysource paqsize dmasizekb nbfiles \n"
     139       << "       nblocperfile acqmode memmgr monitor reducpaqsz "<< endl;
     140  cout << "   BaseDirectory (default= /Raid ) " << endl;
     141  cout << "   TargetMachines : List of target machines for PCIe2Ethernet " << endl;
    107142  return;
    108143}
     
    114149  Timer tm("mfacq/MultiFibre");
    115150  cout << " ---------- mfacq/ MultiFibreAcq()  ------------- " << endl;
    116   PCIEWrapperInterface* pciwp[4]={NULL,NULL,NULL,NULL};
     151  PCIEWrapperInterface* pciwp[16]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
     152                                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
    117153   
    118154  BRAcqConfig bpar;
     
    144180  TestPCIWrapperNODMA pciw3(bpar.RecvPaquetSize(), acpar.nopciLossRate);
    145181  TestPCIWrapperNODMA pciw4(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     182  TestPCIWrapperNODMA pciw5(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     183  TestPCIWrapperNODMA pciw6(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     184  TestPCIWrapperNODMA pciw7(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     185  TestPCIWrapperNODMA pciw8(bpar.RecvPaquetSize(), acpar.nopciLossRate);
    146186  pciwp[0] = &pciw1;
    147187  pciwp[1] = &pciw2;
    148188  pciwp[2] = &pciw3;
    149   pciwp[3] = &pciw4; 
     189  pciwp[3] = &pciw4;
     190  pciwp[4] = &pciw5;
     191  pciwp[5] = &pciw6; 
     192  pciwp[6] = &pciw7;
     193  pciwp[7] = &pciw8; 
    150194#endif
    151195
     
    197241
    198242}
     243
     244/* --Nouvelle-Fonction-- */
     245int PCIEToEthernetTransfer()
     246{
     247  Timer tm("mfacq/PCIEToEthernetTransfer");
     248  cout << " ---------- mfacq/ PCIEToEthernetTransfer()  ------------- " << endl;
     249  PCIEWrapperInterface* pciwp[16]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
     250                                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
     251
     252  pMmgr=NULL;   
     253  BRAcqConfig bpar;
     254  BRParList& acpar=bpar.GetParams();
     255 
     256  cout << " mfacq[1]/Info: PCIEToEthernet for" << acpar.NbFibers << " fibers , nZones="
     257       << acpar.nZones << " NbPaquet/Zone=" << acpar.nPaqZone
     258       << " MmgrPaqSize=" << acpar.MMgrPaquetSize() << endl;
     259 
     260#ifndef NOPCIECARD 
     261  for (int i=0 ;i <acpar.NFibers() ;i++) {
     262    UINT32 card=(acpar.FiberNum[i]-1)/2+1;
     263    UINT32 cardfiber=(acpar.FiberNum[i]-1)%2;
     264    cout <<"mfacq[2] CreatePCIEWrapperV6- indice " << i <<  "INIT card " << card
     265         << " fibre " << cardfiber << endl;
     266    pciwp[i] =  CreatePCIEWrapperV6(card,acpar.PatternSize(),acpar.DMASizeBytes(),acpar.activate_pattern,cardfiber);
     267  }
     268#else
     269  TestPCIWrapperNODMA pciw1(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     270  TestPCIWrapperNODMA pciw2(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     271  TestPCIWrapperNODMA pciw3(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     272  TestPCIWrapperNODMA pciw4(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     273  TestPCIWrapperNODMA pciw5(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     274  TestPCIWrapperNODMA pciw6(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     275  TestPCIWrapperNODMA pciw7(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     276  TestPCIWrapperNODMA pciw8(bpar.RecvPaquetSize(), acpar.nopciLossRate);
     277  pciwp[0] = &pciw1;
     278  pciwp[1] = &pciw2;
     279  pciwp[2] = &pciw3;
     280  pciwp[3] = &pciw4;
     281  pciwp[4] = &pciw5;
     282  pciwp[5] = &pciw6; 
     283  pciwp[6] = &pciw7;
     284  pciwp[7] = &pciw8; 
     285#endif
     286
     287  vector<PCIEWrapperInterface*> vec_pciw;
     288  for  (int i=0 ;i<bpar.NFibers();i++)  vec_pciw.push_back( pciwp[i]);
     289  cout <<"mfacq[2] Creating PCIEToEthernet  thread object " << endl;
     290  PCIEToEthernet pci2eth(vec_pciw, bpar.GetParams().GetEthTargets(), bpar.GetParams());
     291  //  usleep(200);  attente au cas ou ...
     292  pPcie2Eth=&pci2eth;
     293  tm.Split("Threads created"); 
     294  cout << "mfacq[3] - starting one threads: PCIEToEthernet... " << endl;
     295  pci2eth.start();
     296 
     297  // On attend avant de declencher la terminaison des threads
     298  usleep(200000);
     299 
     300  cout << "mfacq[5] -  Waiting for threads to finish ... " << endl; 
     301  pci2eth.join();
     302  cout << "mfacq[6] ---------- threads finished ---------------- " << endl;
     303  tm.Split("Threads Finished"); 
     304 
     305#ifndef NOPCIECARD
     306  for (int i=0 ;i <acpar.NbFibers ;i++) {
     307    UINT32 card=(acpar.FiberNum[i]-1)/2+1;
     308    UINT32 cardfiber=(acpar.FiberNum[i]-1)%2;
     309    DeletePCIEWrapperV6(card,cardfiber);
     310  }
     311#endif   
     312return 0;
     313}
     314
     315/* --Nouvelle-Fonction-- */
     316int EthernetToMemoryAcq()
     317{
     318  Timer tm("mfacq/EthernetToMemoryAcq");
     319  cout << " ---------- mfacq/ EthernetToMemoryAcq()  ------------- " << endl;
     320   
     321  BRAcqConfig bpar;
     322  BRParList& acpar=bpar.GetParams();
     323 
     324  cout << " mfacq[1]/Info: Creating RAcqMemZoneMgr for" << acpar.NbEthLinks() << " Eth-links , nZones="
     325       << acpar.nZones << " NbPaquet/Zone=" << acpar.nPaqZone
     326       << " MmgrPaqSize=" << acpar.MMgrPaquetSize() << endl;
     327  RAcqMemZoneMgr mmgr(acpar.nZones, acpar.NbEthLinks(), acpar.nPaqZone, acpar.MMgrPaquetSize());
     328  pMmgr=&mmgr; 
     329  if (acpar.fgdoProc && (acpar.stepProc>0)) {
     330    // Dans ce cas, toutes les zones doivent passer ds le thread de monitoring
     331    // pour etre au moins marque comme traite - seul 1/acpar.stepProc sont effectivement traite
     332    mmgr.SetFinalizedMask(((uint_4)MemZS_Saved) | ((uint_4)MemZS_Proc));
     333    cout << " mfacq[1.b]/Info: Mmgr.SetFinalizedMask( MemZS_Saved | MemZS_Proc )" << endl;
     334  }
     335 
     336
     337  cout <<"mfacq[2] Creating MultiDataSaver and  MonitorProc thread objects ... " << endl;
     338  MultiDataSaver DsThr(mmgr);   //   Utilise les parametres globaux BRAcqConfig
     339  string ppath=bpar.OutputDirectory();
     340  MonitorProc PrThr(mmgr);
     341  cout << "mfacq[3] Creating   EthernetReader thread object     " << endl;
     342  EthernetReader ethrdr(mmgr, bpar.GetParams(), bpar.GetParams().tcpportid, false);
     343  //  usleep(200);  attente au cas ou ...
     344  pEthRdr=&ethrdr;
     345  tm.Split("Threads created"); 
     346  if (acpar.fgdoProc>0)
     347    cout << "mfacq[4] - starting three threads: EthernetReader, MultiDataSaver, MonitorProc ... " << endl;
     348  else
     349    cout << "mfacq[4] - starting two threads: EthernetReader, MultiDataSaver  ... " << endl;
     350
     351  ethrdr.start();
     352  DsThr.start();
     353  if (acpar.fgdoProc>0) { // On ne demarre que si au moins NMaxProc>0
     354    PrThr.start();
     355  }
     356 
     357  // On attend avant de declencher la terminaison des threads
     358  usleep(200000);
     359 
     360  cout << "mfacq[5] -  Waiting for threads to finish ... " << endl; 
     361  ethrdr.join();
     362  DsThr.join();
     363  mmgr.Stop();
     364  if (acpar.fgdoProc) { // On n'attend la fin que si le thread a ete demarre (NMaxProc>0)
     365    PrThr.join();
     366  }
     367  pMmgr=NULL; 
     368  cout << "mfacq[6] ---------- threads finished ---------------- " << endl;
     369  tm.Split("Threads Finished"); 
     370 
     371  mmgr.Print(cout);
     372
     373return 0;
     374
     375}
  • trunk/AddOn/TAcq/mfacq.h

    r3680 r3757  
    1212#include "racqumem.h"
    1313#include "racqurw.h"
     14#include "racqueth.h"
    1415#ifndef NOPCIECARD
    1516#include "racquwbin.h"
     
    4041
    4142
     43int PCIEToEthernetTransfer();
     44int EthernetToMemoryAcq();
    4245int MultiFibreAcq();
    4346
  • trunk/AddOn/TAcq/racqurw.h

    r3683 r3757  
    2626// Nombre maximum de fibres geres par les classes MultiReader / MultiDiskWriter
    2727#ifndef MAXNBFIB
    28 #define MAXNBFIB  4   
     28#define MAXNBFIB  16   
    2929#endif
    3030
  • trunk/AddOn/TAcq/swrapsock.cc

    r3639 r3757  
    2323  The class Socket is not intended for direct use. Only the derived classes
    2424  ServerSocket and ClientSocket should be used.
     25  The Close() method should be called explicitly.
    2526*/
    2627
     
    3839
    3940/* --Methode-- */
    40 /*  ---  A faire plus tard ...
    4141Socket::Socket(Socket const & a)
     42{
     43  Set(a);
     44}
     45
     46
     47/* --Methode-- */
     48Socket::~Socket()
     49{
     50  //  Close();
     51}
     52
     53/* --Methode-- */
     54void Socket::Set(Socket const & a)
    4255{
    4356  skt = a.skt;
     
    4962  errcnt = a.errcnt;
    5063}
    51 */
    52 
    53 /* --Methode-- */
    54 Socket::~Socket()
    55 {
    56   Close();
    57 }
     64
    5865
    5966/* --Methode-- */
     
    191198  InitConnection(srvname, port);
    192199}
     200
     201/* --Methode-- */
     202ClientSocket::ClientSocket(ClientSocket const& a)
     203  : Socket(a)
     204{
     205  portid=a.portid;
     206  ipskt=a.ipskt;
     207}
     208
     209
     210/* --Methode-- */
     211void ClientSocket::SetC(ClientSocket const& a)
     212{
     213  Set(a);
     214  portid=a.portid;
     215  ipskt=a.ipskt;
     216  return;
     217}
     218
    193219
    194220/* --Methode-- */
  • trunk/AddOn/TAcq/swrapsock.h

    r3542 r3757  
    3636public:
    3737  Socket(int s=-1);
    38   //  Socket(Socket const & a);
     38  Socket(Socket const & a);
    3939  ~Socket();
    4040
     
    4242  size_t Receive(char * buff, size_t len, int flag=0);
    4343  int Close();
     44 
     45  inline Socket& operator=(Socket const & a)
     46  { Set(a);  return (*this); }
     47
    4448  inline int SetPrtLevel(int lev=0)
    4549    { if (lev > 0) prtlev = lev; return prtlev; }
     50  inline long NBytesSent() { return totsnd; }
     51  inline long NBytesRecv() { return totrcv; }
     52 
     53protected:
     54  void Set(Socket const & a);
    4655
    47 protected:
    48  
    4956  int skt;
    5057  long tstart;    /*  Temps de demarrage en sec  */
     
    8996  ClientSocket(string const& srvname, int port);
    9097  ClientSocket(const char* srvname, int port);
     98  ClientSocket(ClientSocket const& a);
     99  inline ClientSocket& operator=(ClientSocket const& a)
     100  { SetC(a);  return (*this); }
    91101protected:
     102  void SetC(ClientSocket const& a);
    92103  void InitConnection(const char* srvname, int port);
     104
    93105  int portid;
    94106  struct sockaddr_in  ipskt;
Note: See TracChangeset for help on using the changeset viewer.