This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Use last dissector data

0

Hi,

I´m developing a plugin for TUP, and to decode the CIC field i need to use the last byte from the previous dissector (MTP3 in my case), as it´s last four bits are part of the 12 bit CIC field from my TUP messages.. I need to , somehow, "share" this last byte between the dissectors How can i do that?

Thanks,

asked 17 May '13, 10:15

Renan's gravatar image

Renan
26448
accept rate: 0%


One Answer:

1

A common way to solve this problem is to store the needed value in the "private_data" field of pinfo. For example the MTP3 dissector used to do this to pass the SI down to subdissectors:

/* Store the SI so that subidissectors know what SI this msg is */   
*pd_save = pinfo->private_data;      
pinfo->private_data = GUINT_TO_POINTER(sio & SERVICE_INDICATOR_MASK);

(A better solution to passing the SI was found and implemented in r45788. That means the private_data field could be used for passing the SLS to TUP.)

A newer (and probably better) way to solve this problem is to pass the data directly. This could be done by calling dissector_try_uint_new() in packet-mtp3.c (and passing the SLS as the 'data' argument) and then using the (now normally unused) 'data' parameter of new-style dissectors (new_dissector_t) and heuristic dissectors.

answered 17 May '13, 11:23

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

[Original comment moved to the new question.]

Also: this is a Q&A site not a forum so if an answer answers your question, please mark the answer as accepted (by checking the checkbox next to the answer).

(21 May '13, 10:43) JeffMorriss ♦