diff options
author | Anders Broman <anders.broman@ericsson.com> | 2005-10-10 20:38:28 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2005-10-10 20:38:28 +0000 |
commit | 3f7ed7c2a2bcf4e5bdcf759f668758113e833673 (patch) | |
tree | da7b41d82f4240e595096fb9ae475f98b89c7300 | |
parent | b12b8769887e92f3a9e3985ec2e012ee5d860da5 (diff) | |
download | wireshark-3f7ed7c2a2bcf4e5bdcf759f668758113e833673.tar.gz wireshark-3f7ed7c2a2bcf4e5bdcf759f668758113e833673.tar.bz2 wireshark-3f7ed7c2a2bcf4e5bdcf759f668758113e833673.zip |
Fix problems with bitstring:
- dissect_per_bitstring needs to know if extention exists or not.
- Fixes for bitstring sizes up to 16 ( where max = min ).
svn path=/trunk/; revision=16181
-rw-r--r-- | asn1/h245/h245.cnf | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h225.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-h225.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h235.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-h245.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h450.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h450.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 2 | ||||
-rwxr-xr-x | tools/asn2eth.py | 2 |
10 files changed, 31 insertions, 24 deletions
diff --git a/asn1/h245/h245.cnf b/asn1/h245/h245.cnf index 07d9db1fdd..14ca9a9610 100644 --- a/asn1/h245/h245.cnf +++ b/asn1/h245/h245.cnf @@ -92,7 +92,7 @@ OpenLogicalChannel pending->fw_channel_params = h223_fw_lc_params; pending->rev_channel_params = h223_rev_lc_params; temp = h223_fw_lc_num; - if (pinfo->p2p_dir) + if (pinfo->p2p_dir > -1) g_hash_table_insert(h223_pending_olc_reqs[pinfo->p2p_dir], GINT_TO_POINTER(temp), pending); } #.END diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index c4c1c27af0..0e2b447723 100644 --- a/epan/dissectors/packet-h225.c +++ b/epan/dissectors/packet-h225.c @@ -3810,7 +3810,7 @@ static int dissect_almostOutOfResources(tvbuff_t *tvb, int offset, packet_info * static int dissect_h225_BIT_STRING_SIZE_32(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - 32, 32); + 32, 32, FALSE); return offset; } @@ -6899,7 +6899,7 @@ static int dissect_integrity_item(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_h225_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - -1, -1); + -1, -1, FALSE); return offset; } diff --git a/epan/dissectors/packet-h225.h b/epan/dissectors/packet-h225.h index 68a98bd1f4..95ed26dad0 100644 --- a/epan/dissectors/packet-h225.h +++ b/epan/dissectors/packet-h225.h @@ -1,6 +1,6 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Ethereal dissector compiler */ -/* ./packet-h225.h */ +/* .\packet-h225.h */ /* ../../tools/asn2eth.py -X -e -p h225 -c h225.cnf -s packet-h225-template h225.asn */ /* Input file: packet-h225-template.h */ diff --git a/epan/dissectors/packet-h235.c b/epan/dissectors/packet-h235.c index 95703219e9..cb9a36f03e 100644 --- a/epan/dissectors/packet-h235.c +++ b/epan/dissectors/packet-h235.c @@ -239,7 +239,7 @@ static int dissect_sendersID(tvbuff_t *tvb, int offset, packet_info *pinfo, prot static int dissect_h235_KeyMaterial(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - 1, 2048); + 1, 2048, FALSE); return offset; } @@ -328,7 +328,7 @@ static int dissect_nonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h235_BIT_STRING_SIZE_0_2048(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - 0, 2048); + 0, 2048, FALSE); return offset; } @@ -366,7 +366,7 @@ static int dissect_dhkey(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h235_BIT_STRING_SIZE_0_511(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - 0, 511); + 0, 511, FALSE); return offset; } @@ -681,7 +681,7 @@ static int dissect_sharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, p static int dissect_h235_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - -1, -1); + -1, -1, FALSE); return offset; } diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c index 7187c3c62f..b3bf878401 100644 --- a/epan/dissectors/packet-h245.c +++ b/epan/dissectors/packet-h245.c @@ -10628,7 +10628,7 @@ static int dissect_certificateResponse(tvbuff_t *tvb, int offset, packet_info *p static int dissect_h245_BIT_STRING_SIZE_1_65535(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index, - 1, 65535); + 1, 65535, FALSE); return offset; } diff --git a/epan/dissectors/packet-h450.c b/epan/dissectors/packet-h450.c index ac8cb0e463..2885df4910 100644 --- a/epan/dissectors/packet-h450.c +++ b/epan/dissectors/packet-h450.c @@ -1,6 +1,6 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Ethereal dissector compiler */ -/* ./packet-h450.c */ +/* .\packet-h450.c */ /* ../../tools/asn2eth.py -X -e -p h450 -c h450.cnf -s packet-h450-template h4501.asn */ /* Input file: packet-h450-template.c */ diff --git a/epan/dissectors/packet-h450.h b/epan/dissectors/packet-h450.h index b8c32c18b8..8f2f90d1c4 100644 --- a/epan/dissectors/packet-h450.h +++ b/epan/dissectors/packet-h450.h @@ -1,6 +1,6 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Ethereal dissector compiler */ -/* ./packet-h450.h */ +/* .\packet-h450.h */ /* ../../tools/asn2eth.py -X -e -p h450 -c h450.cnf -s packet-h450-template h4501.asn */ /* Input file: packet-h450-template.h */ diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index b7c881ba2c..0e6b70f78a 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -59,6 +59,7 @@ static int hf_per_object_identifier_length = -1; static int hf_per_open_type_length = -1; static int hf_per_octet_string_length = -1; static int hf_per_bit_string_length = -1; +static int hf_per_const_int_len; static gint ett_per_sequence_of_item = -1; @@ -928,6 +929,8 @@ DEBUG_ENTRY("dissect_per_constrained_integer"); num_bytes=(num_bytes<<1)|bit; num_bytes++; /* lower bound for length determinant is 1 */ + if (display_internal_per_fields) + proto_tree_add_uint(tree, hf_per_const_int_len, tvb, (offset>>3), 1, num_bytes); /* byte aligned */ BYTE_ALIGN_OFFSET(offset); @@ -1276,7 +1279,7 @@ DEBUG_ENTRY("dissect_per_sequence"); */ guint32 -dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) +dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension) { guint32 length; header_field_info *hfi; @@ -1301,22 +1304,24 @@ DEBUG_ENTRY("dissect_per_bit_string"); gboolean bit; bytes[0]=bytes[1]=bytes[2]=0; - for(i=0;i<min_len;i++){ - offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL); - bytes[0]=(bytes[0]<<1)|bit; + if(min_len<=8){ + for(i=0;i<min_len;i++){ + offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL); + bytes[0]=(bytes[0]<<1)|bit; + } } if(min_len>8){ + for(i=0;i<8;i++){ + offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL); + bytes[0]=(bytes[0]<<1)|bit; + } for(i=8;i<min_len;i++){ offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL); bytes[1]=(bytes[1]<<1)|bit; } - if(min_len<16){ - bytes[1]|=bytes[0]<<(min_len-8); - bytes[0]>>=16-min_len; - } } if (hfi) { - proto_tree_add_bytes(tree, hf_index, tvb, old_offset>>3, (min_len+7)/8+((offset&0x07)?1:0), bytes); + proto_tree_add_bytes(tree, hf_index, tvb, old_offset>>3, (min_len+7)/8, bytes); } return offset; } @@ -1339,7 +1344,7 @@ DEBUG_ENTRY("dissect_per_bit_string"); offset=dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_per_bit_string_length, min_len, max_len, - &length, &pi, FALSE); + &length, &pi, has_extension); if (!display_internal_per_fields) PROTO_ITEM_SET_HIDDEN(pi); } else { offset=dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_bit_string_length, &length); @@ -1511,8 +1516,10 @@ proto_register_per(void) { &hf_per_bit_string_length, { "Bit String Length", "per.bit_string_length", FT_UINT32, BASE_DEC, NULL, 0, "Number of bits in the Bit String", HFILL }}, + { &hf_per_const_int_len, + { "Constrained Integer Length", "per._const_int_len", FT_UINT32, BASE_DEC, + NULL, 0, "Number of bytes in the Constrained Integer", HFILL }}, }; - static gint *ett[] = { &ett_per_sequence_of_item diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 93d7f1f23a..a0856589a8 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -103,7 +103,7 @@ extern guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, packet_info * extern guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, tvbuff_t **value_tvb); -extern guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len); +extern guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension); extern guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb); diff --git a/tools/asn2eth.py b/tools/asn2eth.py index e6fafb14a6..3d4121767a 100755 --- a/tools/asn2eth.py +++ b/tools/asn2eth.py @@ -3246,7 +3246,7 @@ class BitStringType (Type): elif (ectx.OPer()): body = ectx.eth_fn_call('dissect_%(ER)s_bit_string', ret='offset', par=(('%(TVB)s', '%(OFFSET)s', '%(PINFO)s', '%(TREE)s', '%(HF_INDEX)s'), - ('%(MIN_VAL)s', '%(MAX_VAL)s',),)) + ('%(MIN_VAL)s', '%(MAX_VAL)s','%(EXT)s'),)) else: body = '#error Can not decode %s' % (tname) return body |