diff options
author | Anders Broman <anders.broman@ericsson.com> | 2007-05-13 20:58:29 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2007-05-13 20:58:29 +0000 |
commit | c01f3829742dacd6d94dc50be54537661bad0581 (patch) | |
tree | eb3da0d69d5bc62ca587ebd999b6beacd693f168 /asn1/inap/packet-inap-template.c | |
parent | b80cb43018aa49bac3e24cabca009ca0471cd579 (diff) |
Second step in introducing asn context to BER dissectors just like in PER.
svn path=/trunk/; revision=21753
Diffstat (limited to 'asn1/inap/packet-inap-template.c')
-rw-r--r-- | asn1/inap/packet-inap-template.c | 386 |
1 files changed, 84 insertions, 302 deletions
diff --git a/asn1/inap/packet-inap-template.c b/asn1/inap/packet-inap-template.c index 88fa2766c8..4ecee8e813 100644 --- a/asn1/inap/packet-inap-template.c +++ b/asn1/inap/packet-inap-template.c @@ -33,6 +33,8 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/conversation.h> +#include "epan/expert.h" +#include <epan/asn1.h> #include <stdio.h> #include <string.h> @@ -50,18 +52,7 @@ /* Initialize the protocol and registered fields */ int proto_inap = -1; -static int hf_inap_invokeCmd = -1; /* Opcode */ -static int hf_inap_invokeid = -1; /* INTEGER */ -static int hf_inap_linkedid = -1; /* INTEGER */ -static int hf_inap_absent = -1; /* NULL */ -static int hf_inap_invokeId = -1; /* InvokeId */ -static int hf_inap_invoke = -1; /* InvokePDU */ -static int hf_inap_ReturnError = -1; /* InvokePDU */ -static int hf_inap_returnResult = -1; /* InvokePDU */ -static int hf_inap_returnResult_result = -1; -static int hf_inap_getPassword = -1; -static int hf_inap_currentPassword = -1; -static int hf_inap_genproblem = -1; + #include "packet-inap-hf.c" #define MAX_SSN 254 @@ -70,22 +61,15 @@ static range_t *ssn_range; static dissector_handle_t inap_handle; +/* Global variables */ +static guint32 opcode=0; +static guint32 errorCode; + /* Initialize the subtree pointers */ static gint ett_inap = -1; -static gint ett_inap_InvokeId = -1; -static gint ett_inap_InvokePDU = -1; -static gint ett_inap_ReturnErrorPDU = -1; -static gint ett_inap_ReturnResultPDU = -1; -static gint ett_inap_ReturnResult_result = -1; -static gint ett_inap_INAPPDU = -1; static gint ett_inapisup_parameter = -1; #include "packet-inap-ett.c" -static int dissect_invokeCmd(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_); - -#include "packet-inap-fn.c" - - const value_string inap_opr_code_strings[] = { {0,"InitialDP"}, @@ -173,34 +157,12 @@ const value_string inap_general_problem_strings[] = { {0, NULL} }; +/* Forvard declarations */ +static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_); +static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_); +static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx); - -static guint32 opcode=0; - -static int -dissect_inap_Opcode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_index, &opcode); - - if (check_col(pinfo->cinfo, COL_INFO)){ - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(opcode, inap_opr_code_strings, "Unknown Inap (%u)")); - } - - return offset; -} - - - -static int -dissect_inap_errorCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_index, &opcode); - - if (check_col(pinfo->cinfo, COL_INFO)){ - col_set_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, inap_error_code_strings, "Unknown Inap (%u)")); - } - - return offset; -} - +#include "packet-inap-fn.c" /* TC-Invokable OPERATION ::= {activateServiceFiltering | activityTest | analysedInformation | @@ -221,156 +183,156 @@ TC-Invokable OPERATION ::= promptAndCollectUserInformation} */ -static int dissect_invokeData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { +static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { switch(opcode){ case 0: /*InitialDP*/ - offset=dissect_inap_InitialDP(FALSE, tvb, offset, pinfo, tree, hf_inap_InitialDP_PDU); + offset=dissect_inap_InitialDP(FALSE, tvb, offset, actx, tree, hf_inap_InitialDP_PDU); break; case 1: /*1 OriginationAttemptAuthorized */ - offset=dissect_inap_OriginationAttemptAuthorizedArg(FALSE, tvb, offset, pinfo, tree, hf_inap_OriginationAttemptAuthorizedArg_PDU); + offset=dissect_inap_OriginationAttemptAuthorizedArg(FALSE, tvb, offset, actx, tree, hf_inap_OriginationAttemptAuthorizedArg_PDU); break; case 2: /*2 CollectedInformation */ - offset=dissect_inap_CollectedInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CollectedInformationArg_PDU); + offset=dissect_inap_CollectedInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_CollectedInformationArg_PDU); break; case 3: /*3 AnalysedInformation */ - offset=dissect_inap_AnalysedInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_AnalysedInformationArg_PDU); + offset=dissect_inap_AnalysedInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_AnalysedInformationArg_PDU); break; case 4: /*4 RouteSelectFailure */ - offset=dissect_inap_RouteSelectFailureArg(FALSE, tvb, offset, pinfo, tree, hf_inap_RouteSelectFailureArg_PDU); + offset=dissect_inap_RouteSelectFailureArg(FALSE, tvb, offset, actx, tree, hf_inap_RouteSelectFailureArg_PDU); break; case 5: /*5 oCalledPartyBusy */ - offset=dissect_inap_OCalledPartyBusyArg(FALSE, tvb, offset, pinfo, tree, hf_inap_OCalledPartyBusyArg_PDU); + offset=dissect_inap_OCalledPartyBusyArg(FALSE, tvb, offset, actx, tree, hf_inap_OCalledPartyBusyArg_PDU); break; case 6: /*6 oNoAnswer */ - offset=dissect_inap_ONoAnswer(FALSE, tvb, offset, pinfo, tree, hf_inap_ONoAnswer_PDU); + offset=dissect_inap_ONoAnswer(FALSE, tvb, offset, actx, tree, hf_inap_ONoAnswer_PDU); break; case 7: /*7 oAnswer */ - offset=dissect_inap_OAnswerArg(FALSE, tvb, offset, pinfo, tree, hf_inap_OAnswerArg_PDU); + offset=dissect_inap_OAnswerArg(FALSE, tvb, offset, actx, tree, hf_inap_OAnswerArg_PDU); break; case 8: /*8 oDisconnect */ - offset=dissect_inap_ODisconnectArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ODisconnectArg_PDU); + offset=dissect_inap_ODisconnectArg(FALSE, tvb, offset, actx, tree, hf_inap_ODisconnectArg_PDU); break; case 9: /*9 TermAttemptAuthorized */ - offset=dissect_inap_TermAttemptAuthorizedArg(FALSE, tvb, offset, pinfo, tree, hf_inap_TermAttemptAuthorizedArg_PDU); + offset=dissect_inap_TermAttemptAuthorizedArg(FALSE, tvb, offset, actx, tree, hf_inap_TermAttemptAuthorizedArg_PDU); break; case 10: /*10 tBusy */ - offset=dissect_inap_TBusyArg(FALSE, tvb, offset, pinfo, tree, hf_inap_TBusyArg_PDU); + offset=dissect_inap_TBusyArg(FALSE, tvb, offset, actx, tree, hf_inap_TBusyArg_PDU); break; case 11: /*11 tNoAnswer */ - offset=dissect_inap_TNoAnswerArg(FALSE, tvb, offset, pinfo, tree, hf_inap_TNoAnswerArg_PDU); + offset=dissect_inap_TNoAnswerArg(FALSE, tvb, offset, actx, tree, hf_inap_TNoAnswerArg_PDU); break; case 12: /*12 tAnswer */ - offset=dissect_inap_TAnswerArg(FALSE, tvb, offset, pinfo, tree, hf_inap_TAnswerArg_PDU); + offset=dissect_inap_TAnswerArg(FALSE, tvb, offset, actx, tree, hf_inap_TAnswerArg_PDU); break; case 13: /*13 tDisconnect */ - offset=dissect_inap_TDisconnectArg(FALSE, tvb, offset, pinfo, tree, hf_inap_TDisconnectArg_PDU); + offset=dissect_inap_TDisconnectArg(FALSE, tvb, offset, actx, tree, hf_inap_TDisconnectArg_PDU); break; case 14: /*14 oMidCall */ - offset=dissect_inap_MidCallArg(FALSE, tvb, offset, pinfo, tree, hf_inap_MidCallArg_PDU); + offset=dissect_inap_MidCallArg(FALSE, tvb, offset, actx, tree, hf_inap_MidCallArg_PDU); break; case 15: /*15 tMidCall */ - offset=dissect_inap_MidCallArg(FALSE, tvb, offset, pinfo, tree, hf_inap_MidCallArg_PDU); + offset=dissect_inap_MidCallArg(FALSE, tvb, offset, actx, tree, hf_inap_MidCallArg_PDU); break; case 16: /*AssistRequestInstructions*/ - offset=dissect_inap_AssistRequestInstructionsArg(FALSE, tvb, offset, pinfo, tree, hf_inap_AssistRequestInstructionsArg_PDU); + offset=dissect_inap_AssistRequestInstructionsArg(FALSE, tvb, offset, actx, tree, hf_inap_AssistRequestInstructionsArg_PDU); break; case 17: /*EstablishTemporaryConnection*/ - offset=dissect_inap_EstablishTemporaryConnectionArg(FALSE, tvb, offset, pinfo, tree, hf_inap_EstablishTemporaryConnectionArg_PDU); + offset=dissect_inap_EstablishTemporaryConnectionArg(FALSE, tvb, offset, actx, tree, hf_inap_EstablishTemporaryConnectionArg_PDU); break; case 18: /*DisconnectForwardConnections*/ proto_tree_add_text(tree, tvb, offset, -1, "Disconnect Forward Connection"); break; case 19: /*ConnectToResource*/ - offset=dissect_inap_ConnectToResourceArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ConnectToResourceArg_PDU); + offset=dissect_inap_ConnectToResourceArg(FALSE, tvb, offset, actx, tree, hf_inap_ConnectToResourceArg_PDU); break; case 20: /*Connect*/ - offset=dissect_inap_ConnectArg(FALSE, tvb, offset, pinfo, tree,hf_inap_ConnectArg_PDU); + offset=dissect_inap_ConnectArg(FALSE, tvb, offset, actx, tree,hf_inap_ConnectArg_PDU); break; case 21: /* 21 HoldCallInNetwork */ - offset=dissect_inap_HoldCallInNetworkArg(FALSE, tvb, offset, pinfo, tree,hf_inap_HoldCallInNetworkArg_PDU); + offset=dissect_inap_HoldCallInNetworkArg(FALSE, tvb, offset, actx, tree,hf_inap_HoldCallInNetworkArg_PDU); break; case 22: /*ReleaseCall*/ - offset=dissect_inap_ReleaseCallArg(FALSE, tvb, offset, pinfo, tree,hf_inap_ReleaseCallArg_PDU); + offset=dissect_inap_ReleaseCallArg(FALSE, tvb, offset, actx, tree,hf_inap_ReleaseCallArg_PDU); break; case 23: /*InitialDP*/ - offset=dissect_inap_RequestReportBCSMEventArg(FALSE, tvb, offset, pinfo, tree, hf_inap_RequestReportBCSMEventArg_PDU); + offset=dissect_inap_RequestReportBCSMEventArg(FALSE, tvb, offset, actx, tree, hf_inap_RequestReportBCSMEventArg_PDU); break; case 24: /*EventReportBCSM*/ - offset=dissect_inap_EventReportBCSMArg(FALSE, tvb, offset, pinfo, tree, hf_inap_EventReportBCSMArg_PDU); + offset=dissect_inap_EventReportBCSMArg(FALSE, tvb, offset, actx, tree, hf_inap_EventReportBCSMArg_PDU); break; case 25: /*25, "RequestNotificationChargingEvent */ - offset=dissect_inap_RequestNotificationChargingEvent(FALSE, tvb, offset, pinfo, tree, hf_inap_RequestNotificationChargingEvent_PDU); + offset=dissect_inap_RequestNotificationChargingEvent(FALSE, tvb, offset, actx, tree, hf_inap_RequestNotificationChargingEvent_PDU); break; case 26: /*26, "EventNotificationCharging */ - offset=dissect_inap_EventNotificationChargingArg(FALSE, tvb, offset, pinfo, tree, hf_inap_EventNotificationChargingArg_PDU); + offset=dissect_inap_EventNotificationChargingArg(FALSE, tvb, offset, actx, tree, hf_inap_EventNotificationChargingArg_PDU); break; case 27: /*27, "CollectInformation */ - offset=dissect_inap_CollectInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CollectInformationArg_PDU); + offset=dissect_inap_CollectInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_CollectInformationArg_PDU); break; case 28: /*28, "AnalyseInformation */ - offset=dissect_inap_AnalyseInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_AnalyseInformationArg_PDU); + offset=dissect_inap_AnalyseInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_AnalyseInformationArg_PDU); break; case 29: /*29, "SelectRoute */ - offset=dissect_inap_SelectRouteArg(FALSE, tvb, offset, pinfo, tree, hf_inap_SelectRouteArg_PDU); + offset=dissect_inap_SelectRouteArg(FALSE, tvb, offset, actx, tree, hf_inap_SelectRouteArg_PDU); break; case 30: /*30, "SelectFacility */ - offset=dissect_inap_SelectFacilityArg(FALSE, tvb, offset, pinfo, tree, hf_inap_SelectFacilityArg_PDU); + offset=dissect_inap_SelectFacilityArg(FALSE, tvb, offset, actx, tree, hf_inap_SelectFacilityArg_PDU); break; /*31, "Continue */ case 32: /*32, InitiateCallAttempt*/ - offset=dissect_inap_InitiateCallAttemptArg(FALSE, tvb, offset, pinfo, tree, hf_inap_InitiateCallAttemptArg_PDU); + offset=dissect_inap_InitiateCallAttemptArg(FALSE, tvb, offset, actx, tree, hf_inap_InitiateCallAttemptArg_PDU); break; case 33: /*ResetTimer*/ - offset=dissect_inap_ResetTimerArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ResetTimerArg_PDU); + offset=dissect_inap_ResetTimerArg(FALSE, tvb, offset, actx, tree, hf_inap_ResetTimerArg_PDU); break; case 34: /*FurnishChargingInformation*/ - offset=dissect_inap_FurnishChargingInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_FurnishChargingInformationArg_PDU); + offset=dissect_inap_FurnishChargingInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_FurnishChargingInformationArg_PDU); break; case 35: /*35, ApplyCharging */ - offset=dissect_inap_ApplyChargingArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ApplyChargingArg_PDU); + offset=dissect_inap_ApplyChargingArg(FALSE, tvb, offset, actx, tree, hf_inap_ApplyChargingArg_PDU); break; case 36: /*36, "ApplyChargingReport */ - offset=dissect_inap_ApplyChargingReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ApplyChargingReportArg_PDU); + offset=dissect_inap_ApplyChargingReportArg(FALSE, tvb, offset, actx, tree, hf_inap_ApplyChargingReportArg_PDU); break; case 37: /*37, "RequestCurrentStatusReport */ - offset=dissect_inap_RequestCurrentStatusReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_RequestCurrentStatusReportArg_PDU); + offset=dissect_inap_RequestCurrentStatusReportArg(FALSE, tvb, offset, actx, tree, hf_inap_RequestCurrentStatusReportArg_PDU); break; case 38:/*38, "RequestEveryStatusChangeReport */ - offset=dissect_inap_RequestEveryStatusChangeReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_RequestEveryStatusChangeReportArg_PDU); + offset=dissect_inap_RequestEveryStatusChangeReportArg(FALSE, tvb, offset, actx, tree, hf_inap_RequestEveryStatusChangeReportArg_PDU); break; case 39:/*39, "RequestFirstStatusMatchReport */ - offset=dissect_inap_RequestFirstStatusMatchReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_RequestFirstStatusMatchReportArg_PDU); + offset=dissect_inap_RequestFirstStatusMatchReportArg(FALSE, tvb, offset, actx, tree, hf_inap_RequestFirstStatusMatchReportArg_PDU); break; case 40:/*40, "StatusReport */ - offset=dissect_inap_StatusReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_StatusReportArg_PDU); + offset=dissect_inap_StatusReportArg(FALSE, tvb, offset, actx, tree, hf_inap_StatusReportArg_PDU); break; case 41:/*41, "CallGap */ - offset=dissect_inap_CallGapArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CallGapArg_PDU); + offset=dissect_inap_CallGapArg(FALSE, tvb, offset, actx, tree, hf_inap_CallGapArg_PDU); break; case 42:/*42, "ActivateServiceFiltering */ - offset=dissect_inap_ActivateServiceFilteringArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ActivateServiceFilteringArg_PDU); + offset=dissect_inap_ActivateServiceFilteringArg(FALSE, tvb, offset, actx, tree, hf_inap_ActivateServiceFilteringArg_PDU); break; case 43:/*43, "ServiceFilteringResponse */ - offset=dissect_inap_ServiceFilteringResponseArg(FALSE, tvb, offset, pinfo, tree, hf_inap_ServiceFilteringResponseArg_PDU); + offset=dissect_inap_ServiceFilteringResponseArg(FALSE, tvb, offset, actx, tree, hf_inap_ServiceFilteringResponseArg_PDU); break; case 44: /*CallInformationReport*/ - offset=dissect_inap_CallInformationReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CallInformationReportArg_PDU); + offset=dissect_inap_CallInformationReportArg(FALSE, tvb, offset, actx, tree, hf_inap_CallInformationReportArg_PDU); break; case 45: /*CallInformationRequest*/ - offset=dissect_inap_CallInformationRequestArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CallInformationRequestArg_PDU); + offset=dissect_inap_CallInformationRequestArg(FALSE, tvb, offset, actx, tree, hf_inap_CallInformationRequestArg_PDU); break; case 47: /*PlayAnnouncement*/ - offset=dissect_inap_PlayAnnouncementArg(FALSE, tvb, offset, pinfo, tree, hf_inap_PlayAnnouncementArg_PDU); + offset=dissect_inap_PlayAnnouncementArg(FALSE, tvb, offset, actx, tree, hf_inap_PlayAnnouncementArg_PDU); break; case 48: /*PromptAndCollectUserInformation*/ - offset=dissect_inap_PromptAndCollectUserInformationArg(FALSE, tvb, offset, pinfo, tree, hf_inap_PromptAndCollectUserInformationArg_PDU); + offset=dissect_inap_PromptAndCollectUserInformationArg(FALSE, tvb, offset, actx, tree, hf_inap_PromptAndCollectUserInformationArg_PDU); break; case 49: /* 49 SpecializedResourceReport */ - offset=dissect_inap_SpecializedResourceReportArg(FALSE, tvb, offset, pinfo, tree, hf_inap_SpecializedResourceReportArg_PDU); + offset=dissect_inap_SpecializedResourceReportArg(FALSE, tvb, offset, actx, tree, hf_inap_SpecializedResourceReportArg_PDU); break; case 53: /*Cancel*/ - offset=dissect_inap_CancelArg(FALSE, tvb, offset, pinfo, tree, hf_inap_CancelArg_PDU); + offset=dissect_inap_CancelArg(FALSE, tvb, offset, actx, tree, hf_inap_CancelArg_PDU); break; /*55 ActivityTest*/ default: @@ -394,188 +356,43 @@ TC-Returnable OPERATION ::= promptAndCollectUserInformation - RESULT ReceivedInformationArg */ -static int dissect_returnResultData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { +static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { switch(opcode){ case 37: /*requestCurrentStatusReport*/ - offset=dissect_inap_RequestCurrentStatusReportResultArg(FALSE, tvb, offset, pinfo, tree, -1); + offset=dissect_inap_RequestCurrentStatusReportResultArg(FALSE, tvb, offset, actx, tree, -1); break; case 48: /*PromptAndCollectUserInformation*/ - offset=dissect_inap_ReceivedInformationArg(FALSE, tvb, offset, pinfo, tree, -1); + offset=dissect_inap_ReceivedInformationArg(FALSE, tvb, offset, actx, tree, -1); break; default: proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); } return offset; } - -static int -dissect_invokeCmd(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_Opcode(FALSE, tvb, offset, pinfo, tree, hf_inap_invokeCmd); -} - - -static int -dissect_errorCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_errorCode(FALSE, tvb, offset, pinfo, tree, hf_inap_ReturnError); -} - -static int dissect_invokeid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_inap_invokeid, NULL); -} - - -static const value_string InvokeId_vals[] = { - { 0, "invokeid" }, - { 1, "absent" }, - { 0, NULL } -}; - -static int dissect_absent(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_NULL(FALSE, tvb, offset, pinfo, tree, hf_inap_absent); -} - - -static const ber_choice_t InvokeId_choice[] = { - { 0, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeid }, - { 1, BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_absent }, - { 0, 0, 0, 0, NULL } -}; - -static int -dissect_inap_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_choice(pinfo, tree, tvb, offset, - InvokeId_choice, hf_index, ett_inap_InvokeId, NULL); - - return offset; -} -static int dissect_invokeId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_InvokeId(FALSE, tvb, offset, pinfo, tree, hf_inap_invokeId); -} -static int dissect_linkedID_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_ber_integer(TRUE, pinfo, tree, tvb, offset, hf_inap_linkedid, NULL); -} - - -static const ber_sequence_t InvokePDU_sequence[] = { - { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_invokeId }, - { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_linkedID_impl }, - { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeCmd }, - { BER_CLASS_UNI, -1/*depends on Cmd*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_invokeData }, - { 0, 0, 0, NULL } -}; - -static int -dissect_inap_InvokePDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - InvokePDU_sequence, hf_index, ett_inap_InvokePDU); - - return offset; -} - - -static const ber_sequence_t returnErrorPDU_sequence[] = { - { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_invokeId }, - { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_errorCode }, - { 0, 0, 0, NULL } -}; - -static int -dissect_inap_returnErrorPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - returnErrorPDU_sequence, hf_index, ett_inap_ReturnErrorPDU); - - return offset; -} - - -static int dissect_invoke_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_InvokePDU(TRUE, tvb, offset, pinfo, tree, hf_inap_invoke); -} - -static int dissect_returnError_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_returnErrorPDU(TRUE, tvb, offset, pinfo, tree, hf_inap_invoke); -} - -static const ber_sequence_t ReturnResult_result_sequence[] = { - { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeCmd }, - { BER_CLASS_UNI, -1/*depends on Cmd*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_returnResultData }, - { 0, 0, 0, NULL } -}; -static int -dissect_returnResult_result(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - offset = dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, - ReturnResult_result_sequence, hf_inap_returnResult_result, ett_inap_ReturnResult_result); - - return offset; -} - -static const ber_sequence_t ReturnResultPDU_sequence[] = { - { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_invokeId }, - { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_returnResult_result }, - { 0, 0, 0, NULL } -}; - -static int -dissect_inap_returnResultPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - ReturnResultPDU_sequence, hf_index, ett_inap_ReturnResultPDU); - +/* From GSMMAP TODO find out if there is ERROR parameters */ +static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { + proto_item *cause; + + switch(errorCode){ + default: + cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); + proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); + expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",errorCode); + break; + } return offset; } -static int dissect_returnResult_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_returnResultPDU(TRUE, tvb, offset, pinfo, tree, hf_inap_returnResult); -} - - -static int dissect_reject_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - return dissect_inap_RejectPDU(TRUE, tvb, offset, pinfo, tree, -1); -} - -static const value_string INAPPDU_vals[] = { - { 1, "invoke" }, - { 2, "returnResult" }, - { 3, "returnError" }, - { 4, "reject" }, - { 0, NULL } -}; - -static const ber_choice_t INAPPDU_choice[] = { - { 1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_invoke_impl }, - { 2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_returnResult_impl }, - { 3, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_returnError_impl }, - { 4, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_reject_impl }, - { 0, 0, 0, 0, NULL } -}; static guint8 inap_pdu_type = 0; static guint8 inap_pdu_size = 0; -static int -dissect_inap_INAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - - inap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f; - /* Get the length and add 2 */ - inap_pdu_size = tvb_get_guint8(tvb, offset+1)+2; - - offset = dissect_ber_choice(pinfo, tree, tvb, offset, - INAPPDU_choice, hf_index, ett_inap_INAPPDU, NULL); -/* - if (check_col(pinfo->cinfo, COL_INFO)){ - col_prepend_fstr(pinfo->cinfo, COL_INFO, val_to_str(opcode, inap_opr_code_strings, "Unknown INAP (%u)")); - } -*/ - return offset; -} - - - static void dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { proto_item *item=NULL; proto_tree *tree=NULL; - + int offset = 0; if (check_col(pinfo->cinfo, COL_PROTOCOL)) { @@ -587,8 +404,11 @@ dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) item = proto_tree_add_item(parent_tree, proto_inap, tvb, 0, -1, FALSE); tree = proto_item_add_subtree(item, ett_inap); } - - dissect_inap_INAPPDU(FALSE, tvb, 0, pinfo, tree, -1); + inap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f; + /* Get the length and add 2 */ + inap_pdu_size = tvb_get_guint8(tvb, offset+1)+2; + opcode = 0; + dissect_Component_PDU(tvb, pinfo, tree); } @@ -632,40 +452,8 @@ void proto_register_inap(void) { module_t *inap_module; /* List of fields */ static hf_register_info hf[] = { - { &hf_inap_invokeCmd, - { "invokeCmd", "inap.invokeCmd", - FT_UINT32, BASE_DEC, VALS(inap_opr_code_strings), 0, - "InvokePDU/invokeCmd", HFILL }}, - { &hf_inap_ReturnError, - { "ReturnError", "inap.ReturnError", - FT_UINT32, BASE_DEC, VALS(inap_error_code_strings), 0, - "InvokePDU/ReturnError", HFILL }}, - { &hf_inap_invokeid, - { "invokeid", "inap.invokeid", - FT_INT32, BASE_DEC, NULL, 0, - "InvokeId/invokeid", HFILL }}, - { &hf_inap_linkedid, - { "linkedid", "inap.linkedid", - FT_INT32, BASE_DEC, NULL, 0, - "LinkedId/linkedid", HFILL }}, - - { &hf_inap_absent, - { "absent", "inap.absent", - FT_NONE, BASE_NONE, NULL, 0, - "InvokeId/absent", HFILL }}, - { &hf_inap_invokeId, - { "invokeId", "inap.invokeId", - FT_UINT32, BASE_DEC, VALS(InvokeId_vals), 0, - "InvokePDU/invokeId", HFILL }}, - { &hf_inap_invoke, - { "invoke", "inap.invoke", - FT_NONE, BASE_NONE, NULL, 0, - "INAPPDU/invoke", HFILL }}, - { &hf_inap_returnResult, - { "returnResult", "inap.returnResult", - FT_NONE, BASE_NONE, NULL, 0, - "INAPPDU/returnResult", HFILL }}, - + + #include "packet-inap-hfarr.c" }; @@ -678,13 +466,7 @@ void proto_register_inap(void) { /* List of subtrees */ static gint *ett[] = { &ett_inap, - &ett_inap_InvokeId, - &ett_inap_InvokePDU, - &ett_inap_ReturnErrorPDU, - &ett_inap_ReturnResultPDU, - &ett_inap_ReturnResult_result, - &ett_inap_INAPPDU, - &ett_inapisup_parameter, + &ett_inapisup_parameter, #include "packet-inap-ettarr.c" }; |