Add a "saved_can_desegment" field to the "packet_info" structure, so

that dissectors for pass-through proxying protocols such as SOCKS can
allow the subdissectors they call to ask that desegmentation be done.

svn path=/trunk/; revision=9488
This commit is contained in:
Guy Harris 2003-12-29 22:44:50 +00:00
parent d177c7d731
commit 354b911d05
2 changed files with 30 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.99 2003/11/21 21:58:54 guy Exp $
* $Id: packet.c,v 1.100 2003/12/29 22:44:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -418,7 +418,12 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb,
* by one.
* Thus only the subdissector immediately on top of whoever
* offers this service can use it.
* We save the current value of "can_desegment" for the
* benefit of TCP proxying dissectors such as SOCKS, so they
* can restore it and allow the dissectors they call to use
* the desegmentation service.
*/
pinfo->saved_can_desegment = saved_can_desegment;
pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0);
if (handle->protocol != NULL) {
pinfo->current_proto =
@ -1414,13 +1419,19 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
then everytime a subdissector is called it is decremented by one.
thus only the subdissector immediately ontop of whoever offers this
service can use it.
We save the current value of "can_desegment" for the
benefit of TCP proxying dissectors such as SOCKS, so they
can restore it and allow the dissectors they call to use
the desegmentation service.
*/
saved_can_desegment=pinfo->can_desegment;
pinfo->saved_can_desegment = saved_can_desegment;
pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0);
status = FALSE;
saved_proto = pinfo->current_proto;
for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) {
/* XXX - why set this now and above? */
pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0);
dtbl_entry = (heur_dtbl_entry_t *)entry->data;
if (dtbl_entry->protocol != NULL &&

View File

@ -1,7 +1,7 @@
/* packet_info.h
* Definitions for packet info structures and routines
*
* $Id: packet_info.h,v 1.37 2003/12/23 12:07:12 obiot Exp $
* $Id: packet_info.h,v 1.38 2003/12/29 22:44:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -41,8 +41,8 @@ typedef enum {
AT_OSI, /* OSI NSAP */
AT_ARCNET, /* ARCNET */
AT_FC, /* Fibre Channel */
AT_SS7PC, /* SS7 Point Code */
AT_STRINGZ /* null-terminated string */
AT_SS7PC, /* SS7 Point Code */
AT_STRINGZ /* null-terminated string */
} address_type;
typedef struct _address {
@ -158,11 +158,21 @@ typedef struct _packet_info {
guint32 match_port;
const char *match_string; /* Subdissectors with string dissector tables use this */
guint16 can_desegment; /* >0 if this segment could be desegmented.
A dissector that can offer this API (e.g. TCP)
sets can_desegment=2, then can_desegment is
decremented by 1 each time we pass to the next
subdissector. Thus only the dissector immediately
above the protocol which sets the flag can use it*/
A dissector that can offer this API (e.g.
TCP) sets can_desegment=2, then
can_desegment is decremented by 1 each time
we pass to the next subdissector. Thus only
the dissector immediately above the
protocol which sets the flag can use it*/
guint16 saved_can_desegment; /* Value of can_desegment before current
dissector was called. Supplied so that
dissectors for proxy protocols such as
SOCKS can restore it, allowing the
dissectors that they call to use the
TCP dissector's desegmentation (SOCKS
just retransmits TCP segments once it's
finished setting things up, so the TCP
desegmentor can desegment its payload). */
int desegment_offset; /* offset to stuff needing desegmentation */
guint32 desegment_len; /* requested desegmentation additional length */
guint16 want_pdu_tracking; /* >0 if the subdissector has specified