GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fLmd.h
Go to the documentation of this file.
1 // $Id: fLmd.h 478 2009-10-29 12:26:09Z 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 für 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
15 #define MbsLmdStruct
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 fLmdConnectMbs(sLmdControl*,char*,uint32_t,uint32_t*);
79 uint32_t fLmdInitMbs(sLmdControl*,char*,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t);
80 uint32_t fLmdGetMbsBuffer(sLmdControl*,sMbsBufferHeader*,uint32_t,uint32_t*,uint32_t*);
82 uint32_t fLmdCloseMbs(sLmdControl*);
83 #endif
84 uint32_t fLmdGetOpen(sLmdControl*,char*,sMbsFileHeader*,uint32_t,uint32_t);
85 uint32_t fLmdGetBuffer(sLmdControl*,sMbsHeader*,uint32_t,uint32_t*,uint32_t*);
86 int32_t fLmdReadBuffer(sLmdControl*,char*,uint32_t);
87 uint32_t fLmdGetElement(sLmdControl*,uint32_t,sMbsHeader**);
88 uint32_t fLmdGetClose(sLmdControl*);
90 void fLmdPrintFileHeader(uint32_t,sMbsFileHeader*);
91 void fLmdPrintHeader(uint32_t,sMbsHeader*);
92 void fLmdPrintEvent(uint32_t,sMbsEventHeader*);
93 void fLmdPrintControl(uint32_t,sLmdControl*);
94 void fLmdVerbose(sLmdControl*,uint32_t);
95 void fLmdSwap4(uint32_t*,uint32_t);
96 void fLmdSwap8(uint64_t*,uint32_t);
97 void fLmdSetWrittenEndian(sLmdControl *,uint32_t);
99 uint32_t fLmdGetSwap(sLmdControl *);
100 uint64_t fLmdGetBytesWritten(sLmdControl *);
101 
102 #endif
uint32_t fLmdPutElement(sLmdControl *, sMbsHeader *)
Definition: fLmd.c:189
uint64_t fLmdGetBytesWritten(sLmdControl *)
Definition: fLmd.c:815
void fLmdSwap8(uint64_t *, uint32_t)
Definition: fLmd.c:1132
void fLmdVerbose(sLmdControl *, uint32_t)
uint32_t fLmdGetSwap(sLmdControl *)
Definition: fLmd.c:851
sMbsHeader * pMbsHeader
Definition: fLmd.h:64
uint32_t fLmdPutBuffer(sLmdControl *, sMbsHeader *, uint32_t)
Definition: fLmd.c:248
uint32_t fLmdGetMbsEvent(sLmdControl *, sMbsHeader **)
Definition: fLmd.c:422
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:405
uint32_t iInternBuffer
Definition: fLmd.h:51
uint32_t fLmdPutOpen(sLmdControl *, char *, sMbsFileHeader *, uint32_t, uint32_t, uint32_t, uint32_t)
Definition: fLmd.c:119
uint32_t iElements
Definition: fLmd.h:52
void fLmdSetWrittenEndian(sLmdControl *, uint32_t)
Definition: fLmd.c:858
uint64_t lmdoff_t
Definition: sMbs.h:45
lmdoff_t oTableOffset
Definition: fLmd.h:60
uint32_t fLmdGetClose(sLmdControl *)
Definition: fLmd.c:789
uint32_t * pOffset4
Definition: fLmd.h:58
uint32_t fLmdConnectMbs(sLmdControl *, char *, uint32_t, uint32_t *)
Definition: fLmd.c:329
uint32_t iPort
Definition: fLmd.h:67
uint32_t iOffsetSize
Definition: fLmd.h:61
void fLmdPrintFileHeader(uint32_t, sMbsFileHeader *)
Definition: fLmd.c:1068
int32_t fLmdReadBuffer(sLmdControl *, char *, uint32_t)
Definition: fLmd.c:800
void fLmdPrintControl(uint32_t, sLmdControl *)
Definition: fLmd.c:1104
void fLmdPrintBufferHeader(uint32_t, sMbsBufferHeader *)
Definition: fLmd.c:1054
void fLmdPrintEvent(uint32_t, sMbsEventHeader *)
Definition: fLmd.c:1093
uint32_t fLmdPutClose(sLmdControl *)
Definition: fLmd.c:297
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:382
uint32_t fLmdGetMbsBuffer(sLmdControl *, sMbsBufferHeader *, uint32_t, uint32_t *, uint32_t *)
Definition: fLmd.c:445
uint32_t fLmdGetBuffer(sLmdControl *, sMbsHeader *, uint32_t, uint32_t *, uint32_t *)
Definition: fLmd.c:598
void fLmdPrintHeader(uint32_t, sMbsHeader *)
Definition: fLmd.c:1084
uint32_t iLeftWords
Definition: fLmd.h:49
uint32_t fLmdGetOpen(sLmdControl *, char *, sMbsFileHeader *, uint32_t, uint32_t)
Definition: fLmd.c:505
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:865
uint32_t iTcpTimeout
Definition: fLmd.h:68
char * cHeader
Definition: fLmd.h:57
uint32_t fLmdGetElement(sLmdControl *, uint32_t, sMbsHeader **)
Definition: fLmd.c:710
sMbsFileHeader * pMbsFileHeader
Definition: fLmd.h:63
void fLmdSwap4(uint32_t *, uint32_t)
Definition: fLmd.c:1118
sLmdControl * fLmdAllocateControl()
Definition: fLmd.c:872
uint32_t iBufferWords
Definition: fLmd.h:48