Update the sample code dealing with desegmentation to new style dissector

Change-Id: I2e9f6341138e7305b849a754e28edfd322d44160
Reviewed-on: https://code.wireshark.org/review/2415
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2014-06-19 00:35:24 +02:00
parent 5844e12989
commit 43c64c0ade
1 changed files with 4 additions and 2 deletions

View File

@ -2973,8 +2973,9 @@ static hf_register_info hf[] = {
* @param tvb The buffer to dissect.
* @param pinfo Packet Info.
* @param tree The protocol tree.
* @param data Optional data parameter given by parent dissector.
**/
static void dissect_cstr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
static int dissect_cstr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *data _U_)
{
guint offset = 0;
while(offset < tvb_reported_length(tvb)) {
@ -2985,7 +2986,7 @@ static void dissect_cstr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/* we ran out of data: ask for more */
pinfo->desegment_offset = offset;
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
return;
return (offset + available);
}
col_set_str(pinfo->cinfo, COL_INFO, "C String");
@ -3001,6 +3002,7 @@ static void dissect_cstr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/* if we get here, then the end of the tvb coincided with the end of a
string. Happy days. */
return tvb_captured_length(tvb);
}
This simple dissector will repeatedly return DESEGMENT_ONE_MORE_SEGMENT