1 | /* |
---|
2 | * |
---|
3 | * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand. |
---|
4 | * All rights reserved. |
---|
5 | * |
---|
6 | * This file is part of libtrace. |
---|
7 | * |
---|
8 | * This code has been developed by the University of Waikato WAND |
---|
9 | * research group. For further information please see http://www.wand.net.nz/ |
---|
10 | * |
---|
11 | * libtrace is free software; you can redistribute it and/or modify |
---|
12 | * it under the terms of the GNU Lesser General Public License as published by |
---|
13 | * the Free Software Foundation; either version 3 of the License, or |
---|
14 | * (at your option) any later version. |
---|
15 | * |
---|
16 | * libtrace is distributed in the hope that it will be useful, |
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | * GNU Lesser General Public License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU Lesser General Public License |
---|
22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | * |
---|
24 | * |
---|
25 | */ |
---|
26 | #ifndef FORMAT_ERF_H |
---|
27 | #define FORMAT_ERF_H |
---|
28 | |
---|
29 | #include "libtrace.h" |
---|
30 | |
---|
31 | /* ERF Section codes */ |
---|
32 | #define ERF_PROV_SECTION_CAPTURE 0xFF00 |
---|
33 | #define ERF_PROV_SECTION_HOST 0xFF01 |
---|
34 | #define ERF_PROV_SECTION_MODULE 0xFF02 |
---|
35 | #define ERF_PROV_SECTION_INTERFACE 0xFF03 |
---|
36 | |
---|
37 | /* ERF Provenance record tag type codes */ |
---|
38 | #define ERF_PROV_COMMENT 1 |
---|
39 | #define ERF_PROV_FCS_LEN 8 |
---|
40 | #define ERF_PROV_MASK_CIDR 10 |
---|
41 | #define ERF_PROV_NAME 12 |
---|
42 | #define ERF_PROV_DESCR 13 |
---|
43 | #define ERF_PROV_APP_NAME 16 |
---|
44 | #define ERF_PROV_HOSTNAME 18 |
---|
45 | #define ERF_PROV_OS 17 |
---|
46 | #define ERF_PROV_MODEL 20 |
---|
47 | #define ERF_PROV_FW_VERSION 21 |
---|
48 | #define ERF_PROV_SERIAL_NO 22 |
---|
49 | #define ERF_PROV_ORG_NAME 11 |
---|
50 | #define ERF_PROV_SNAPLEN 29 |
---|
51 | #define ERF_PROV_CARD_NUM 30 |
---|
52 | #define ERF_PROV_MODULE_NUM 31 |
---|
53 | #define ERF_PROV_LOC_NAME 34 |
---|
54 | #define ERF_PROV_FILTER 36 |
---|
55 | #define ERF_PROV_FLOW_HASH_MODE 37 |
---|
56 | #define ERF_PROV_TUNNELING_MODE 38 |
---|
57 | #define ERF_PROV_ROTFILE_NAME 43 |
---|
58 | #define ERF_PROV_LOC_DESCR 46 |
---|
59 | #define ERF_PROV_APP_VERSION 47 |
---|
60 | #define ERF_PROV_MEM 40 |
---|
61 | #define ERF_PROV_DEV_NAME 44 |
---|
62 | #define ERF_PROV_DEV_PATH 45 |
---|
63 | #define ERF_PROV_CPU 49 |
---|
64 | #define ERF_PROV_CPU_PHYS_CORES 50 |
---|
65 | #define ERF_PROV_CPU_NUMA_NODES 51 |
---|
66 | #define ERF_PROV_DAG_VERSION 53 |
---|
67 | #define ERF_PROV_IF_NUM 64 |
---|
68 | #define ERF_PROV_IF_SPEED 66 |
---|
69 | #define ERF_PROV_IF_IPV4 67 |
---|
70 | #define ERF_PROV_IF_IPV6 68 |
---|
71 | #define ERF_PROV_IF_MAC 69 |
---|
72 | #define ERF_PROV_IF_SFP_TYPE 78 |
---|
73 | #define ERF_PROV_IF_LINK_STATUS 81 |
---|
74 | #define ERF_PROV_IF_PHY_MODE 82 |
---|
75 | #define ERF_PROV_IF_PORT_TYPE 83 |
---|
76 | #define ERF_PROV_IF_RX_LATENCY 84 |
---|
77 | #define ERF_PROV_IF_RX_POWER 79 |
---|
78 | #define ERF_PROV_IF_TX_POWER 80 |
---|
79 | #define ERF_PROV_CLK_SOURCE 384 |
---|
80 | #define ERF_PROV_CLK_STATE 385 |
---|
81 | #define ERF_PROV_CLK_THRESHOLD 386 |
---|
82 | #define ERF_PROV_CLK_CORRECTION 387 |
---|
83 | #define ERF_PROV_CLK_FAILURES 388 |
---|
84 | #define ERF_PROV_CLK_RESYNCS 389 |
---|
85 | #define ERF_PROV_CLK_PHASE_ERROR 390 |
---|
86 | #define ERF_PROV_CLK_INPUT_PULSES 391 |
---|
87 | #define ERF_PROV_CLK_REJECTED_PULSES 392 |
---|
88 | #define ERF_PROV_CLK_PHC_INDEX 393 |
---|
89 | #define ERF_PROV_CLK_PHC_OFFSET 394 |
---|
90 | #define ERF_PROV_CLK_TIMEBASE 395 |
---|
91 | #define ERF_PROV_CLK_DESCR 396 |
---|
92 | #define ERF_PROV_CLK_OUT_SOURCE 397 |
---|
93 | #define ERF_PROV_CLK_LINK_MODE 398 |
---|
94 | #define ERF_PROV_PTP_DOMAIN_NUM 399 |
---|
95 | #define ERF_PROV_PTP_STEPS_REMOVED 400 |
---|
96 | #define ERF_PROV_CLK_PORT_PROTO 414 |
---|
97 | |
---|
98 | /** @file |
---|
99 | * |
---|
100 | * @brief Header file defining functions that apply to all libtrace formats |
---|
101 | * that use the ERF record format, e.g. ERF, DAG 2.4, DAG 2.5 |
---|
102 | * |
---|
103 | * @author Daniel Lawson |
---|
104 | * @author Perry Lorier |
---|
105 | * @author Shane Alcock |
---|
106 | * |
---|
107 | * @version $Id$ |
---|
108 | * |
---|
109 | * Not too much detail required with these functions - this header file exists |
---|
110 | * solely to ensure that we don't have to duplicate the same code across |
---|
111 | * multiple format modules. |
---|
112 | */ |
---|
113 | |
---|
114 | typedef struct dag_section_header { |
---|
115 | uint16_t type; |
---|
116 | uint16_t len; |
---|
117 | } PACKED dag_sec_t; |
---|
118 | |
---|
119 | struct dag_opthdr { |
---|
120 | uint16_t optcode; |
---|
121 | uint16_t optlen; |
---|
122 | } PACKED; |
---|
123 | |
---|
124 | int erf_get_framing_length(const libtrace_packet_t *packet); |
---|
125 | libtrace_linktype_t erf_get_link_type(const libtrace_packet_t *packet); |
---|
126 | libtrace_direction_t erf_get_direction(const libtrace_packet_t *packet); |
---|
127 | libtrace_direction_t erf_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction); |
---|
128 | uint64_t erf_get_erf_timestamp(const libtrace_packet_t *packet); |
---|
129 | int erf_get_capture_length(const libtrace_packet_t *packet); |
---|
130 | int erf_get_wire_length(const libtrace_packet_t *packet); |
---|
131 | size_t erf_set_capture_length(libtrace_packet_t *packet, size_t size); |
---|
132 | int erf_is_color_type(uint8_t erf_type); |
---|
133 | |
---|
134 | void *erf_get_meta_section(libtrace_packet_t *packet, uint32_t section); |
---|
135 | void *erf_get_meta_section_option(libtrace_packet_t *packet, uint32_t section, |
---|
136 | uint16_t option); |
---|
137 | |
---|
138 | #endif |
---|