| [313] | 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 "libtrace.h" |
|---|
| [325] | 32 | #include "libtrace_int.h" |
|---|
| [333] | 33 | #include "format_helper.h" |
|---|
| [313] | 34 | #include "wag.h" |
|---|
| [336] | 35 | #include "config.h" |
|---|
| [313] | 36 | |
|---|
| 37 | #ifdef HAVE_INTTYPES_H |
|---|
| 38 | # include <inttypes.h> |
|---|
| 39 | #else |
|---|
| 40 | # error "Can't find inttypes.h - this needs to be fixed" |
|---|
| 41 | #endif |
|---|
| 42 | |
|---|
| 43 | #ifdef HAVE_STDDEF_H |
|---|
| 44 | # include <stddef.h> |
|---|
| 45 | #else |
|---|
| 46 | # error "Can't find stddef.h - do you define ptrdiff_t elsewhere?" |
|---|
| 47 | #endif |
|---|
| 48 | #include <sys/types.h> |
|---|
| [345] | 49 | #include <sys/time.h> |
|---|
| 50 | #include <time.h> |
|---|
| [313] | 51 | #include <sys/socket.h> |
|---|
| 52 | #include <sys/un.h> |
|---|
| 53 | #include <sys/mman.h> |
|---|
| 54 | #include <sys/stat.h> |
|---|
| 55 | #include <fcntl.h> |
|---|
| 56 | #include <unistd.h> |
|---|
| 57 | #include <assert.h> |
|---|
| 58 | #include <errno.h> |
|---|
| 59 | #include <netdb.h> |
|---|
| [372] | 60 | #include <stdio.h> |
|---|
| [313] | 61 | |
|---|
| [357] | 62 | #ifdef HAVE_LIMITS_H |
|---|
| 63 | # include <limits.h> |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | #ifdef HAVE_SYS_LIMITS_H |
|---|
| 67 | # include <sys/limits.h> |
|---|
| 68 | #endif |
|---|
| 69 | |
|---|
| [313] | 70 | #ifndef O_LARGEFILE |
|---|
| 71 | #define O_LARGEFILE 0 |
|---|
| 72 | #endif |
|---|
| [325] | 73 | |
|---|
| [354] | 74 | static struct libtrace_format_t *wag_ptr = 0; |
|---|
| 75 | |
|---|
| [333] | 76 | #define CONNINFO libtrace->format_data->conn_info |
|---|
| 77 | #define INPUT libtrace->format_data->input |
|---|
| [354] | 78 | #define OUTPUT libtrace->format_data->output |
|---|
| 79 | #define OPTIONS libtrace->format_data->options |
|---|
| 80 | |
|---|
| [325] | 81 | struct libtrace_format_data_t { |
|---|
| 82 | union { |
|---|
| 83 | /** Information about rtclients */ |
|---|
| 84 | struct { |
|---|
| 85 | char *hostname; |
|---|
| 86 | short port; |
|---|
| 87 | } rt; |
|---|
| 88 | char *path; /**< information for local sockets */ |
|---|
| 89 | } conn_info; |
|---|
| 90 | /** Information about the current state of the input device */ |
|---|
| 91 | union { |
|---|
| 92 | int fd; |
|---|
| 93 | #if HAVE_ZLIB |
|---|
| 94 | gzFile *file; |
|---|
| 95 | #else |
|---|
| 96 | FILE *file; |
|---|
| 97 | #endif |
|---|
| 98 | } input; |
|---|
| 99 | }; |
|---|
| 100 | |
|---|
| [354] | 101 | struct libtrace_format_data_out_t { |
|---|
| 102 | union { |
|---|
| 103 | char *path; |
|---|
| 104 | } conn_info; |
|---|
| 105 | union { |
|---|
| 106 | struct { |
|---|
| 107 | int level; |
|---|
| 108 | } zlib; |
|---|
| 109 | } options; |
|---|
| 110 | union { |
|---|
| 111 | int fd; |
|---|
| 112 | #if HAVE_ZLIB |
|---|
| 113 | gzFile *file; |
|---|
| 114 | #else |
|---|
| 115 | FILE *file; |
|---|
| 116 | #endif |
|---|
| 117 | } output; |
|---|
| 118 | }; |
|---|
| 119 | |
|---|
| [313] | 120 | static int wag_init_input(struct libtrace_t *libtrace) { |
|---|
| 121 | struct stat buf; |
|---|
| 122 | struct hostent *he; |
|---|
| 123 | struct sockaddr_in remote; |
|---|
| 124 | struct sockaddr_un unix_sock; |
|---|
| [325] | 125 | libtrace->format_data = (struct libtrace_format_data_t *) |
|---|
| 126 | calloc(1,sizeof(struct libtrace_format_data_t)); |
|---|
| [333] | 127 | CONNINFO.path = libtrace->uridata; |
|---|
| 128 | if (!strncmp(CONNINFO.path,"-",1)) { |
|---|
| 129 | libtrace->sourcetype = STDIN; |
|---|
| [313] | 130 | // STDIN |
|---|
| 131 | #if HAVE_ZLIB |
|---|
| [333] | 132 | INPUT.file = gzdopen(STDIN, "r"); |
|---|
| [313] | 133 | #else |
|---|
| [333] | 134 | INPUT.file = stdin; |
|---|
| [313] | 135 | #endif |
|---|
| 136 | |
|---|
| 137 | } else { |
|---|
| [333] | 138 | if (stat(CONNINFO.path,&buf) == -1 ) { |
|---|
| [313] | 139 | perror("stat"); |
|---|
| 140 | return 0; |
|---|
| 141 | } |
|---|
| 142 | if (S_ISSOCK(buf.st_mode)) { |
|---|
| [333] | 143 | libtrace->sourcetype = SOCKET; |
|---|
| [313] | 144 | // SOCKET |
|---|
| [333] | 145 | if ((INPUT.fd = socket( |
|---|
| [313] | 146 | AF_UNIX, SOCK_STREAM, 0)) == -1) { |
|---|
| 147 | perror("socket"); |
|---|
| 148 | return 0; |
|---|
| 149 | } |
|---|
| 150 | unix_sock.sun_family = AF_UNIX; |
|---|
| 151 | bzero(unix_sock.sun_path,108); |
|---|
| 152 | snprintf(unix_sock.sun_path, |
|---|
| 153 | 108,"%s" |
|---|
| [333] | 154 | ,CONNINFO.path); |
|---|
| [313] | 155 | |
|---|
| [333] | 156 | if (connect(INPUT.fd, |
|---|
| [313] | 157 | (struct sockaddr *)&unix_sock, |
|---|
| 158 | sizeof(struct sockaddr)) == -1) { |
|---|
| 159 | perror("connect (unix)"); |
|---|
| 160 | return 0; |
|---|
| 161 | } |
|---|
| 162 | } else { |
|---|
| 163 | // TRACE |
|---|
| [333] | 164 | libtrace->sourcetype = TRACE; |
|---|
| [313] | 165 | #if HAVE_ZLIB |
|---|
| 166 | // using gzdopen means we can set O_LARGEFILE |
|---|
| 167 | // ourselves. However, this way is messy and |
|---|
| 168 | // we lose any error checking on "open" |
|---|
| [333] | 169 | INPUT.file = |
|---|
| [313] | 170 | gzdopen(open( |
|---|
| [333] | 171 | CONNINFO.path, |
|---|
| [313] | 172 | O_LARGEFILE), "r"); |
|---|
| 173 | #else |
|---|
| [333] | 174 | INPUT.file = |
|---|
| [313] | 175 | fdopen(open( |
|---|
| [333] | 176 | CONNINFO.path, |
|---|
| [313] | 177 | O_LARGEFILE), "r"); |
|---|
| 178 | #endif |
|---|
| 179 | |
|---|
| 180 | } |
|---|
| 181 | } |
|---|
| [345] | 182 | return 1; |
|---|
| [313] | 183 | } |
|---|
| 184 | |
|---|
| [354] | 185 | static int wag_init_output(struct libtrace_out_t *libtrace) { |
|---|
| 186 | char *filemode = 0; |
|---|
| 187 | libtrace->format_data = (struct libtrace_format_data_out_t *) |
|---|
| 188 | calloc(1,sizeof(struct libtrace_format_data_out_t)); |
|---|
| 189 | |
|---|
| 190 | OPTIONS.zlib.level = 0; |
|---|
| 191 | asprintf(&filemode,"wb%d",OPTIONS.zlib.level); |
|---|
| 192 | if (!strncmp(libtrace->uridata,"-",1)) { |
|---|
| 193 | // STDOUT |
|---|
| 194 | #if HAVE_ZLIB |
|---|
| 195 | OUTPUT.file = gzdopen(dup(1), filemode); |
|---|
| 196 | #else |
|---|
| 197 | OUTPUT.file = stdout; |
|---|
| 198 | #endif |
|---|
| 199 | } else { |
|---|
| 200 | // TRACE |
|---|
| 201 | #if HAVE_ZLIB |
|---|
| 202 | OUTPUT.file = gzdopen(open( |
|---|
| 203 | libtrace->uridata, |
|---|
| 204 | O_CREAT | O_LARGEFILE | O_WRONLY, |
|---|
| 205 | S_IRUSR | S_IWUSR), filemode); |
|---|
| 206 | #else |
|---|
| 207 | OUTPUT.file = fdopen(open( |
|---|
| 208 | O_CREAT | O_LARGEFILE | O_WRONLY, |
|---|
| 209 | S_IRUSR | S_IWUSR), "w"); |
|---|
| 210 | #endif |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | return 1; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | static int wag_config_output(struct libtrace_out_t *libtrace, int argc, char *argv[]) { |
|---|
| 217 | #if HAVE_ZLIB |
|---|
| 218 | int opt; |
|---|
| 219 | int level = OPTIONS.zlib.level; |
|---|
| 220 | optind = 1; |
|---|
| 221 | while ((opt = getopt(argc, argv, "z:")) != EOF) { |
|---|
| 222 | switch (opt) { |
|---|
| 223 | case 'z': |
|---|
| 224 | level = atoi(optarg); |
|---|
| 225 | break; |
|---|
| 226 | default: |
|---|
| 227 | printf("Bad argument to wag: %s\n", opt); |
|---|
| 228 | return -1; |
|---|
| 229 | } |
|---|
| 230 | } |
|---|
| 231 | if (level != OPTIONS.zlib.level) { |
|---|
| 232 | if (level > 9 || level < 0) { |
|---|
| 233 | // retarded level choice |
|---|
| 234 | printf("Compression level must be between 0 and 9 inclusive - you selected %i \n", level); |
|---|
| 235 | } else { |
|---|
| 236 | OPTIONS.zlib.level = level; |
|---|
| 237 | return gzsetparams(OUTPUT.file, level, Z_DEFAULT_STRATEGY); |
|---|
| 238 | } |
|---|
| 239 | } |
|---|
| 240 | #endif |
|---|
| 241 | return 0; |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| [313] | 244 | static int wag_fin_input(struct libtrace_t *libtrace) { |
|---|
| 245 | #if HAVE_ZLIB |
|---|
| [333] | 246 | gzclose(INPUT.file); |
|---|
| [313] | 247 | #else |
|---|
| [333] | 248 | fclose(INPUT.file); |
|---|
| [313] | 249 | #endif |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| [354] | 252 | static int wag_fin_output(struct libtrace_out_t *libtrace) { |
|---|
| 253 | #if HAVE_ZLIB |
|---|
| 254 | gzclose(OUTPUT.file); |
|---|
| 255 | #else |
|---|
| 256 | fclose(OUTPUT.file); |
|---|
| 257 | #endif |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| [316] | 260 | static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) { |
|---|
| 261 | int numbytes; |
|---|
| 262 | static short lctr = 0; |
|---|
| 263 | int rlen; |
|---|
| 264 | assert(libtrace); |
|---|
| 265 | assert(len >= 0); |
|---|
| 266 | |
|---|
| 267 | if (buffer == 0) |
|---|
| 268 | buffer = malloc(len); |
|---|
| 269 | |
|---|
| 270 | while(1) { |
|---|
| 271 | switch(libtrace->sourcetype) { |
|---|
| 272 | case DEVICE: |
|---|
| [333] | 273 | if ((numbytes=read(INPUT.fd, |
|---|
| [316] | 274 | buffer, |
|---|
| 275 | len)) == -1) { |
|---|
| 276 | perror("read"); |
|---|
| 277 | return -1; |
|---|
| 278 | } |
|---|
| 279 | break; |
|---|
| 280 | default: |
|---|
| 281 | #if HAVE_ZLIB |
|---|
| [333] | 282 | if ((numbytes=gzread(INPUT.file, |
|---|
| [316] | 283 | buffer, |
|---|
| 284 | len)) == -1) { |
|---|
| 285 | perror("gzread"); |
|---|
| 286 | return -1; |
|---|
| 287 | } |
|---|
| 288 | #else |
|---|
| 289 | if ((numbytes=fread(buffer,len,1, |
|---|
| [333] | 290 | INPUT.file)) == 0 ) { |
|---|
| 291 | if(feof(INPUT.file)) { |
|---|
| [316] | 292 | return 0; |
|---|
| 293 | } |
|---|
| [333] | 294 | if(ferror(INPUT.file)) { |
|---|
| [316] | 295 | perror("fread"); |
|---|
| 296 | return -1; |
|---|
| 297 | } |
|---|
| 298 | return 0; |
|---|
| 299 | } |
|---|
| 300 | #endif |
|---|
| 301 | } |
|---|
| 302 | break; |
|---|
| 303 | } |
|---|
| 304 | return numbytes; |
|---|
| 305 | |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | |
|---|
| [313] | 309 | static int wag_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
|---|
| 310 | int numbytes; |
|---|
| 311 | int size; |
|---|
| 312 | char buf[RP_BUFSIZE]; |
|---|
| 313 | int read_required = 0; |
|---|
| 314 | struct wag_frame_hdr *waghdr = 0; |
|---|
| 315 | |
|---|
| 316 | void *buffer = 0; |
|---|
| 317 | |
|---|
| 318 | packet->trace = libtrace; |
|---|
| 319 | buffer = packet->buffer; |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | do { |
|---|
| [356] | 323 | if (tracefifo_out_available(libtrace->fifo) == 0 || read_required) { |
|---|
| [313] | 324 | if ((numbytes = wag_read(libtrace,buf,RP_BUFSIZE)) <= 0) { |
|---|
| 325 | return numbytes; |
|---|
| 326 | } |
|---|
| 327 | assert(libtrace->fifo); |
|---|
| [356] | 328 | tracefifo_write(libtrace->fifo,buf,numbytes); |
|---|
| [313] | 329 | read_required = 0; |
|---|
| 330 | } |
|---|
| 331 | // read in wag_frame_hdr |
|---|
| [356] | 332 | if ((numbytes = tracefifo_out_read(libtrace->fifo, |
|---|
| [313] | 333 | buffer, |
|---|
| 334 | sizeof(struct wag_frame_hdr))) |
|---|
| 335 | == 0 ) { |
|---|
| [356] | 336 | tracefifo_out_reset(libtrace->fifo); |
|---|
| [313] | 337 | read_required = 1; |
|---|
| 338 | continue; |
|---|
| 339 | } |
|---|
| [316] | 340 | |
|---|
| [313] | 341 | size = ntohs(((struct wag_frame_hdr *)buffer)->size); |
|---|
| 342 | |
|---|
| [316] | 343 | // wag isn't in network byte order yet |
|---|
| [345] | 344 | //size = htons(size); |
|---|
| [316] | 345 | //printf("%d %d\n",size,htons(size)); |
|---|
| 346 | |
|---|
| [313] | 347 | // read in full packet |
|---|
| [356] | 348 | if((numbytes = tracefifo_out_read(libtrace->fifo,buffer,size)) == 0) { |
|---|
| 349 | tracefifo_out_reset(libtrace->fifo); |
|---|
| [313] | 350 | read_required = 1; |
|---|
| 351 | continue; |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | // have the whole packet |
|---|
| [356] | 355 | tracefifo_out_update(libtrace->fifo,size); |
|---|
| 356 | tracefifo_ack_update(libtrace->fifo,size); |
|---|
| [313] | 357 | |
|---|
| [367] | 358 | packet->status = 0; |
|---|
| [313] | 359 | packet->size = numbytes; |
|---|
| 360 | return numbytes; |
|---|
| 361 | } while(1); |
|---|
| 362 | } |
|---|
| 363 | |
|---|
| [354] | 364 | static int wag_write_packet(struct libtrace_out_t *libtrace, struct libtrace_packet_t *packet) { |
|---|
| 365 | int numbytes =0 ; |
|---|
| 366 | if (packet->trace->format != wag_ptr) { |
|---|
| 367 | fprintf(stderr,"Cannot convert from wag to %s format yet\n", |
|---|
| 368 | packet->trace->format->name); |
|---|
| 369 | return -1; |
|---|
| 370 | } |
|---|
| 371 | #if HAVE_ZLIB |
|---|
| 372 | if ((numbytes = gzwrite(OUTPUT.file, packet->buffer, packet->size)) == 0) { |
|---|
| 373 | perror("gzwrite"); |
|---|
| 374 | return -1; |
|---|
| 375 | } |
|---|
| 376 | #else |
|---|
| 377 | if ((numbytes = write(OUTPUT.file, packet->buffer, packet->size)) == 0) { |
|---|
| 378 | perror("write"); |
|---|
| 379 | return -1; |
|---|
| 380 | } |
|---|
| 381 | #endif |
|---|
| 382 | return numbytes; |
|---|
| 383 | } |
|---|
| 384 | |
|---|
| [313] | 385 | static void *wag_get_link(const struct libtrace_packet_t *packet) { |
|---|
| 386 | struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; |
|---|
| 387 | void *payload = wagptr->data; |
|---|
| 388 | return (void*)payload; |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet) { |
|---|
| 392 | return TRACE_TYPE_80211; |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | static int8_t wag_get_direction(const struct libtrace_packet_t *packet) { |
|---|
| 396 | struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; |
|---|
| 397 | if (wagptr->hdr.type == 0) { |
|---|
| 398 | return wagptr->hdr.subtype; |
|---|
| 399 | } |
|---|
| 400 | return -1; |
|---|
| 401 | } |
|---|
| 402 | |
|---|
| 403 | static uint64_t wag_get_erf_timestamp(const struct libtrace_packet_t *packet) { |
|---|
| 404 | struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; |
|---|
| 405 | uint64_t timestamp = 0; |
|---|
| 406 | timestamp = wagptr->ts.subsecs; |
|---|
| [345] | 407 | //timestamp |= (uint64_t)wagptr->ts.secs<<32; |
|---|
| [313] | 408 | timestamp = ((timestamp%44000000)*(UINT_MAX/44000000)) |
|---|
| 409 | | ((timestamp/44000000)<<32); |
|---|
| 410 | return timestamp; |
|---|
| 411 | } |
|---|
| 412 | |
|---|
| 413 | static int wag_get_capture_length(const struct libtrace_packet_t *packet) { |
|---|
| 414 | struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; |
|---|
| [345] | 415 | //return (wagptr->hdr.size); |
|---|
| 416 | return ntohs(wagptr->hdr.size); |
|---|
| [313] | 417 | } |
|---|
| 418 | |
|---|
| 419 | static int wag_get_wire_length(const struct libtrace_packet_t *packet) { |
|---|
| 420 | struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; |
|---|
| [345] | 421 | //return (wagptr->hdr.size); |
|---|
| 422 | return ntohs(wagptr->hdr.size); |
|---|
| [313] | 423 | } |
|---|
| 424 | |
|---|
| [333] | 425 | static int wag_get_fd(const struct libtrace_packet_t *packet) { |
|---|
| 426 | return packet->trace->format_data->input.fd; |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | static struct libtrace_eventobj_t wag_event_trace(struct libtrace_t *trace, struct libtrace_packet_t *packet) { |
|---|
| 430 | switch(trace->sourcetype) { |
|---|
| 431 | case DEVICE: |
|---|
| 432 | return trace_event_device(trace,packet); |
|---|
| 433 | default: |
|---|
| 434 | return trace_event_trace(trace,packet); |
|---|
| 435 | } |
|---|
| 436 | } |
|---|
| [319] | 437 | static int wag_help() { |
|---|
| [324] | 438 | printf("wag format module: $Revision$\n"); |
|---|
| 439 | printf("Supported input URIs:\n"); |
|---|
| 440 | printf("\twag:/dev/wagn\n"); |
|---|
| 441 | printf("\twag:/path/to/trace.wag\n"); |
|---|
| 442 | printf("\twag:/path/to/trace.wag.gz\n"); |
|---|
| 443 | printf("\n"); |
|---|
| 444 | printf("\te.g.: wag:/dev/wag0\n"); |
|---|
| 445 | printf("\te.g.: wag:/tmp/trace.wag.gz\n"); |
|---|
| 446 | printf("\n"); |
|---|
| 447 | printf("Supported output URIs:\n"); |
|---|
| 448 | printf("\tnone\n"); |
|---|
| 449 | printf("\n"); |
|---|
| [319] | 450 | |
|---|
| 451 | } |
|---|
| 452 | |
|---|
| [325] | 453 | static struct libtrace_format_t wag = { |
|---|
| [313] | 454 | "wag", |
|---|
| 455 | "$Id$", |
|---|
| [355] | 456 | "wag", |
|---|
| [313] | 457 | wag_init_input, /* init_input */ |
|---|
| [354] | 458 | wag_init_output, /* init_output */ |
|---|
| 459 | wag_config_output, /* config_output */ |
|---|
| [313] | 460 | wag_fin_input, /* fin_input */ |
|---|
| [354] | 461 | wag_fin_output, /* fin_output */ |
|---|
| [313] | 462 | wag_read_packet, /* read_packet */ |
|---|
| [354] | 463 | wag_write_packet, /* write_packet */ |
|---|
| [313] | 464 | wag_get_link, /* get_link */ |
|---|
| 465 | wag_get_link_type, /* get_link_type */ |
|---|
| 466 | wag_get_direction, /* get_direction */ |
|---|
| 467 | NULL, /* set_direction */ |
|---|
| [345] | 468 | wag_get_erf_timestamp, /* get_erf_timestamp */ |
|---|
| [313] | 469 | NULL, /* get_timeval */ |
|---|
| 470 | NULL, /* get_seconds */ |
|---|
| 471 | wag_get_capture_length, /* get_capture_length */ |
|---|
| 472 | wag_get_wire_length, /* get_wire_length */ |
|---|
| [319] | 473 | NULL, /* set_capture_length */ |
|---|
| [333] | 474 | wag_get_fd, /* get_fd */ |
|---|
| 475 | wag_event_trace, /* trace_event */ |
|---|
| [319] | 476 | wag_help /* help */ |
|---|
| [313] | 477 | }; |
|---|
| 478 | |
|---|
| 479 | void __attribute__((constructor)) wag_constructor() { |
|---|
| [354] | 480 | wag_ptr = &wag; |
|---|
| 481 | register_format(wag_ptr); |
|---|
| [313] | 482 | } |
|---|