diff options
author | Anders Broman <anders.broman@ericsson.com> | 2007-06-12 21:29:27 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2007-06-12 21:29:27 +0000 |
commit | 58f01d87ccb0cce46b1ce2146d42615f85880ec4 (patch) | |
tree | a48a0c152883318edbc45eb20ff697f3815fab67 /epan | |
parent | 930c097b1041f5358e7f4a2fdce451138eec1170 (diff) |
Preparations for updated CMIP dissector:
- Export AE-title from ACSE
- Start REAL dissection(unfinished).
svn path=/trunk/; revision=22083
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-acse.c | 26 | ||||
-rw-r--r-- | epan/dissectors/packet-acse.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.c | 68 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.h | 1 |
4 files changed, 84 insertions, 13 deletions
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c index 62c9076e09..a4248db5a2 100644 --- a/epan/dissectors/packet-acse.c +++ b/epan/dissectors/packet-acse.c @@ -324,7 +324,7 @@ static int dissect_direct_reference(proto_tree *tree _U_, tvbuff_t *tvb _U_, int static int dissect_acse_T_indirect_reference(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 83 "acse.cnf" +#line 84 "acse.cnf" char *oid; offset = dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_acse_indirect_reference, @@ -364,7 +364,7 @@ static int dissect_data_value_descriptor(proto_tree *tree _U_, tvbuff_t *tvb _U_ static int dissect_acse_T_single_ASN1_type(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 100 "acse.cnf" +#line 101 "acse.cnf" offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); @@ -443,7 +443,7 @@ static const ber_old_sequence_t EXTERNALt_sequence[] = { int dissect_acse_EXTERNALt(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 41 "acse.cnf" +#line 42 "acse.cnf" gint8 class; gboolean pc, ind_field; gint32 tag; @@ -505,7 +505,7 @@ static int dissect_ASO_context_name_list_item(proto_tree *tree _U_, tvbuff_t *tv static int dissect_acse_T_AARQ_aSO_context_name(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 67 "acse.cnf" +#line 68 "acse.cnf" offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset, hf_index, &object_identifier_id); @@ -794,7 +794,7 @@ static int dissect_other_mechanism_name(proto_tree *tree _U_, tvbuff_t *tvb _U_, static int dissect_acse_T_other_mechanism_value(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 61 "acse.cnf" +#line 62 "acse.cnf" offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree); @@ -1182,7 +1182,7 @@ static int dissect_aARE_protocol_version_impl(proto_tree *tree _U_, tvbuff_t *tv static int dissect_acse_T_AARE_aSO_context_name(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 71 "acse.cnf" +#line 72 "acse.cnf" offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset, hf_index, &object_identifier_id); @@ -1423,7 +1423,7 @@ static const value_string acse_Release_request_reason_vals[] = { static int dissect_acse_Release_request_reason(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 106 "acse.cnf" +#line 107 "acse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -1473,7 +1473,7 @@ static const value_string acse_Release_response_reason_vals[] = { static int dissect_acse_Release_response_reason(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 118 "acse.cnf" +#line 119 "acse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -1607,7 +1607,7 @@ static int dissect_simply_encoded_data(proto_tree *tree _U_, tvbuff_t *tvb _U_, static int dissect_acse_T_simple_ASN1_type(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 64 "acse.cnf" +#line 65 "acse.cnf" /*XXX not implemented yet */ @@ -1714,7 +1714,7 @@ static int dissect_adt_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset static int dissect_acse_T_ACRQ_aSO_context_name(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 75 "acse.cnf" +#line 76 "acse.cnf" offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset, hf_index, &object_identifier_id); @@ -1752,7 +1752,7 @@ static int dissect_acrq_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset static int dissect_acse_T_ACRP_aSO_context_name(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 79 "acse.cnf" +#line 80 "acse.cnf" offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset, hf_index, &object_identifier_id); @@ -1853,7 +1853,7 @@ static int dissect_ae_title_form2(proto_tree *tree _U_, tvbuff_t *tvb _U_, int o } -static const value_string acse_AE_title_vals[] = { +const value_string acse_AE_title_vals[] = { { 0, "ae-title-form1" }, { 1, "ae-title-form2" }, { 0, NULL } @@ -1865,7 +1865,7 @@ static const ber_old_choice_t AE_title_choice[] = { { 0, 0, 0, 0, NULL } }; -static int +int dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_old_choice(actx, tree, tvb, offset, AE_title_choice, hf_index, ett_acse_AE_title, diff --git a/epan/dissectors/packet-acse.h b/epan/dissectors/packet-acse.h index 9adb5eba12..c94df91838 100644 --- a/epan/dissectors/packet-acse.h +++ b/epan/dissectors/packet-acse.h @@ -39,10 +39,12 @@ #line 1 "packet-acse-exp.h" extern const value_string acse_AP_title_vals[]; extern const value_string acse_ASO_qualifier_vals[]; +extern const value_string acse_AE_title_vals[]; int dissect_acse_EXTERNALt(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); int dissect_acse_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); int dissect_acse_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); int dissect_acse_ASO_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); +int dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); int dissect_acse_AE_invocation_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); int dissect_acse_AP_invocation_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 96e6356b46..22dbab1b15 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -114,6 +114,8 @@ static gint hf_ber_encoding = -1; /* T_encoding */ 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_real_binary_encoding = -1; +static gint hf_ber_real_decimal_encoding = -1; static gint ett_ber_octet_string = -1; static gint ett_ber_unknown = -1; @@ -184,6 +186,16 @@ static const value_string ber_uni_tag_codes[] = { { 0, NULL } }; +static const true_false_string ber_real_binary_vals = { + "Binary encoding", + "Decimal encoding" +}; + +static const true_false_string ber_real_decimal_vals = { + "SpecialRealValue", + "Decimal encoding " +}; + typedef struct _da_data { GHFunc func; gpointer user_data; @@ -1213,8 +1225,55 @@ dissect_ber_boolean(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t } +/* 8.5 Encoding of a real value */ +/* NOT FULLY IMPLEMENTED !!!!!*/ +int +dissect_ber_real(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, double *value) +{ + gint8 class; + gboolean pc; + gint32 tag; + guint32 len; + guint8 encoding; + int start_offset; + start_offset = offset; + if(!implicit_tag){ + offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag); + offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); + } else { + /* 8.5.1 The encoding of a real value shall be primitive. */ + DISSECTOR_ASSERT_NOT_REACHED(); + } + /* 8.5.2 If the real value is the value zero, + * there shall be no contents octets in the encoding. + */ + if (len=0){ + if (value) + *value = 0; + return offset; + } + encoding = tvb_get_guint8(tvb,offset); + if(encoding&0x80){ + /* a) if bit 8 = 1, then the binary encoding specified in 8.5.6 applies; */ + if(show_internal_ber_fields){ + proto_tree_add_item(tree, hf_ber_real_binary_encoding, tvb, offset, 1, FALSE); + } + }else{ + /* b) if bit 8 = 0 and bit 7 = 0, + * then the decimal encoding specified in 8.5.7 applies; + * c) if bit 8 = 0 and bit 7 = 1, then a "SpecialRealValue" + * (see ITU-T Rec. X.680 | ISO/IEC 8824 1) is encoded as specified in 8.5.8. + */ + if(show_internal_ber_fields){ + proto_tree_add_item(tree, hf_ber_real_binary_encoding, tvb, offset, 1, FALSE); + proto_tree_add_item(tree, hf_ber_real_decimal_encoding, tvb, offset, 1, FALSE); + } + } + offset = start_offset + len; + return offset; +} /* this function dissects a BER sequence */ int dissect_ber_sequence(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_sequence_t *seq, gint hf_id, gint ett_id) { @@ -3903,8 +3962,17 @@ proto_register_ber(void) { "single-ASN1-type", "ber.single_ASN1_type", FT_NONE, BASE_NONE, NULL, 0, "ber.T_single_ASN1_type", HFILL }}, + { &hf_ber_real_binary_encoding, + { "Real binary encoding", "ber.real_binary_encoding", + FT_BOOLEAN, 8, TFS(&ber_real_binary_vals), 0x80, + "Binary or decimal encoding", HFILL }}, + { &hf_ber_real_decimal_encoding, + { "Real decimal encoding type", "ber.real_decimal_encoding", + FT_BOOLEAN, 8, TFS(&ber_real_decimal_vals), 0x40, + "Decimal encoding type ", HFILL }}, }; + static gint *ett[] = { &ett_ber_octet_string, &ett_ber_unknown, diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h index 29c433b41a..2d4f20d165 100644 --- a/epan/dissectors/packet-ber.h +++ b/epan/dissectors/packet-ber.h @@ -119,6 +119,7 @@ extern int dissect_ber_null(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree extern int dissect_ber_boolean(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id); extern int dissect_ber_boolean_value(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, gboolean *value); +extern int dissect_ber_real(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, double *value); extern int dissect_ber_external_type(gboolean implicit_tag, proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, gint hf_id, ber_callback func); extern int dissect_ber_EmbeddedPDV_Type(gboolean implicit_tag, proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, gint hf_id, ber_callback func); |