#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <memory.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "fLmd.h"
Go to the source code of this file.
Defines | |
#define | OFFSET__ENTRIES 250000 |
Functions | |
int32_t | fLmdWriteBuffer (sLmdControl *, char *, uint32_t) |
uint32_t | fLmdCleanup (sLmdControl *) |
void | fLmdOffsetResize (sLmdControl *, uint32_t) |
uint32_t | fLmdOffsetSet (sLmdControl *, uint32_t) |
uint32_t | fLmdOffsetRead (sLmdControl *) |
uint32_t | fLmdOffsetWrite (sLmdControl *) |
lmdoff_t | fLmdOffsetGet (sLmdControl *, uint32_t) |
void | fLmdOffsetElements (sLmdControl *, uint32_t, uint32_t *, uint32_t *) |
uint32_t | fLmdPutOpen (sLmdControl *pLmdControl, char *Filename, sMbsFileHeader *pBuffHead, uint32_t iBytes, uint32_t iOver, uint32_t iUseOffset, uint32_t iLargeFile) |
uint32_t | fLmdPutElement (sLmdControl *pLmdControl, sMbsHeader *pHeader) |
uint32_t | fLmdPutBuffer (sLmdControl *pLmdControl, sMbsHeader *pHeader, uint32_t Items) |
uint32_t | fLmdPutClose (sLmdControl *pLmdControl) |
uint32_t | fLmdConnectMbs (sLmdControl *pLmdControl, char *Nodename, uint32_t iPort, uint32_t *iBufferBytes) |
uint32_t | fLmdInitMbs (sLmdControl *pLmdControl, char *Nodename, uint32_t iMaxBytes, uint32_t iBuffers, uint32_t iStreams, uint32_t iPort, uint32_t iTimeout) |
uint32_t | fLmdCloseMbs (sLmdControl *pLmdControl) |
uint32_t | fLmdGetMbsEvent (sLmdControl *pLmdControl, sMbsHeader **event) |
uint32_t | fLmdGetMbsBuffer (sLmdControl *pLmdControl, sMbsBufferHeader *pBuffer, uint32_t iBytes, uint32_t *iElements, uint32_t *iBytesUsed) |
uint32_t | fLmdGetOpen (sLmdControl *pLmdControl, char *Filename, sMbsFileHeader *pBuffHead, uint32_t iBytes, uint32_t iUseOffset) |
uint32_t | fLmdGetBuffer (sLmdControl *pLmdControl, sMbsHeader *pMbsHeader, uint32_t iBytes, uint32_t *iElements, uint32_t *iBytesUsed) |
uint32_t | fLmdGetElement (sLmdControl *pLmdControl, uint32_t iEvent, sMbsHeader **event) |
uint32_t | fLmdGetClose (sLmdControl *pLmdControl) |
int32_t | fLmdReadBuffer (sLmdControl *pLmdControl, char *buffer, uint32_t bytes) |
uint64_t | fLmdGetBytesWritten (sLmdControl *pLmdControl) |
uint32_t | fLmdGetSwap (sLmdControl *pLmdControl) |
void | fLmdSetWrittenEndian (sLmdControl *pLmdControl, uint32_t iE) |
uint32_t | fLmdGetWrittenEndian (sLmdControl *pLmdControl) |
sLmdControl * | fLmdAllocateControl () |
void | fLmdPrintBufferHeader (uint32_t iVerbose, sMbsBufferHeader *pMbsBufferHeader) |
void | fLmdPrintFileHeader (uint32_t iVerbose, sMbsFileHeader *pMbsFileHeader) |
void | fLmdPrintHeader (uint32_t iVerbose, sMbsHeader *pMbsHeader) |
void | fLmdPrintEvent (uint32_t iVerbose, sMbsEventHeader *pMbsEventHeader) |
void | fLmdPrintControl (uint32_t iVerbose, sLmdControl *pLmdControl) |
void | fLmdSwap4 (uint32_t *array, uint32_t items) |
void | fLmdSwap8 (uint64_t *array, uint32_t items) |
sLmdControl* fLmdAllocateControl | ( | ) |
Definition at line 872 of file fLmd.c.
Referenced by f_evt_get_open(), and f_evt_put_open().
uint32_t fLmdCleanup | ( | sLmdControl * | pLmdControl | ) |
Definition at line 827 of file fLmd.c.
References sLmdControl::cHeader, sLmdControl::iInternBuffer, sLmdControl::iInternHeader, LMD__SUCCESS, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, sLmdControl::pMbsHeader, sLmdControl::pOffset4, sLmdControl::pOffset8, and sLmdControl::pTCP.
Referenced by fLmdCloseMbs(), fLmdConnectMbs(), fLmdGetClose(), fLmdGetOpen(), fLmdPutClose(), and fLmdPutOpen().
uint32_t fLmdCloseMbs | ( | sLmdControl * | pLmdControl | ) |
Definition at line 405 of file fLmd.c.
References f_stc_close(), f_stc_write(), fLmdCleanup(), sLmdControl::iPort, sLmdControl::iTCP, sLmdControl::iTCPowner, sLmdControl::pMbsFileHeader, PORT__STREAM, and sLmdControl::pTCP.
Referenced by f_evt_get_close().
uint32_t fLmdConnectMbs | ( | sLmdControl * | pLmdControl, | |
char * | Nodename, | |||
uint32_t | iPort, | |||
uint32_t * | iBufferBytes | |||
) |
Definition at line 329 of file fLmd.c.
References sLmdControl::cFile, f_stc_connectserver(), f_stc_read(), fLmdCleanup(), fLmdSwap4(), sLmdControl::iBufferWords, sLmdControl::iInternBuffer, sLmdControl::iPort, sLmdControl::iSwap, sLmdControl::iTCP, sLmdControl::iTCPowner, LMD__FAILURE, LMD__GET_EVENTS, LMD__SUCCESS, sLmdControl::pBuffer, PORT__STREAM, PORT__TRANS, sLmdControl::pTCP, and STC__SUCCESS.
uint32_t fLmdGetBuffer | ( | sLmdControl * | pLmdControl, | |
sMbsHeader * | pMbsHeader, | |||
uint32_t | iBytes, | |||
uint32_t * | iElements, | |||
uint32_t * | iBytesUsed | |||
) |
Definition at line 598 of file fLmd.c.
References sLmdControl::cFile, fLmdOffsetElements(), fLmdReadBuffer(), fLmdSwap4(), GETLMD__EOFILE, GETLMD__NOLMDFILE, sLmdControl::iBufferWords, sLmdControl::iBytes, sMbsFileHeader::iElements, sLmdControl::iElements, sLmdControl::iLeftWords, sMbsFileHeader::iMaxWords, sLmdControl::iOffsetEntries, sLmdControl::iSwap, sMbsHeader::iType, sMbsHeader::iWords, LMD__FAILURE, LMD__SUCCESS, LMD__TYPE_FILE_INDEX_101_2, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, and sLmdControl::pMbsHeader.
uint64_t fLmdGetBytesWritten | ( | sLmdControl * | pLmdControl | ) |
Definition at line 815 of file fLmd.c.
References sLmdControl::iBufferWords, sLmdControl::iBytes, sLmdControl::iElements, sLmdControl::iLeftWords, sLmdControl::iOffsetSize, sLmdControl::pOffset4, and sLmdControl::pOffset8.
uint32_t fLmdGetClose | ( | sLmdControl * | pLmdControl | ) |
Definition at line 789 of file fLmd.c.
References sLmdControl::fFile, fLmdCleanup(), LMD__CLOSE_ERR, and LMD__SUCCESS.
Referenced by f_evt_get_close(), fLmdGetOpen(), and fLmdPutClose().
uint32_t fLmdGetElement | ( | sLmdControl * | pLmdControl, | |
uint32_t | iEvent, | |||
sMbsHeader ** | event | |||
) |
Definition at line 710 of file fLmd.c.
References sLmdControl::cFile, sLmdControl::fFile, fLmdOffsetGet(), fLmdReadBuffer(), fLmdSwap4(), GETLMD__EOFILE, GETLMD__NOBUFFER, GETLMD__NOMORE, GETLMD__OUTOF_RANGE, GETLMD__SIZE_ERROR, GETLMD__TOOBIG, sLmdControl::iBufferWords, sLmdControl::iBytes, sLmdControl::iElements, sMbsFileHeader::iElements, sLmdControl::iLeftWords, sLmdControl::iOffsetEntries, sLmdControl::iSwap, sMbsHeader::iWords, LMD__NO_INDEX, LMD__SUCCESS, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, and sLmdControl::pMbsHeader.
Referenced by f_evt_get_event().
uint32_t fLmdGetMbsBuffer | ( | sLmdControl * | pLmdControl, | |
sMbsBufferHeader * | pBuffer, | |||
uint32_t | iBytes, | |||
uint32_t * | iElements, | |||
uint32_t * | iBytesUsed | |||
) |
Definition at line 445 of file fLmd.c.
References sLmdControl::cFile, f_stc_read(), f_stc_write(), fLmdSwap4(), sLmdControl::iBufferWords, sLmdControl::iBytes, sLmdControl::iLeftWords, sLmdControl::iPort, sLmdControl::iSwap, sLmdControl::iTCP, sLmdControl::iTcpTimeout, LMD__FAILURE, LMD__SUCCESS, LMD__TIMEOUT, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, PORT__STREAM, STC__SUCCESS, and STC__TIMEOUT.
Referenced by fLmdGetMbsEvent().
uint32_t fLmdGetMbsEvent | ( | sLmdControl * | pLmdControl, | |
sMbsHeader ** | event | |||
) |
Definition at line 422 of file fLmd.c.
References fLmdGetMbsBuffer(), sLmdControl::iElements, sLmdControl::iLeftWords, sMbsHeader::iWords, LMD__SUCCESS, sLmdControl::pBuffer, and sLmdControl::pMbsHeader.
Referenced by f_evt_get_event().
uint32_t fLmdGetOpen | ( | sLmdControl * | pLmdControl, | |
char * | Filename, | |||
sMbsFileHeader * | pBuffHead, | |||
uint32_t | iBytes, | |||
uint32_t | iUseOffset | |||
) |
Definition at line 505 of file fLmd.c.
References sLmdControl::cFile, sLmdControl::cHeader, sLmdControl::fFile, fLmdCleanup(), fLmdGetClose(), fLmdOffsetRead(), fLmdPrintFileHeader(), fLmdReadBuffer(), fLmdSwap4(), fLmdSwap8(), GETLMD__NOFILE, GETLMD__NOLMDFILE, sLmdControl::iBufferWords, sLmdControl::iBytes, sMbsFileHeader::iEndian, sLmdControl::iInternBuffer, sLmdControl::iInternHeader, sLmdControl::iLeftWords, sMbsFileHeader::iMaxWords, sMbsFileHeader::iOffsetSize, sLmdControl::iOffsetSize, sLmdControl::iSwap, sMbsFileHeader::iTableOffset, sMbsFileHeader::iType, sMbsFileHeader::iUsedWords, l, LMD__INDEX, LMD__INTERNAL_HEADER, LMD__SUCCESS, LMD__TYPE_FILE_HEADER_101_1, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, and sLmdControl::pMbsHeader.
Referenced by f_evt_get_open().
uint32_t fLmdGetSwap | ( | sLmdControl * | pLmdControl | ) |
Definition at line 851 of file fLmd.c.
References sLmdControl::iSwap.
uint32_t fLmdGetWrittenEndian | ( | sLmdControl * | pLmdControl | ) |
Definition at line 865 of file fLmd.c.
References sMbsFileHeader::iWrittenEndian, LMD__ENDIAN_UNKNOWN, and sLmdControl::pMbsFileHeader.
uint32_t fLmdInitMbs | ( | sLmdControl * | pLmdControl, | |
char * | Nodename, | |||
uint32_t | iMaxBytes, | |||
uint32_t | iBuffers, | |||
uint32_t | iStreams, | |||
uint32_t | iPort, | |||
uint32_t | iTimeout | |||
) |
Definition at line 382 of file fLmd.c.
References sLmdControl::cFile, sLmdControl::iBufferWords, sLmdControl::iInternBuffer, sLmdControl::iPort, sLmdControl::iTCP, sLmdControl::iTCPowner, sLmdControl::iTcpTimeout, LMD__FAILURE, LMD__SUCCESS, sLmdControl::pBuffer, sLmdControl::pTCP, and s_tcpcomm::socket.
Referenced by f_evt_get_open().
void fLmdOffsetElements | ( | sLmdControl * | pLmdControl, | |
uint32_t | bytes, | |||
uint32_t * | elements, | |||
uint32_t * | used | |||
) |
Definition at line 879 of file fLmd.c.
References sLmdControl::iElements, sLmdControl::iOffsetSize, sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdGetBuffer().
lmdoff_t fLmdOffsetGet | ( | sLmdControl * | pLmdControl, | |
uint32_t | index | |||
) |
Definition at line 1011 of file fLmd.c.
References sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdGetElement().
uint32_t fLmdOffsetRead | ( | sLmdControl * | pLmdControl | ) |
Definition at line 912 of file fLmd.c.
References sLmdControl::cFile, sLmdControl::fFile, fLmdReadBuffer(), fLmdSwap4(), fLmdSwap8(), GETLMD__NOLMDFILE, sMbsFileHeader::iElements, sLmdControl::iOffsetEntries, sLmdControl::iOffsetSize, sLmdControl::iSwap, sMbsFileHeader::iTableOffset, LMD__SUCCESS, LMD__TYPE_FILE_INDEX_101_2, sLmdControl::pMbsFileHeader, sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdGetOpen().
void fLmdOffsetResize | ( | sLmdControl * | pLmdControl, | |
uint32_t | firstValue | |||
) |
Definition at line 1019 of file fLmd.c.
References sLmdControl::iOffsetEntries, sLmdControl::iOffsetSize, sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdOffsetSet(), and fLmdPutOpen().
uint32_t fLmdOffsetSet | ( | sLmdControl * | pLmdControl, | |
uint32_t | lwords | |||
) |
Definition at line 996 of file fLmd.c.
References fLmdOffsetResize(), sLmdControl::iElements, sLmdControl::iOffsetEntries, LMD__SUCCESS, sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdPutBuffer(), and fLmdPutElement().
uint32_t fLmdOffsetWrite | ( | sLmdControl * | pLmdControl | ) |
Definition at line 960 of file fLmd.c.
References sLmdControl::fFile, fLmdWriteBuffer(), sLmdControl::iElements, sLmdControl::iOffsetSize, sMbsFileHeader::iTableOffset, sMbsHeader::iType, sMbsHeader::iWords, LMD__FAILURE, LMD__SUCCESS, LMD__TYPE_FILE_INDEX_101_2, sLmdControl::pMbsFileHeader, sLmdControl::pOffset4, and sLmdControl::pOffset8.
Referenced by fLmdPutClose().
void fLmdPrintBufferHeader | ( | uint32_t | iVerbose, | |
sMbsBufferHeader * | pMbsBufferHeader | |||
) |
Definition at line 1054 of file fLmd.c.
References sMbsBufferHeader::iBuffer, sMbsBufferHeader::iElements, sMbsBufferHeader::iMaxWords, sMbsBufferHeader::iTimeSpecNanoSec, sMbsBufferHeader::iTimeSpecSec, sMbsBufferHeader::iType, and sMbsBufferHeader::iUsedWords.
void fLmdPrintControl | ( | uint32_t | iVerbose, | |
sLmdControl * | pLmdControl | |||
) |
Definition at line 1104 of file fLmd.c.
References sLmdControl::cFile, fLmdPrintEvent(), fLmdPrintFileHeader(), sLmdControl::iBufferWords, sLmdControl::iBytes, sLmdControl::iElements, sLmdControl::iLeftWords, sLmdControl::pMbsFileHeader, and sLmdControl::pMbsHeader.
void fLmdPrintEvent | ( | uint32_t | iVerbose, | |
sMbsEventHeader * | pMbsEventHeader | |||
) |
Definition at line 1093 of file fLmd.c.
References sMbsEventHeader::iEventNumber, sMbsEventHeader::iTrigger, sMbsEventHeader::iType, and sMbsEventHeader::iWords.
Referenced by fLmdPrintControl().
void fLmdPrintFileHeader | ( | uint32_t | iVerbose, | |
sMbsFileHeader * | pMbsFileHeader | |||
) |
Definition at line 1068 of file fLmd.c.
References sMbsFileHeader::iElements, sMbsFileHeader::iMaxWords, sMbsFileHeader::iOffsetSize, sMbsFileHeader::iTableOffset, sMbsFileHeader::iTimeSpecNanoSec, sMbsFileHeader::iTimeSpecSec, sMbsFileHeader::iType, and sMbsFileHeader::iUsedWords.
Referenced by fLmdGetOpen(), and fLmdPrintControl().
void fLmdPrintHeader | ( | uint32_t | iVerbose, | |
sMbsHeader * | pMbsHeader | |||
) |
Definition at line 1084 of file fLmd.c.
References sMbsHeader::iType, and sMbsHeader::iWords.
uint32_t fLmdPutBuffer | ( | sLmdControl * | pLmdControl, | |
sMbsHeader * | pHeader, | |||
uint32_t | Items | |||
) |
Definition at line 248 of file fLmd.c.
References fLmdOffsetSet(), fLmdWriteBuffer(), sLmdControl::iBytes, sMbsFileHeader::iElements, sLmdControl::iElements, sMbsFileHeader::iMaxWords, sLmdControl::iOffsetEntries, sLmdControl::iOffsetSize, sMbsHeader::iWords, LMD__FAILURE, LMD__SUCCESS, sLmdControl::pMbsFileHeader, and PUTLMD__EXCEED.
Referenced by f_evt_put_buffer().
uint32_t fLmdPutClose | ( | sLmdControl * | pLmdControl | ) |
Definition at line 297 of file fLmd.c.
References sLmdControl::fFile, fLmdCleanup(), fLmdGetClose(), fLmdOffsetWrite(), fLmdWriteBuffer(), sLmdControl::iBufferWords, sLmdControl::iBytes, sLmdControl::iLeftWords, sLmdControl::iOffsetEntries, sMbsFileHeader::iTableOffset, LMD__FAILURE, LMD__SUCCESS, sLmdControl::pBuffer, and sLmdControl::pMbsFileHeader.
Referenced by f_evt_put_close().
uint32_t fLmdPutElement | ( | sLmdControl * | pLmdControl, | |
sMbsHeader * | pHeader | |||
) |
Definition at line 189 of file fLmd.c.
References fLmdOffsetSet(), fLmdWriteBuffer(), sLmdControl::iBufferWords, sLmdControl::iBytes, sMbsFileHeader::iElements, sLmdControl::iElements, sLmdControl::iLeftWords, sMbsFileHeader::iMaxWords, sLmdControl::iOffsetEntries, sLmdControl::iOffsetSize, sMbsHeader::iWords, LMD__FAILURE, LMD__SUCCESS, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, sLmdControl::pMbsHeader, PUTLMD__EXCEED, and PUTLMD__TOOBIG.
Referenced by f_evt_put_event().
uint32_t fLmdPutOpen | ( | sLmdControl * | pLmdControl, | |
char * | Filename, | |||
sMbsFileHeader * | pBuffHead, | |||
uint32_t | iBytes, | |||
uint32_t | iOver, | |||
uint32_t | iUseOffset, | |||
uint32_t | iLargeFile | |||
) |
Definition at line 119 of file fLmd.c.
References sLmdControl::cFile, sLmdControl::fFile, fLmdCleanup(), fLmdOffsetResize(), fLmdWriteBuffer(), sLmdControl::iBufferWords, sLmdControl::iBytes, sMbsFileHeader::iEndian, sLmdControl::iInternBuffer, sLmdControl::iInternHeader, sLmdControl::iLeftWords, sMbsFileHeader::iOffsetSize, sLmdControl::iOffsetSize, sMbsFileHeader::iTimeSpecNanoSec, sMbsFileHeader::iTimeSpecSec, sMbsFileHeader::iType, sMbsFileHeader::iUsedWords, LMD__INDEX, LMD__LARGE_FILE, LMD__NO_OVERWRITE, LMD__STANDARD_HEADER, LMD__SUCCESS, sLmdControl::pBuffer, sLmdControl::pMbsFileHeader, PUTLMD__FILE_EXIST, and PUTLMD__OPEN_ERR.
Referenced by f_evt_put_open().
int32_t fLmdReadBuffer | ( | sLmdControl * | pLmdControl, | |
char * | buffer, | |||
uint32_t | bytes | |||
) |
Definition at line 800 of file fLmd.c.
References sLmdControl::fFile.
Referenced by fLmdGetBuffer(), fLmdGetElement(), fLmdGetOpen(), and fLmdOffsetRead().
void fLmdSetWrittenEndian | ( | sLmdControl * | pLmdControl, | |
uint32_t | iE | |||
) |
Definition at line 858 of file fLmd.c.
References sMbsFileHeader::iWrittenEndian, and sLmdControl::pMbsFileHeader.
void fLmdSwap4 | ( | uint32_t * | array, | |
uint32_t | items | |||
) |
Definition at line 1118 of file fLmd.c.
Referenced by fLmdConnectMbs(), fLmdGetBuffer(), fLmdGetElement(), fLmdGetMbsBuffer(), fLmdGetOpen(), and fLmdOffsetRead().
void fLmdSwap8 | ( | uint64_t * | array, | |
uint32_t | items | |||
) |
Definition at line 1132 of file fLmd.c.
Referenced by fLmdGetOpen(), and fLmdOffsetRead().
int32_t fLmdWriteBuffer | ( | sLmdControl * | pLmdControl, | |
char * | buffer, | |||
uint32_t | bytes | |||
) |
Definition at line 807 of file fLmd.c.
References sLmdControl::fFile.
Referenced by fLmdOffsetWrite(), fLmdPutBuffer(), fLmdPutClose(), fLmdPutElement(), and fLmdPutOpen().