4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 2c060e3 was
2c060e3,
checked in by Daniel Lawson <dlawson@…>, 18 years ago
|
Initial revision
|
-
Property mode set to
100644
|
File size:
917 bytes
|
Line | |
---|
1 | // $Id$ |
---|
2 | |
---|
3 | #include <stdio.h> /* printf */ |
---|
4 | #include <netinet/in.h> /* ntohs */ |
---|
5 | #include <netdb.h> |
---|
6 | #include "dagformat.h" |
---|
7 | |
---|
8 | #include "libtrace.h" |
---|
9 | |
---|
10 | struct libtrace_t *trace; |
---|
11 | |
---|
12 | char *buffer[4096]; |
---|
13 | |
---|
14 | int main(int argc, char *argv[]) { |
---|
15 | |
---|
16 | char *hostname = "rtclient:chasm.cs.waikato.ac.nz"; |
---|
17 | struct libtrace_ip *ipptr = 0; |
---|
18 | |
---|
19 | int status; // need to pass to rtclient_read_packet |
---|
20 | int psize; |
---|
21 | if (argc == 2) { |
---|
22 | hostname = argv[1]; |
---|
23 | } |
---|
24 | |
---|
25 | // create an rtclient to hostname, on the default port |
---|
26 | trace = create_trace(hostname); |
---|
27 | |
---|
28 | for (;;) { |
---|
29 | if ((psize = libtrace_read_packet(trace, buffer,4096, &status)) <= 0) { |
---|
30 | // terminate |
---|
31 | break; |
---|
32 | } |
---|
33 | ipptr = get_ip(trace,buffer,4096); |
---|
34 | if (ipptr) { |
---|
35 | printf("%d\n",ipptr->ip_p); |
---|
36 | } |
---|
37 | } |
---|
38 | destroy_trace(trace); |
---|
39 | return 0; |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.