change it to
if (!initialized) {
data_handle = find_dissector("data");
helen_handle = create_dissector_handle(dissect_helen,
proto_helen);
for (i = 0; i < 25; i++) {
dissector_add("udp.port", ports[i], helen_handle);
}
}
You also shouldnt hardcode the size of the array in the for loop like
that, use something like sizeof[ports] / sizeof(ports[0])
instead.
On Tue, Mar 23, 2010 at 9:30 AM, Brian Oleksa
<oleksab@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Olivier
>
> Yes...looks like I do. Any thoughts on how I can fix this..??
>
> Thanks,
> Brian
>
> void proto_reg_handoff_helen(void) {
> static gboolean initialized = FALSE;
>
> int i;
>
> for (i = 0; i < 25; i++) {
>
> if (!initialized) {
> data_handle = find_dissector("data");
> helen_handle = create_dissector_handle(dissect_helen,
> proto_helen);
> dissector_add("udp.port", ports[i], helen_handle);
> }
> }
> initialized = TRUE;
> }
>
>
>
> wsgd wrote:
>> Perhaps you call create_dissector_handle for each port ?
>>
>> Olivier
>>
>> Brian Oleksa a écrit :
>>
>>> Guy
>>>
>>> Actually....this is what I am doing:
>>>
>>> dissector_add("udp.port", ports[i], helen_handle);
>>>
>>> Where ports has a list of port numbers in it.
>>>
>>> static int ports[25] = {5136, 5000, 5220, 42250, 50000, 5221, 5222,
>>> 49901, 49501, 49510, 42251, 42250, 5226, 47001, 5227, 7636, 59201,
>>> 59202, 59203, 59204, 59205, 59206, 59207, 59209, 59210};
>>>
>>> Is this a problem..?? How do I get around this..??
>>>
>>> Thanks,
>>> Brian
>>>
>>>
>>>
>>> Guy Harris wrote:
>>>
>>>
>>>> On Mar 22, 2010, at 1:04 PM, Brian Oleksa wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> When I right click on a packet and select decode as....under the
>>>>> transport tab... there is like 14 of my protocols in the selection box.
>>>>> (so I see the word HELEN 14 times in a row)
>>>>>
>>>>> Does anybody know why this is..??
>>>>>
>>>>>
>>>>>
>>>> You're only calling dissector_add() or dissector_add_handle() once, right? You're not calling it, for example, every time a preference is set?
>>>> ___________________________________________________________________________
>>>> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
>>>> Archives: http://www.wireshark.org/lists/wireshark-dev
>>>> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>>>> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>>>>
>>>>
>>>>
>>> ___________________________________________________________________________
>>> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
>>> Archives: http://www.wireshark.org/lists/wireshark-dev
>>> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>>> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>>>
>>>
>>>
>>>
>>
>>
>>
> ___________________________________________________________________________
> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives: http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>