diff options
author | Michael Mann <mmann78@netscape.net> | 2015-09-05 09:55:03 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-09-20 18:08:01 +0000 |
commit | 8626bb4cbb4d9926f7b56663585d9ef66252f93f (patch) | |
tree | 8158efe2226f7d70ac3a57099e224fcb2a1b34d9 /epan/dissectors/packet-csn1.h | |
parent | 4ec8a06caed461d0e22c315e9d91dcb24870d733 (diff) |
Make CSN.1 dissectors more filterable.
The intent here is to remove proto_tree_add_text from packet-csn1.c, but the macros setup means A LOT more hf fields needs to be created.
Many of those new hf fields were created with a perl script
Bug: 11504
Change-Id: If12c7677185f18a7f684fd3746397be92b56b36d
Reviewed-on: https://code.wireshark.org/review/10391
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-csn1.h')
-rw-r--r-- | epan/dissectors/packet-csn1.h | 154 |
1 files changed, 79 insertions, 75 deletions
diff --git a/epan/dissectors/packet-csn1.h b/epan/dissectors/packet-csn1.h index 058cde0c13..fe2741a24d 100644 --- a/epan/dissectors/packet-csn1.h +++ b/epan/dissectors/packet-csn1.h @@ -26,6 +26,8 @@ #ifndef _PACKET_CSN1_H_ #define _PACKET_CSN1_H_ +#include <epan/expert.h> + /* Error codes */ #define CSN_OK 0 #define CSN_ERROR_GENERAL -1 @@ -62,6 +64,7 @@ typedef struct { gint remaining_bits_len; /* IN to an csn stream operation */ gint bit_offset; /* IN/OUT to an csn stream operation */ + packet_info* pinfo; } csnStream_t; typedef gint16 (*StreamSerializeFcn_t)(proto_tree *tree, csnStream_t* ar, tvbuff_t *tvb, void* data, int ett_csn1); @@ -184,12 +187,12 @@ typedef struct size_t offset; gboolean may_be_null; const char* sz; - union - { - void * dummy; /* to eliminate --pedantic compiler warnings */ - guint32 value; - int* hf_ptr; - } format_p; + expert_field* error; + guint32 value; + int* hf_ptr; + /* used in M_REC_ARRAY to distinguish between "field" and "field exists", + it's not used on fields that just "exist" */ + int* hf_exist_ptr; void_fn_t aux_fn; } CSN_DESCR; @@ -201,7 +204,7 @@ typedef struct CSN_DESCR descr; } CSN_ChoiceElement_t; -void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount); +void csnStreamInit(csnStream_t* ar, gint BitOffset, gint BitCount, packet_info* pinfo); /****************************************************************************** * FUNCTION: csnStreamDissector @@ -226,7 +229,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD CSN_DESCR CSNDESCR_##_STRUCT[] = { #define CSN_DESCR_END(_STRUCT)\ - {CSN_END, 0, {0}, 0, FALSE, "", {NULL}, NULL} }; + {CSN_END, 0, {0}, 0, FALSE, "", NULL, 0, NULL, NULL, NULL} }; /****************************************************************************** * CSN_ERROR(Par1, Par2, Par3) @@ -236,8 +239,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par2: free text which will appear in the error handler * Par3: Error code *****************************************************************************/ -#define CSN_ERROR(_STRUCT, _Text, _ERRCODE)\ - {CSN_TRAP_ERROR, _ERRCODE, {_Text}, 0, FALSE, _Text, {NULL}, NULL} +#define CSN_ERROR(_STRUCT, _Text, _ERRCODE, _EI_ERROR)\ + {CSN_TRAP_ERROR, _ERRCODE, {_Text}, 0, FALSE, _Text, _EI_ERROR, 0, NULL, NULL, NULL} /****************************************************************************** * M_BIT(Par1, Par2, Par3) @@ -247,7 +250,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: pointer to the header field *****************************************************************************/ #define M_BIT(_STRUCT, _MEMBER, _HF_PTR)\ - {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *)_HF_PTR}, NULL} + {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_BIT_OR_NULL(Par1, Par2, Par3) @@ -257,7 +260,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Covers the case {null | 0 | 1} *****************************************************************************/ #define M_BIT_OR_NULL(_STRUCT, _MEMBER, _HF_PTR)\ - {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(int *) _HF_PTR}, NULL} + {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_NEXT_EXIST(Par1, Par2, Par3) * Indicates whether the next element or a group of elements defined in the @@ -267,8 +270,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: number of lines to skip in the CSN_DESCR type specified if the * element(s) does not exist *****************************************************************************/ -#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\ + {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_NEXT_EXIST_LH(Par1, Par2, Par3) @@ -277,8 +280,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * present in the message, the logical operation XOR with the background * pattern 0x2B is performed on the read bit before the decision is made. *****************************************************************************/ -#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\ + {CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_NEXT_EXIST_OR_NULL(Par1, Par2, Par3) @@ -287,8 +290,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * message. * Covers the case {null | 0 | 1 < IE >} *****************************************************************************/ -#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {NULL}, NULL} +#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\ + {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_NEXT_EXIST_OR_NULL_LH(Par1, Par2, Par3) @@ -297,8 +300,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * the message. * Covers the case {null | L | H < IE >} *****************************************************************************/ -#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {NULL}, NULL} +#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\ + {CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT(Par1, Par2, Par3, Par4) @@ -309,7 +312,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: pointer to the header field *****************************************************************************/ #define M_UINT(_STRUCT, _MEMBER, _BITS, _HF_PTR)\ - {CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *)_HF_PTR}, NULL} + {CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT_SPLIT(Par1, Par2, Par3, Par4) @@ -321,7 +324,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: pointer to the header field *****************************************************************************/ #define M_SPLIT_BITS(_STRUCT, _MEMBER, _SPEC, _BITS, _HF_PTR)\ - {CSN_SPLIT_BITS, _BITS, {_SPEC}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL} + {CSN_SPLIT_BITS, _BITS, {_SPEC}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_NULL_SPLIT(Par1, Par2, Par3, Par4) @@ -332,7 +335,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: segment number (0 based) *****************************************************************************/ #define M_BITS_CRUMB(_STRUCT, _MEMBER, _SPEC, _SEG, _HF_PTR)\ - {CSN_SPLIT_BITS_CRUMB, _SEG, {_SPEC}, 0, FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL} + {CSN_SPLIT_BITS_CRUMB, _SEG, {_SPEC}, 0, FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT_OR_NULL(Par1, Par2, Par3, Par4) @@ -342,7 +345,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Covers the case {null | 0 | 1 < IE >} *****************************************************************************/ #define M_UINT_OR_NULL(_STRUCT, _MEMBER, _BITS, _HF_PTR)\ - {CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(int *) _HF_PTR}, NULL} + {CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT_LH(Par1, Par2, Par3, Par4) @@ -352,7 +355,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * received CSN.1 message *****************************************************************************/ #define M_UINT_LH(_STRUCT, _MEMBER, _BITS, _HF_PTR)\ - {CSN_UINT_LH, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL} + {CSN_UINT_LH, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT_OFFSET(Par1, Par2, Par3, Par4) @@ -362,8 +365,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: number of bits used to code the element (between 1 and 32) * Par4: value added to the returned integer (offset) *****************************************************************************/ -#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET)\ - {CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET, _HF_PTR)\ + {CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UINT_ARRAY(Par1, Par2, Par3, Par4) @@ -373,8 +376,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: number of bits used to code the each integer element (between 1 and 32) * Par4: number of elements in the array (fixed integer value) *****************************************************************************/ -#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount)\ - {CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount, _HF_PTR)\ + {CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_VAR_UINT_ARRAY(Par1, Par2, Par3, Par4) @@ -385,8 +388,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: number of elements in the array supplied by reference to the * structure member holding the length value *****************************************************************************/ -#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField)\ - {CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)1}, NULL} +#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField, _HF_PTR)\ + {CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 1, _HF_PTR, NULL, NULL} /****************************************************************************** * M_VAR_ARRAY(Par1, Par2, Par3, Par4) @@ -396,8 +399,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: name of the structure member holding the size of the array * Par4: offset that is added to the Par3 to get the actual size of the array *****************************************************************************/ -#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\ + {CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_VAR_TARRAY(Par1, Par2, Par3, Par4) @@ -408,14 +411,14 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: name of the structure member holding the size of the array *****************************************************************************/ #define M_VAR_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} + {CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL} /****************************************************************************** * M_VAR_TARRAY_OFFSET(Par1, Par2, Par3, Par4) * Same as M_VAR_TARRAY with offset *****************************************************************************/ #define M_VAR_TARRAY_OFFSET(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} + {CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL} /****************************************************************************** * M_REC_ARRAY(Par1, Par2, Par3, Par4) @@ -432,8 +435,9 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * array will be stored * Par4: length of each element in bits *****************************************************************************/ -#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS)\ - {CSN_RECURSIVE_ARRAY, _BITS, {(const void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +/* XXX - need 2 hf support */ +#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS, _HF_PTR, _HF_PTR_EXIST)\ + {CSN_RECURSIVE_ARRAY, _BITS, {(const void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, _HF_PTR_EXIST, NULL} /****************************************************************************** * M_VAR_TYPE_ARRAY(Par1, Par2, Par3, Par4) @@ -444,7 +448,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: number of elements in the array (fixed integer value) *****************************************************************************/ #define M_TYPE_ARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCount)\ - {CSN_TYPE_ARRAY, _ElementCount, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} + {CSN_TYPE_ARRAY, _ElementCount, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL} /****************************************************************************** * M_REC_TARRAY(Par1, Par2, Par3, Par4) @@ -455,16 +459,16 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: name of the structure * Par4: will hold the number of element in the array after unpacking *****************************************************************************/ -#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} +#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField, _HF_PTR)\ + {CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), _HF_PTR, NULL, NULL} /****************************************************************************** * M_REC_TARRAY1(Par1, Par2, Par3, Par4) * Same as M_REC_TARRAY but first element always exist: * <list> ::= <type> {1 <type>} ** 0 ; *****************************************************************************/ -#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} +#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField, _HF_PTR)\ + {CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), _HF_PTR, NULL, NULL} /****************************************************************************** * M_REC_TARRAY2(Par1, Par2, Par3, Par4) @@ -472,7 +476,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * <lists> ::= <type> { 0 <type> } ** 1 ; *****************************************************************************/ #define M_REC_TARRAY_2(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL} + {CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL} /****************************************************************************** * M_TYPE(Par1, Par2, Par3) @@ -483,7 +487,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: type of member *****************************************************************************/ #define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\ - {CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} + {CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL} /****************************************************************************** * M_TYPE_LABEL(Par1, Par2, Par3, Par4) @@ -495,7 +499,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par4: C string for the text *****************************************************************************/ #define M_TYPE_LABEL(_STRUCT, _MEMBER, _MEMBER_TYPE, _LABEL)\ - {CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, _LABEL, {NULL}, NULL} + {CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, _LABEL, NULL, 0, NULL, NULL, NULL} /****************************************************************************** * M_UNION(Par1, Par2) @@ -507,15 +511,15 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par1: C structure name * Par2: number of possible choice in the union *****************************************************************************/ -#define M_UNION(_STRUCT, _COUNT)\ - {CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", {NULL}, NULL} +#define M_UNION(_STRUCT, _COUNT, _HF_PTR)\ + {CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_UNION_LH(Par1, Par2) * Same as M_UNION but masked with background value 0x2B *****************************************************************************/ -#define M_UNION_LH(_STRUCT, _COUNT)\ - {CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", {NULL}, NULL} +#define M_UNION_LH(_STRUCT, _COUNT, _HF_PTR)\ + {CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_CHOICE(Par1, Par2, Par3, Par4) @@ -543,16 +547,16 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * the variable pointed out by the _MEMBER * Par4: number of possible choices in the union *****************************************************************************/ -#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\ - {CSN_CHOICE, _ElementCount, {(const void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, #_CHOICE, {NULL}, NULL} +#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount, _HF_PTR)\ + {CSN_CHOICE, _ElementCount, {(const void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, #_CHOICE, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_CHOICE_IL(Par1, Par2, Par3, Par4) * See M_CHOICE above, but displayed inline (i.e. no specific elements are * displayed to show there was a choice *****************************************************************************/ -#define M_CHOICE_IL(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\ - {CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, {NULL}, NULL} +#define M_CHOICE_IL(_STRUCT, _MEMBER, _CHOICE, _ElementCount, _HF_PTR)\ + {CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_FIXED(Par1, Par2, Par3) @@ -563,8 +567,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par3: the value of the number. If the expected value is not present in * the message the unpacking procedure is aborted *****************************************************************************/ -#define M_FIXED(_STRUCT, _BITS, _BITVALUE)\ - {CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, #_BITVALUE, {NULL}, NULL} +#define M_FIXED(_STRUCT, _BITS, _BITVALUE, _HF_PTR)\ + {CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, #_BITVALUE, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_FIXED_LABEL(Par1, Par2, Par3, Par4) @@ -575,8 +579,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * the message the unpacking procedure is aborted * Par4: C string for the text *****************************************************************************/ -#define M_FIXED_LABEL(_STRUCT, _BITS, _BITVALUE, _LABEL)\ - {CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, {NULL}, NULL} +#define M_FIXED_LABEL(_STRUCT, _BITS, _BITVALUE, _LABEL, _HF_PTR)\ + {CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, NULL, 0, _HF_PTR, NULL, NULL} /****************************************************************************** * M_SERIALIZE(Par1, Par2, Par3) @@ -588,11 +592,11 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * data to or from the message is finished by the function the CSNstream gets * back control over the data stream and continues to work with the message. *****************************************************************************/ -#define M_SERIALIZE(_STRUCT, _MEMBER, _LENGTH_LEN, _SERIALIZEFCN)\ - {CSN_SERIALIZE, _LENGTH_LEN, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, (void_fn_t)_SERIALIZEFCN} +#define M_SERIALIZE(_STRUCT, _MEMBER, _LENGTH_LEN, _HF_PTR, _SERIALIZEFCN)\ + {CSN_SERIALIZE, _LENGTH_LEN, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, (void_fn_t)_SERIALIZEFCN} #define M_CALLBACK(_STRUCT, _CSNCALLBACKFCN, _PARAM1, _PARAM2)\ - {CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {0}, offsetof(_STRUCT, _PARAM2), FALSE, "CallBack_"#_CSNCALLBACKFCN, {NULL}, (void_fn_t)_CSNCALLBACKFCN} + {CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {0}, offsetof(_STRUCT, _PARAM2), FALSE, "CallBack_"#_CSNCALLBACKFCN, NULL, 0, NULL, NULL, (void_fn_t)_CSNCALLBACKFCN} /****************************************************************************** * M_BITMAP(Par1, Par2, Par3) @@ -602,43 +606,43 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD * Par2: C structure element name * Par3: length of the bitmap expressed in bits *****************************************************************************/ -#define M_BITMAP(_STRUCT, _MEMBER, _BITS)\ - {CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_BITMAP(_STRUCT, _MEMBER, _BITS, _HF_PTR)\ + {CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /* variable length, right aligned bitmap i.e. _ElementCountField = 11 => 00000111 11111111 */ -#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\ + {CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /* variable length, right aligned bitmap filling the rest of message * - when unpacking the _ElementCountField will be set in runtime * - when packing _ElementCountField contains the size of bitmap */ #define M_VAR_BITMAP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} + {CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL} /* variable length, left aligned bitmap i.e. _ElementCountField = 11 => 11111111 11100000 */ -#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} +#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\ + {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL} /* variable length, left aligned bitmap filling the rest of message *- when unpacking the _ElementCountField will be set in runtime * - when packing _ElementCountField contains the size of bitmap */ #define M_LEFT_VAR_BMP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} + {CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL} /* todo: dissect padding bits looking for unexpected extensions */ -#define M_PADDING_BITS(_STRUCT)\ - {CSN_PADDING_BITS, 0, {0}, 0, TRUE, "Padding", {NULL}, NULL} +#define M_PADDING_BITS(_STRUCT, _HF_PTR)\ + {CSN_PADDING_BITS, 0, {0}, 0, TRUE, "Padding", NULL, 0, _HF_PTR, NULL, NULL} #define M_NULL(_STRUCT, _MEMBER, _SKIP_BITS)\ - {CSN_NULL, _SKIP_BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL} + {CSN_NULL, _SKIP_BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL} -#define M_THIS_EXIST(_STRUCT)\ - {CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", {NULL}, NULL} +#define M_THIS_EXIST(_STRUCT, _HF_PTR)\ + {CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", NULL, 0, _HF_PTR, NULL, NULL} -#define M_THIS_EXIST_LH(_STRUCT)\ - {CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", {NULL}, NULL} +#define M_THIS_EXIST_LH(_STRUCT, _HF_PTR)\ + {CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", NULL, 0, _HF_PTR, NULL, NULL} /* return value 0 if ok else discontionue the unpacking */ typedef gint16 (*CsnCallBackFcn_t)(void* pv ,...); |