Changeset d0f25d4 for lib/format_pcapng.h
- Timestamp:
- 01/23/19 13:02:54 (2 years ago)
- Branches:
- develop
- Children:
- 23741ec5
- Parents:
- 23d263a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_pcapng.h
r23d263a rd0f25d4 1 2 1 #define PCAPNG_SECTION_TYPE 0x0A0D0D0A 3 2 #define PCAPNG_INTERFACE_TYPE 0x00000001 … … 34 33 #define PCAPNG_OPTION_CUSTOM_4 19373 35 34 36 #define PACKET_IS_SECTION (pcapng_get_record_type(packet) == PCAPNG_SECTION_ _TYPE)35 #define PACKET_IS_SECTION (pcapng_get_record_type(packet) == PCAPNG_SECTION_TYPE) 37 36 #define PACKET_IS_INTERFACE (pcapng_get_record_type(packet) == PCAPNG_INTERFACE_TYPE) 38 37 #define PACKET_IS_OLD (pcapng_get_record_type(packet) == PCAPNG_OLD_PACKET_TYPE) 39 38 #define PACKET_IS_SIMPLE (pcapng_get_record_type(packet) == PCAPNG_SIMPLE_PACKET_TYPE) 40 39 #define PACKET_IS_NAME_RESOLUTION (pcapng_get_record_type(packet) == PCAPNG_NAME_RESOLUTION_TYPE) 41 #define PACKET_IS_INTERFACE_STATS _TYPE(pcapng_get_record_type(packet) == PCAPNG_INTERFACE_STATS_TYPE)40 #define PACKET_IS_INTERFACE_STATS (pcapng_get_record_type(packet) == PCAPNG_INTERFACE_STATS_TYPE) 42 41 #define PACKET_IS_ENHANCED (pcapng_get_record_type(packet) == PCAPNG_ENHANCED_PACKET_TYPE) 43 #define PACKET_IS_CUSTOM _TYPE(pcapng_get_record_type(packet) == PCAPNG_CUSTOM_TYPE)44 #define P CAPNG_IS_CUSTOM_NONCOPY_TYPE(pcapng_get_record_type(packet) == PCAPNG_CUSTOM_NONCOPY_TYPE)45 #define P CAPNG_DECRYPTION_SECRETS_TYPE(pcapng_get_record_type(packet) == PCAPNG_DECRYPTION_SECRETS_TYPE)42 #define PACKET_IS_CUSTOM (pcapng_get_record_type(packet) == PCAPNG_CUSTOM_TYPE) 43 #define PACKET_IS_CUSTOM_NONCOPY (pcapng_get_record_type(packet) == PCAPNG_CUSTOM_NONCOPY_TYPE) 44 #define PACKET_IS_DECRYPTION_SECRETS (pcapng_get_record_type(packet) == PCAPNG_DECRYPTION_SECRETS_TYPE) 46 45 47 46 #define PCAPNG_IFOPT_TSRESOL 9 … … 96 95 #define PCAPNG_META_ISB_OSDROP 7 97 96 #define PCAPNG_META_ISB_USRDELIV 8 97 /* Old packet type */ 98 #define PCAPNG_META_OLD_FLAGS 2 99 #define PCAPNG_META_OLD_HASH 3 100 101 #define DATA(x) ((struct pcapng_format_data_t *)((x)->format_data)) 102 #define DATAOUT(x) ((struct pcapng_format_data_out_t*)((x)->format_data)) 103 104 typedef struct pcagng_section_header_t { 105 uint32_t blocktype; 106 uint32_t blocklen; 107 uint32_t ordering; 108 uint16_t majorversion; 109 uint16_t minorversion; 110 uint64_t sectionlen; 111 } pcapng_sec_t; 112 113 typedef struct pcapng_interface_header_t { 114 uint32_t blocktype; 115 uint32_t blocklen; 116 uint16_t linktype; 117 uint16_t reserved; 118 uint32_t snaplen; 119 } pcapng_int_t; 120 121 typedef struct pcapng_nrb_header_t { 122 uint32_t blocktype; 123 uint32_t blocklen; 124 } pcapng_nrb_t; 125 126 typedef struct pcapng_enhanced_packet_t { 127 uint32_t blocktype; 128 uint32_t blocklen; 129 uint32_t interfaceid; 130 uint32_t timestamp_high; 131 uint32_t timestamp_low; 132 uint32_t caplen; 133 uint32_t wlen; 134 } pcapng_epkt_t; 135 136 typedef struct pcapng_simple_packet_t { 137 uint32_t blocktype; 138 uint32_t blocklen; 139 uint32_t wlen; 140 } pcapng_spkt_t; 141 142 typedef struct pcapng_old_packet_t { 143 uint32_t blocktype; 144 uint32_t blocklen; 145 uint16_t interfaceid; 146 uint16_t drops; 147 uint32_t timestamp_high; 148 uint32_t timestamp_low; 149 uint32_t caplen; 150 uint32_t wlen; 151 } pcapng_opkt_t; 152 153 typedef struct pcapng_stats_header_t { 154 uint32_t blocktype; 155 uint32_t blocklen; 156 uint32_t interfaceid; 157 uint32_t timestamp_high; 158 uint32_t timestamp_low; 159 } pcapng_stats_t; 160 161 typedef struct pcapng_decryption_secrets_header_t { 162 uint32_t blocktype; 163 uint32_t blocklen; 164 uint32_t secrets_type; 165 uint32_t secrets_len; 166 } pcapng_secrets_t; 167 168 typedef struct pcapng_custom_header_t { 169 uint32_t blocktype; 170 uint32_t blocklen; 171 uint32_t pen; 172 } pcapng_custom_t; 173 174 typedef struct pcapng_interface_t pcapng_interface_t; 175 176 struct pcapng_timestamp { 177 uint32_t timehigh; 178 uint32_t timelow; 179 }; 180 181 struct pcapng_interface_t { 182 183 uint16_t id; 184 libtrace_dlt_t linktype; 185 uint32_t snaplen; 186 uint32_t tsresol; 187 188 uint64_t received; 189 uint64_t dropped; /* as reported by interface stats */ 190 uint64_t dropcounter; /* as reported by packet records */ 191 uint64_t accepted; 192 uint64_t osdropped; 193 uint64_t laststats; 194 195 }; 196 197 struct pcapng_format_data_t { 198 bool started; 199 bool realtime; 200 bool discard_meta; 201 202 /* Section data */ 203 bool byteswapped; 204 205 /* Interface data */ 206 pcapng_interface_t **interfaces; 207 uint16_t allocatedinterfaces; 208 uint16_t nextintid; 209 210 }; 211 212 struct pcapng_format_data_out_t { 213 iow_t *file; 214 int compress_level; 215 int compress_type; 216 int flag; 217 218 /* Section data */ 219 uint16_t sechdr_count; 220 bool byteswapped; 221 222 /* Interface data */ 223 uint16_t nextintid; 224 libtrace_linktype_t lastdlt; 225 }; 226 227 struct pcapng_optheader { 228 uint16_t optcode; 229 uint16_t optlen; 230 }; 231 232 struct pcapng_custom_optheader { 233 uint16_t optcode; 234 uint16_t optlen; 235 uint32_t pen; 236 }; 237 struct pcapng_nrb_record { 238 uint16_t recordtype; 239 uint16_t recordlen; 240 }; 241 struct pcapng_peeker { 242 uint32_t blocktype; 243 uint32_t blocklen; 244 }; 245 246 typedef struct pcapng_peeker pcapng_hdr_t; 98 247 99 248 void *pcapng_get_meta_section(libtrace_packet_t *packet, uint32_t section);
Note: See TracChangeset
for help on using the changeset viewer.