diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-11-02 18:10:34 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-11-02 18:10:34 +0000 |
commit | d1c256002f6cd64377d4a3885c2a235e844a5b20 (patch) | |
tree | 2c4e55eef66a674b9be04c3fba4793b95cf43f0e /asn1 | |
parent | 475b93f975bbbd3d4d675474c1b38335bba1437f (diff) |
Handle differences in Camel V2
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3911
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6474
svn path=/trunk/; revision=39715
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/camel/CamelV2diff.asn | 64 | ||||
-rw-r--r-- | asn1/camel/Makefile.common | 3 | ||||
-rw-r--r-- | asn1/camel/camel.cnf | 31 | ||||
-rw-r--r-- | asn1/camel/packet-camel-template.c | 151 |
4 files changed, 210 insertions, 39 deletions
diff --git a/asn1/camel/CamelV2diff.asn b/asn1/camel/CamelV2diff.asn new file mode 100644 index 0000000000..f64f0bb99e --- /dev/null +++ b/asn1/camel/CamelV2diff.asn @@ -0,0 +1,64 @@ +-- $Id$-- +-- +-- Hand crafted ASN1 file for the differences between latest spec and V2 +-- statments sufixed with V2 to be able to generate this with the latest ASN1 spec. +-- .cnf and -template is used to call the statmets here. + +CAP-DataTypesV2 {ccitt(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) modules(3)cap-datatypes(52) version2(1)} + +-- This module contains the type definitions for the CAP v.2 data types. + +DEFINITIONS IMPLICIT TAGS ::= +BEGIN + IMPORTS + + NAEA-CIC +FROM MAP-CommonDataTypes {itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) +gsm-Network(1) modules(3) map-CommonDataTypes(18) version12(12)} + +; + +-- TYPE DEFINITIONS FOR CAP v.2 DATA TYPES FOLLOW + +InitialDPArgExtensionV2 ::= SEQUENCE { + naCarrierInformation [0] NACarrierInformation OPTIONAL, + gmscAddress [1] ISDN-AddressString OPTIONAL, + ... + + +} + +-- Use of the text parameter is network operator/equipment vendor specific. + +NACarrierInformation ::= SEQUENCE { + naCarrierId [0] NAEA-CIC OPTIONAL, + naCICSelectionType [1] NACarrierSelectionInfo OPTIONAL, + ...} + +NACarrierSelectionInfo ::= OCTET STRING (SIZE (1)) +-- NA carrier selection information octet carries the same values as ANSI +-- ISUP T1.113: '00'H – not indicated or not explicitly provided +-- '01'H – subscribed not dialed +-- '02'H – subscribed and dialed +-- '03'H – subscribed with dialing undetermined +-- '04'H – dialed CIC not subscribed + + +CAMEL-AChBillingChargingCharacteristicsV2 ::= CHOICE { + timeDurationCharging [0] SEQUENCE { + maxCallPeriodDuration [0] INTEGER (1..864000), + releaseIfdurationExceeded [1] ReleaseIfDurationExceeded OPTIONAL, + tariffSwitchInterval [2] INTEGER (1..86400) OPTIONAL + } + } +-- tariffSwitchInterval is measured in 1 second units. +-- maxCallPeriodDuration is measured in100 millisecond units + +ReleaseIfDurationExceeded ::= SEQUENCE { + tone BOOLEAN DEFAULT FALSE, + ..., + extensions [10] SEQUENCE SIZE(1..numOfExtensions) OF + ExtensionField OPTIONAL + } + +END
\ No newline at end of file diff --git a/asn1/camel/Makefile.common b/asn1/camel/Makefile.common index 3ff4ca3227..d3534e5270 100644 --- a/asn1/camel/Makefile.common +++ b/asn1/camel/Makefile.common @@ -38,7 +38,8 @@ ASN_FILE_LIST = \ CAP-gsmSSF-gsmSCF-ops-args.asn \ CAP-gprsSSF-gsmSCF-ops-args.asn \ CAP-SMS-ops-args.asn \ - CAP-U-ABORT-Data.asn + CAP-U-ABORT-Data.asn \ + CamelV2diff.asn # The packet-$(PROTOCOL_NAME)-template.h and $(PROTOCOL_NAME).asn # files do not exist for all protocols: Please add/remove as required. diff --git a/asn1/camel/camel.cnf b/asn1/camel/camel.cnf index 0302832716..040bd071cc 100644 --- a/asn1/camel/camel.cnf +++ b/asn1/camel/camel.cnf @@ -211,6 +211,14 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a # END ROS +#.FN_BODY InitialDPArgExtension + +if((camel_ver == 2)||(camel_ver == 1)){ + return dissect_camel_InitialDPArgExtensionV2(implicit_tag, tvb, offset, actx, tree, hf_index); +} + +%(DEFAULT_BODY)s + #.FN_HDR ExtensionField camel_obj_id = NULL; is_ExtensionField =TRUE; @@ -227,37 +235,43 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a #---------------------------------------------------------------------------------------- #.FN_BODY CallingPartyNumber VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; + proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; -dissect_isup_calling_party_number_parameter(parameter_tvb, tree, NULL); +subtree = proto_item_add_subtree(actx->created_item, ett_camel_callingpartynumber); +dissect_isup_calling_party_number_parameter(parameter_tvb, subtree, NULL); #.END #---------------------------------------------------------------------------------------- #.FN_BODY CalledPartyNumber VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; + proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; -dissect_isup_called_party_number_parameter(parameter_tvb, tree, NULL); + subtree = proto_item_add_subtree(actx->created_item, ett_camel_calledpartybcdnumber); + dissect_isup_called_party_number_parameter(parameter_tvb, subtree, NULL); #.END #---------------------------------------------------------------------------------------- #.FN_BODY LocationNumber VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; + proto_tree *subtree; %(DEFAULT_BODY)s if (!parameter_tvb) return offset; -dissect_isup_location_number_parameter(parameter_tvb, tree, NULL); +subtree = proto_item_add_subtree(actx->created_item, ett_camel_locationnumber); +dissect_isup_location_number_parameter(parameter_tvb, subtree, NULL); #.END #---------------------------------------------------------------------------------------- @@ -468,10 +482,10 @@ proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_camel_pdptypenumber); switch (PDPTypeOrganization){ case 0: /* ETSI */ - proto_tree_add_item(tree, hf_camel_PDPTypeNumber_etsi, parameter_tvb, 0, 1, FALSE); + proto_tree_add_item(subtree, hf_camel_PDPTypeNumber_etsi, parameter_tvb, 0, 1, FALSE); break; case 1: /* IETF */ - proto_tree_add_item(tree, hf_camel_PDPTypeNumber_ietf, parameter_tvb, 0, 1, FALSE); + proto_tree_add_item(subtree, hf_camel_PDPTypeNumber_ietf, parameter_tvb, 0, 1, FALSE); break; default: break; @@ -495,10 +509,10 @@ proto_tree *subtree; case 1: /* IETF */ switch(PDPTypeNumber){ case 0x21: /* IPv4 */ - proto_tree_add_item(tree, hf_camel_PDPAddress_IPv4, parameter_tvb, 0, tvb_length(parameter_tvb), FALSE); + proto_tree_add_item(subtree, hf_camel_PDPAddress_IPv4, parameter_tvb, 0, tvb_length(parameter_tvb), FALSE); break; case 0x57: /* IPv6 */ - proto_tree_add_item(tree, hf_camel_PDPAddress_IPv6, parameter_tvb, 0, tvb_length(parameter_tvb), FALSE); + proto_tree_add_item(subtree, hf_camel_PDPAddress_IPv6, parameter_tvb, 0, tvb_length(parameter_tvb), FALSE); break; default: break; @@ -535,6 +549,9 @@ proto_tree *subtree; if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_camel_CAMEL_AChBillingChargingCharacteristics); + if((camel_ver == 2)||(camel_ver == 1)){ + return dissect_camel_CAMEL_AChBillingChargingCharacteristicsV2(FALSE, parameter_tvb, 0, actx, subtree, hf_camel_CAMEL_AChBillingChargingCharacteristics); + } dissect_camel_CAMEL_AChBillingChargingCharacteristics(FALSE, parameter_tvb, 0, actx, subtree, hf_camel_CAMEL_AChBillingChargingCharacteristics); #.FN_BODY FCIBillingChargingCharacteristics VAL_PTR = ¶meter_tvb diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c index 556d4c27e1..7ca268640d 100644 --- a/asn1/camel/packet-camel-template.c +++ b/asn1/camel/packet-camel-template.c @@ -70,7 +70,7 @@ int camel_tap = -1; /* Global variables */ static guint32 opcode=0; static guint32 errorCode=0; - +static guint32 camel_ver = 0; /* ROSE context */ static rose_ctx_t camel_rose_ctx; @@ -116,6 +116,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_c static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx); static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx); static int dissect_camel_CAMEL_AChBillingChargingCharacteristics(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); +static int dissect_camel_CAMEL_AChBillingChargingCharacteristicsV2(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); static int dissect_camel_CAMEL_CallResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); gboolean gcamel_HandleSRT=FALSE; @@ -130,7 +131,9 @@ static gint ett_camel_pdptypenumber = -1; static gint ett_camel_cause = -1; static gint ett_camel_RPcause = -1; static gint ett_camel_stat = -1; -static guint ett_camel_calledpartybcdnumber = -1; +static gint ett_camel_calledpartybcdnumber = -1; +static gint ett_camel_callingpartynumber = -1; +static gint ett_camel_locationnumber = -1; #include "packet-camel-ett.c" @@ -139,6 +142,8 @@ static guint ett_camel_calledpartybcdnumber = -1; #define MAX_SSN 254 static range_t *global_ssn_range; static dissector_handle_t camel_handle; +static dissector_handle_t camel_v1_handle; +static dissector_handle_t camel_v2_handle; /* Global variables */ @@ -313,6 +318,8 @@ dissect_RP_cause_ie(tvbuff_t *tvb, guint32 offset, _U_ guint len, return(curr_offset - offset); } +static int dissect_camel_InitialDPArgExtensionV2(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); + #include "packet-camel-fn.c" #include "packet-camel-table2.c" @@ -325,40 +332,113 @@ static guint8 camel_pdu_size = 0; static int dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree, int hf_index) { - char *version_ptr; - struct tcap_private_t * p_private_tcap; + char *version_ptr; + struct tcap_private_t * p_private_tcap; + + opcode = 0; + application_context_version = 0; + if (actx->pinfo->private_data != NULL){ + p_private_tcap=actx->pinfo->private_data; + + if (p_private_tcap->acv==TRUE ){ + version_ptr = strrchr(p_private_tcap->oid,'.'); + if (version_ptr) + application_context_version = atoi(version_ptr+1); + } + gp_camelsrt_info->tcap_context=p_private_tcap->context; + if (p_private_tcap->context) + gp_camelsrt_info->tcap_session_id = ( (struct tcaphash_context_t *) (p_private_tcap->context))->session_id; + } - opcode = 0; - application_context_version = 0; - if (actx->pinfo->private_data != NULL){ - p_private_tcap=actx->pinfo->private_data; + camel_pdu_type = tvb_get_guint8(tvb, offset)&0x0f; + /* Get the length and add 2 */ + camel_pdu_size = tvb_get_guint8(tvb, offset+1)+2; - if (p_private_tcap->acv==TRUE ){ - version_ptr = strrchr(p_private_tcap->oid,'.'); - if (version_ptr) - application_context_version = atoi(version_ptr+1); - } - gp_camelsrt_info->tcap_context=p_private_tcap->context; - if (p_private_tcap->context) - gp_camelsrt_info->tcap_session_id + /* Populate the info column with PDU type*/ + col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(camel_pdu_type, camel_Component_vals, "Unknown Camel (%u)")); + col_append_str(actx->pinfo->cinfo, COL_INFO, " "); - = ( (struct tcaphash_context_t *) (p_private_tcap->context))->session_id; - } + is_ExtensionField =FALSE; + offset = dissect_camel_ROS(TRUE, tvb, offset, actx, tree, hf_index); + + return offset; +} + +static void +dissect_camel_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + proto_item *stat_item=NULL; + proto_tree *stat_tree=NULL; + asn1_ctx_t asn1_ctx; + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Camel-v1"); + + camel_ver = 1; - camel_pdu_type = tvb_get_guint8(tvb, offset)&0x0f; - /* Get the length and add 2 */ - camel_pdu_size = tvb_get_guint8(tvb, offset+1)+2; + /* create display subtree for the protocol */ + if(parent_tree){ + item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_camel); + } + /* camelsrt reset counter, and initialise global pointer + to store service response time related data */ + gp_camelsrt_info=camelsrt_razinfo(); - /* Populate the info column with PDU type*/ - col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(camel_pdu_type, camel_Component_vals, "Unknown Camel (%u)")); - col_append_str(actx->pinfo->cinfo, COL_INFO, " "); + dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1); - is_ExtensionField =FALSE; - offset = dissect_camel_ROS(TRUE, tvb, offset, actx, tree, hf_index); + /* If a Tcap context is associated to this transaction */ + if (gcamel_HandleSRT && + gp_camelsrt_info->tcap_context ) { + if (gcamel_DisplaySRT && tree) { + stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat"); + stat_tree = proto_item_add_subtree(stat_item, ett_camel_stat); + } + camelsrt_call_matching(tvb, pinfo, stat_tree, gp_camelsrt_info); + tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info); + } - return offset; } +static void +dissect_camel_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + proto_item *stat_item=NULL; + proto_tree *stat_tree=NULL; + asn1_ctx_t asn1_ctx; + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Camel-v2"); + + camel_ver = 2; + + /* create display subtree for the protocol */ + if(parent_tree){ + item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_camel); + } + /* camelsrt reset counter, and initialise global pointer + to store service response time related data */ + gp_camelsrt_info=camelsrt_razinfo(); + + dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1); + + /* If a Tcap context is associated to this transaction */ + if (gcamel_HandleSRT && + gp_camelsrt_info->tcap_context ) { + if (gcamel_DisplaySRT && tree) { + stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat"); + stat_tree = proto_item_add_subtree(stat_item, ett_camel_stat); + } + camelsrt_call_matching(tvb, pinfo, stat_tree, gp_camelsrt_info); + tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info); + } + +} static void dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) @@ -372,6 +452,9 @@ dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Camel"); + /* Unknown camel version */ + camel_ver = 0; + /* create display subtree for the protocol */ if(parent_tree){ item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA); @@ -417,12 +500,14 @@ void proto_reg_handoff_camel(void) { camel_prefs_initialized = TRUE; camel_handle = find_dissector("camel"); + camel_v1_handle = find_dissector("camel-v1"); + camel_v2_handle = find_dissector("camel-v2"); - register_ber_oid_dissector_handle("0.4.0.0.1.0.50.0",camel_handle, proto_camel, "CAP-v1-gsmSSF-to-gsmSCF-AC" ); - register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_handle, proto_camel, "CAP-v2-gsmSSF-to-gsmSCF-AC" ); - register_ber_oid_dissector_handle("0.4.0.0.1.0.51.1",camel_handle, proto_camel, "CAP-v2-assist-gsmSSF-to-gsmSCF-AC" ); - register_ber_oid_dissector_handle("0.4.0.0.1.0.52.1",camel_handle, proto_camel, "CAP-v2-gsmSRF-to-gsmSCF-AC" ); + register_ber_oid_dissector_handle("0.4.0.0.1.0.50.0",camel_v1_handle, proto_camel, "CAP-v1-gsmSSF-to-gsmSCF-AC" ); + register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_v2_handle, proto_camel, "CAP-v2-gsmSSF-to-gsmSCF-AC" ); + register_ber_oid_dissector_handle("0.4.0.0.1.0.51.1",camel_v2_handle, proto_camel, "CAP-v2-assist-gsmSSF-to-gsmSCF-AC" ); + register_ber_oid_dissector_handle("0.4.0.0.1.0.52.1",camel_v2_handle, proto_camel, "CAP-v2-gsmSRF-to-gsmSCF-AC" ); register_ber_oid_dissector_handle("0.4.0.0.1.21.3.50",camel_handle, proto_camel, "cap3-gprssf-scfAC" ); register_ber_oid_dissector_handle("0.4.0.0.1.21.3.51",camel_handle, proto_camel, "cap3-gsmscf-gprsssfAC" ); register_ber_oid_dissector_handle("0.4.0.0.1.21.3.61",camel_handle, proto_camel, "cap3-sms-AC" ); @@ -616,6 +701,8 @@ void proto_register_camel(void) { &ett_camel_RPcause, &ett_camel_stat, &ett_camel_calledpartybcdnumber, + &ett_camel_callingpartynumber, + &ett_camel_locationnumber, #include "packet-camel-ettarr.c" }; @@ -623,6 +710,8 @@ void proto_register_camel(void) { proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("camel", dissect_camel, proto_camel); + register_dissector("camel-v1", dissect_camel_v1, proto_camel); + register_dissector("camel-v2", dissect_camel_v2, proto_camel); proto_register_field_array(proto_camel, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); |