| 1 | /* |
|---|
| 2 | * This file is part of libtrace |
|---|
| 3 | * |
|---|
| 4 | * Copyright (c) 2004 The University of Waikato, Hamilton, New Zealand. |
|---|
| 5 | * Authors: Daniel Lawson |
|---|
| 6 | * Perry Lorier |
|---|
| 7 | * |
|---|
| 8 | * All rights reserved. |
|---|
| 9 | * |
|---|
| 10 | * This code has been developed by the University of Waikato WAND |
|---|
| 11 | * research group. For further information please see http://www.wand.net.nz/ |
|---|
| 12 | * |
|---|
| 13 | * libtrace is free software; you can redistribute it and/or modify |
|---|
| 14 | * it under the terms of the GNU General Public License as published by |
|---|
| 15 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 16 | * (at your option) any later version. |
|---|
| 17 | * |
|---|
| 18 | * libtrace is distributed in the hope that it will be useful, |
|---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 21 | * GNU General Public License for more details. |
|---|
| 22 | * |
|---|
| 23 | * You should have received a copy of the GNU General Public License |
|---|
| 24 | * along with libtrace; if not, write to the Free Software |
|---|
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 26 | * |
|---|
| 27 | * $Id$ |
|---|
| 28 | * |
|---|
| 29 | */ |
|---|
| 30 | |
|---|
| 31 | #include "common.h" |
|---|
| 32 | #include "config.h" |
|---|
| 33 | #include "libtrace.h" |
|---|
| 34 | #include "libtrace_int.h" |
|---|
| 35 | #include "format_helper.h" |
|---|
| 36 | |
|---|
| 37 | #include <sys/stat.h> |
|---|
| 38 | #include <assert.h> |
|---|
| 39 | #include <stdio.h> |
|---|
| 40 | #include <stdlib.h> |
|---|
| 41 | #include <string.h> |
|---|
| 42 | #include <errno.h> |
|---|
| 43 | #include <fcntl.h> |
|---|
| 44 | |
|---|
| 45 | #define DATA(x) ((struct pcapfile_format_data_t*)((x)->format_data)) |
|---|
| 46 | #define DATAOUT(x) ((struct pcapfile_format_data_out_t*)((x)->format_data)) |
|---|
| 47 | |
|---|
| 48 | typedef struct pcapfile_header_t { |
|---|
| 49 | uint32_t magic_number; /* magic number */ |
|---|
| 50 | uint16_t version_major; /* major version number */ |
|---|
| 51 | uint16_t version_minor; /* minor version number */ |
|---|
| 52 | int32_t thiszone; /* GMT to local correction */ |
|---|
| 53 | uint32_t sigfigs; /* timestamp accuracy */ |
|---|
| 54 | uint32_t snaplen; /* aka "wirelen" */ |
|---|
| 55 | uint32_t network; /* data link type */ |
|---|
| 56 | } pcapfile_header_t; |
|---|
| 57 | |
|---|
| 58 | struct pcapfile_format_data_t { |
|---|
| 59 | libtrace_io_t *file; |
|---|
| 60 | pcapfile_header_t header; |
|---|
| 61 | }; |
|---|
| 62 | |
|---|
| 63 | struct pcapfile_format_data_out_t { |
|---|
| 64 | libtrace_io_t *file; |
|---|
| 65 | int level; |
|---|
| 66 | int flag; |
|---|
| 67 | |
|---|
| 68 | }; |
|---|
| 69 | |
|---|
| 70 | static int pcapfile_init_input(libtrace_t *libtrace) { |
|---|
| 71 | libtrace->format_data = malloc(sizeof(struct pcapfile_format_data_t)); |
|---|
| 72 | |
|---|
| 73 | if (libtrace->format_data == NULL) { |
|---|
| 74 | trace_set_err(libtrace,ENOMEM,"Out of memory"); |
|---|
| 75 | return -1; |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | DATA(libtrace)->file=NULL; |
|---|
| 79 | |
|---|
| 80 | return 0; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | static int pcapfile_init_output(libtrace_out_t *libtrace) { |
|---|
| 84 | libtrace->format_data = |
|---|
| 85 | malloc(sizeof(struct pcapfile_format_data_out_t)); |
|---|
| 86 | |
|---|
| 87 | DATAOUT(libtrace)->file=NULL; |
|---|
| 88 | DATAOUT(libtrace)->level=0; |
|---|
| 89 | DATAOUT(libtrace)->flag=O_CREAT|O_WRONLY; |
|---|
| 90 | |
|---|
| 91 | return 0; |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | static uint16_t swaps(libtrace_t *libtrace, uint16_t num) |
|---|
| 95 | { |
|---|
| 96 | /* to deal with open_dead traces that might try and use this |
|---|
| 97 | * if we don't have any per trace data, assume host byte order |
|---|
| 98 | */ |
|---|
| 99 | if (!DATA(libtrace)) |
|---|
| 100 | return num; |
|---|
| 101 | if (DATA(libtrace)->header.magic_number == 0xd4c3b2a1) |
|---|
| 102 | return byteswap16(num); |
|---|
| 103 | |
|---|
| 104 | return num; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | static uint32_t swapl(libtrace_t *libtrace, uint32_t num) |
|---|
| 108 | { |
|---|
| 109 | /* to deal with open_dead traces that might try and use this |
|---|
| 110 | * if we don't have any per trace data, assume host byte order |
|---|
| 111 | */ |
|---|
| 112 | if (!DATA(libtrace)) |
|---|
| 113 | return num; |
|---|
| 114 | if (DATA(libtrace)->header.magic_number == 0xd4c3b2a1) |
|---|
| 115 | return byteswap32(num); |
|---|
| 116 | |
|---|
| 117 | return num; |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | static int pcapfile_start_input(libtrace_t *libtrace) |
|---|
| 122 | { |
|---|
| 123 | int err; |
|---|
| 124 | |
|---|
| 125 | if (!DATA(libtrace)->file) { |
|---|
| 126 | DATA(libtrace)->file=trace_open_file(libtrace); |
|---|
| 127 | |
|---|
| 128 | if (!DATA(libtrace)->file) |
|---|
| 129 | return -1; |
|---|
| 130 | |
|---|
| 131 | err=libtrace_io_read(DATA(libtrace)->file, |
|---|
| 132 | &DATA(libtrace)->header, |
|---|
| 133 | sizeof(DATA(libtrace)->header)); |
|---|
| 134 | |
|---|
| 135 | if (err<1) |
|---|
| 136 | return -1; |
|---|
| 137 | |
|---|
| 138 | if (swapl(libtrace,DATA(libtrace)->header.magic_number) != 0xa1b2c3d4) { |
|---|
| 139 | trace_set_err(libtrace,TRACE_ERR_INIT_FAILED,"Not a pcap tracefile\n"); |
|---|
| 140 | return -1; /* Not a pcap file */ |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | if (swaps(libtrace,DATA(libtrace)->header.version_major)!=2 |
|---|
| 144 | && swaps(libtrace,DATA(libtrace)->header.version_minor)!=4) { |
|---|
| 145 | trace_set_err(libtrace,TRACE_ERR_INIT_FAILED,"Unknown pcap tracefile version %d.%d\n", |
|---|
| 146 | swaps(libtrace, |
|---|
| 147 | DATA(libtrace)->header.version_major), |
|---|
| 148 | swaps(libtrace, |
|---|
| 149 | DATA(libtrace)->header.version_minor)); |
|---|
| 150 | return -1; |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | return 0; |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | static int pcapfile_start_output(libtrace_out_t *libtrace) |
|---|
| 159 | { |
|---|
| 160 | return 0; |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | static int pcapfile_config_input(libtrace_t *libtrace, |
|---|
| 164 | trace_option_t option, |
|---|
| 165 | void *data) |
|---|
| 166 | { |
|---|
| 167 | trace_set_err(libtrace,TRACE_ERR_UNKNOWN_OPTION, |
|---|
| 168 | "Unknown option %i", option); |
|---|
| 169 | return -1; |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | static int pcapfile_fin_input(libtrace_t *libtrace) |
|---|
| 173 | { |
|---|
| 174 | libtrace_io_close(DATA(libtrace)->file); |
|---|
| 175 | free(libtrace->format_data); |
|---|
| 176 | return 0; /* success */ |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | static int pcapfile_fin_output(libtrace_out_t *libtrace) |
|---|
| 180 | { |
|---|
| 181 | libtrace_io_close(DATA(libtrace)->file); |
|---|
| 182 | free(libtrace->format_data); |
|---|
| 183 | libtrace->format_data=NULL; |
|---|
| 184 | return 0; /* success */ |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | static int pcapfile_config_output(libtrace_out_t *libtrace, |
|---|
| 188 | trace_option_output_t option, |
|---|
| 189 | void *value) |
|---|
| 190 | { |
|---|
| 191 | switch (option) { |
|---|
| 192 | case TRACE_OPTION_OUTPUT_COMPRESS: |
|---|
| 193 | DATAOUT(libtrace)->level = *(int*)value; |
|---|
| 194 | return 0; |
|---|
| 195 | case TRACE_OPTION_OUTPUT_FILEFLAGS: |
|---|
| 196 | DATAOUT(libtrace)->flag = *(int*)value; |
|---|
| 197 | return 0; |
|---|
| 198 | default: |
|---|
| 199 | /* Unknown option */ |
|---|
| 200 | trace_set_err_out(libtrace,TRACE_ERR_UNKNOWN_OPTION, |
|---|
| 201 | "Unknown option"); |
|---|
| 202 | return -1; |
|---|
| 203 | } |
|---|
| 204 | return -1; |
|---|
| 205 | } |
|---|
| 206 | |
|---|
| 207 | static int pcapfile_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) |
|---|
| 208 | { |
|---|
| 209 | int err; |
|---|
| 210 | |
|---|
| 211 | assert(libtrace->format_data); |
|---|
| 212 | |
|---|
| 213 | packet->type = pcap_dlt_to_rt(swapl(libtrace, |
|---|
| 214 | DATA(libtrace)->header.network)); |
|---|
| 215 | |
|---|
| 216 | if (!packet->buffer || packet->buf_control == TRACE_CTRL_EXTERNAL) { |
|---|
| 217 | packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE); |
|---|
| 218 | packet->buf_control = TRACE_CTRL_PACKET; |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | err=libtrace_io_read(DATA(libtrace)->file, |
|---|
| 222 | packet->buffer, |
|---|
| 223 | sizeof(libtrace_pcapfile_pkt_hdr_t)); |
|---|
| 224 | |
|---|
| 225 | if (err<0) { |
|---|
| 226 | trace_set_err(libtrace,errno,"reading packet"); |
|---|
| 227 | return -1; |
|---|
| 228 | } |
|---|
| 229 | if (err==0) { |
|---|
| 230 | /* EOF */ |
|---|
| 231 | return 0; |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | packet->header = packet->buffer; |
|---|
| 235 | |
|---|
| 236 | |
|---|
| 237 | err=libtrace_io_read(DATA(libtrace)->file, |
|---|
| 238 | (char*)packet->buffer+sizeof(libtrace_pcapfile_pkt_hdr_t), |
|---|
| 239 | swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen) |
|---|
| 240 | ); |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | if (err<0) { |
|---|
| 244 | trace_set_err(libtrace,errno,"reading packet"); |
|---|
| 245 | return -1; |
|---|
| 246 | } |
|---|
| 247 | if (err==0) { |
|---|
| 248 | return 0; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | packet->payload = (char*)packet->buffer |
|---|
| 252 | + sizeof(libtrace_pcapfile_pkt_hdr_t); |
|---|
| 253 | |
|---|
| 254 | return sizeof(libtrace_pcapfile_pkt_hdr_t) |
|---|
| 255 | +swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen); |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | static int pcapfile_write_packet(libtrace_out_t *out, |
|---|
| 259 | libtrace_packet_t *packet) |
|---|
| 260 | { |
|---|
| 261 | struct libtrace_pcapfile_pkt_hdr_t hdr; |
|---|
| 262 | struct timeval tv = trace_get_timeval(packet); |
|---|
| 263 | int numbytes; |
|---|
| 264 | int ret; |
|---|
| 265 | |
|---|
| 266 | /* Now we know the link type write out a header if we've not done |
|---|
| 267 | * so already |
|---|
| 268 | */ |
|---|
| 269 | if (!DATAOUT(out)->file) { |
|---|
| 270 | struct pcapfile_header_t hdr; |
|---|
| 271 | |
|---|
| 272 | DATAOUT(out)->file=trace_open_file_out(out, |
|---|
| 273 | DATAOUT(out)->level, |
|---|
| 274 | DATAOUT(out)->flag); |
|---|
| 275 | if (!DATAOUT(out)->file) |
|---|
| 276 | return -1; |
|---|
| 277 | |
|---|
| 278 | hdr.magic_number = 0xa1b2c3d4; |
|---|
| 279 | hdr.version_major = 2; |
|---|
| 280 | hdr.version_minor = 4; |
|---|
| 281 | hdr.thiszone = 0; |
|---|
| 282 | hdr.sigfigs = 0; |
|---|
| 283 | hdr.snaplen = 65536; |
|---|
| 284 | hdr.network = |
|---|
| 285 | libtrace_to_pcap_dlt(trace_get_link_type(packet)); |
|---|
| 286 | |
|---|
| 287 | libtrace_io_write(DATAOUT(out)->file, &hdr, sizeof(hdr)); |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | hdr.ts_sec = tv.tv_sec; |
|---|
| 291 | hdr.ts_usec = tv.tv_usec; |
|---|
| 292 | hdr.caplen = trace_get_capture_length(packet); |
|---|
| 293 | /* PCAP doesn't include the FCS, we do */ |
|---|
| 294 | hdr.wirelen = trace_get_wire_length(packet)-4; |
|---|
| 295 | |
|---|
| 296 | numbytes=libtrace_io_write(DATAOUT(out)->file, |
|---|
| 297 | &hdr, sizeof(hdr)); |
|---|
| 298 | |
|---|
| 299 | if (numbytes!=sizeof(hdr)) |
|---|
| 300 | return -1; |
|---|
| 301 | |
|---|
| 302 | ret=libtrace_io_write(DATAOUT(out)->file, |
|---|
| 303 | trace_get_link(packet), |
|---|
| 304 | trace_get_capture_length(packet)); |
|---|
| 305 | |
|---|
| 306 | if (ret!=(int)trace_get_capture_length(packet)) |
|---|
| 307 | return -1; |
|---|
| 308 | |
|---|
| 309 | return numbytes+ret; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | static libtrace_linktype_t pcapfile_get_link_type( |
|---|
| 313 | const libtrace_packet_t *packet) |
|---|
| 314 | { |
|---|
| 315 | #if 0 |
|---|
| 316 | return pcap_dlt_to_libtrace( |
|---|
| 317 | swapl(packet->trace, |
|---|
| 318 | DATA(packet->trace)->header.network |
|---|
| 319 | ) |
|---|
| 320 | ); |
|---|
| 321 | #endif |
|---|
| 322 | return pcap_dlt_to_libtrace(rt_to_pcap_dlt(packet->type)); |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | static libtrace_direction_t pcapfile_get_direction(const libtrace_packet_t *packet) |
|---|
| 326 | { |
|---|
| 327 | libtrace_direction_t direction = -1; |
|---|
| 328 | switch(pcapfile_get_link_type(packet)) { |
|---|
| 329 | case TRACE_TYPE_LINUX_SLL: |
|---|
| 330 | { |
|---|
| 331 | libtrace_sll_header_t *sll; |
|---|
| 332 | sll = trace_get_link(packet); |
|---|
| 333 | if (!sll) { |
|---|
| 334 | trace_set_err(packet->trace, |
|---|
| 335 | TRACE_ERR_BAD_PACKET, |
|---|
| 336 | "Bad or missing packet"); |
|---|
| 337 | return -1; |
|---|
| 338 | } |
|---|
| 339 | /* 0 == LINUX_SLL_HOST */ |
|---|
| 340 | /* the Waikato Capture point defines "packets |
|---|
| 341 | * originating locally" (ie, outbound), with a |
|---|
| 342 | * direction of 0, and "packets destined locally" |
|---|
| 343 | * (ie, inbound), with a direction of 1. |
|---|
| 344 | * This is kind-of-opposite to LINUX_SLL. |
|---|
| 345 | * We return consistent values here, however |
|---|
| 346 | * |
|---|
| 347 | * Note that in recent versions of pcap, you can |
|---|
| 348 | * use "inbound" and "outbound" on ppp in linux |
|---|
| 349 | */ |
|---|
| 350 | if (ntohs(sll->pkttype == 0)) { |
|---|
| 351 | direction = TRACE_DIR_INCOMING; |
|---|
| 352 | } else { |
|---|
| 353 | direction = TRACE_DIR_OUTGOING; |
|---|
| 354 | } |
|---|
| 355 | break; |
|---|
| 356 | |
|---|
| 357 | } |
|---|
| 358 | case TRACE_TYPE_PFLOG: |
|---|
| 359 | { |
|---|
| 360 | libtrace_pflog_header_t *pflog; |
|---|
| 361 | pflog = trace_get_link(packet); |
|---|
| 362 | if (!pflog) { |
|---|
| 363 | trace_set_err(packet->trace, |
|---|
| 364 | TRACE_ERR_BAD_PACKET, |
|---|
| 365 | "Bad or missing packet"); |
|---|
| 366 | return -1; |
|---|
| 367 | } |
|---|
| 368 | /* enum { PF_IN=0, PF_OUT=1 }; */ |
|---|
| 369 | if (ntohs(pflog->dir==0)) { |
|---|
| 370 | |
|---|
| 371 | direction = TRACE_DIR_INCOMING; |
|---|
| 372 | } |
|---|
| 373 | else { |
|---|
| 374 | direction = TRACE_DIR_OUTGOING; |
|---|
| 375 | } |
|---|
| 376 | break; |
|---|
| 377 | } |
|---|
| 378 | default: |
|---|
| 379 | break; |
|---|
| 380 | } |
|---|
| 381 | return direction; |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | static struct timeval pcapfile_get_timeval( |
|---|
| 386 | const libtrace_packet_t *packet) |
|---|
| 387 | { |
|---|
| 388 | libtrace_pcapfile_pkt_hdr_t *hdr = |
|---|
| 389 | (libtrace_pcapfile_pkt_hdr_t*)packet->header; |
|---|
| 390 | struct timeval ts; |
|---|
| 391 | ts.tv_sec = swapl(packet->trace,hdr->ts_sec); |
|---|
| 392 | ts.tv_usec = swapl(packet->trace,hdr->ts_usec); |
|---|
| 393 | return ts; |
|---|
| 394 | } |
|---|
| 395 | |
|---|
| 396 | |
|---|
| 397 | static int pcapfile_get_capture_length(const libtrace_packet_t *packet) { |
|---|
| 398 | libtrace_pcapfile_pkt_hdr_t *pcapptr |
|---|
| 399 | = (libtrace_pcapfile_pkt_hdr_t *)packet->header; |
|---|
| 400 | |
|---|
| 401 | return swapl(packet->trace,pcapptr->caplen); |
|---|
| 402 | } |
|---|
| 403 | |
|---|
| 404 | static int pcapfile_get_wire_length(const libtrace_packet_t *packet) { |
|---|
| 405 | libtrace_pcapfile_pkt_hdr_t *pcapptr |
|---|
| 406 | = (libtrace_pcapfile_pkt_hdr_t *)packet->header; |
|---|
| 407 | if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB)) |
|---|
| 408 | /* Include the missing FCS */ |
|---|
| 409 | return swapl(packet->trace,pcapptr->wirelen)+4; |
|---|
| 410 | else |
|---|
| 411 | return swapl(packet->trace,pcapptr->wirelen); |
|---|
| 412 | } |
|---|
| 413 | |
|---|
| 414 | static int pcapfile_get_framing_length(const libtrace_packet_t *packet UNUSED) { |
|---|
| 415 | return sizeof(libtrace_pcapfile_pkt_hdr_t); |
|---|
| 416 | } |
|---|
| 417 | |
|---|
| 418 | static size_t pcapfile_set_capture_length(libtrace_packet_t *packet,size_t size) { |
|---|
| 419 | libtrace_pcapfile_pkt_hdr_t *pcapptr = 0; |
|---|
| 420 | assert(packet); |
|---|
| 421 | if (size > trace_get_capture_length(packet)) { |
|---|
| 422 | /* can't make a packet larger */ |
|---|
| 423 | return trace_get_capture_length(packet); |
|---|
| 424 | } |
|---|
| 425 | pcapptr = (libtrace_pcapfile_pkt_hdr_t *)packet->header; |
|---|
| 426 | pcapptr->caplen = swapl(packet->trace,size); |
|---|
| 427 | return trace_get_capture_length(packet); |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | static void pcapfile_help() { |
|---|
| 431 | printf("pcapfile format module: $Revision$\n"); |
|---|
| 432 | printf("Supported input URIs:\n"); |
|---|
| 433 | printf("\tpcapfile:/path/to/file\n"); |
|---|
| 434 | printf("\tpcapfile:/path/to/file.gz\n"); |
|---|
| 435 | printf("\n"); |
|---|
| 436 | printf("\te.g.: pcapfile:/tmp/trace.pcap\n"); |
|---|
| 437 | printf("\n"); |
|---|
| 438 | } |
|---|
| 439 | |
|---|
| 440 | static struct libtrace_format_t pcapfile = { |
|---|
| 441 | "pcapfile", |
|---|
| 442 | "$Id$", |
|---|
| 443 | TRACE_FORMAT_PCAPFILE, |
|---|
| 444 | pcapfile_init_input, /* init_input */ |
|---|
| 445 | pcapfile_config_input, /* config_input */ |
|---|
| 446 | pcapfile_start_input, /* start_input */ |
|---|
| 447 | NULL, /* pause_input */ |
|---|
| 448 | pcapfile_init_output, /* init_output */ |
|---|
| 449 | pcapfile_config_output, /* config_output */ |
|---|
| 450 | pcapfile_start_output, /* start_output */ |
|---|
| 451 | pcapfile_fin_input, /* fin_input */ |
|---|
| 452 | pcapfile_fin_output, /* fin_output */ |
|---|
| 453 | pcapfile_read_packet, /* read_packet */ |
|---|
| 454 | NULL, /* fin_packet */ |
|---|
| 455 | pcapfile_write_packet, /* write_packet */ |
|---|
| 456 | pcapfile_get_link_type, /* get_link_type */ |
|---|
| 457 | pcapfile_get_direction, /* get_direction */ |
|---|
| 458 | NULL, /* set_direction */ |
|---|
| 459 | NULL, /* get_erf_timestamp */ |
|---|
| 460 | pcapfile_get_timeval, /* get_timeval */ |
|---|
| 461 | NULL, /* get_seconds */ |
|---|
| 462 | NULL, /* seek_erf */ |
|---|
| 463 | NULL, /* seek_timeval */ |
|---|
| 464 | NULL, /* seek_seconds */ |
|---|
| 465 | pcapfile_get_capture_length, /* get_capture_length */ |
|---|
| 466 | pcapfile_get_wire_length, /* get_wire_length */ |
|---|
| 467 | pcapfile_get_framing_length, /* get_framing_length */ |
|---|
| 468 | pcapfile_set_capture_length, /* set_capture_length */ |
|---|
| 469 | NULL, /* get_fd */ |
|---|
| 470 | trace_event_trace, /* trace_event */ |
|---|
| 471 | pcapfile_help, /* help */ |
|---|
| 472 | NULL /* next pointer */ |
|---|
| 473 | }; |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | void pcapfile_constructor() { |
|---|
| 477 | register_format(&pcapfile); |
|---|
| 478 | } |
|---|
| 479 | |
|---|
| 480 | |
|---|