/ bm_common_pub_sub.h
bm_common_pub_sub.h
 1  #pragma once
 2  #include <stdint.h>
 3  
 4  #ifdef __cplusplus
 5  extern "C" {
 6  #endif
 7  
 8  #ifndef BM_COMMON_PUB_SUB_VERSION
 9  #define BM_COMMON_PUB_SUB_VERSION (1)
10  #endif // BM_COMMON_PUB_SUB_VERSION
11  
12  // Add data structures published through pub sub must have this header.
13  typedef struct {
14    uint8_t type; // Type of data.
15    uint8_t version; // Protocol Version.
16    uint8_t payload[0]; // Payload
17  } __attribute__ ((packed)) bm_common_pub_sub_header_t;
18  
19  // Add pub sub data structures below
20  
21  typedef struct {
22      uint64_t utc_us; // UTC in nanoseconds.
23  } __attribute__ ((packed)) bm_common_pub_sub_utc_t;
24  
25  // This is the payload for a printf/fprintf publication
26  typedef struct {
27    uint64_t target_node_id;
28    uint16_t fname_len;
29    uint16_t data_len;
30    uint8_t fnameAndData[0];
31  } __attribute__((packed)) bm_print_publication_t;
32  
33  #ifdef __cplusplus
34  }
35  #endif