Fawkes API  Fawkes Development Version
file.h
1 
2 /***************************************************************************
3  * file.h - Fawkes BlackBoard Logger data file definitions
4  *
5  * Created: Sat Nov 07 23:20:51 2009 (from earlier edits elsewhere)
6  * Copyright 2006-2009 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_BBLOGGER_FILE_H_
24 #define __PLUGINS_BBLOGGER_FILE_H_
25 
26 #include <interface/interface.h>
27 
28 #include <stdint.h>
29 
30 #define BBLOGGER_FILE_MAGIC 0xffbbffbb
31 #define BBLOGGER_FILE_VERSION 1
32 
33 #pragma pack(push,4)
34 
35 #define BBLOG_BIG_ENDIAN 1
36 #define BBLOG_LITTLE_ENDIAN 0
37 
38 #define BBLOG_INTERFACE_TYPE_SIZE __INTERFACE_TYPE_SIZE
39 #define BBLOG_INTERFACE_ID_SIZE __INTERFACE_ID_SIZE
40 #define BBLOG_INTERFACE_HASH_SIZE __INTERFACE_HASH_SIZE
41 #define BBLOG_SCENARIO_SIZE 32
42 
43 
44 /** BBLogger file header definition.
45  * To identify log files created for different interfaces but belonging to a
46  * single run files must be
47  * - created at the exact same timestamp (filename and start_time_* fields
48  * - have the same scenario id
49  * The file_version is stored in network byte order. Anything beyond this is
50  * stored in the native system format, read the endianess field to check whether
51  * you must do data conversion.
52  */
53 typedef struct {
54  uint32_t file_magic; /**< Magic value to identify file,
55  * must be 0xFFBBFFBB (big endian) */
56  uint32_t file_version; /**< File version, set to BBLOGGER_FILE_VERSION on
57  * write and verify on read (big endian) */
58  uint32_t endianess : 1; /**< Endianess, 0 little endian, 1 big endian */
59  uint32_t reserved : 31; /**< Reserved for future use */
60  uint32_t num_data_items; /**< Number of data items in file, if set to zero
61  * reader must scan the file for this number */
62  char scenario[BBLOG_SCENARIO_SIZE]; /**< Scenario as defined in
63  * config */
64  char interface_type[BBLOG_INTERFACE_TYPE_SIZE]; /**< Interface type */
65  char interface_id[BBLOG_INTERFACE_ID_SIZE]; /**< Interface ID */
66  unsigned char interface_hash[BBLOG_INTERFACE_HASH_SIZE]; /**< Interface Hash */
67  uint32_t data_size; /**< size of one interface data block */
68  uint64_t start_time_sec; /**< Start time, timestamp seconds */
69  uint64_t start_time_usec; /**< Start time, timestamp microseconds */
71 
72 /** BBLogger entry header.
73  * This header is written before every data block.
74  */
75 typedef struct {
76  uint32_t rel_time_sec; /**< time since start time, seconds */
77  uint32_t rel_time_usec; /**< time since start time, microseconds */
79 
80 #pragma pack(pop)
81 
82 #endif
uint32_t rel_time_sec
time since start time, seconds
Definition: file.h:76
uint64_t start_time_sec
Start time, timestamp seconds.
Definition: file.h:68
BBLogger file header definition.
Definition: file.h:53
uint32_t reserved
Reserved for future use.
Definition: file.h:59
uint32_t endianess
Endianess, 0 little endian, 1 big endian.
Definition: file.h:58
uint32_t file_magic
Magic value to identify file, must be 0xFFBBFFBB (big endian)
Definition: file.h:54
BBLogger entry header.
Definition: file.h:75
uint32_t num_data_items
Number of data items in file, if set to zero reader must scan the file for this number.
Definition: file.h:60
uint32_t data_size
size of one interface data block
Definition: file.h:67
uint32_t rel_time_usec
time since start time, microseconds
Definition: file.h:77
uint64_t start_time_usec
Start time, timestamp microseconds.
Definition: file.h:69
uint32_t file_version
File version, set to BBLOGGER_FILE_VERSION on write and verify on read (big endian) ...
Definition: file.h:56