ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] header field arrays

From: "Jonathan Walker (c)" <JWalker@xxxxxxxxxxxx>
Date: Thu, 18 Jun 2009 15:11:58 -0700
It wasn't giving the specific error, which is why it was so hard to debug.

It's not causing me problems anymore though.  I made the array into a pointer instead, and allocated the same amount of memory to the pointer, and for some reason it fixed the problem.

I don't know why the array was causing problems.  Still trying to figure that out.

Thanks,
J. Walker

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Thursday, June 18, 2009 5:03 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] header field arrays


On Jun 18, 2009, at 1:43 PM, Jonathan Walker (c) wrote:

>    When creating and registering a new header field array in a plug- 
> in, does the size of the array have to be exactly the same as the  
> number of used fields?

No.  This is C, not PL/I :-), so if you pass an array (which really  
means passing a pointer to the first element of the array) to a  
function, the function has no idea how big the array actually is.

> For example, I created a hf array as follows:
>
>       static hf_register_info hf[MAX_FIELDS];
>
> I plan to fill up a certain variable amount of fields (up to  
> "cur_field") less than MAX_FIELDS, and then register the first  
> cur_field amount of values of the array as follows:
>
>       proto_register_field_array(proto_shsip, hf, cur_field);
>
> However, I'm getting a run-time error upon trying to click a field  
> in Wireshark, and I was wondering if this is the problem.

Probably not.  What is the run-time error?
___________________________________________________________________________
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