Fix a couple of typos and use 2 spaces consistently after a period.
[obnox/wireshark/wip.git] / doc / README.design
1 $Id$
2
3 Unfortunately, the closest thing to a design document is the
4 "README.developer" document in the "doc" directory of the Wireshark
5 source tree; however, although that's useful for people adding new
6 protocol dissectors to Wireshark, it doesn't describe the operations of
7 the "core" of Wireshark.
8
9 We have no document describing that; however, a quick summary of the
10 part of the code you'd probably be working with is:
11
12         for every capture file that Wireshark has open, there's a
13         "capture_file" structure - Wireshark currently supports only one
14         open capture file at a time, and that structure is named
15         "cfile" (see the "file.h" header file);
16
17         that structure has a member "plist", which points to a
18         "frame_data" structure - every link-layer frame that Wireshark
19         has read in has a "frame_data" structure (see the
20         "epan/packet.h" header file), the "plist" member of "cfile"
21         points to the first frame, and each frame has a "next" member
22         that points to the next frame in the capture (or is null for the
23         last frame);
24
25         each "frame_data" struct has:
26
27                 a pointer to the next frame (null for the last frame);
28
29                 a pointer to the previous frame (null for the first
30                 frame);
31
32                 information such as the ordinal number of the frame in
33                 the capture, the time stamps for the capture, the size
34                 of the packet data in bytes, the size of the frame in
35                 bytes (which might not equal the size of the packet data
36                 if, for example, the program capturing the packets
37                 captured no more than the first N bytes of the capture,
38                 for some value of N);
39
40                 the byte offset in the capture file where the frame's
41                 data is located.
42
43 See the "print_packets()" routine in "file.c" for an example of a
44 routine that goes through all the packets in the capture; the loop does
45
46         for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) {
47
48                 update a progress bar (because it could take a
49                     significant period of time to process all packets);
50
51                 read the packet data if the packet is to be printed;
52
53                 print the packet;
54
55         }
56
57 The "wtap_seek_read()" call read the packet data into memory; the
58 "epan_dissect_new()" call "dissects" that data, building a tree
59 structure for the fields in the packet.
60