Commit Graph

69 Commits

Author SHA1 Message Date
Guy Harris 9cc45a4a10 Include the control-field information in the Info column for LLC frames.
svn path=/trunk/; revision=2370
2000-08-25 06:31:25 +00:00
Laurent Deniel cc36f0b931 Add the "Edit:Protocols..." feature which currently only implements
the following:

It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.

Disabling a protocol could be interesting:

- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)

Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)

I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).

Two functions are added in proto.c :

gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);

and two MACROs which can be used in dissectors:

OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)

See also the XXX in proto_dlg.c and proto.c around the new functions.

svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
Guy Harris 74a0606402 Don't bump "offset" in the non-SNAP case - it hasn't been set, and we
don't use it there.

svn path=/trunk/; revision=2252
2000-08-11 08:19:32 +00:00
Guy Harris 56b989e0ad Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.

Have the code that calls those dissectors translate the arguments as
necessary.  (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation.  Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)

This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so.  It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.

Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.

Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_".  Update the
dissectors that use those routines appropriately.

Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".

svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
Guy Harris 283ce59938 Add routines for adding items to a protocol tree that take arguments of
a particular type, rather than taking a varargs list, along the lines of
the "proto_tree_add_XXX_format()" routines.

Replace most calls to "proto_tree_add_item()" and
"proto_tree_add_item_hidden()" with calls to those routines.

Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to
"proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and
add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()"
routines that don't take the item to be added as an argument - instead,
they fetch the argument from the packet whose tvbuff was handed to them,
from the offset handed to them.

svn path=/trunk/; revision=2031
2000-05-31 05:09:07 +00:00
Gilbert Ramirez aa553f63ec Convert LAPD and V.120 dissector to use tvbuff. Convert xdlc dissector-helper,
too.

svn path=/trunk/; revision=2030
2000-05-31 03:58:56 +00:00
Guy Harris 713245f76c In the FDDI and LLC dissectors, extract fields as we use them, so that
we don't get an exception (and thus a "Short Frame" or "Malformed
Frame" entry) until we get to a field that isn't in the frame.

svn path=/trunk/; revision=2021
2000-05-28 22:02:17 +00:00
Guy Harris a2b30d028c Use "tvb_get_ntoh24()" to extract the OUI from a SNAP header, rather
than extracting each byte with "tvb_get_guint8()" and then putting them
together.

svn path=/trunk/; revision=2020
2000-05-28 21:21:23 +00:00
Gilbert Ramirez b263e4934b Add protection against 0-length FT_BYTES being added to proto_tree.
Convert ethertype() and dissect_null() to use tvbuff.

svn path=/trunk/; revision=1979
2000-05-19 04:54:36 +00:00
Gilbert Ramirez 0a2817ceba Have tvbuff's keep track of cap_len and pkt_len ('length' and 'reported_length'
in tvbuff terminology). This is implemented for TVBUFF_REAL and TVBUFF_SUBSET
so far; support for TVBUFF_COMPOSITE is coming soon.

Throw either ReportedBoundsError or BoundsError.
A ReportedBoundsError is reported as "Malformed Frame" since the protocol
stated that a certain number of bytes should be available but they weren't.
A BoundsError is reported as a "Short Frame" since the snaplen was too short.

Register proto_short (BoundsError) and proto_malformed (ReportedBounds)
so searches can be made on "short" and "malformed".

svn path=/trunk/; revision=1965
2000-05-16 04:44:14 +00:00
Gilbert Ramirez 4ec50578de In wiretap, set err to 0 before doing anything inside wtap_loop().
Tethereal was dying on me because err was initialized to some random value.

It was this section of code that would exit even if wtap_loop was successful
(returned TRUE) because err was never initialized or set to anything.

err = load_cap_file(&cf, out_file_type);
if (err != 0) {
       dissect_cleanup();
       exit(2);
}

<BIGGER sheepish grin>
Fixed even more errors in LLC dissector. I had inadvertantly used the
wrong tvbuff_t* when calling dissect_data_tvb(). There is no way we are going
to be successful in this tvbuff conversion w/o regression testing. I'm
working on setting up a simple Makefile for regression testing tonight.
That's why I'm finding so many bugs in my LLC conversion.
</BIGGER sheepish grin>

svn path=/trunk/; revision=1946
2000-05-12 05:06:33 +00:00
Gilbert Ramirez 742cb69433 <sheepish grin>
Fix error in my conversion to tvbuff routines.
Because offset was calculated based on next_tvb, which already knew to
skip 8 bytes, I don't have to use "offset+8" in calls to the next non-tvbuff
dissectors.
</sheepish grin>

svn path=/trunk/; revision=1945
2000-05-12 04:21:21 +00:00
Gilbert Ramirez 0c39c03bf5 Convert LLC dissector to use tvbuffs.
Non-tvbuff dissectors create a tvbuff when calling dissect_llc()
Changed name of current_proto to match string in COL_PROTO ("FDDI" instead of "fddi")
Changed short text to be: [Short Frame: %s]  where %s is current_proto.

svn path=/trunk/; revision=1943
2000-05-11 22:04:18 +00:00
Gilbert Ramirez 292e38e2c6 Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.

dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.

The FDDI dissector is converted to use tvbuff's.

svn path=/trunk/; revision=1939
2000-05-11 08:18:09 +00:00
Guy Harris 0ba3e2b233 Register a "llc.dsap" dissector table for 802.2 LLC, and have dissectors
for protocols that run inside 802.2 LLC register themselves with it
using "dissector_add()".

Make various dissectors static if they can be, and remove from header
files declarations of those dissectors.

svn path=/trunk/; revision=1872
2000-04-17 00:32:43 +00:00
Guy Harris 50e76e6d49 For I and S frames, the LLC control field is 2 bytes, so make it
FT_UINT16 (that won't break things for U frames, where it's 1 byte).

svn path=/trunk/; revision=1838
2000-04-13 02:36:35 +00:00
Gilbert Ramirez ef73f1757e Change my e-mail address from @tivoli.com to @xiexie.org
svn path=/trunk/; revision=1831
2000-04-12 20:24:43 +00:00
Gerald Combs a42b1820e4 Add DOCSIS BPDU patch from Johannes Hennecke <Johannes.Hennecke@elsa.de>.
svn path=/trunk/; revision=1826
2000-04-10 14:45:30 +00:00
Guy Harris cd3eccbef8 The "llc_ctrl_vals[]" value_string table isn't used to generate the
protocol tree text for the control field - that protocol tree entry is
added by "dissect_xdlc_control()", which uses
"proto_tree_add_uint_format()" - and it's not a simple enumerated field
(which is why "proto_tree_add_uint_format()" is used, to show all the
various bits of the field).  Eliminate it.

svn path=/trunk/; revision=1825
2000-04-09 18:33:26 +00:00
Guy Harris b1bf10bacb The "llc_ctrl_vals[]" value_string table isn't used to generate the
protocol tree text for the control field - that protocol tree entry is
added by "dissect_xdlc_control()", which uses
"proto_tree_add_uint_format()" - and it's not a simple enumerated field
(which is why "proto_tree_add_uint_format()" is used, to more fully
describe the field).  Eliminate it.

svn path=/trunk/; revision=1824
2000-04-08 07:55:11 +00:00
Gilbert Ramirez ddfa11e870 Create a header file for every packet-*.c file. Prune the packet.h file.
This change allows you to add a new packet-*.c file and not cause a
recompilation of everything that #include's packet.h

Add the plugin_api.[ch] files ot the plugins/Makefile.am packaging list.

Add #define YY_NO_UNPUT 1 to the lex source so that the yyunput symbol
is not defined, squelching a compiler complaint when compiling the generated
C file.

svn path=/trunk/; revision=1637
2000-02-15 21:06:58 +00:00
Guy Harris 99576b1786 Squelch a complaint from Visual C++ 6.0 (the code was OK beforehand, at
least as I remember the ANSI C standard, but I guess they're warning you
that you might've intended to return the return value of a function but
forgot to put a parameter list after the function name).

svn path=/trunk/; revision=1626
2000-02-12 11:22:26 +00:00
Guy Harris 5da490dab2 Note the document that specified the PIDs for VTP and DRiP that go along
with Cisco's "wacky proprietary protocols atop LLC/SNAP" OUI, and put in
"#if 0"ed out code for Cisco's DRiP.

svn path=/trunk/; revision=1604
2000-02-05 09:34:33 +00:00
Guy Harris 101bc1a007 Dissector for Cisco's Virtual Trunking Protocol.
svn path=/trunk/; revision=1603
2000-02-05 09:19:06 +00:00
Guy Harris 4b81b2dbc9 Cisco Group Management Protocol dissector.
svn path=/trunk/; revision=1601
2000-02-05 05:54:17 +00:00
Guy Harris 9d4c965c81 Add some new SAP values from
http://www.optimized.com/COMPENDI/REF-SAP.htm

svn path=/trunk/; revision=1529
2000-01-24 02:44:52 +00:00
Guy Harris 05b04d0a42 xDLC frames other than I and UI frames may have a payload, e.g. TEST
frames; rename "XDLC_HAS_PAYLOAD()" to "XDLC_IS_INFORMATION()", and if
the frame isn't an "information" frame, dissect its payload (if any) as
data.

svn path=/trunk/; revision=1528
2000-01-24 02:05:39 +00:00
Guy Harris e55dac5888 Put the PID of SNAP frames into the protocol tree regardless of whether
the frame has a payload or not.

Note in a comment that in one capture there's a U frame with a function
of TEST, rather than UI, that appears to have a payload.

svn path=/trunk/; revision=1527
2000-01-24 01:45:12 +00:00
Guy Harris 2461d79698 In "dissect_eth()", update "pi.len" and "pi.captured_len" regardless of
whether we're building a protocol tree or not.

Make "dissect_eth()" use "BYTES_ARE_IN_FRAME()" to see if we have a full
Ethernet header - it can be called with a non-zero offset, if Ethernet
frames are encapsulated inside other frames (e.g., ATM LANE).

Make capture routines take an "offset" argument if the corresponding
dissect routine takes one (for symmetry, and for Cisco ISL or any other
protocol that encapsulates Ethernet or Token-Ring frames inside other
frames).

Pass the frame lengths to capture routines via the "pi" structure,
rather than as an in-line argument, so that they can macros such as
"BYTES_ARE_IN_FRAME()" the way the corresponding dissect routines do.

Make capture routines update "pi.len" and "pi.captured_len" the same way
the corresponding diseect routines do, if the capture routines then call
other capture routines.

Make "capture_vlan()" count as "other" frames that are too short, the
way other capture routines do.

svn path=/trunk/; revision=1525
2000-01-23 08:55:37 +00:00
Gerald Combs 42d68156a9 Merge Paul Ionescu's CDP fixes with Guy's. Add #defines to oui.h for Cisco
IOS 9.0 and bridged frame relay and update packet-llc.c accordingly.  Add
CDP handler to capture_llc() in packet-llc.c.

svn path=/trunk/; revision=1524
2000-01-22 21:49:50 +00:00
Guy Harris 8c09da31c8 For the Cisco OUI, always add the protocol ID to the tree if we're
constructing a protocol tree.

Don't add the protocol ID for unknown OUIs unless we're constructing a
protocol tree.

svn path=/trunk/; revision=1453
2000-01-12 20:00:19 +00:00
Guy Harris 3db486ab74 Cisco CDP packets appears to be sent as LLC packets with an OUI of
0x00000c and a protocol ID of 0x2000 - we used to recognize those as CDP
because we ignored the OUI and treated all LLC packets as
SNAP-encapsulated packets, and treated 0x2000 as an Ethertype, but we
now treat only encapsulated-Ethernet and Apple packets as
SNAP-encapsulated (and arguably we should handle Apple separately).

svn path=/trunk/; revision=1452
2000-01-12 19:37:24 +00:00
Guy Harris 7a943b7810 Fix Gerald's e-mail address.
svn path=/trunk/; revision=1437
2000-01-07 22:05:43 +00:00
Guy Harris 9b4e0a8dd3 Put a list of known OUIs in "oui.h", along with a declaration of
"value_string" array for OUIs.

Add the OUI for the ATM Forum to that list.

Handle the OUI for the ATM Forum in the layer 3 information for ISO TR
9577 in a Broadband Low Layer Information information element (for ATM
LANE).

Add an initial version of the dissection of TLV values in LANE LE
Control frames (I have no frames with TLV values against which to test
it, alas).

svn path=/trunk/; revision=1385
1999-12-29 05:20:00 +00:00
Guy Harris 7e0d32b3d9 *** empty log message ***
svn path=/trunk/; revision=1325
1999-12-14 07:22:56 +00:00
Guy Harris 0c4067f31e Provide #defines for the Group/Individual bit in the DSAP, the
Command/Response bit in the SSAP, and the mask that extracts the rest of
the {D,S}SAP.

svn path=/trunk/; revision=1316
1999-12-13 23:39:59 +00:00
Nathan Neulinger 1b4f9ef224 Break out IG and CR bits of SSAP and DSAP
Handle figuring out correct dsap/ssap if the last bit is 0/1

svn path=/trunk/; revision=1315
1999-12-13 21:48:18 +00:00
Guy Harris 29b204f996 Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk.  (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)

Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.

Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.

For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.

svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
Guy Harris 3eb2e8576e Fix a typo.
svn path=/trunk/; revision=1218
1999-12-05 09:50:58 +00:00
Guy Harris 0525c8cfa3 Don't assume that the OUI of all SNAP frames is 00-00-00; treat only
frames with an OUI of 00-00-00 as SNAP-encapsulated Ethernet, and, for
other SNAP frames, display the protocol ID as hex and dissect the
payload as data.

svn path=/trunk/; revision=1217
1999-12-05 09:45:32 +00:00
Gilbert Ramirez 3fa90ff0cf Add IPX to packet stats during capture.
svn path=/trunk/; revision=1173
1999-11-30 23:56:37 +00:00
Guy Harris a7aba0a288 Replace the ETT_ "enum" members, declared in "packet.h", with
dynamically-assigned "ett_" integer values, assigned by
"proto_register_subtree_array()"; this:

	obviates the need to update "packet.h" whenever you add a new
	subtree type - you only have to add a call to
	"proto_register_subtree_array()" to a "register" routine and an
	array of pointers to "ett_", if they're not already there, and
	add a pointer to the new "ett_" variable to the array, if they
	are there;

	would allow run-time-loaded dissectors to allocate subtree types
	when they're loaded.

svn path=/trunk/; revision=1043
1999-11-16 11:44:20 +00:00
Guy Harris 80d5d4bf7e "XDLC_CONTROL_LEN()" actually returned the length of the entire xDLC
header, under the assumption that the address field was two octets.

It should return the length of the *control* field, and leave it up to
its caller to add in the length of the address field.  (The address
field appears to be one byte in SNA, not two bytes.)

svn path=/trunk/; revision=1006
1999-11-11 08:04:06 +00:00
Gilbert Ramirez bacb9d5bae New proto_tree header_field_info stuff. Header_field_infos now contain
the base for numbers to be displayed in, bitmasks for bitfields, and blurbs
(which are one or two sentences describing the field).

proto_tree_add*() routines now automatically handle bitfields. You tell
it which header field you are adding, and just pass it the value of the
entire field, and the proto_tree routines will do the masking and shifting
for you.

This means that bitfields are more naturally filtered via dfilter now.

Added Phil Techau's support for signed integers in dfilters/proto_tree.

Added the beginning of the SNA dissector. It's not complete, but I'm
committing it now because it has example after example of how to use
bitfields with the new header_field_info struct and proto_tree routines.
It was the impetus to change how header_field_info works.

svn path=/trunk/; revision=815
1999-10-12 06:21:15 +00:00
Guy Harris 93b7dfe367 Christophe Tronche's BPDU dissector.
svn path=/trunk/; revision=790
1999-10-08 20:50:39 +00:00
Guy Harris 073aced0b8 Don't bother setting the length of the LLC header when we create the LLC
tree to anything other than 0, as we're going to change it to the right
value once the control field has been parsed and we know the right value.

svn path=/trunk/; revision=731
1999-09-27 08:39:10 +00:00
Guy Harris f76a67e084 Handle the length of the LLC(+SNAP) header correctly for SNAP frames.
svn path=/trunk/; revision=728
1999-09-26 20:40:00 +00:00
Guy Harris 63edea877f Have "get_xdlc_control()" and "dissect_xdlc_control()" return the
xDLC control field, so that its caller can not only determine from it
whether the frame has a payload, but can also determine how long the
control field is.  Put macros in "xdlc.h" to determine both of those.

Have "capture_llc()" and "dissect_llc()" use that information
appropriately.

svn path=/trunk/; revision=727
1999-09-26 20:31:51 +00:00
Guy Harris 9fc0d3aefe Have "get_xdlc_control()" and "dissect_xdlc_control()" just return a
Boolean indicating whether the frame has any payload to dissect or not.

svn path=/trunk/; revision=556
1999-08-23 23:24:36 +00:00
Guy Harris 397b2be709 The only LLC frame types that should be dissected based on their SAP or,
if the SAPs are SNAP, based on their ethertype are I frames and UI
frames; others don't have payload to be dissected as belonging to other
protocols.

svn path=/trunk/; revision=555
1999-08-23 22:47:13 +00:00