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 | #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 | #include <sys/types.h> |
---|
44 | #include <sys/stat.h> |
---|
45 | #include <unistd.h> |
---|
46 | #include <assert.h> |
---|
47 | #include <stdio.h> |
---|
48 | #include <stdlib.h> |
---|
49 | #include <string.h> |
---|
50 | #include <errno.h> |
---|
51 | |
---|
52 | #if HAVE_PCAP_BPF_H |
---|
53 | # include <pcap-bpf.h> |
---|
54 | #else |
---|
55 | # ifdef HAVE_NET_BPF_H |
---|
56 | # include <net/bpf.h> |
---|
57 | # endif |
---|
58 | #endif |
---|
59 | |
---|
60 | #if HAVE_PCAP_H |
---|
61 | # include <pcap.h> |
---|
62 | # ifdef HAVE_PCAP_INT_H |
---|
63 | # include <pcap-int.h> |
---|
64 | # endif |
---|
65 | #endif |
---|
66 | |
---|
67 | #if HAVE_PCAP |
---|
68 | static struct libtrace_format_t pcap; |
---|
69 | static struct libtrace_format_t pcapint; |
---|
70 | |
---|
71 | #define DATA(x) ((struct libtrace_format_data_t*)((x)->format_data)) |
---|
72 | |
---|
73 | #define INPUT libtrace->format_data->input |
---|
74 | #define OUTPUT libtrace->format_data->output |
---|
75 | struct libtrace_format_data_t { |
---|
76 | union { |
---|
77 | char *path; /**< information for local sockets */ |
---|
78 | char *interface; /**< intormation for reading of network |
---|
79 | interfaces */ |
---|
80 | } conn_info; |
---|
81 | /** Information about the current state of the input device */ |
---|
82 | union { |
---|
83 | pcap_t *pcap; |
---|
84 | } input; |
---|
85 | int snaplen; |
---|
86 | libtrace_filter_t *filter; |
---|
87 | int promisc; |
---|
88 | }; |
---|
89 | |
---|
90 | struct libtrace_format_data_out_t { |
---|
91 | union { |
---|
92 | char *path; |
---|
93 | char *interface; |
---|
94 | } conn_info; |
---|
95 | union { |
---|
96 | struct { |
---|
97 | pcap_t *pcap; |
---|
98 | pcap_dumper_t *dump; |
---|
99 | } trace; |
---|
100 | |
---|
101 | } output; |
---|
102 | }; |
---|
103 | |
---|
104 | static int pcap_init_input(struct libtrace_t *libtrace) { |
---|
105 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
106 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
107 | |
---|
108 | INPUT.pcap = NULL; |
---|
109 | DATA(libtrace)->filter = NULL; |
---|
110 | DATA(libtrace)->snaplen = 0; |
---|
111 | DATA(libtrace)->promisc = 0; |
---|
112 | |
---|
113 | return 1; |
---|
114 | } |
---|
115 | |
---|
116 | static int pcap_start_input(struct libtrace_t *libtrace) { |
---|
117 | char errbuf[PCAP_ERRBUF_SIZE]; |
---|
118 | if ((INPUT.pcap = |
---|
119 | pcap_open_offline(libtrace->uridata, |
---|
120 | errbuf)) == NULL) { |
---|
121 | trace_set_err(TRACE_ERR_INIT_FAILED,"%s", |
---|
122 | errbuf); |
---|
123 | return -1; |
---|
124 | } |
---|
125 | if (DATA(libtrace)->filter) { |
---|
126 | trace_bpf_compile(DATA(libtrace)->filter); |
---|
127 | if (pcap_setfilter(INPUT.pcap,&DATA(libtrace)->filter->filter) |
---|
128 | == -1) { |
---|
129 | trace_set_err(TRACE_ERR_INIT_FAILED,"%s", |
---|
130 | pcap_geterr(INPUT.pcap)); |
---|
131 | return -1; |
---|
132 | } |
---|
133 | } |
---|
134 | return 0; |
---|
135 | } |
---|
136 | |
---|
137 | static int pcap_config_input(libtrace_t *libtrace, |
---|
138 | trace_option_t option, |
---|
139 | void *data) |
---|
140 | { |
---|
141 | switch(option) { |
---|
142 | case TRACE_OPTION_FILTER: |
---|
143 | DATA(libtrace)->filter=data; |
---|
144 | return 0; |
---|
145 | case TRACE_OPTION_SNAPLEN: |
---|
146 | /* Snapping isn't supported directly, so fall thru |
---|
147 | * and let libtrace deal with it |
---|
148 | */ |
---|
149 | case TRACE_OPTION_PROMISC: |
---|
150 | /* can't do promisc on a trace! fall thru */ |
---|
151 | default: |
---|
152 | trace_set_err(TRACE_ERR_UNKNOWN_OPTION, |
---|
153 | "Unknown option %i", option); |
---|
154 | return -1; |
---|
155 | } |
---|
156 | assert(0); |
---|
157 | } |
---|
158 | |
---|
159 | static int pcap_pause_input(libtrace_t *libtrace) { |
---|
160 | pcap_close(INPUT.pcap); |
---|
161 | INPUT.pcap=NULL; |
---|
162 | } |
---|
163 | |
---|
164 | static int pcap_init_output(struct libtrace_out_t *libtrace) { |
---|
165 | libtrace->format_data = (struct libtrace_format_data_out_t *) |
---|
166 | malloc(sizeof(struct libtrace_format_data_out_t)); |
---|
167 | OUTPUT.trace.pcap = NULL; |
---|
168 | OUTPUT.trace.dump = NULL; |
---|
169 | return 0; |
---|
170 | } |
---|
171 | |
---|
172 | static int pcapint_init_input(struct libtrace_t *libtrace) { |
---|
173 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
174 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
175 | DATA(libtrace)->filter = NULL; |
---|
176 | DATA(libtrace)->snaplen = 0; |
---|
177 | DATA(libtrace)->promisc = 0; |
---|
178 | return 1; |
---|
179 | } |
---|
180 | |
---|
181 | static int pcapint_config_input(libtrace_t *libtrace, |
---|
182 | trace_option_t option, |
---|
183 | void *data) |
---|
184 | { |
---|
185 | switch(option) { |
---|
186 | case TRACE_OPTION_FILTER: |
---|
187 | DATA(libtrace)->filter=data; |
---|
188 | return 0; |
---|
189 | case TRACE_OPTION_SNAPLEN: |
---|
190 | DATA(libtrace)->snaplen=*(int*)data; |
---|
191 | return 0; |
---|
192 | case TRACE_OPTION_PROMISC: |
---|
193 | DATA(libtrace)->promisc=*(int*)data; |
---|
194 | return 0; |
---|
195 | default: |
---|
196 | trace_set_err(TRACE_ERR_UNKNOWN_OPTION, |
---|
197 | "Unknown option %i", option); |
---|
198 | return -1; |
---|
199 | } |
---|
200 | assert(0); |
---|
201 | } |
---|
202 | |
---|
203 | static int pcapint_start_input(libtrace_t *libtrace) { |
---|
204 | char errbuf[PCAP_ERRBUF_SIZE]; |
---|
205 | if ((INPUT.pcap = |
---|
206 | pcap_open_live(libtrace->uridata, |
---|
207 | DATA(libtrace)->snaplen, |
---|
208 | DATA(libtrace)->promisc, |
---|
209 | 1, |
---|
210 | errbuf)) == NULL) { |
---|
211 | trace_set_err(TRACE_ERR_INIT_FAILED,"%s",errbuf); |
---|
212 | /* Set a filter if one is defined */ |
---|
213 | if (DATA(libtrace)->filter) |
---|
214 | if (pcap_setfilter(INPUT.pcap,&DATA(libtrace)->filter->filter) |
---|
215 | == -1) { |
---|
216 | trace_set_err(TRACE_ERR_INIT_FAILED,"%s", |
---|
217 | pcap_geterr(INPUT.pcap)); |
---|
218 | return -1; |
---|
219 | } |
---|
220 | return 0; |
---|
221 | } |
---|
222 | return 1; |
---|
223 | } |
---|
224 | |
---|
225 | static int pcapint_init_output(struct libtrace_out_t *libtrace __attribute__((unused))) { |
---|
226 | trace_set_err(TRACE_ERR_NO_INIT_OUT,"Writing to a pcap interface not implemented yet"); |
---|
227 | return -1; |
---|
228 | } |
---|
229 | |
---|
230 | static int pcap_fin_input(struct libtrace_t *libtrace) { |
---|
231 | pcap_close(INPUT.pcap); |
---|
232 | free(libtrace->format_data); |
---|
233 | return 0; |
---|
234 | } |
---|
235 | |
---|
236 | static int pcap_fin_output(struct libtrace_out_t *libtrace) { |
---|
237 | pcap_dump_flush(OUTPUT.trace.dump); |
---|
238 | pcap_dump_close(OUTPUT.trace.dump); |
---|
239 | return 0; |
---|
240 | } |
---|
241 | |
---|
242 | static int pcapint_fin_output(struct libtrace_out_t *libtrace __attribute__((unused))) { |
---|
243 | return -1; |
---|
244 | } |
---|
245 | |
---|
246 | static void trace_pcap_handler(u_char *user, const struct pcap_pkthdr *pcaphdr, const u_char *pcappkt) { |
---|
247 | struct libtrace_packet_t *packet = (struct libtrace_packet_t *)user; |
---|
248 | int numbytes = 0; |
---|
249 | |
---|
250 | /* |
---|
251 | // pcap provides us with the right bits, in it's own buffers. |
---|
252 | // We hijack them. |
---|
253 | */ |
---|
254 | numbytes = pcaphdr->len; |
---|
255 | |
---|
256 | if (!packet->buffer || packet->buf_control==TRACE_CTRL_EXTERNAL) { |
---|
257 | /* We only need struct pcap_pkthdr, but we have no way |
---|
258 | * to say how much we malloc'd so that formats can determine |
---|
259 | * if they need to malloc more, so at the moment we just |
---|
260 | * malloc 64k |
---|
261 | */ |
---|
262 | packet->buf_control = TRACE_CTRL_PACKET; |
---|
263 | packet->buffer=malloc(65536); |
---|
264 | } |
---|
265 | memcpy(packet->buffer,pcaphdr,sizeof(struct pcap_pkthdr)); |
---|
266 | packet->header = packet->buffer; |
---|
267 | packet->payload = (void *)pcappkt; |
---|
268 | |
---|
269 | packet->size = numbytes + sizeof(struct pcap_pkthdr); |
---|
270 | |
---|
271 | assert(pcaphdr->caplen>=0 && pcaphdr->caplen<=65536); |
---|
272 | } |
---|
273 | |
---|
274 | static int pcap_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
275 | int pcapbytes = 0; |
---|
276 | |
---|
277 | pcapbytes = pcap_dispatch(INPUT.pcap, |
---|
278 | 1, /* number of packets */ |
---|
279 | &trace_pcap_handler, |
---|
280 | (u_char *)packet); |
---|
281 | |
---|
282 | if (pcapbytes <= 0) { |
---|
283 | return pcapbytes; |
---|
284 | } |
---|
285 | return (packet->size - sizeof(struct pcap_pkthdr)); |
---|
286 | } |
---|
287 | |
---|
288 | static int pcap_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) { |
---|
289 | struct pcap_pkthdr pcap_pkt_hdr; |
---|
290 | |
---|
291 | if (!OUTPUT.trace.pcap) { |
---|
292 | OUTPUT.trace.pcap = (pcap_t *)pcap_open_dead( |
---|
293 | libtrace_to_pcap_dlt(trace_get_link_type(packet)), |
---|
294 | 65536); |
---|
295 | OUTPUT.trace.dump = pcap_dump_open(OUTPUT.trace.pcap, |
---|
296 | libtrace->uridata); |
---|
297 | fflush((FILE *)OUTPUT.trace.dump); |
---|
298 | } |
---|
299 | if (packet->trace->format == &pcap || |
---|
300 | packet->trace->format == &pcapint) { |
---|
301 | |
---|
302 | pcap_dump((u_char*)OUTPUT.trace.dump,(struct pcap_pkthdr *)packet->header,packet->payload); |
---|
303 | } else { |
---|
304 | /* Leave the manual copy as it is, as it gets around |
---|
305 | * some OS's having different structures in pcap_pkt_hdr |
---|
306 | */ |
---|
307 | struct timeval ts = trace_get_timeval(packet); |
---|
308 | pcap_pkt_hdr.ts.tv_sec = ts.tv_sec; |
---|
309 | pcap_pkt_hdr.ts.tv_usec = ts.tv_usec; |
---|
310 | pcap_pkt_hdr.caplen = trace_get_capture_length(packet); |
---|
311 | pcap_pkt_hdr.len = trace_get_wire_length(packet); |
---|
312 | |
---|
313 | pcap_dump((u_char*)OUTPUT.trace.dump, &pcap_pkt_hdr, packet->payload); |
---|
314 | } |
---|
315 | return 0; |
---|
316 | } |
---|
317 | |
---|
318 | static int pcapint_write_packet(struct libtrace_out_t *libtrace __attribute__((unused)), const struct libtrace_packet_t *packet __attribute__((unused))) { |
---|
319 | |
---|
320 | assert(0); |
---|
321 | return 0; |
---|
322 | } |
---|
323 | |
---|
324 | static libtrace_linktype_t pcap_get_link_type(const struct libtrace_packet_t *packet) { |
---|
325 | struct pcap_pkthdr *pcapptr = 0; |
---|
326 | int linktype = 0; |
---|
327 | pcapptr = (struct pcap_pkthdr *)packet->header; |
---|
328 | linktype = pcap_datalink(packet->trace->format_data->input.pcap); |
---|
329 | return pcap_dlt_to_libtrace(linktype); |
---|
330 | } |
---|
331 | |
---|
332 | static int8_t pcap_get_direction(const struct libtrace_packet_t *packet) { |
---|
333 | int8_t direction = -1; |
---|
334 | switch(pcap_get_link_type(packet)) { |
---|
335 | case TRACE_TYPE_LINUX_SLL: |
---|
336 | { |
---|
337 | struct trace_sll_header_t *sll; |
---|
338 | sll = trace_get_link(packet); |
---|
339 | if (!sll) { |
---|
340 | trace_set_err(TRACE_ERR_BAD_PACKET, |
---|
341 | "Bad or missing packet"); |
---|
342 | return -1; |
---|
343 | } |
---|
344 | /* 0 == LINUX_SLL_HOST */ |
---|
345 | /* the Waikato Capture point defines "packets |
---|
346 | * originating locally" (ie, outbound), with a |
---|
347 | * direction of 0, and "packets destined locally" |
---|
348 | * (ie, inbound), with a direction of 1. |
---|
349 | * This is kind-of-opposite to LINUX_SLL. |
---|
350 | * We return consistent values here, however |
---|
351 | * |
---|
352 | * Note that in recent versions of pcap, you can |
---|
353 | * use "inbound" and "outbound" on ppp in linux |
---|
354 | */ |
---|
355 | if (ntohs(sll->pkttype == 0)) { |
---|
356 | direction = 1; |
---|
357 | } else { |
---|
358 | direction = 0; |
---|
359 | } |
---|
360 | break; |
---|
361 | |
---|
362 | } |
---|
363 | case TRACE_TYPE_PFLOG: |
---|
364 | { |
---|
365 | struct trace_pflog_header_t *pflog; |
---|
366 | pflog = trace_get_link(packet); |
---|
367 | if (!pflog) { |
---|
368 | trace_set_err(TRACE_ERR_BAD_PACKET, |
---|
369 | "Bad or missing packet"); |
---|
370 | return -1; |
---|
371 | } |
---|
372 | /* enum { PF_IN=0, PF_OUT=1 }; */ |
---|
373 | if (ntohs(pflog->dir==0)) { |
---|
374 | |
---|
375 | direction = 1; |
---|
376 | } |
---|
377 | else { |
---|
378 | direction = 0; |
---|
379 | } |
---|
380 | break; |
---|
381 | } |
---|
382 | default: |
---|
383 | break; |
---|
384 | } |
---|
385 | return direction; |
---|
386 | } |
---|
387 | |
---|
388 | |
---|
389 | static struct timeval pcap_get_timeval(const struct libtrace_packet_t *packet) { |
---|
390 | struct pcap_pkthdr *pcapptr = (struct pcap_pkthdr *)packet->header; |
---|
391 | struct timeval ts; |
---|
392 | ts.tv_sec = pcapptr->ts.tv_sec; |
---|
393 | ts.tv_usec = pcapptr->ts.tv_usec; |
---|
394 | return ts; |
---|
395 | } |
---|
396 | |
---|
397 | |
---|
398 | static int pcap_get_capture_length(const struct libtrace_packet_t *packet) { |
---|
399 | struct pcap_pkthdr *pcapptr = 0; |
---|
400 | pcapptr = (struct pcap_pkthdr *)packet->header; |
---|
401 | assert(pcapptr->caplen>=0 && pcapptr->caplen<=65536); |
---|
402 | return pcapptr->caplen; |
---|
403 | } |
---|
404 | |
---|
405 | static int pcap_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
406 | struct pcap_pkthdr *pcapptr = 0; |
---|
407 | pcapptr = (struct pcap_pkthdr *)packet->header; |
---|
408 | return ntohs(pcapptr->len); |
---|
409 | } |
---|
410 | |
---|
411 | static int pcap_get_framing_length(const struct libtrace_packet_t *packet UNUSED) { |
---|
412 | return sizeof(struct pcap_pkthdr); |
---|
413 | } |
---|
414 | |
---|
415 | static size_t pcap_set_capture_length(struct libtrace_packet_t *packet,size_t size) { |
---|
416 | struct pcap_pkthdr *pcapptr = 0; |
---|
417 | assert(packet); |
---|
418 | if ((size + sizeof(struct pcap_pkthdr)) > packet->size) { |
---|
419 | /* can't make a packet larger */ |
---|
420 | return (packet->size - sizeof(struct pcap_pkthdr)); |
---|
421 | } |
---|
422 | pcapptr = (struct pcap_pkthdr *)packet->header; |
---|
423 | pcapptr->caplen = size; |
---|
424 | packet->size = size + sizeof(struct pcap_pkthdr); |
---|
425 | return packet->size; |
---|
426 | } |
---|
427 | |
---|
428 | static int pcap_get_fd(const struct libtrace_packet_t *packet) { |
---|
429 | return pcap_fileno(packet->trace->format_data->input.pcap); |
---|
430 | } |
---|
431 | |
---|
432 | static void pcap_help() { |
---|
433 | printf("pcap format module: $Revision$\n"); |
---|
434 | printf("Supported input URIs:\n"); |
---|
435 | printf("\tpcap:/path/to/file\n"); |
---|
436 | printf("\n"); |
---|
437 | printf("\te.g.: pcap:/tmp/trace.pcap\n"); |
---|
438 | printf("\n"); |
---|
439 | printf("Supported output URIs:\n"); |
---|
440 | printf("\tnone\n"); |
---|
441 | printf("\n"); |
---|
442 | } |
---|
443 | |
---|
444 | static void pcapint_help() { |
---|
445 | printf("pcapint format module: $Revision$\n"); |
---|
446 | printf("Supported input URIs:\n"); |
---|
447 | printf("\tpcapint:interface\n"); |
---|
448 | printf("\n"); |
---|
449 | printf("\te.g.: pcapint:eth0\n"); |
---|
450 | printf("\n"); |
---|
451 | printf("Supported output URIs:\n"); |
---|
452 | printf("\tnone\n"); |
---|
453 | printf("\n"); |
---|
454 | } |
---|
455 | |
---|
456 | |
---|
457 | static struct libtrace_format_t pcap = { |
---|
458 | "pcap", |
---|
459 | "$Id$", |
---|
460 | TRACE_FORMAT_PCAP, |
---|
461 | pcap_init_input, /* init_input */ |
---|
462 | NULL, /* config_input */ |
---|
463 | pcap_start_input, /* start_input */ |
---|
464 | pcap_pause_input, /* pause_input */ |
---|
465 | pcap_init_output, /* init_output */ |
---|
466 | NULL, /* config_output */ |
---|
467 | NULL, /* start_output */ |
---|
468 | pcap_fin_input, /* fin_input */ |
---|
469 | pcap_fin_output, /* fin_output */ |
---|
470 | pcap_read_packet, /* read_packet */ |
---|
471 | pcap_write_packet, /* write_packet */ |
---|
472 | pcap_get_link_type, /* get_link_type */ |
---|
473 | pcap_get_direction, /* get_direction */ |
---|
474 | NULL, /* set_direction */ |
---|
475 | NULL, /* get_erf_timestamp */ |
---|
476 | pcap_get_timeval, /* get_timeval */ |
---|
477 | NULL, /* get_seconds */ |
---|
478 | NULL, /* seek_erf */ |
---|
479 | NULL, /* seek_timeval */ |
---|
480 | NULL, /* seek_seconds */ |
---|
481 | pcap_get_capture_length, /* get_capture_length */ |
---|
482 | pcap_get_wire_length, /* get_wire_length */ |
---|
483 | pcap_get_framing_length, /* get_framing_length */ |
---|
484 | pcap_set_capture_length, /* set_capture_length */ |
---|
485 | NULL, /* get_fd */ |
---|
486 | trace_event_trace, /* trace_event */ |
---|
487 | pcap_help /* help */ |
---|
488 | }; |
---|
489 | |
---|
490 | static struct libtrace_format_t pcapint = { |
---|
491 | "pcapint", |
---|
492 | "$Id$", |
---|
493 | TRACE_FORMAT_PCAP, |
---|
494 | pcapint_init_input, /* init_input */ |
---|
495 | pcapint_config_input, /* config_input */ |
---|
496 | pcapint_start_input, /* start_input */ |
---|
497 | pcap_pause_input, /* pause_input */ |
---|
498 | pcapint_init_output, /* init_output */ |
---|
499 | NULL, /* config_output */ |
---|
500 | NULL, /* start_output */ |
---|
501 | pcap_fin_input, /* fin_input */ |
---|
502 | pcapint_fin_output, /* fin_output */ |
---|
503 | pcap_read_packet, /* read_packet */ |
---|
504 | pcapint_write_packet, /* write_packet */ |
---|
505 | pcap_get_link_type, /* get_link_type */ |
---|
506 | pcap_get_direction, /* get_direction */ |
---|
507 | NULL, /* set_direction */ |
---|
508 | NULL, /* get_erf_timestamp */ |
---|
509 | pcap_get_timeval, /* get_timeval */ |
---|
510 | NULL, /* get_seconds */ |
---|
511 | NULL, /* seek_erf */ |
---|
512 | NULL, /* seek_timeval */ |
---|
513 | NULL, /* seek_seconds */ |
---|
514 | pcap_get_capture_length, /* get_capture_length */ |
---|
515 | pcap_get_wire_length, /* get_wire_length */ |
---|
516 | pcap_get_framing_length, /* get_framing_length */ |
---|
517 | pcap_set_capture_length, /* set_capture_length */ |
---|
518 | pcap_get_fd, /* get_fd */ |
---|
519 | trace_event_device, /* trace_event */ |
---|
520 | pcapint_help /* help */ |
---|
521 | }; |
---|
522 | |
---|
523 | void __attribute__((constructor)) pcap_constructor() { |
---|
524 | register_format(&pcap); |
---|
525 | register_format(&pcapint); |
---|
526 | } |
---|
527 | |
---|
528 | |
---|
529 | #endif |
---|