00001 // $Id: sMbs.h 478 2009-10-29 12:26:09Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef MbsStruct 00015 #define MbsStruct 00016 00017 #define LMD__TYPE_FILE_HEADER_101_1 0x00010065 00018 #define LMD__TYPE_EVENT_HEADER_10_1 0x0001000a 00019 #define LMD__TYPE_FILE_INDEX_101_2 0x00020065 00020 #define LMD__TYPE_BUFFER_HEADER_10_1 0x0001000a 00021 #define LMD__TYPE_BUFFER_HEADER_100_1 0x00010064 00022 #define LMD__TYPE_TIME_STAMP_11_1 0x0001000b 00023 #define LMD__GET_EVENTS NULL 00024 #define LMD__STANDARD_HEADER NULL 00025 #define LMD__INTERNAL_HEADER NULL 00026 #define LMD__INDEX 1 00027 #define LMD__OVERWRITE 1 00028 #define LMD__LARGE_FILE 1 00029 #define LMD__MIN_BUFFER 0 00030 #define LMD__BUFFER 1 00031 #define LMD__VERBOSE 1 00032 #define LMD__NO_VERBOSE 0 00033 #define LMD__NO_BUFFER 0 00034 #define LMD__NO_INDEX 0 00035 #define LMD__NO_OVERWRITE 0 00036 #define LMD__NO_LARGE_FILE 0 00037 #define LMD__NO_VERBOSE 0 00038 #define LMD__VERBOSE 1 00039 #define LMD__ENDIAN_LITTLE 1 00040 #define LMD__ENDIAN_BIG 2 00041 #define LMD__ENDIAN_UNKNOWN 0 00042 00043 #include "s_stdint.h" 00044 00045 typedef uint64_t lmdoff_t; 00046 00047 // must #include <stdint.h> 00048 // on Lynx, define int32_t, uint32_t, int16_t 00049 // structure used to talk between client and server 00050 // Client connects to server (MBS) and reads this structure first 00051 00052 //-------------------------------------------------- 00053 // Structure maps the MBS transport info buffer 00054 typedef struct{ 00055 uint32_t iEndian; // byte order. Set to 1 by sender 00056 uint32_t iMaxBytes; // maximum buffer size 00057 uint32_t iBuffers; // buffers per stream 00058 uint32_t iStreams; // number of streams 00059 } sMbsTransportInfo; 00060 00061 //-------------------------------------------------- 00062 // Buffer header, maps s_bufhe, some fields used in different way 00063 typedef struct{ 00064 uint32_t iMaxWords; // compatible with s_bufhe (total buffer size - header) 00065 uint32_t iType; // compatible with s_bufhe, low=type (=100), high=subtype 00066 uint32_t iUsed; // not used for iMaxWords>MAX__DLEN (16360), low 16bits only 00067 uint32_t iBuffer; // compatible with s_bufhe 00068 uint32_t iElements; // compatible with s_bufhe 00069 uint32_t iTemp; // Used volatile 00070 uint32_t iTimeSpecSec; // compatible with s_bufhe (2*32bit) 00071 uint32_t iTimeSpecNanoSec; // compatible with s_bufhe (2*32bit) 00072 // struct timespec TimeSpec; 00073 uint32_t iEndian; // compatible with s_bufhe free[0] 00074 uint32_t iWrittenEndian;// one of LMD__ENDIAN_x 00075 uint32_t iUsedWords; // total words without header to read for type=100, free[2] 00076 uint32_t iFree3; // free[3] 00077 } sMbsBufferHeader; 00078 00079 //-------------------------------------------------- 00080 // Buffer header, maps s_bufhe 00081 typedef struct{ 00082 uint32_t iMaxWords; // compatible with s_bufhe (total buffer size - header) 00083 uint32_t iType; // compatible with s_bufhe, low=type (=100), high=subtype 00084 lmdoff_t iTableOffset; // optional offset to element offset table in file 00085 uint32_t iElements; // compatible with s_bufhe 00086 uint32_t iOffsetSize; // Offset size, 4 or 8 [bytes] 00087 uint32_t iTimeSpecSec; // compatible with s_bufhe (2*32bit) 00088 uint32_t iTimeSpecNanoSec; // compatible with s_bufhe (2*32bit) 00089 // struct timespec TimeSpec; 00090 uint32_t iEndian; // compatible with s_bufhe free[0] 00091 uint32_t iWrittenEndian;// one of LMD__ENDIAN_x 00092 uint32_t iUsedWords; // total words without header to read for type=100, free[2] 00093 uint32_t iFree3; // free[3] 00094 } sMbsFileHeader; 00095 00096 //-------------------------------------------------- 00097 typedef struct{ 00098 uint32_t iMaxWords; 00099 uint32_t iType; 00100 uint32_t iTimeSpecSec; 00101 uint32_t iTimeSpecNanoSec; 00102 } sMbsTimeStamp; 00103 00104 //-------------------------------------------------- 00105 // maps s_evhe 00106 typedef struct{ 00107 uint32_t iWords; // following data words 00108 uint32_t iType; // compatible with s_ve10_1, low=type (=10), high=subtype 00109 } sMbsHeader; 00110 00111 //-------------------------------------------------- 00112 // maps s_ve10_1 00113 typedef struct{ 00114 uint32_t iWords; // data words + 4 00115 uint32_t iType; // compatible with s_ve10_1, low=type (=10), high=subtype 00116 uint32_t iTrigger; 00117 uint32_t iEventNumber; 00118 } sMbsEventHeader; 00119 00120 //-------------------------------------------------- 00121 // maps s_ves10_1 00122 typedef struct{ 00123 uint32_t iWords; // data words + 2 00124 uint32_t iType; // compatible with s_ves10_1, low=type (=10), high=subtype 00125 uint32_t iSubeventID; // 2 low bytes=procid, next byte=subcrate, high byte control 00126 } sMbsSubeventHeader; 00127 #endif