1 | #ifndef _DAGFORMAT_H_ |
---|
2 | #define _DAGFORMAT_H_ |
---|
3 | |
---|
4 | #include "libtrace.h" |
---|
5 | |
---|
6 | /* GPP record type defines */ |
---|
7 | #define TYPE_LEGACY 0 |
---|
8 | #define TYPE_HDLC_POS 1 |
---|
9 | #define TYPE_ETH 2 |
---|
10 | #define TYPE_ATM 3 |
---|
11 | #define TYPE_AAL5 4 |
---|
12 | |
---|
13 | #ifdef WIN32 |
---|
14 | #pragma pack(push) |
---|
15 | #pragma pack(1) |
---|
16 | #endif |
---|
17 | |
---|
18 | /** GPP Type 1 */ |
---|
19 | typedef struct pos_rec { |
---|
20 | uint32_t hdlc; |
---|
21 | uint8_t pload[1]; /**< payload */ |
---|
22 | } pos_rec_t; |
---|
23 | |
---|
24 | /** GPP Type 2 */ |
---|
25 | typedef struct eth_rec { |
---|
26 | uint8_t offset; |
---|
27 | uint8_t pad; |
---|
28 | uint8_t dst[6]; |
---|
29 | uint8_t src[6]; |
---|
30 | uint16_t etype; /**< ether type (?) */ |
---|
31 | uint8_t pload[1]; /**< payload */ |
---|
32 | } eth_rec_t; |
---|
33 | |
---|
34 | /** GPP Type 3 */ |
---|
35 | typedef struct atm_rec { |
---|
36 | uint32_t header; |
---|
37 | uint8_t pload[1]; /**< payload */ |
---|
38 | } atm_rec_t; |
---|
39 | |
---|
40 | /** GPP Type 4 */ |
---|
41 | typedef struct aal5_rec { |
---|
42 | uint32_t header; |
---|
43 | uint8_t pload[1]; /**< payload */ |
---|
44 | } aal5_rec_t; |
---|
45 | |
---|
46 | /** Flags */ |
---|
47 | typedef struct flags { |
---|
48 | LT_BITFIELD8 iface:2; /**< Interface (direction) */ |
---|
49 | LT_BITFIELD8 vlen:1; |
---|
50 | LT_BITFIELD8 trunc:1; /**< Trunacted */ |
---|
51 | LT_BITFIELD8 rxerror:1; /**< RX Error in this packet/before |
---|
52 | * this packet |
---|
53 | */ |
---|
54 | LT_BITFIELD8 dserror:1; /**< Data stream error */ |
---|
55 | LT_BITFIELD8 pad:2; /**< Unused */ |
---|
56 | } PACKED flags_t; |
---|
57 | |
---|
58 | /** GPP Global type */ |
---|
59 | typedef struct dag_record { |
---|
60 | uint64_t ts; /**< erf timestamp */ |
---|
61 | uint8_t type; /**< GPP record type */ |
---|
62 | flags_t flags; /**< flags */ |
---|
63 | uint16_t rlen; /**< record len (capture+framing) */ |
---|
64 | uint16_t lctr; /**< loss counter */ |
---|
65 | uint16_t wlen; /**< wire length */ |
---|
66 | union { |
---|
67 | pos_rec_t pos; |
---|
68 | eth_rec_t eth; |
---|
69 | atm_rec_t atm; |
---|
70 | aal5_rec_t aal5; |
---|
71 | } rec; |
---|
72 | } PACKED dag_record_t; |
---|
73 | |
---|
74 | /** Dynamic(?) Universal Clock Kit Information packet */ |
---|
75 | typedef struct duck_inf_pkt { |
---|
76 | uint32_t command; |
---|
77 | uint32_t config; |
---|
78 | uint32_t clock_inc; |
---|
79 | uint32_t clock_wrap; |
---|
80 | uint32_t DDS_rate; |
---|
81 | uint32_t crystal_freq; |
---|
82 | uint32_t synth_freq; |
---|
83 | uint32_t sync_rate; |
---|
84 | uint64_t last_ticks; |
---|
85 | uint32_t resyncs; |
---|
86 | uint32_t bad_diffs, bad_offs, bad_pulses; |
---|
87 | uint32_t worst_error, worst_off; |
---|
88 | uint32_t off_limit, off_damp; |
---|
89 | uint32_t pulses, single_pulses_missing, longest_pulse_missing; |
---|
90 | uint32_t health; |
---|
91 | uint32_t sickness; |
---|
92 | int32_t error; |
---|
93 | int32_t offset; |
---|
94 | int32_t stat_start, stat_end; |
---|
95 | uint32_t set_duck_field; |
---|
96 | } duck_inf; |
---|
97 | |
---|
98 | #ifdef WIN32 |
---|
99 | #pragma pack(pop) |
---|
100 | #endif |
---|
101 | |
---|
102 | /** sizeof(dag_record_t) without the payload helpers */ |
---|
103 | #define dag_record_size 16U |
---|
104 | |
---|
105 | #endif /* _DAGFORMAT_H_ */ |
---|