Wireshark mailing list archives
Re: How to get a header_field_info instance from its id?
From: Jakub Zawadzki <darkjames-ws () darkjames pl>
Date: Wed, 19 Aug 2015 17:54:44 +0200
Hi, W dniu 19.08.2015 16:45, yves baumes napisaĆ(a):
My first one would be: how do I get the header_field_info structure instance from its structure id? Here is what I'm trying to achieve: static int hf_instr_id = -1; [...] { &hf_instr_id, { "Instrument Identifier", "my_proto.instr_id", FT_UINT64, BASE_DEC, NULL, 0x00, "[...]", HFILL } }, [...] ptvcursor_add(cursor, hf_instr_id, 8, ENC_LITTLE_ENDIAN); In the line just above I'd like to replace the length (which is 8) by something roughly looking like that: int len = ftype_len(gap_hfinfo.hfi[xxx]->type); ptvcursor_add(cursor, hf_instr_id, len, ENC_LITTLE_ENDIAN); One of my issue is that gap_hfinfo array (which contains all the header_fields_info instances) is static to the proto.c file. And I find no accessors to it. Is there an actual way that I've overlooked?
/** Get the header_field information based upon a field or protocol id. @param hfindex item # n (0-indexed) @return the registered item */ WS_DLL_PUBLIC header_field_info* proto_registrar_get_nth(guint hfindex); btw. there is also a proto_registrar_get_length() function, which do what you want (ftype_len(...)->type). Cheers, Jakub. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- How to get a header_field_info instance from its id? yves baumes (Aug 19)
- Re: How to get a header_field_info instance from its id? mmann78 (Aug 19)
- Re: How to get a header_field_info instance from its id? Jakub Zawadzki (Aug 19)