BER: Add a function to add a BER encoded boilerplate.

This commit is contained in:
Anders Broman 2022-03-28 18:09:11 +02:00 committed by A Wireshark GitLab Utility
parent 499a33c709
commit 2c5f2ac6f3
4 changed files with 21 additions and 6 deletions

View File

@ -165,6 +165,7 @@ dissect_goose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
item = proto_tree_add_item(parent_tree, proto_goose, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_goose);
add_ber_encoded_label(tvb, pinfo, parent_tree);
/* APPID */

View File

@ -111,6 +111,7 @@ static gint hf_ber_single_ASN1_type = -1; /* T_single_ASN1_type */
static gint hf_ber_octet_aligned = -1; /* OCTET_STRING */
static gint hf_ber_arbitrary = -1; /* BIT_STRING */
static gint hf_ber_extra_data = -1;
static gint hf_ber_encoding_boiler_plate = -1;
/* Generated from convert_proto_tree_add_text.pl */
static int hf_ber_seq_of_eoc = -1;
@ -321,6 +322,16 @@ static const fragment_items octet_string_frag_items = {
"OCTET STRING fragments"
};
void
add_ber_encoded_label(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree)
{
proto_item *ti;
ti = proto_tree_add_item(tree, hf_ber_encoding_boiler_plate, tvb, 0, -1, ENC_NA);
proto_item_set_generated(ti);
}
static void *
oid_copy_cb(void *dest, const void *orig, size_t len _U_)
{
@ -4412,9 +4423,9 @@ proto_register_ber(void)
{ &hf_ber_choice_eoc, { "CHOICE EOC", "ber.choice_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_ber_seq_of_eoc, { "SEQ OF EOC", "ber.seq_of_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_ber_64bit_uint_as_bytes, { "64bits unsigned integer", "ber.64bit_uint_as_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_ber_encoding_boiler_plate, { "BER encoded protocol, to see BER internal fields set protocol BER preferences", "ber.encoding_boiler_plate", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
};
static gint *ett[] = {
&ett_ber_octet_string,
&ett_ber_reassembled_octet_string,

View File

@ -191,5 +191,7 @@ void ber_decode_as_foreach(GHFunc func, gpointer user_data); /* iterate through
WS_DLL_PUBLIC
gboolean oid_has_dissector(const char *oid);
WS_DLL_PUBLIC
void add_ber_encoded_label(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree);
#endif /* __PACKET_BER_H__ */

View File

@ -520,7 +520,7 @@ dissect_goose_GSEMngtPdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_goose_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 31 "./asn1/goose/goose.cnf"
#line 33 "./asn1/goose/goose.cnf"
guint32 len;
guint32 seconds;
@ -564,7 +564,7 @@ dissect_goose_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
static int
dissect_goose_T_simulation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 14 "./asn1/goose/goose.cnf"
#line 16 "./asn1/goose/goose.cnf"
gboolean value;
guint32 len = tvb_reported_length_remaining(tvb, offset);
int origin_offset = offset;
@ -622,7 +622,7 @@ dissect_goose_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_goose_FloatingPoint(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 68 "./asn1/goose/goose.cnf"
#line 70 "./asn1/goose/goose.cnf"
int len = tvb_reported_length_remaining(tvb, offset);
@ -848,6 +848,7 @@ dissect_goose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
item = proto_tree_add_item(parent_tree, proto_goose, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_goose);
add_ber_encoded_label(tvb, pinfo, parent_tree);
/* APPID */
@ -1486,7 +1487,7 @@ void proto_register_goose(void) {
"UtcTime", HFILL }},
/*--- End of included file: packet-goose-hfarr.c ---*/
#line 566 "./asn1/goose/packet-goose-template.c"
#line 567 "./asn1/goose/packet-goose-template.c"
};
/* List of subtrees */
@ -1522,7 +1523,7 @@ void proto_register_goose(void) {
&ett_goose_Data,
/*--- End of included file: packet-goose-ettarr.c ---*/
#line 580 "./asn1/goose/packet-goose-template.c"
#line 581 "./asn1/goose/packet-goose-template.c"
};
static ei_register_info ei[] = {