• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.gdbinitH A D12-Dec-1996114 1310

ANNOUNCEH A D30-Jun-19982.3 KiB6342

Makefile.inH A D03-May-20222.7 KiB8433

READMEH A D27-Apr-19995.3 KiB12599

README.tcp_plotsH A D29-Jun-19942.4 KiB9983

acconfig.hH A D18-Jun-199864 31

config.h.inH A D15-Jan-1999702 2617

configureH A D04-May-200074.1 KiB2,4542,009

configure.inH A D18-Jun-1998761 3727

coord.cH A D20-May-19995.9 KiB229155

coord.hH A D29-Apr-19943 KiB8344

double.cH A D18-Jun-19984.2 KiB229165

dtime.cH A D18-Jun-19984.6 KiB239173

install-shH A D06-Dec-19964.7 KiB239152

signed.cH A D18-Jun-19983.8 KiB194133

tcpdump2xplot.1H A D04-Feb-19991.7 KiB8776

tcpdump2xplot.plH A D03-May-200013.6 KiB483362

timeval.cH A D22-Oct-19987.9 KiB371271

unsigned.cH A D18-Jun-19984.4 KiB238164

versionH A D19-Sep-20039 21

xplot.1H A D04-Feb-19993.8 KiB151129

xplot.cH A D19-Sep-200397.3 KiB3,7703,145

xplot.hH A D18-Jun-19982.2 KiB7832

README

1This is the README file for the program xplot.
2
3There seems to be a few other programs floating around the net by the
4same name.  This one was written by Tim Shepard while doing his S.M.
5thesis "TCP Packet Trace Analysis" for David Clark at the MIT
6Laboratory for Computer Science.  The thesis can be ordered from
7MIT/LCS Publications.  Ordering information can be obtained from
8+1 617 253 5851 or send mail to publications@lcs.mit.edu.  Ask for
9MIT/LCS/TR-494.  Or you can get it on the net free of charge from
10<ftp://ftp.lcs.mit.edu/pub/lcs-pubs/tr.outbox/MIT-LCS-TR-494.ps.gz>.
11
12To make plots like the ones in my S.M. thesis, you should read the
13ANNOUNCE file, the README.tcp_plots file, and the tcpdump2xplot.pl
14perl script.
15
16Thanks to Garret Wollman for contributing the original
17tcpdump2xplot.pl script and thanks to Eric Prud'hommeaux (@ w3.org)
18for making <http://www.w3.org/pub/WWW/config/tcpdump2xplot.pl>
19available, a much improved version. The one included here is a
20slightly improved version of Eric's.  It tries to do the right thing
21with SYN and FIN bits (by including them in the sequence space) and
22can also handle wscale and SACK options, though you may have to fix
23your version of tcpdump to print out the rfc2018 SACK blocks
24correctly.  (Some versions of tcpdump print out rfc1185 SACK blocks
25which have a different (obsolete) format, but share the same TCP
26option number.)  When you run tcpdump, you'll probably want to include
27the options "-s 96 -S -tt -n".
28
29xplot is compiled by running:
30
31	./configure
32	make
33
34After you get xplot compiled try running:
35
36	xplot demo.*
37
38You will get one window for each input file.  The demo.0 file just
39demonstrates the different things that can be plotted.  The demo.1
40file is from the thesis mentioned above.  Xplot was written to make it
41possible to zoom in on data like this.  To get a feel for zooming, run
42xplot on demo.1 and resize the window so that it fills most of your
43screen.  Then zoom in on the data a few times, and then scroll around.
44The demo.2 file is an ntp wedge plot.  (Ntp wedge plots were invented
45by David Mills when he developed the ntp.)  demo.3 is a simply made
46histogram.  demo.4 is another ntp wedge plot but with some of the data
47points in color.  demo.5 shows how the text commands can be used to
48label things.  demo.6 is a sort of timing diagram.  Most people who
49have made use of xplot write awk or perl scripts to convert their data
50into a form suitable for input into xplot.
51
52There isn't much documentation other than the sourcecode.  To see what
53type of things can be drawn, look in demo.0 .  You can easily add new
54types of points by editing xplot.c.  e.g. adding the "diamond" type
55was accomplished in about 10 minutes by searching for each occurance
56of "box" or "BOX" in xplot.c.
57
58The currently available coordinate types are:
59 double
60 signed
61 unsigned
62 timeval
63
64It should be fairly easy to add a new coordinate type.  Model the
65implementation after an existing coordinate type (like signed.c) and
66make the necessary edits to coord.c and xplot.h.
67
68xplot does not behave well when you wrap around the end of a
69coordinate space.  This is particularly likely if the "unsigned"
70coordinate type is used and you attempt to scroll or zoom to values
71below zero.  Because of this, the "unsigned" coordinate type is not
72recommended.  However, "unsigned" is the only reasonable choice for
73TCP sequence numbers.  A 64-bit signed integer coordinate type should
74be added to xplot someday.  For typical applications, double should be
75used for both coordinate types.
76
77The first line of input names the x and y coordinate types.  After the
78first line, all lines are plot commands.  A line "go" can be included
79to mark the end of the input file, but shouldn't be necessary.
80
81How to drive the mouse
82----------------------
83
84Drag a rectangle with the left mouse button to zoom in.
85Click the left mouse button to pop the zoom stack.
86
87Drag with the middle mouse button to scroll.
88
89Zooming or scrolling below the x axis zooms or scrolls only in the x
90direction.  Similarly, zooming or scrolling to the left of the y axis
91zooms or scrolls only in the y direction.
92
93Click the right mouse button to close the window. Xplot will exit if
94you close all windows.
95
96Clicking the left button while SHIFT is pressed causes xplot to drop a
97postscript file in the current directory.  The title is used as the
98first part of the filename if there has been a title plot command.
99Otherwise, "xplot" is used.  The file ends in PS.# where # is a serial
100number.  Xplot is careful not to write over a previously dumped
101postscript file, and # is incremented until an unused filename is
102found.
103
104Clicking the middle button while SHIFT is pressed similarly causes
105xplot to drop a postscript file, but this will be scaled suitably to
106allow the figure to be included in a document.  You might have to
107fiddle with the constants in emit_PS() and recompile to get the figure
108sized the way you want it.
109
110If you didn't like the size of the figure produced by SHIFT-Middle,
111Clicking the right button while SHIFT is pressed will produce a
112postscript plot just like the middle button, but it will take less
113vertical space.  Again, you can fiddle with the constants in emit_PS()
114and recompile if you don't like these sizes.
115
116X Resources
117-----------
118
119xplot understands the standard geometry, foreground, and background resource
120settings.
121
122---------
123
124Good luck.
125

README.tcp_plots

1The following C-like psuedocode should help you make tcp plots like
2those in the MIT/LCS/TR-494.  The code below is simultaneously making
3two different plots, one plot for each direction that data can be
4carried on a tcp connection.  In addition to emulating the pseudo code
5below, you'll have to add some boilerplate to the plotter files.  See
6demo.1 for an example tcp plot.
7
8static  struct last {
9  unsigned long ack;
10  unsigned long windowend;
11  struct timeval time;
12} a, b;
13
14typedef struct {
15  unsigned long  a_address;
16  unsigned long  b_address;
17  unsigned short a_port;
18  unsigned short b_port;
19} tcp_pair;
20
21tcp_pair tp;
22
23PLOTTER topl;
24PLOTTER frompl;
25PLOTTER abpl;
26PLOTTER bapl;
27
28for each tcp packet in order {
29  struct ip_header *iph;
30  struct tcp_header *tcph;
31  tcp_pair ttp;
32  unsigned int tcp_length;
33  unsigned int tcp_data_length;
34  unsigned int start;
35  unsigned int end;
36  struct timeval time;
37
38  iph = get_pointer_to_ip_header;
39  ttp = iph2ttp(iph);
40
41  /* figure out which direction this packet is going */
42  if (tp.a_address == ttp.a_address && tp.a_port == ttp.a_port) {
43    topl = bapl;
44    frompl = abpl;
45    r = &a;
46  } else {
47    topl = abpl;
48    frompl = bapl;
49    r = &b;
50  }
51
52  tcph = iph2tcph(iph);
53
54  time = nh->nh_timestamp;
55
56  tcp_length = ntohs(iph->total_length) - (4 * iph->ihl);
57  tcp_data_length =
58    tcp_length - (4 * tcph->data_offset) + tcph->syn + tcph->fin;
59
60  start = ntohl(tcph->sequence_number);
61  end = start + tcp_data_length;
62
63  /* draw the packet */
64
65  plotter_darrow(frompl, time, start);
66  plotter_uarrow(frompl, time, end);
67  plotter_line(frompl, time, start, time, end);
68
69  /* draw the ack and win in the other plotter */
70  if (tcph->ack) {
71    unsigned int ack;
72    unsigned int win;
73    unsigned int winend;
74    ack = ntohl(tcph->acknowledgment_number);
75    win = ntohs(tcph->window);
76    winend = ack + win;
77
78    if (r->time.tv_sec != -1) {
79      plotter_line(topl, r->time, r->ack, time, r->ack);
80      if (r->ack != ack) {
81	plotter_line(topl, time, r->ack, time, ack);
82      } else {
83	plotter_dtick(topl, time, ack);
84      }
85      if (plotwindow) {
86	plotter_line(topl, r->time, r->windowend, time, r->windowend);
87	if (r->windowend != winend) {
88	  plotter_line(topl, time, r->windowend, time, winend);
89	} else {
90	  plotter_utick(topl, time, winend);
91	}
92      }
93    }
94    r->time = time;
95    r->ack = ack;
96    r->windowend = winend;
97  }
98}
99