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 | #define _GNU_SOURCE |
---|
31 | |
---|
32 | #include "config.h" |
---|
33 | #include "common.h" |
---|
34 | #include "libtrace.h" |
---|
35 | #include "libtrace_int.h" |
---|
36 | #include "format_helper.h" |
---|
37 | #include "parse_cmd.h" |
---|
38 | |
---|
39 | #ifdef HAVE_INTTYPES_H |
---|
40 | # include <inttypes.h> |
---|
41 | #else |
---|
42 | # error "Can't find inttypes.h - this needs to be fixed" |
---|
43 | #endif |
---|
44 | |
---|
45 | #ifdef HAVE_STDDEF_H |
---|
46 | # include <stddef.h> |
---|
47 | #else |
---|
48 | # error "Can't find stddef.h - do you define ptrdiff_t elsewhere?" |
---|
49 | #endif |
---|
50 | #include <sys/types.h> |
---|
51 | #include <sys/socket.h> |
---|
52 | #include <sys/un.h> |
---|
53 | #include <sys/mman.h> |
---|
54 | #include <sys/stat.h> |
---|
55 | #include <unistd.h> |
---|
56 | #include <assert.h> |
---|
57 | #include <errno.h> |
---|
58 | #include <netdb.h> |
---|
59 | #include <fcntl.h> |
---|
60 | #include <getopt.h> |
---|
61 | #include <stdio.h> |
---|
62 | #include <string.h> |
---|
63 | #include <stdlib.h> |
---|
64 | |
---|
65 | #if HAVE_ZLIB |
---|
66 | # include <zlib.h> |
---|
67 | # define LIBTRACE_READ gzread |
---|
68 | # define LIBTRACE_FDOPEN gzdopen |
---|
69 | # define LIBTRACE_CLOSE gzclose |
---|
70 | # define LIBTRACE_WRITE gzwrite |
---|
71 | #else |
---|
72 | # define LIBTRACE_READ read |
---|
73 | # define LIBTRACE_FDOPEN open |
---|
74 | # define LIBTRACE_CLOSE close |
---|
75 | # define LIBTRACE_WRITE write |
---|
76 | #endif |
---|
77 | |
---|
78 | /* Catch undefined O_LARGEFILE on *BSD etc */ |
---|
79 | #ifndef O_LARGEFILE |
---|
80 | # define O_LARGEFILE 0 |
---|
81 | #endif |
---|
82 | |
---|
83 | static struct libtrace_format_t *erf_ptr = 0; |
---|
84 | static struct libtrace_format_t *rtclient_ptr = 0; |
---|
85 | #if HAVE_DAG |
---|
86 | static struct libtrace_format_t *dag_ptr = 0; |
---|
87 | #endif |
---|
88 | static struct libtrace_format_t *legacypos_ptr = 0; |
---|
89 | static struct libtrace_format_t *legacyeth_ptr = 0; |
---|
90 | static struct libtrace_format_t *legacyatm_ptr = 0; |
---|
91 | |
---|
92 | #define CONNINFO libtrace->format_data->conn_info |
---|
93 | #define INPUT libtrace->format_data->input |
---|
94 | #define OUTPUT libtrace->format_data->output |
---|
95 | #if HAVE_DAG |
---|
96 | #define DAG libtrace->format_data->dag |
---|
97 | #endif |
---|
98 | #define OPTIONS libtrace->format_data->options |
---|
99 | struct libtrace_format_data_t { |
---|
100 | union { |
---|
101 | struct { |
---|
102 | char *hostname; |
---|
103 | short port; |
---|
104 | } rt; |
---|
105 | char *path; |
---|
106 | } conn_info; |
---|
107 | |
---|
108 | union { |
---|
109 | int fd; |
---|
110 | #if HAVE_ZLIB |
---|
111 | gzFile *file; |
---|
112 | #else |
---|
113 | FILE *file; |
---|
114 | #endif |
---|
115 | } input; |
---|
116 | |
---|
117 | #if HAVE_DAG |
---|
118 | struct { |
---|
119 | void *buf; |
---|
120 | unsigned bottom; |
---|
121 | unsigned top; |
---|
122 | unsigned diff; |
---|
123 | unsigned curr; |
---|
124 | unsigned offset; |
---|
125 | } dag; |
---|
126 | #endif |
---|
127 | }; |
---|
128 | |
---|
129 | struct libtrace_format_data_out_t { |
---|
130 | union { |
---|
131 | struct { |
---|
132 | char *hostname; |
---|
133 | short port; |
---|
134 | } rt; |
---|
135 | char *path; |
---|
136 | } conn_info; |
---|
137 | |
---|
138 | union { |
---|
139 | struct { |
---|
140 | int level; |
---|
141 | } erf; |
---|
142 | |
---|
143 | } options; |
---|
144 | |
---|
145 | union { |
---|
146 | int fd; |
---|
147 | struct rtserver_t * rtserver; |
---|
148 | #if HAVE_ZLIB |
---|
149 | gzFile *file; |
---|
150 | #else |
---|
151 | FILE *file; |
---|
152 | #endif |
---|
153 | } output; |
---|
154 | }; |
---|
155 | |
---|
156 | #ifdef HAVE_DAG |
---|
157 | static int dag_init_input(struct libtrace_t *libtrace) { |
---|
158 | struct stat buf; |
---|
159 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
160 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
161 | |
---|
162 | CONNINFO.path = libtrace->uridata; |
---|
163 | if (stat(CONNINFO.path,&buf) == -1) { |
---|
164 | perror("stat"); |
---|
165 | return 0; |
---|
166 | } |
---|
167 | if (S_ISCHR(buf.st_mode)) { |
---|
168 | // DEVICE |
---|
169 | libtrace->sourcetype = DEVICE; |
---|
170 | if((INPUT.fd = dag_open(CONNINFO.path)) < 0) { |
---|
171 | fprintf(stderr,"Cannot open DAG %s: %m\n", |
---|
172 | CONNINFO.path,errno); |
---|
173 | exit(0); |
---|
174 | } |
---|
175 | if((DAG.buf = (void *)dag_mmap(INPUT.fd)) == MAP_FAILED) { |
---|
176 | fprintf(stderr,"Cannot mmap DAG %s: %m\n", |
---|
177 | CONNINFO.path,errno); |
---|
178 | exit(0); |
---|
179 | } |
---|
180 | if(dag_start(INPUT.fd) < 0) { |
---|
181 | fprintf(stderr,"Cannot start DAG %s: %m\n", |
---|
182 | CONNINFO.path,errno); |
---|
183 | exit(0); |
---|
184 | } |
---|
185 | } else { |
---|
186 | fprintf(stderr,"%s isn't a valid char device, exiting\n", |
---|
187 | CONNINFO.path); |
---|
188 | return 0; |
---|
189 | } |
---|
190 | return 1; |
---|
191 | } |
---|
192 | #endif |
---|
193 | |
---|
194 | /* Dag erf ether packets have a 2 byte padding before the packet |
---|
195 | * so that the ip header is aligned on a 32 bit boundary. |
---|
196 | */ |
---|
197 | static int erf_get_padding(const struct libtrace_packet_t *packet) |
---|
198 | { |
---|
199 | switch(trace_get_link_type(packet)) { |
---|
200 | case TRACE_TYPE_ETH: return 2; |
---|
201 | default: return 0; |
---|
202 | } |
---|
203 | } |
---|
204 | |
---|
205 | static int erf_get_erf_headersize(const struct libtrace_packet_t *packet) |
---|
206 | { |
---|
207 | return dag_record_size + erf_get_padding(packet); |
---|
208 | } |
---|
209 | |
---|
210 | |
---|
211 | static int erf_init_input(struct libtrace_t *libtrace) { |
---|
212 | struct stat buf; |
---|
213 | struct sockaddr_un unix_sock; |
---|
214 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
215 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
216 | |
---|
217 | CONNINFO.path = libtrace->uridata; |
---|
218 | if (!strncmp(CONNINFO.path,"-",1)) { |
---|
219 | // STDIN |
---|
220 | libtrace->sourcetype = STDIN; |
---|
221 | INPUT.file = LIBTRACE_FDOPEN(STDIN, "r"); |
---|
222 | |
---|
223 | } else { |
---|
224 | if (stat(CONNINFO.path,&buf) == -1 ) { |
---|
225 | perror("stat"); |
---|
226 | return 0; |
---|
227 | } |
---|
228 | if (S_ISSOCK(buf.st_mode)) { |
---|
229 | libtrace->sourcetype = SOCKET; |
---|
230 | if ((INPUT.fd = socket( |
---|
231 | AF_UNIX, SOCK_STREAM, 0)) == -1) { |
---|
232 | perror("socket"); |
---|
233 | return 0; |
---|
234 | } |
---|
235 | unix_sock.sun_family = AF_UNIX; |
---|
236 | bzero(unix_sock.sun_path,108); |
---|
237 | snprintf(unix_sock.sun_path, |
---|
238 | 108,"%s" |
---|
239 | ,CONNINFO.path); |
---|
240 | |
---|
241 | if (connect(INPUT.fd, |
---|
242 | (struct sockaddr *)&unix_sock, |
---|
243 | sizeof(struct sockaddr)) == -1) { |
---|
244 | perror("connect (unix)"); |
---|
245 | return 0; |
---|
246 | } |
---|
247 | } else { |
---|
248 | |
---|
249 | libtrace->sourcetype = TRACE; |
---|
250 | |
---|
251 | // we use an FDOPEN call to reopen an FD |
---|
252 | // returned from open(), so that we can set |
---|
253 | // O_LARGEFILE. This gets around gzopen not |
---|
254 | // letting you do this... |
---|
255 | INPUT.file = LIBTRACE_FDOPEN(open( |
---|
256 | CONNINFO.path, |
---|
257 | O_LARGEFILE),"r"); |
---|
258 | } |
---|
259 | } |
---|
260 | return 1; |
---|
261 | } |
---|
262 | |
---|
263 | static int rtclient_init_input(struct libtrace_t *libtrace) { |
---|
264 | char *scan; |
---|
265 | char *uridata = libtrace->uridata; |
---|
266 | struct hostent *he; |
---|
267 | struct sockaddr_in remote; |
---|
268 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
269 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
270 | |
---|
271 | libtrace->sourcetype = RT; |
---|
272 | |
---|
273 | if (strlen(uridata) == 0) { |
---|
274 | CONNINFO.rt.hostname = |
---|
275 | strdup("localhost"); |
---|
276 | CONNINFO.rt.port = |
---|
277 | COLLECTOR_PORT; |
---|
278 | } else { |
---|
279 | if ((scan = strchr(uridata,':')) == NULL) { |
---|
280 | CONNINFO.rt.hostname = |
---|
281 | strdup(uridata); |
---|
282 | CONNINFO.rt.port = |
---|
283 | COLLECTOR_PORT; |
---|
284 | } else { |
---|
285 | CONNINFO.rt.hostname = |
---|
286 | (char *)strndup(uridata, |
---|
287 | (scan - uridata)); |
---|
288 | CONNINFO.rt.port = |
---|
289 | atoi(++scan); |
---|
290 | } |
---|
291 | } |
---|
292 | |
---|
293 | if ((he=gethostbyname(CONNINFO.rt.hostname)) == NULL) { |
---|
294 | perror("gethostbyname"); |
---|
295 | return 0; |
---|
296 | } |
---|
297 | if ((INPUT.fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { |
---|
298 | perror("socket"); |
---|
299 | return 0; |
---|
300 | } |
---|
301 | |
---|
302 | remote.sin_family = AF_INET; |
---|
303 | remote.sin_port = htons(CONNINFO.rt.port); |
---|
304 | remote.sin_addr = *((struct in_addr *)he->h_addr); |
---|
305 | bzero(&(remote.sin_zero), 8); |
---|
306 | |
---|
307 | if (connect(INPUT.fd, (struct sockaddr *)&remote, |
---|
308 | sizeof(struct sockaddr)) == -1) { |
---|
309 | perror("connect (inet)"); |
---|
310 | return 0; |
---|
311 | } |
---|
312 | return 1; |
---|
313 | } |
---|
314 | |
---|
315 | static int erf_init_output(struct libtrace_out_t *libtrace) { |
---|
316 | char *filemode = 0; |
---|
317 | int fd; |
---|
318 | libtrace->format_data = (struct libtrace_format_data_out_t *) |
---|
319 | calloc(1,sizeof(struct libtrace_format_data_out_t)); |
---|
320 | |
---|
321 | OPTIONS.erf.level = 0; |
---|
322 | #if HAVE_ZLIB |
---|
323 | asprintf(&filemode,"wb%d",OPTIONS.erf.level); |
---|
324 | #else |
---|
325 | asprintf(&filemode,"w"); |
---|
326 | #endif |
---|
327 | |
---|
328 | if (!strncmp(libtrace->uridata,"-",1)) { |
---|
329 | // STDOUT |
---|
330 | OUTPUT.file = LIBTRACE_FDOPEN(dup(1),filemode); |
---|
331 | } |
---|
332 | else { |
---|
333 | // TRACE |
---|
334 | fd = open(libtrace->uridata, O_CREAT | O_LARGEFILE | O_WRONLY, S_IRUSR | S_IWUSR); |
---|
335 | if (fd <= 0) { |
---|
336 | return 0; |
---|
337 | } |
---|
338 | OUTPUT.file = LIBTRACE_FDOPEN(fd,filemode); |
---|
339 | |
---|
340 | } |
---|
341 | free(filemode); |
---|
342 | return 1; |
---|
343 | } |
---|
344 | |
---|
345 | static int erf_config_output(struct libtrace_out_t *libtrace, int argc, char *argv[]) { |
---|
346 | #if HAVE_ZLIB |
---|
347 | int opt; |
---|
348 | int level = OPTIONS.erf.level; |
---|
349 | optind = 1; |
---|
350 | |
---|
351 | |
---|
352 | while ((opt = getopt(argc, argv, "z:")) != EOF) { |
---|
353 | switch (opt) { |
---|
354 | case 'z': |
---|
355 | level = atoi(optarg); |
---|
356 | break; |
---|
357 | default: |
---|
358 | printf("Bad argument to erf: %s\n", optarg); |
---|
359 | // maybe spit out some help here |
---|
360 | return -1; |
---|
361 | } |
---|
362 | } |
---|
363 | if (level != OPTIONS.erf.level) { |
---|
364 | if (level > 9 || level < 0) { |
---|
365 | // retarded level choice |
---|
366 | printf("Compression level must be between 0 and 9 inclusive - you selected %i \n", level); |
---|
367 | |
---|
368 | } else { |
---|
369 | OPTIONS.erf.level = level; |
---|
370 | return gzsetparams(OUTPUT.file, level, Z_DEFAULT_STRATEGY); |
---|
371 | } |
---|
372 | } |
---|
373 | #endif |
---|
374 | return 0; |
---|
375 | |
---|
376 | } |
---|
377 | |
---|
378 | |
---|
379 | #ifdef HAVE_DAG |
---|
380 | static int dag_fin_input(struct libtrace_t *libtrace) { |
---|
381 | dag_stop(INPUT.fd); |
---|
382 | } |
---|
383 | #endif |
---|
384 | |
---|
385 | static int erf_fin_input(struct libtrace_t *libtrace) { |
---|
386 | LIBTRACE_CLOSE(INPUT.file); |
---|
387 | free(libtrace->format_data); |
---|
388 | return 0; |
---|
389 | } |
---|
390 | |
---|
391 | static int rtclient_fin_input(struct libtrace_t *libtrace) { |
---|
392 | close(INPUT.fd); |
---|
393 | return 0; |
---|
394 | } |
---|
395 | |
---|
396 | static int erf_fin_output(struct libtrace_out_t *libtrace) { |
---|
397 | LIBTRACE_CLOSE(OUTPUT.file); |
---|
398 | free(libtrace->format_data); |
---|
399 | |
---|
400 | return 0; |
---|
401 | } |
---|
402 | |
---|
403 | |
---|
404 | |
---|
405 | #if HAVE_DAG |
---|
406 | static int dag_read(struct libtrace_t *libtrace, void *buffer, size_t len) { |
---|
407 | int numbytes; |
---|
408 | static short lctr = 0; |
---|
409 | struct dag_record_t *erfptr = 0; |
---|
410 | int rlen; |
---|
411 | |
---|
412 | if (buffer == 0) |
---|
413 | buffer = malloc(len); |
---|
414 | |
---|
415 | DAG.bottom = DAG.top; |
---|
416 | DAG.top = dag_offset( |
---|
417 | INPUT.fd, |
---|
418 | &(DAG.bottom), |
---|
419 | 0); |
---|
420 | DAG.diff = DAG.top - |
---|
421 | DAG.bottom; |
---|
422 | |
---|
423 | numbytes=DAG.diff; |
---|
424 | DAG.offset = 0; |
---|
425 | return numbytes; |
---|
426 | } |
---|
427 | #endif |
---|
428 | |
---|
429 | #if HAVE_DAG |
---|
430 | static int dag_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
431 | int numbytes; |
---|
432 | int size; |
---|
433 | char buf[RP_BUFSIZE]; |
---|
434 | dag_record_t *erfptr; |
---|
435 | void *buffer = packet->buffer; |
---|
436 | void *buffer2 = buffer; |
---|
437 | int rlen; |
---|
438 | |
---|
439 | if (DAG.diff == 0) { |
---|
440 | if ((numbytes = dag_read(libtrace,buf,RP_BUFSIZE)) <= 0) |
---|
441 | return numbytes; |
---|
442 | } |
---|
443 | |
---|
444 | //DAG always gives us whole packets |
---|
445 | erfptr = (dag_record_t *) ((void *)DAG.buf + |
---|
446 | (DAG.bottom + DAG.offset)); |
---|
447 | size = ntohs(erfptr->rlen); |
---|
448 | |
---|
449 | if ( size > LIBTRACE_PACKET_BUFSIZE) { |
---|
450 | assert( size < LIBTRACE_PACKET_BUFSIZE); |
---|
451 | } |
---|
452 | |
---|
453 | // have to copy it out of the memory hole at this stage: |
---|
454 | memcpy(packet->buffer, erfptr, size); |
---|
455 | |
---|
456 | packet->status = 0; |
---|
457 | packet->size = size; |
---|
458 | DAG.offset += size; |
---|
459 | DAG.diff -= size; |
---|
460 | |
---|
461 | assert(DAG.diff >= 0); |
---|
462 | |
---|
463 | return (size); |
---|
464 | } |
---|
465 | #endif |
---|
466 | |
---|
467 | static int legacy_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
468 | int numbytes; |
---|
469 | int size; |
---|
470 | void *buffer = packet->buffer; |
---|
471 | void *buffer2 = buffer; |
---|
472 | dag_record_t *erfptr = (dag_record_t *)buffer; |
---|
473 | int rlen; |
---|
474 | |
---|
475 | if ((numbytes=LIBTRACE_READ(INPUT.file, |
---|
476 | buffer, |
---|
477 | dag_record_size)) == -1) { |
---|
478 | perror("libtrace_read"); |
---|
479 | return -1; |
---|
480 | } |
---|
481 | if (numbytes == 0) { |
---|
482 | return 0; |
---|
483 | } |
---|
484 | |
---|
485 | // legacy - 64byte captures |
---|
486 | // type is TYPE_LEGACY |
---|
487 | rlen = 64; |
---|
488 | size = rlen - dag_record_size; |
---|
489 | buffer2 = buffer + dag_record_size; |
---|
490 | |
---|
491 | if ((numbytes=LIBTRACE_READ(INPUT.file, |
---|
492 | buffer2, |
---|
493 | size)) == -1) { |
---|
494 | perror("libtrace_read"); |
---|
495 | return -1; |
---|
496 | } |
---|
497 | packet->status = 0; |
---|
498 | packet->size = rlen; |
---|
499 | return rlen; |
---|
500 | } |
---|
501 | static int erf_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
502 | int numbytes; |
---|
503 | int size; |
---|
504 | void *buffer = packet->buffer; |
---|
505 | void *buffer2 = buffer; |
---|
506 | int rlen; |
---|
507 | if ((numbytes=LIBTRACE_READ(INPUT.file, |
---|
508 | buffer, |
---|
509 | dag_record_size)) == -1) { |
---|
510 | perror("libtrace_read"); |
---|
511 | return -1; |
---|
512 | } |
---|
513 | if (numbytes == 0) { |
---|
514 | return 0; |
---|
515 | } |
---|
516 | rlen = ntohs(((dag_record_t *)buffer)->rlen); |
---|
517 | buffer2 = buffer + dag_record_size; |
---|
518 | size = rlen - dag_record_size; |
---|
519 | assert(size < LIBTRACE_PACKET_BUFSIZE); |
---|
520 | /* If your trace is legacy, or corrupt, then this assert may fire. */ |
---|
521 | assert(ntohs(((dag_record_t *)buffer)->rlen) <= |
---|
522 | ntohs(((dag_record_t*)buffer)->wlen)+erf_get_erf_headersize(packet)); |
---|
523 | /* If it's an unknown type, your trace is legacy */ |
---|
524 | assert(((dag_record_t *)buffer)->type != 0); |
---|
525 | /* Unknown/corrupt */ |
---|
526 | assert(((dag_record_t *)buffer)->type < 10); |
---|
527 | |
---|
528 | // read in the rest of the packet |
---|
529 | if ((numbytes=LIBTRACE_READ(INPUT.file, |
---|
530 | buffer2, |
---|
531 | size)) != size) { |
---|
532 | perror("libtrace_read"); |
---|
533 | return -1; |
---|
534 | } |
---|
535 | packet->status = 0; |
---|
536 | packet->size = rlen; |
---|
537 | return rlen; |
---|
538 | } |
---|
539 | |
---|
540 | static int rtclient_read(struct libtrace_t *libtrace, void *buffer, size_t len) { |
---|
541 | int numbytes; |
---|
542 | |
---|
543 | if (buffer == 0) |
---|
544 | buffer = malloc(len); |
---|
545 | while(1) { |
---|
546 | #ifndef MSG_NOSIGNAL |
---|
547 | # define MSG_NOSIGNAL 0 |
---|
548 | #endif |
---|
549 | if ((numbytes = recv(INPUT.fd, |
---|
550 | buffer, |
---|
551 | len, |
---|
552 | MSG_NOSIGNAL)) == -1) { |
---|
553 | if (errno == EINTR) { |
---|
554 | //ignore EINTR in case |
---|
555 | // a caller is using signals |
---|
556 | continue; |
---|
557 | } |
---|
558 | perror("recv"); |
---|
559 | return -1; |
---|
560 | } |
---|
561 | break; |
---|
562 | |
---|
563 | } |
---|
564 | return numbytes; |
---|
565 | } |
---|
566 | |
---|
567 | static int rtclient_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
568 | int numbytes = 0; |
---|
569 | int size = 0; |
---|
570 | char buf[RP_BUFSIZE]; |
---|
571 | int read_required = 0; |
---|
572 | |
---|
573 | void *buffer = 0; |
---|
574 | |
---|
575 | packet->trace = libtrace; |
---|
576 | buffer = packet->buffer; |
---|
577 | |
---|
578 | do { |
---|
579 | if (tracefifo_out_available(libtrace->fifo) == 0 || read_required) { |
---|
580 | if ((numbytes = rtclient_read( |
---|
581 | libtrace,buf,RP_BUFSIZE))<=0) { |
---|
582 | return numbytes; |
---|
583 | } |
---|
584 | tracefifo_write(libtrace->fifo,buf,numbytes); |
---|
585 | read_required = 0; |
---|
586 | } |
---|
587 | // Read status byte |
---|
588 | if (tracefifo_out_read(libtrace->fifo, |
---|
589 | &packet->status, sizeof(int)) == 0) { |
---|
590 | read_required = 1; |
---|
591 | continue; |
---|
592 | } |
---|
593 | tracefifo_out_update(libtrace->fifo,sizeof(int)); |
---|
594 | |
---|
595 | // read in the ERF header |
---|
596 | if ((numbytes = tracefifo_out_read(libtrace->fifo, buffer, |
---|
597 | dag_record_size)) == 0) { |
---|
598 | tracefifo_out_reset(libtrace->fifo); |
---|
599 | read_required = 1; |
---|
600 | continue; |
---|
601 | } |
---|
602 | size = ntohs(((dag_record_t *)buffer)->rlen); |
---|
603 | |
---|
604 | // read in the full packet |
---|
605 | if ((numbytes = tracefifo_out_read(libtrace->fifo, |
---|
606 | buffer, size)) == 0) { |
---|
607 | tracefifo_out_reset(libtrace->fifo); |
---|
608 | read_required = 1; |
---|
609 | continue; |
---|
610 | } |
---|
611 | |
---|
612 | // got in our whole packet, so... |
---|
613 | tracefifo_out_update(libtrace->fifo,size); |
---|
614 | |
---|
615 | tracefifo_ack_update(libtrace->fifo,size + sizeof(int)); |
---|
616 | |
---|
617 | packet->size = numbytes; |
---|
618 | return numbytes; |
---|
619 | } while(1); |
---|
620 | } |
---|
621 | |
---|
622 | static int erf_dump_packet(struct libtrace_out_t *libtrace, dag_record_t *erfptr, int pad, void *buffer, size_t size) { |
---|
623 | int numbytes = 0; |
---|
624 | if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, erfptr, dag_record_size + pad)) == 0) { |
---|
625 | perror("libtrace_write"); |
---|
626 | return -1; |
---|
627 | } |
---|
628 | if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, buffer, size)) == 0) { |
---|
629 | perror("libtrace_write"); |
---|
630 | return -1; |
---|
631 | } |
---|
632 | return numbytes + pad + dag_record_size; |
---|
633 | } |
---|
634 | |
---|
635 | static int erf_write_packet(struct libtrace_out_t *libtrace, struct libtrace_packet_t *packet) { |
---|
636 | int numbytes = 0; |
---|
637 | dag_record_t erfhdr; |
---|
638 | int pad = 0; |
---|
639 | void *payload = (void *)trace_get_link(packet); |
---|
640 | |
---|
641 | pad = erf_get_padding(packet); |
---|
642 | if (packet->trace->format == erf_ptr || |
---|
643 | #if HAVE_DAG |
---|
644 | packet->trace->format == dag_ptr || |
---|
645 | #endif |
---|
646 | packet->trace->format == rtclient_ptr ) { |
---|
647 | numbytes = erf_dump_packet(libtrace, |
---|
648 | (dag_record_t *)packet->buffer, |
---|
649 | pad, |
---|
650 | payload, |
---|
651 | packet->size - |
---|
652 | (dag_record_size + pad)); |
---|
653 | } else { |
---|
654 | // convert format - build up a new erf header |
---|
655 | // Timestamp |
---|
656 | erfhdr.ts = trace_get_erf_timestamp(packet); |
---|
657 | // Flags. Can't do this |
---|
658 | memset(&erfhdr.flags,1,1); |
---|
659 | // Packet length (rlen includes format overhead) |
---|
660 | erfhdr.rlen = trace_get_capture_length(packet) + erf_get_erf_headersize(packet); |
---|
661 | // loss counter. Can't do this |
---|
662 | erfhdr.lctr = 0; |
---|
663 | // Wire length |
---|
664 | erfhdr.wlen = trace_get_wire_length(packet); |
---|
665 | |
---|
666 | // Write it out |
---|
667 | numbytes = erf_dump_packet(libtrace, |
---|
668 | &erfhdr, |
---|
669 | pad, |
---|
670 | payload, |
---|
671 | erfhdr.rlen); |
---|
672 | } |
---|
673 | return numbytes; |
---|
674 | } |
---|
675 | |
---|
676 | |
---|
677 | static void *legacy_get_link(const struct libtrace_packet_t *packet) { |
---|
678 | return (void *)packet->buffer; |
---|
679 | } |
---|
680 | |
---|
681 | static libtrace_linktype_t legacy_get_link_type(const struct libtrace_packet_t *packet) { |
---|
682 | return TRACE_TYPE_LEGACY; |
---|
683 | } |
---|
684 | |
---|
685 | static libtrace_linktype_t legacyeth_get_link_type(const struct libtrace_packet_t *packet) { |
---|
686 | return TRACE_TYPE_LEGACY_ETH; |
---|
687 | } |
---|
688 | |
---|
689 | static libtrace_linktype_t legacyatm_get_link_type(const struct libtrace_packet_t *packet) { |
---|
690 | return TRACE_TYPE_LEGACY_ATM; |
---|
691 | } |
---|
692 | |
---|
693 | static libtrace_linktype_t legacypos_get_link_type(const struct libtrace_packet_t *packet) { |
---|
694 | return TRACE_TYPE_LEGACY_POS; |
---|
695 | } |
---|
696 | |
---|
697 | static void *erf_get_link(const struct libtrace_packet_t *packet) { |
---|
698 | const void *ethptr = 0; |
---|
699 | dag_record_t *erfptr = 0; |
---|
700 | erfptr = (dag_record_t *)packet->buffer; |
---|
701 | |
---|
702 | if (erfptr->flags.rxerror == 1) { |
---|
703 | return NULL; |
---|
704 | } |
---|
705 | ethptr = ((uint8_t *)packet->buffer + |
---|
706 | erf_get_erf_headersize(packet)); |
---|
707 | return (void *)ethptr; |
---|
708 | } |
---|
709 | |
---|
710 | static libtrace_linktype_t erf_get_link_type(const struct libtrace_packet_t *packet) { |
---|
711 | dag_record_t *erfptr = 0; |
---|
712 | erfptr = (dag_record_t *)packet->buffer; |
---|
713 | switch (erfptr->type) { |
---|
714 | case TYPE_ETH: return TRACE_TYPE_ETH; |
---|
715 | case TYPE_ATM: return TRACE_TYPE_ATM; |
---|
716 | default: assert(0); |
---|
717 | } |
---|
718 | return erfptr->type; |
---|
719 | } |
---|
720 | |
---|
721 | static int8_t erf_get_direction(const struct libtrace_packet_t *packet) { |
---|
722 | dag_record_t *erfptr = 0; |
---|
723 | erfptr = (dag_record_t *)packet->buffer; |
---|
724 | return erfptr->flags.iface; |
---|
725 | } |
---|
726 | |
---|
727 | static int8_t erf_set_direction(const struct libtrace_packet_t *packet, int8_t direction) { |
---|
728 | dag_record_t *erfptr = 0; |
---|
729 | erfptr = (dag_record_t *)packet->buffer; |
---|
730 | erfptr->flags.iface = direction; |
---|
731 | return erfptr->flags.iface; |
---|
732 | } |
---|
733 | |
---|
734 | static uint64_t erf_get_erf_timestamp(const struct libtrace_packet_t *packet) { |
---|
735 | dag_record_t *erfptr = 0; |
---|
736 | erfptr = (dag_record_t *)packet->buffer; |
---|
737 | return erfptr->ts; |
---|
738 | } |
---|
739 | |
---|
740 | static int legacy_get_capture_length(const struct libtrace_packet_t *packet __attribute__((unused))) { |
---|
741 | return 64; |
---|
742 | } |
---|
743 | |
---|
744 | static int legacypos_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
745 | legacy_pos_t *lpos = (legacy_pos_t *)packet->buffer; |
---|
746 | return ntohs(lpos->wlen); |
---|
747 | } |
---|
748 | |
---|
749 | static int legacyatm_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
750 | return 53; |
---|
751 | } |
---|
752 | |
---|
753 | static int legacyeth_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
754 | legacy_ether_t *leth = (legacy_ether_t *)packet->buffer; |
---|
755 | return ntohs(leth->wlen); |
---|
756 | } |
---|
757 | static int erf_get_capture_length(const struct libtrace_packet_t *packet) { |
---|
758 | dag_record_t *erfptr = 0; |
---|
759 | erfptr = (dag_record_t *)packet->buffer; |
---|
760 | return (ntohs(erfptr->rlen) - erf_get_erf_headersize(packet)); |
---|
761 | } |
---|
762 | |
---|
763 | static int erf_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
764 | dag_record_t *erfptr = 0; |
---|
765 | erfptr = (dag_record_t *)packet->buffer; |
---|
766 | return ntohs(erfptr->wlen); |
---|
767 | } |
---|
768 | |
---|
769 | static size_t erf_set_capture_length(struct libtrace_packet_t *packet, size_t size) { |
---|
770 | dag_record_t *erfptr = 0; |
---|
771 | assert(packet); |
---|
772 | if((size + erf_get_erf_headersize(packet)) > packet->size) { |
---|
773 | // can't make a packet larger |
---|
774 | return (packet->size - erf_get_erf_headersize(packet)); |
---|
775 | } |
---|
776 | erfptr = (dag_record_t *)packet->buffer; |
---|
777 | erfptr->rlen = htons(size + erf_get_erf_headersize(packet)); |
---|
778 | packet->size = size + erf_get_erf_headersize(packet); |
---|
779 | return size; |
---|
780 | } |
---|
781 | |
---|
782 | static int rtclient_get_fd(const struct libtrace_packet_t *packet) { |
---|
783 | return packet->trace->format_data->input.fd; |
---|
784 | } |
---|
785 | |
---|
786 | static int erf_get_fd(const struct libtrace_packet_t *packet) { |
---|
787 | return packet->trace->format_data->input.fd; |
---|
788 | } |
---|
789 | |
---|
790 | #if HAVE_DAG |
---|
791 | static void dag_help() { |
---|
792 | printf("dag format module: $Revision$\n"); |
---|
793 | printf("Supported input URIs:\n"); |
---|
794 | printf("\tdag:/dev/dagn\n"); |
---|
795 | printf("\n"); |
---|
796 | printf("\te.g.: dag:/dev/dag0\n"); |
---|
797 | printf("\n"); |
---|
798 | printf("Supported output URIs:\n"); |
---|
799 | printf("\tnone\n"); |
---|
800 | printf("\n"); |
---|
801 | } |
---|
802 | #endif |
---|
803 | |
---|
804 | static void legacypos_help() { |
---|
805 | printf("legacypos format module: $Revision$\n"); |
---|
806 | printf("Supported input URIs:\n"); |
---|
807 | printf("\tlegacypos:/path/to/file\t(uncompressed)\n"); |
---|
808 | printf("\tlegacypos:/path/to/file.gz\t(gzip-compressed)\n"); |
---|
809 | printf("\tlegacypos:-\t(stdin, either compressed or not)\n"); |
---|
810 | printf("\n"); |
---|
811 | printf("\te.g.: legacypos:/tmp/trace.gz\n"); |
---|
812 | printf("\n"); |
---|
813 | } |
---|
814 | |
---|
815 | static void legacyatm_help() { |
---|
816 | printf("legacyatm format module: $Revision$\n"); |
---|
817 | printf("Supported input URIs:\n"); |
---|
818 | printf("\tlegacyatm:/path/to/file\t(uncompressed)\n"); |
---|
819 | printf("\tlegacyatm:/path/to/file.gz\t(gzip-compressed)\n"); |
---|
820 | printf("\tlegacyatm:-\t(stdin, either compressed or not)\n"); |
---|
821 | printf("\n"); |
---|
822 | printf("\te.g.: legacyatm:/tmp/trace.gz\n"); |
---|
823 | printf("\n"); |
---|
824 | } |
---|
825 | |
---|
826 | static void legacyeth_help() { |
---|
827 | printf("legacyeth format module: $Revision$\n"); |
---|
828 | printf("Supported input URIs:\n"); |
---|
829 | printf("\tlegacyeth:/path/to/file\t(uncompressed)\n"); |
---|
830 | printf("\tlegacyeth:/path/to/file.gz\t(gzip-compressed)\n"); |
---|
831 | printf("\tlegacyeth:-\t(stdin, either compressed or not)\n"); |
---|
832 | printf("\n"); |
---|
833 | printf("\te.g.: legacyeth:/tmp/trace.gz\n"); |
---|
834 | printf("\n"); |
---|
835 | } |
---|
836 | |
---|
837 | static void erf_help() { |
---|
838 | printf("erf format module: $Revision$\n"); |
---|
839 | printf("Supported input URIs:\n"); |
---|
840 | printf("\terf:/path/to/file\t(uncompressed)\n"); |
---|
841 | printf("\terf:/path/to/file.gz\t(gzip-compressed)\n"); |
---|
842 | printf("\terf:-\t(stdin, either compressed or not)\n"); |
---|
843 | printf("\terf:/path/to/socket\n"); |
---|
844 | printf("\n"); |
---|
845 | printf("\te.g.: erf:/tmp/trace\n"); |
---|
846 | printf("\n"); |
---|
847 | printf("Supported output URIs:\n"); |
---|
848 | printf("\terf:path/to/file\t(uncompressed)\n"); |
---|
849 | printf("\terf:/path/to/file.gz\t(gzip-compressed)\n"); |
---|
850 | printf("\terf:-\t(stdout, either compressed or not)\n"); |
---|
851 | printf("\n"); |
---|
852 | printf("\te.g.: erf:/tmp/trace\n"); |
---|
853 | printf("\n"); |
---|
854 | printf("Supported output options:\n"); |
---|
855 | printf("\t-z\tSpecify the gzip compression, ranging from 0 (uncompressed) to 9 - defaults to 1\n"); |
---|
856 | printf("\n"); |
---|
857 | |
---|
858 | |
---|
859 | } |
---|
860 | |
---|
861 | static void rtclient_help() { |
---|
862 | printf("rtclient format module\n"); |
---|
863 | printf("Supported input URIs:\n"); |
---|
864 | printf("\trtclient:hostname:port\n"); |
---|
865 | printf("\trtclient:hostname (connects on default port)\n"); |
---|
866 | printf("\n"); |
---|
867 | printf("\te.g.: rtclient:localhost\n"); |
---|
868 | printf("\te.g.: rtclient:localhost:32500\n"); |
---|
869 | printf("\n"); |
---|
870 | printf("Supported output URIs:\n"); |
---|
871 | printf("\trtclient: \t(will output on default port on all available IP addresses) \n"); |
---|
872 | printf("\trtclient:hostname:port\n"); |
---|
873 | printf("\trtclient:port\n"); |
---|
874 | printf("\n"); |
---|
875 | printf("\te.g.: rtclient:32500\n"); |
---|
876 | printf("\te.g.: rtclient:\n"); |
---|
877 | printf("\n"); |
---|
878 | |
---|
879 | } |
---|
880 | |
---|
881 | static struct libtrace_format_t legacyatm = { |
---|
882 | "legacyatm", |
---|
883 | "$Id$", |
---|
884 | "legacyatm", |
---|
885 | erf_init_input, /* init_input */ |
---|
886 | NULL, /* init_output */ |
---|
887 | NULL, /* config_output */ |
---|
888 | erf_fin_input, /* fin_input */ |
---|
889 | NULL, /* fin_output */ |
---|
890 | legacy_read_packet, /* read_packet */ |
---|
891 | NULL, /* write_packet */ |
---|
892 | legacy_get_link, /* get_link */ |
---|
893 | legacyatm_get_link_type, /* get_link_type */ |
---|
894 | NULL, /* get_direction */ |
---|
895 | NULL, /* set_direction */ |
---|
896 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
897 | NULL, /* get_timeval */ |
---|
898 | NULL, /* get_seconds */ |
---|
899 | legacy_get_capture_length, /* get_capture_length */ |
---|
900 | legacyatm_get_wire_length, /* get_wire_length */ |
---|
901 | NULL, /* set_capture_length */ |
---|
902 | NULL, /* get_fd */ |
---|
903 | trace_event_trace, /* trace_event */ |
---|
904 | legacyatm_help /* help */ |
---|
905 | }; |
---|
906 | |
---|
907 | static struct libtrace_format_t legacyeth = { |
---|
908 | "legacyeth", |
---|
909 | "$Id$", |
---|
910 | "legacyeth", |
---|
911 | erf_init_input, /* init_input */ |
---|
912 | NULL, /* init_output */ |
---|
913 | NULL, /* config_output */ |
---|
914 | erf_fin_input, /* fin_input */ |
---|
915 | NULL, /* fin_output */ |
---|
916 | legacy_read_packet, /* read_packet */ |
---|
917 | NULL, /* write_packet */ |
---|
918 | legacy_get_link, /* get_link */ |
---|
919 | legacyeth_get_link_type, /* get_link_type */ |
---|
920 | NULL, /* get_direction */ |
---|
921 | NULL, /* set_direction */ |
---|
922 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
923 | NULL, /* get_timeval */ |
---|
924 | NULL, /* get_seconds */ |
---|
925 | legacy_get_capture_length, /* get_capture_length */ |
---|
926 | legacyeth_get_wire_length, /* get_wire_length */ |
---|
927 | NULL, /* set_capture_length */ |
---|
928 | NULL, /* get_fd */ |
---|
929 | trace_event_trace, /* trace_event */ |
---|
930 | legacyeth_help /* help */ |
---|
931 | }; |
---|
932 | |
---|
933 | static struct libtrace_format_t legacypos = { |
---|
934 | "legacypos", |
---|
935 | "$Id$", |
---|
936 | "legacypos", |
---|
937 | erf_init_input, /* init_input */ |
---|
938 | NULL, /* init_output */ |
---|
939 | NULL, /* config_output */ |
---|
940 | erf_fin_input, /* fin_input */ |
---|
941 | NULL, /* fin_output */ |
---|
942 | legacy_read_packet, /* read_packet */ |
---|
943 | NULL, /* write_packet */ |
---|
944 | legacy_get_link, /* get_link */ |
---|
945 | legacypos_get_link_type, /* get_link_type */ |
---|
946 | NULL, /* get_direction */ |
---|
947 | NULL, /* set_direction */ |
---|
948 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
949 | NULL, /* get_timeval */ |
---|
950 | NULL, /* get_seconds */ |
---|
951 | legacy_get_capture_length, /* get_capture_length */ |
---|
952 | legacypos_get_wire_length, /* get_wire_length */ |
---|
953 | NULL, /* set_capture_length */ |
---|
954 | NULL, /* get_fd */ |
---|
955 | trace_event_trace, /* trace_event */ |
---|
956 | legacypos_help /* help */ |
---|
957 | }; |
---|
958 | |
---|
959 | |
---|
960 | static struct libtrace_format_t erf = { |
---|
961 | "erf", |
---|
962 | "$Id$", |
---|
963 | "erf", |
---|
964 | erf_init_input, /* init_input */ |
---|
965 | erf_init_output, /* init_output */ |
---|
966 | erf_config_output, /* config_output */ |
---|
967 | erf_fin_input, /* fin_input */ |
---|
968 | erf_fin_output, /* fin_output */ |
---|
969 | erf_read_packet, /* read_packet */ |
---|
970 | erf_write_packet, /* write_packet */ |
---|
971 | erf_get_link, /* get_link */ |
---|
972 | erf_get_link_type, /* get_link_type */ |
---|
973 | erf_get_direction, /* get_direction */ |
---|
974 | erf_set_direction, /* set_direction */ |
---|
975 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
976 | NULL, /* get_timeval */ |
---|
977 | NULL, /* get_seconds */ |
---|
978 | erf_get_capture_length, /* get_capture_length */ |
---|
979 | erf_get_wire_length, /* get_wire_length */ |
---|
980 | erf_set_capture_length, /* set_capture_length */ |
---|
981 | erf_get_fd, /* get_fd */ |
---|
982 | trace_event_trace, /* trace_event */ |
---|
983 | erf_help /* help */ |
---|
984 | }; |
---|
985 | |
---|
986 | #ifdef HAVE_DAG |
---|
987 | static struct libtrace_format_t dag = { |
---|
988 | "dag", |
---|
989 | "$Id$", |
---|
990 | "erf", |
---|
991 | dag_init_input, /* init_input */ |
---|
992 | NULL, /* init_output */ |
---|
993 | NULL, /* config_output */ |
---|
994 | dag_fin_input, /* fin_input */ |
---|
995 | NULL, /* fin_output */ |
---|
996 | dag_read_packet, /* read_packet */ |
---|
997 | NULL, /* write_packet */ |
---|
998 | erf_get_link, /* get_link */ |
---|
999 | erf_get_link_type, /* get_link_type */ |
---|
1000 | erf_get_direction, /* get_direction */ |
---|
1001 | erf_set_direction, /* set_direction */ |
---|
1002 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
1003 | NULL, /* get_timeval */ |
---|
1004 | NULL, /* get_seconds */ |
---|
1005 | erf_get_capture_length, /* get_capture_length */ |
---|
1006 | erf_get_wire_length, /* get_wire_length */ |
---|
1007 | erf_set_capture_length, /* set_capture_length */ |
---|
1008 | NULL, /* get_fd */ |
---|
1009 | trace_event_trace, /* trace_event */ |
---|
1010 | dag_help /* help */ |
---|
1011 | }; |
---|
1012 | #endif |
---|
1013 | |
---|
1014 | static struct libtrace_format_t rtclient = { |
---|
1015 | "rtclient", |
---|
1016 | "$Id$", |
---|
1017 | "erf", |
---|
1018 | rtclient_init_input, /* init_input */ |
---|
1019 | NULL, /* init_output */ |
---|
1020 | NULL, /* config_output */ |
---|
1021 | rtclient_fin_input, /* fin_input */ |
---|
1022 | NULL, /* fin_output */ |
---|
1023 | rtclient_read_packet, /* read_packet */ |
---|
1024 | NULL, /* write_packet */ |
---|
1025 | erf_get_link, /* get_link */ |
---|
1026 | erf_get_link_type, /* get_link_type */ |
---|
1027 | erf_get_direction, /* get_direction */ |
---|
1028 | erf_set_direction, /* set_direction */ |
---|
1029 | erf_get_erf_timestamp, /* get_erf_timestamp */ |
---|
1030 | NULL, /* get_timeval */ |
---|
1031 | NULL, /* get_seconds */ |
---|
1032 | erf_get_capture_length, /* get_capture_length */ |
---|
1033 | erf_get_wire_length, /* get_wire_length */ |
---|
1034 | erf_set_capture_length, /* set_capture_length */ |
---|
1035 | rtclient_get_fd, /* get_fd */ |
---|
1036 | trace_event_device, /* trace_event */ |
---|
1037 | rtclient_help /* help */ |
---|
1038 | }; |
---|
1039 | |
---|
1040 | void __attribute__((constructor)) erf_constructor() { |
---|
1041 | erf_ptr = &erf; |
---|
1042 | register_format(erf_ptr); |
---|
1043 | #ifdef HAVE_DAG |
---|
1044 | dag_ptr = &dag; |
---|
1045 | register_format(dag_ptr); |
---|
1046 | #endif |
---|
1047 | rtclient_ptr = &rtclient; |
---|
1048 | register_format(rtclient_ptr); |
---|
1049 | |
---|
1050 | legacypos_ptr = &legacypos; |
---|
1051 | register_format(legacypos_ptr); |
---|
1052 | |
---|
1053 | legacyeth_ptr = &legacyeth; |
---|
1054 | register_format(legacyeth_ptr); |
---|
1055 | |
---|
1056 | legacyatm_ptr = &legacyatm; |
---|
1057 | register_format(legacyatm_ptr); |
---|
1058 | |
---|
1059 | } |
---|