GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fLmd.h
Go to the documentation of this file.
1 // $Id: fLmd.h 3497 2022-01-21 16:33:45Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef MbsLmdStruct_H
15 #define MbsLmdStruct_H
16 
17 #include <stdio.h>
18 
19 #include "sMbs.h"
20 
21 #ifndef FILEONLY
22 #include "f_stccomm.h"
23 #endif
24 
25 #define LMD__SUCCESS 0
26 #define LMD__FAILURE 1
27 #define LMD__CLOSE_ERR 3
28 #define GETLMD__NOFILE 2
29 #define GETLMD__NOLMDFILE 4
30 #define GETLMD__EOFILE 5
31 #define GETLMD__NOMORE 6
32 #define GETLMD__NOBUFFER 7
33 #define GETLMD__TOOBIG 8
34 #define GETLMD__OUTOF_RANGE 9
35 #define GETLMD__SIZE_ERROR 10
36 #define LMD__TIMEOUT 50
37 #define PUTLMD__FILE_EXIST 101
38 #define PUTLMD__TOOBIG 102
39 #define PUTLMD__OPEN_ERR 103
40 #define PUTLMD__EXCEED 104
41 #define PORT__TRANS 6000
42 #define PORT__STREAM 6002
43 
44 typedef struct
45 {
46  FILE *fFile; /* file descripter or server No. */
47  int16_t *pBuffer; /* pointer to internal buffer */
48  uint32_t iBufferWords; /* internal buffer size */
49  uint32_t iLeftWords; /* left words in buffer */
50  uint32_t iInternHeader; /* has intern allocated header buffer */
51  uint32_t iInternBuffer; /* has intern allocated buffer */
52  uint32_t iElements; /* events since open */
53  uint64_t iBytes; /* bytes since open */
54  char cFile[512]; /* channel name */
55  uint32_t iSwap;
56  uint32_t iVerbose;
57  char *cHeader; /* header data buffer */
58  uint32_t *pOffset4; /* offset table */
59  lmdoff_t *pOffset8; /* long offset table */
60  lmdoff_t oTableOffset; /* greater zero when Long offset in file */
61  uint32_t iOffsetSize; /* Offset size, 4 or 8 [bytes] */
62  uint32_t iOffsetEntries;/* offset table length */
65  struct s_tcpcomm *pTCP;
66  uint32_t iTCP;
67  uint32_t iPort;
68  uint32_t iTcpTimeout;
69  uint32_t iTCPowner;
70 } sLmdControl;
71 
73 uint32_t fLmdPutOpen(sLmdControl*,char*,sMbsFileHeader*,uint32_t,uint32_t,uint32_t,uint32_t);
75 uint32_t fLmdPutBuffer(sLmdControl*, sMbsHeader*,uint32_t);
76 uint32_t fLmdPutClose(sLmdControl*);
77 #ifndef FILEONLY
78 uint32_t fLmdInitMbs(sLmdControl*,char*,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t);
79 uint32_t fLmdGetMbsBuffer(sLmdControl*,sMbsBufferHeader*,uint32_t,uint32_t*,uint32_t*);
81 uint32_t fLmdCloseMbs(sLmdControl*);
82 #endif
83 uint32_t fLmdGetOpen(sLmdControl*,char*,sMbsFileHeader*,uint32_t,uint32_t);
84 uint32_t fLmdGetBuffer(sLmdControl*,sMbsHeader*,uint32_t,uint32_t*,uint32_t*);
85 int32_t fLmdReadBuffer(sLmdControl*,char*,uint32_t);
86 uint32_t fLmdGetElement(sLmdControl*,uint32_t,sMbsHeader**);
87 uint32_t fLmdGetClose(sLmdControl*);
89 void fLmdPrintFileHeader(uint32_t,sMbsFileHeader*);
90 void fLmdPrintHeader(uint32_t,sMbsHeader*);
91 void fLmdPrintEvent(uint32_t,sMbsEventHeader*);
92 void fLmdPrintControl(uint32_t,sLmdControl*);
93 void fLmdVerbose(sLmdControl*,uint32_t);
94 void fLmdSwap4(uint32_t*,uint32_t);
95 void fLmdSwap8(uint64_t*,uint32_t);
96 void fLmdSetWrittenEndian(sLmdControl *,uint32_t);
98 uint32_t fLmdGetSwap(sLmdControl *);
100 
101 #endif
uint32_t fLmdPutElement(sLmdControl *, sMbsHeader *)
Definition: fLmd.c:145
uint64_t fLmdGetBytesWritten(sLmdControl *)
Definition: fLmd.c:710
void fLmdSwap8(uint64_t *, uint32_t)
Definition: fLmd.c:1019
void fLmdVerbose(sLmdControl *, uint32_t)
uint32_t fLmdGetSwap(sLmdControl *)
Definition: fLmd.c:747
sMbsHeader * pMbsHeader
Definition: fLmd.h:64
uint32_t fLmdPutBuffer(sLmdControl *, sMbsHeader *, uint32_t)
Definition: fLmd.c:205
uint32_t fLmdGetMbsEvent(sLmdControl *, sMbsHeader **)
Definition: fLmd.c:321
int16_t * pBuffer
Definition: fLmd.h:47
uint64_t iBytes
Definition: fLmd.h:53
uint32_t iTCP
Definition: fLmd.h:66
uint32_t iVerbose
Definition: fLmd.h:56
uint32_t fLmdCloseMbs(sLmdControl *)
Definition: fLmd.c:303
uint32_t iInternBuffer
Definition: fLmd.h:51
uint32_t fLmdPutOpen(sLmdControl *, char *, sMbsFileHeader *, uint32_t, uint32_t, uint32_t, uint32_t)
Definition: fLmd.c:71
uint32_t iElements
Definition: fLmd.h:52
void fLmdSetWrittenEndian(sLmdControl *, uint32_t)
Definition: fLmd.c:755
uint64_t lmdoff_t
Definition: sMbs.h:45
lmdoff_t oTableOffset
Definition: fLmd.h:60
uint32_t fLmdGetClose(sLmdControl *)
Definition: fLmd.c:684
uint32_t * pOffset4
Definition: fLmd.h:58
uint32_t iPort
Definition: fLmd.h:67
uint32_t iOffsetSize
Definition: fLmd.h:61
void fLmdPrintFileHeader(uint32_t, sMbsFileHeader *)
Definition: fLmd.c:968
int32_t fLmdReadBuffer(sLmdControl *, char *, uint32_t)
Definition: fLmd.c:695
void fLmdPrintControl(uint32_t, sLmdControl *)
Definition: fLmd.c:999
void fLmdPrintBufferHeader(uint32_t, sMbsBufferHeader *)
Definition: fLmd.c:957
void fLmdPrintEvent(uint32_t, sMbsEventHeader *)
Definition: fLmd.c:989
uint32_t fLmdPutClose(sLmdControl *)
Definition: fLmd.c:251
uint32_t iOffsetEntries
Definition: fLmd.h:62
uint32_t iTCPowner
Definition: fLmd.h:69
uint32_t fLmdInitMbs(sLmdControl *, char *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)
Definition: fLmd.c:282
uint32_t fLmdGetMbsBuffer(sLmdControl *, sMbsBufferHeader *, uint32_t, uint32_t *, uint32_t *)
Definition: fLmd.c:344
uint32_t fLmdGetBuffer(sLmdControl *, sMbsHeader *, uint32_t, uint32_t *, uint32_t *)
Definition: fLmd.c:491
sLmdControl * fLmdAllocateControl(void)
Definition: fLmd.c:773
void fLmdPrintHeader(uint32_t, sMbsHeader *)
Definition: fLmd.c:980
uint32_t iLeftWords
Definition: fLmd.h:49
uint32_t fLmdGetOpen(sLmdControl *, char *, sMbsFileHeader *, uint32_t, uint32_t)
Definition: fLmd.c:398
FILE * fFile
Definition: fLmd.h:46
lmdoff_t * pOffset8
Definition: fLmd.h:59
uint32_t iInternHeader
Definition: fLmd.h:50
uint32_t iSwap
Definition: fLmd.h:55
struct s_tcpcomm * pTCP
Definition: fLmd.h:65
uint32_t fLmdGetWrittenEndian(sLmdControl *)
Definition: fLmd.c:764
uint32_t iTcpTimeout
Definition: fLmd.h:68
char * cHeader
Definition: fLmd.h:57
uint32_t fLmdGetElement(sLmdControl *, uint32_t, sMbsHeader **)
Definition: fLmd.c:601
sMbsFileHeader * pMbsFileHeader
Definition: fLmd.h:63
void fLmdSwap4(uint32_t *, uint32_t)
Definition: fLmd.c:1009
uint32_t iBufferWords
Definition: fLmd.h:48