FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fLmd.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef MbsLmdStruct
9 #define MbsLmdStruct
10 
11 #include "sMbs.h"
12 
13 #include <stdio.h>
14 
15 #ifndef FILEONLY
16 #include "f_stccomm.h"
17 #endif
18 
19 #define LMD__SUCCESS 0
20 #define LMD__FAILURE 1
21 #define LMD__CLOSE_ERR 3
22 #define GETLMD__NOFILE 2
23 #define GETLMD__NOLMDFILE 4
24 #define GETLMD__EOFILE 5
25 #define GETLMD__NOMORE 6
26 #define GETLMD__NOBUFFER 7
27 #define GETLMD__TOOBIG 8
28 #define GETLMD__OUTOF_RANGE 9
29 #define GETLMD__SIZE_ERROR 10
30 #define LMD__TIMEOUT 50
31 #define PUTLMD__FILE_EXIST 101
32 #define PUTLMD__TOOBIG 102
33 #define PUTLMD__OPEN_ERR 103
34 #define PUTLMD__EXCEED 104
35 #define PORT__TRANS 6000
36 #define PORT__STREAM 6002
37 
38 typedef struct
39 {
40  FILE* fFile; /* file descripter or server No. */
41  int16_t* pBuffer; /* pointer to internal buffer */
42  uint32_t iBufferWords; /* internal buffer size */
43  uint32_t iLeftWords; /* left words in buffer */
44  uint32_t iInternHeader; /* has intern allocated header buffer */
45  uint32_t iInternBuffer; /* has intern allocated buffer */
46  uint32_t iElements; /* events since open */
47  uint64_t iBytes; /* bytes since open */
48  char cFile[512]; /* channel name */
51  char* cHeader; /* header data buffer */
52  uint32_t* pOffset4; /* offset table */
53  lmdoff_t* pOffset8; /* long offset table */
54  lmdoff_t oTableOffset; /* greater zero when Long offset in file */
55  uint32_t iOffsetSize; /* Offset size, 4 or 8 [bytes] */
56  uint32_t iOffsetEntries; /* offset table length */
59  struct s_tcpcomm* pTCP;
64 } sLmdControl;
65 
71 #ifndef FILEONLY
77 #endif
80 int32_t fLmdReadBuffer(sLmdControl*, char*, uint32_t);
90 void fLmdSwap8(uint64_t*, uint32_t);
95 
96 #endif
void fLmdVerbose(sLmdControl *, uint32_t)
sMbsHeader * pMbsHeader
Definition: fLmd.h:58
int16_t * pBuffer
Definition: fLmd.h:41
uint64_t iBytes
Definition: fLmd.h:47
void fLmdPrintFileHeader(uint32_t iVerbose, sMbsFileHeader *pMbsFileHeader)
Definition: fLmd.c:1244
uint32_t fLmdGetMbsEvent(sLmdControl *pLmdControl, sMbsHeader **event)
Definition: fLmd.c:463
uint32_t iTCP
Definition: fLmd.h:60
uint32_t iVerbose
Definition: fLmd.h:50
uint32_t iInternBuffer
Definition: fLmd.h:45
uint32_t fLmdGetElement(sLmdControl *pLmdControl, uint32_t iEvent, sMbsHeader **event)
Definition: fLmd.c:792
uint32_t iElements
Definition: fLmd.h:46
uint64_t lmdoff_t
Definition: sMbs.h:39
lmdoff_t oTableOffset
Definition: fLmd.h:54
uint32_t * pOffset4
Definition: fLmd.h:52
uint32_t fLmdInitMbs(sLmdControl *pLmdControl, char *Nodename, uint32_t iMaxBytes, uint32_t iBuffers, uint32_t iStreams, uint32_t iPort, uint32_t iTimeout)
Definition: fLmd.c:405
uint32_t fLmdPutClose(sLmdControl *pLmdControl)
Definition: fLmd.c:307
uint32_t fLmdGetClose(sLmdControl *pLmdControl)
Definition: fLmd.c:912
uint32_t iPort
Definition: fLmd.h:61
void fLmdSwap4(uint32_t *array, uint32_t items)
Definition: fLmd.c:1298
uint32_t iOffsetSize
Definition: fLmd.h:55
uint64_t fLmdGetBytesWritten(sLmdControl *pLmdControl)
Definition: fLmd.c:940
void fLmdSetWrittenEndian(sLmdControl *pLmdControl, uint32_t iE)
Definition: fLmd.c:997
uint32_t fLmdGetBuffer(sLmdControl *pLmdControl, sMbsHeader *pMbsHeader, uint32_t iBytes, uint32_t *iElements, uint32_t *iBytesUsed)
Definition: fLmd.c:665
uint32_t iOffsetEntries
Definition: fLmd.h:56
uint32_t iTCPowner
Definition: fLmd.h:63
uint32_t fLmdGetWrittenEndian(sLmdControl *pLmdControl)
Definition: fLmd.c:1007
void fLmdPrintEvent(uint32_t iVerbose, sMbsEventHeader *pMbsEventHeader)
Definition: fLmd.c:1271
uint32_t fLmdGetOpen(sLmdControl *pLmdControl, char *Filename, sMbsFileHeader *pBuffHead, uint32_t iBytes, uint32_t iUseOffset)
Definition: fLmd.c:566
void fLmdPrintHeader(uint32_t iVerbose, sMbsHeader *pMbsHeader)
Definition: fLmd.c:1262
int32_t fLmdReadBuffer(sLmdControl *pLmdControl, char *buffer, uint32_t bytes)
Definition: fLmd.c:923
uint32_t fLmdCloseMbs(sLmdControl *pLmdControl)
Definition: fLmd.c:442
void fLmdPrintControl(uint32_t iVerbose, sLmdControl *pLmdControl)
Definition: fLmd.c:1284
uint32_t iLeftWords
Definition: fLmd.h:43
sLmdControl * fLmdAllocateControl()
Definition: fLmd.c:1017
FILE * fFile
Definition: fLmd.h:40
lmdoff_t * pOffset8
Definition: fLmd.h:53
uint32_t iInternHeader
Definition: fLmd.h:44
unsigned int uint32_t
uint32_t fLmdPutElement(sLmdControl *pLmdControl, sMbsHeader *pHeader)
Definition: fLmd.c:190
uint32_t fLmdGetMbsBuffer(sLmdControl *pLmdControl, sMbsBufferHeader *pBuffer, uint32_t iBytes, uint32_t *iElements, uint32_t *iBytesUsed)
Definition: fLmd.c:484
uint32_t iSwap
Definition: fLmd.h:49
uint32_t fLmdPutOpen(sLmdControl *pLmdControl, char *Filename, sMbsFileHeader *pBuffHead, uint32_t iBytes, uint32_t iOver, uint32_t iUseOffset, uint32_t iLargeFile)
Definition: fLmd.c:110
struct s_tcpcomm * pTCP
Definition: fLmd.h:59
uint32_t fLmdGetSwap(sLmdControl *pLmdControl)
Definition: fLmd.c:987
uint32_t iTcpTimeout
Definition: fLmd.h:62
char * cHeader
Definition: fLmd.h:51
sMbsFileHeader * pMbsFileHeader
Definition: fLmd.h:57
uint32_t fLmdConnectMbs(sLmdControl *pLmdControl, char *Nodename, uint32_t iPort, uint32_t *iBufferBytes)
Definition: fLmd.c:338
uint32_t fLmdPutBuffer(sLmdControl *pLmdControl, sMbsHeader *pHeader, uint32_t Items)
Definition: fLmd.c:257
uint32_t iBufferWords
Definition: fLmd.h:42
void fLmdPrintBufferHeader(uint32_t iVerbose, sMbsBufferHeader *pMbsBufferHeader)
Definition: fLmd.c:1228
void fLmdSwap8(uint64_t *array, uint32_t items)
Definition: fLmd.c:1310