forked from osmocom/wireshark
rose_ctx_t structure usage in Q.932 dissector
svn path=/trunk/; revision=22349
This commit is contained in:
parent
54a9c2e94e
commit
ab5d466fc7
|
@ -295,7 +295,6 @@ EXTRA_DIST = \
|
|||
q932/Makefile \
|
||||
q932/Makefile.nmake \
|
||||
q932/packet-q932-ros-template.c \
|
||||
q932/packet-q932-ros-template.h \
|
||||
q932/packet-q932-template.c \
|
||||
q932/packet-q932-template.h \
|
||||
qsig/qsig-cf.asn \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
PROTOCOL_NAME=q932
|
||||
Q932_FILES=packet-$(PROTOCOL_NAME).c packet-$(PROTOCOL_NAME).h
|
||||
Q932_ROS_FILES=packet-$(PROTOCOL_NAME)-ros.c packet-$(PROTOCOL_NAME)-ros.h
|
||||
Q932_ROS_FILES=packet-$(PROTOCOL_NAME)-ros.c
|
||||
DISSECTOR_FILES=$(Q932_FILES) $(Q932_ROS_FILES)
|
||||
Q932_ASN=Addressing-Data-Elements.asn Network-Facility-Extension.asn Network-Protocol-Profile-component.asn Interpretation-component.asn
|
||||
Q932_ROS_ASN=../ros/Remote-Operations-Information-Objects.asn Facility-Information-Element-Components.asn
|
||||
|
@ -14,7 +14,7 @@ generate_dissector: $(DISSECTOR_FILES)
|
|||
$(Q932_FILES): ../../tools/asn2wrs.py $(Q932_ASN) packet-$(PROTOCOL_NAME)-template.c packet-$(PROTOCOL_NAME)-template.h $(PROTOCOL_NAME).cnf
|
||||
python ../../tools/asn2wrs.py -b -T -X -e -p $(PROTOCOL_NAME) -c $(PROTOCOL_NAME).cnf -s packet-$(PROTOCOL_NAME)-template $(Q932_ASN)
|
||||
|
||||
$(Q932_ROS_FILES): ../../tools/asn2wrs.py $(Q932_ROS_ASN) packet-$(PROTOCOL_NAME)-ros-template.c packet-$(PROTOCOL_NAME)-ros-template.h $(PROTOCOL_NAME)-ros.cnf
|
||||
$(Q932_ROS_FILES): ../../tools/asn2wrs.py $(Q932_ROS_ASN) packet-$(PROTOCOL_NAME)-ros-template.c $(PROTOCOL_NAME)-ros.cnf
|
||||
python ../../tools/asn2wrs.py -b -T -X -e -p $(PROTOCOL_NAME).ros -c $(PROTOCOL_NAME)-ros.cnf -o $(PROTOCOL_NAME)-ros -s packet-$(PROTOCOL_NAME)-ros-template $(Q932_ROS_ASN)
|
||||
|
||||
clean:
|
||||
|
|
|
@ -8,7 +8,7 @@ UNIX2DOS=$(PERL) ../../tools/unix2dos.pl
|
|||
|
||||
PROTOCOL_NAME=q932
|
||||
Q932_FILES=packet-$(PROTOCOL_NAME).c packet-$(PROTOCOL_NAME).h
|
||||
Q932_ROS_FILES=packet-$(PROTOCOL_NAME)-ros.c packet-$(PROTOCOL_NAME)-ros.h
|
||||
Q932_ROS_FILES=packet-$(PROTOCOL_NAME)-ros.c
|
||||
DISSECTOR_FILES=$(Q932_FILES) $(Q932_ROS_FILES)
|
||||
Q932_ASN=Addressing-Data-Elements.asn Network-Facility-Extension.asn Network-Protocol-Profile-component.asn Interpretation-component.asn
|
||||
Q932_ROS_ASN=../ros/Remote-Operations-Information-Objects.asn Facility-Information-Element-Components.asn
|
||||
|
@ -25,7 +25,7 @@ $(Q932_FILES): ../../tools/asn2wrs.py $(Q932_ASN) packet-$(PROTOCOL_NAME)-templa
|
|||
@exit 1
|
||||
!ENDIF
|
||||
|
||||
$(Q932_ROS_FILES): ../../tools/asn2wrs.py $(Q932_ROS_ASN) packet-$(PROTOCOL_NAME)-ros-template.c packet-$(PROTOCOL_NAME)-ros-template.h $(PROTOCOL_NAME)-ros.cnf
|
||||
$(Q932_ROS_FILES): ../../tools/asn2wrs.py $(Q932_ROS_ASN) packet-$(PROTOCOL_NAME)-ros-template.c $(PROTOCOL_NAME)-ros.cnf
|
||||
!IFDEF PYTHON
|
||||
$(PYTHON) "../../tools/asn2wrs.py" -b -T -X -p $(PROTOCOL_NAME).ros -c $(PROTOCOL_NAME)-ros.cnf -o $(PROTOCOL_NAME)-ros -s packet-$(PROTOCOL_NAME)-ros-template $(Q932_ROS_ASN)
|
||||
!ELSE
|
||||
|
@ -49,15 +49,12 @@ fix_eol: generate_dissector
|
|||
move packet-$(PROTOCOL_NAME).c packet-$(PROTOCOL_NAME).c.tmp
|
||||
move packet-$(PROTOCOL_NAME).h packet-$(PROTOCOL_NAME).h.tmp
|
||||
move packet-$(PROTOCOL_NAME)-ros.c packet-$(PROTOCOL_NAME)-ros.c.tmp
|
||||
move packet-$(PROTOCOL_NAME)-ros.h packet-$(PROTOCOL_NAME)-ros.h.tmp
|
||||
$(UNIX2DOS) < packet-$(PROTOCOL_NAME).c.tmp > packet-$(PROTOCOL_NAME).c
|
||||
$(UNIX2DOS) < packet-$(PROTOCOL_NAME).h.tmp > packet-$(PROTOCOL_NAME).h
|
||||
$(UNIX2DOS) < packet-$(PROTOCOL_NAME)-ros.c.tmp > packet-$(PROTOCOL_NAME)-ros.c
|
||||
$(UNIX2DOS) < packet-$(PROTOCOL_NAME)-ros.h.tmp > packet-$(PROTOCOL_NAME)-ros.h
|
||||
del /f packet-$(PROTOCOL_NAME).c.tmp packet-$(PROTOCOL_NAME).h.tmp packet-$(PROTOCOL_NAME)-ros.c.tmp packet-$(PROTOCOL_NAME)-ros.h.tmp
|
||||
del /f packet-$(PROTOCOL_NAME).c.tmp packet-$(PROTOCOL_NAME).h.tmp packet-$(PROTOCOL_NAME)-ros.c.tmp
|
||||
|
||||
copy_files: generate_dissector fix_eol
|
||||
xcopy packet-$(PROTOCOL_NAME).c ..\..\epan\dissectors /d /y
|
||||
xcopy packet-$(PROTOCOL_NAME).h ..\..\epan\dissectors /d /y
|
||||
xcopy packet-$(PROTOCOL_NAME)-ros.c ..\..\epan\dissectors /d /y
|
||||
xcopy packet-$(PROTOCOL_NAME)-ros.h ..\..\epan\dissectors /d /y
|
||||
|
|
|
@ -36,14 +36,13 @@
|
|||
#include <epan/asn1.h>
|
||||
|
||||
#include "packet-ber.h"
|
||||
#include "packet-q932-ros.h"
|
||||
|
||||
#define PNAME "Q.932 Operations Service Element"
|
||||
#define PSNAME "Q932.ROS"
|
||||
#define PFNAME "q932.ros"
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
int proto_rose = -1;
|
||||
int proto_q932_ros = -1;
|
||||
#include "packet-q932-ros-hf.c"
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
|
@ -55,11 +54,8 @@ int proto_rose = -1;
|
|||
static dissector_handle_t data_handle = NULL;
|
||||
|
||||
/* Gloabl variables */
|
||||
static rose_ctx_t *rose_ctx;
|
||||
static rose_ctx_t *rose_ctx_tmp;
|
||||
|
||||
static gint32 code_choice;
|
||||
static guint32 code_local;
|
||||
static const gchar *code_global;
|
||||
static guint32 problem_val;
|
||||
static gchar problem_str[64];
|
||||
static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
|
||||
|
@ -67,15 +63,15 @@ static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
|
|||
|
||||
#include "packet-q932-ros-fn.c"
|
||||
|
||||
/*--- dissect_rose_apdu -----------------------------------------------------*/
|
||||
int dissect_rose_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rose_ctx_t *rctx) {
|
||||
if (rctx)
|
||||
rose_ctx = rctx;
|
||||
/*--- dissect_q932_ros -----------------------------------------------------*/
|
||||
static int dissect_q932_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
||||
rose_ctx_tmp = get_rose_ctx(pinfo->private_data);
|
||||
DISSECTOR_ASSERT(rose_ctx_tmp);
|
||||
return dissect_ROS_PDU(tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
/*--- proto_register_rose ---------------------------------------------------*/
|
||||
void proto_register_rose(void) {
|
||||
/*--- proto_register_q932_ros -----------------------------------------------*/
|
||||
void proto_register_q932_ros(void) {
|
||||
|
||||
/* List of fields */
|
||||
static hf_register_info hf[] = {
|
||||
|
@ -88,17 +84,18 @@ void proto_register_rose(void) {
|
|||
};
|
||||
|
||||
/* Register protocol and dissector */
|
||||
proto_rose = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
||||
proto_set_cant_toggle(proto_rose);
|
||||
proto_q932_ros = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
||||
proto_set_cant_toggle(proto_q932_ros);
|
||||
|
||||
/* Register fields and subtrees */
|
||||
proto_register_field_array(proto_rose, hf, array_length(hf));
|
||||
proto_register_field_array(proto_q932_ros, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_dissector(PFNAME, dissect_q932_ros, proto_q932_ros);
|
||||
}
|
||||
|
||||
/*--- proto_reg_handoff_rose ------------------------------------------------*/
|
||||
void proto_reg_handoff_rose(void) {
|
||||
/*--- proto_reg_handoff_q932_ros --------------------------------------------*/
|
||||
void proto_reg_handoff_q932_ros(void) {
|
||||
data_handle = find_dissector("data");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/* packet-q932-ros.h
|
||||
* Routines for Q.932 packet dissection
|
||||
* 2007 Tomas Kukosa
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef PACKET_ROSE_H
|
||||
#define PACKET_ROSE_H
|
||||
|
||||
#include "epan/asn1.h"
|
||||
|
||||
int dissect_rose_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rose_ctx_t *rctx);
|
||||
|
||||
#endif /* PACKET_ROSE_H */
|
||||
|
|
@ -34,7 +34,6 @@
|
|||
#include <epan/asn1.h>
|
||||
|
||||
#include "packet-ber.h"
|
||||
#include "packet-q932-ros.h"
|
||||
#include "packet-q932.h"
|
||||
|
||||
#define PNAME "Q.932"
|
||||
|
@ -62,6 +61,7 @@ static rose_ctx_t q932_rose_ctx;
|
|||
|
||||
/* Subdissectors */
|
||||
static dissector_handle_t data_handle = NULL;
|
||||
static dissector_handle_t q932_ros_handle = NULL;
|
||||
|
||||
/* Gloabl variables */
|
||||
|
||||
|
@ -166,7 +166,8 @@ dissect_q932_facility_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
|
|||
case 3 : /* returnError */
|
||||
case 4 : /* reject */
|
||||
q932_rose_ctx.apdu_depth = 1;
|
||||
dissect_rose_apdu(next_tvb, pinfo, tree, &q932_rose_ctx);
|
||||
pinfo->private_data = &q932_rose_ctx;
|
||||
call_dissector(q932_ros_handle, next_tvb, pinfo, tree);
|
||||
break;
|
||||
/* DSE APDU */
|
||||
case 12 : /* begin */
|
||||
|
@ -270,7 +271,7 @@ dissect_q932_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
/*--- dissect_q932_apdu -----------------------------------------------------*/
|
||||
static void
|
||||
dissect_q932_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
||||
dissect_rose_apdu(tvb, pinfo, tree, pinfo->private_data);
|
||||
call_dissector(q932_ros_handle, tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
/*--- proto_register_q932 ---------------------------------------------------*/
|
||||
|
@ -311,6 +312,8 @@ void proto_register_q932(void) {
|
|||
proto_register_field_array(proto_q932, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
rose_ctx_init(&q932_rose_ctx);
|
||||
|
||||
/* Register dissector tables */
|
||||
q932_rose_ctx.arg_global_dissector_table = register_dissector_table("q932.ros.global.arg", "Q.932 Operation Argument (global opcode)", FT_STRING, BASE_NONE);
|
||||
q932_rose_ctx.res_global_dissector_table = register_dissector_table("q932.ros.global.res", "Q.932 Operation Result (global opcode)", FT_STRING, BASE_NONE);
|
||||
|
@ -328,6 +331,7 @@ void proto_reg_handoff_q932(void) {
|
|||
/* Notification indicator */
|
||||
dissector_add("q931.ie", (0x00 << 8) | Q932_IE_NOTIFICATION_INDICATOR, q932_ie_handle);
|
||||
|
||||
q932_ros_handle = find_dissector("q932.ros");
|
||||
data_handle = find_dissector("data");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,19 +18,24 @@ Reject/problem/returnResult returnResultProblem
|
|||
|
||||
ReturnResult/result/result resultArgument
|
||||
|
||||
#--- ROS ---
|
||||
|
||||
#.FN_PARS
|
||||
ROS VAL_PTR = &%(ACTX)s->rose_ctx->d.pdu
|
||||
#.FN_HDR ROS
|
||||
/* will be moved to ROS_PDU when PDU function can be alternated from conformance file */
|
||||
actx->rose_ctx = rose_ctx_tmp;
|
||||
rose_ctx_clean_data(actx->rose_ctx);
|
||||
#.END
|
||||
|
||||
#--- Code ---
|
||||
|
||||
#.FN_HDR Code
|
||||
code_choice = -1;
|
||||
code_local = -1;
|
||||
code_global = "";
|
||||
#.FN_PARS
|
||||
Code/local VAL_PTR = &code_local
|
||||
Code/global FN_VARIANT = _str VAL_PTR = &code_global
|
||||
#.FN_FTR Code/local
|
||||
code_choice = 0;
|
||||
#.FN_FTR Code/global
|
||||
code_choice = 1;
|
||||
Code VAL_PTR = &%(ACTX)s->rose_ctx->d.code
|
||||
Code/local VAL_PTR = &%(ACTX)s->rose_ctx->d.code_local
|
||||
Code/global FN_VARIANT = _str VAL_PTR = &%(ACTX)s->rose_ctx->d.code_global
|
||||
#.FN_FTR Code
|
||||
actx->rose_ctx->d.code_item = actx->created_item;
|
||||
#.END
|
||||
|
||||
#--- Problem ---
|
||||
|
@ -70,24 +75,24 @@ Invoke/argument TYPE = FT_BYTES DISPLAY = BASE_HEX
|
|||
|
||||
arg_next_tvb = NULL;
|
||||
#.FN_FTR Invoke
|
||||
if (code_choice == 0) {
|
||||
arg_handle = dissector_get_port_handle(rose_ctx->arg_local_dissector_table, code_local);
|
||||
} else if (code_choice == 1) {
|
||||
arg_handle = dissector_get_string_handle(rose_ctx->arg_global_dissector_table, code_global);
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
arg_handle = dissector_get_port_handle(actx->rose_ctx->arg_local_dissector_table, actx->rose_ctx->d.code_local);
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
arg_handle = dissector_get_string_handle(actx->rose_ctx->arg_global_dissector_table, actx->rose_ctx->d.code_global);
|
||||
} else {
|
||||
arg_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " INV:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " INV:");
|
||||
if (!arg_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(arg_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (arg_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
#.END
|
||||
|
@ -113,24 +118,24 @@ ReturnResult/result/result TYPE = FT_BYTES DISPLAY = BASE_HEX
|
|||
|
||||
res_next_tvb = NULL;
|
||||
#.FN_FTR ReturnResult
|
||||
if (code_choice == 0) {
|
||||
res_handle = dissector_get_port_handle(rose_ctx->res_local_dissector_table, code_local);
|
||||
} else if (code_choice == 1) {
|
||||
res_handle = dissector_get_string_handle(rose_ctx->res_global_dissector_table, code_global);
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
res_handle = dissector_get_port_handle(actx->rose_ctx->res_local_dissector_table, actx->rose_ctx->d.code_local);
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
res_handle = dissector_get_string_handle(actx->rose_ctx->res_global_dissector_table, actx->rose_ctx->d.code_global);
|
||||
} else {
|
||||
res_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " RES:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " RES:");
|
||||
if (!res_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(res_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (res_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((res_handle)?res_handle:data_handle, res_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
#.END
|
||||
|
@ -156,24 +161,24 @@ ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_HEX
|
|||
|
||||
err_next_tvb = NULL;
|
||||
#.FN_FTR ReturnError
|
||||
if (code_choice == 0) {
|
||||
/*err_handle = dissector_get_port_handle(rose_ctx->err_local_dissector_table, code_local);*/
|
||||
} else if (code_choice == 1) {
|
||||
/*err_handle = dissector_get_string_handle(rose_ctx->err_global_dissector_table, code_global);*/
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
/*err_handle = dissector_get_port_handle(actx->rose_ctx->err_local_dissector_table, actx->rose_ctx->d.code_local);*/
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
/*err_handle = dissector_get_string_handle(actx->rose_ctx->err_global_dissector_table, actx->rose_ctx->d.code_global);*/
|
||||
} else {
|
||||
err_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " ERR:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " ERR:");
|
||||
if (!err_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(err_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (err_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
#.END
|
||||
|
@ -183,5 +188,5 @@ ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_HEX
|
|||
#.FN_HDR Reject
|
||||
problem_str[0] = '\0';
|
||||
#.FN_FTR Reject
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " REJ: %s", problem_str);
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " REJ: %s", problem_str);
|
||||
#.END
|
||||
|
|
48
epan/asn1.c
48
epan/asn1.c
|
@ -46,12 +46,58 @@ void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, gboolean aligned, pack
|
|||
}
|
||||
|
||||
gboolean asn1_ctx_check_signature(asn1_ctx_t *actx) {
|
||||
return actx->signature == ASN1_CTX_SIGNATURE;
|
||||
return actx && (actx->signature == ASN1_CTX_SIGNATURE);
|
||||
}
|
||||
|
||||
void asn1_ctx_clean_external(asn1_ctx_t *actx) {
|
||||
memset(&actx->external, '\0', sizeof(actx->external));
|
||||
actx->external.hf_index = -1;
|
||||
actx->external.encoding = -1;
|
||||
}
|
||||
|
||||
void asn1_ctx_clean_epdv(asn1_ctx_t *actx) {
|
||||
memset(&actx->embedded_pdv, '\0', sizeof(actx->embedded_pdv));
|
||||
actx->embedded_pdv.hf_index = -1;
|
||||
actx->embedded_pdv.identification = -1;
|
||||
}
|
||||
|
||||
void rose_ctx_init(rose_ctx_t *rctx) {
|
||||
memset(rctx, '\0', sizeof(*rctx));
|
||||
rctx->signature = ROSE_CTX_SIGNATURE;
|
||||
}
|
||||
|
||||
gboolean rose_ctx_check_signature(rose_ctx_t *rctx) {
|
||||
return rctx && (rctx->signature == ROSE_CTX_SIGNATURE);
|
||||
}
|
||||
|
||||
void rose_ctx_clean_data(rose_ctx_t *rctx) {
|
||||
memset(&rctx->d, '\0', sizeof(rctx->d));
|
||||
rctx->d.code = -1;
|
||||
}
|
||||
|
||||
asn1_ctx_t *get_asn1_ctx(void *ptr) {
|
||||
asn1_ctx_t *actx = (asn1_ctx_t*)ptr;
|
||||
|
||||
if (!asn1_ctx_check_signature(actx))
|
||||
actx = NULL;
|
||||
|
||||
return actx;
|
||||
}
|
||||
|
||||
rose_ctx_t *get_rose_ctx(void *ptr) {
|
||||
rose_ctx_t *rctx = (rose_ctx_t*)ptr;
|
||||
asn1_ctx_t *actx = (asn1_ctx_t*)ptr;
|
||||
|
||||
if (!asn1_ctx_check_signature(actx))
|
||||
actx = NULL;
|
||||
|
||||
if (actx)
|
||||
rctx = actx->rose_ctx;
|
||||
|
||||
if (!rose_ctx_check_signature(rctx))
|
||||
rctx = NULL;
|
||||
|
||||
return rctx;
|
||||
}
|
||||
|
||||
double asn1_get_real(const guint8 *real_ptr, gint real_len) {
|
||||
|
|
27
epan/asn1.h
27
epan/asn1.h
|
@ -55,7 +55,7 @@ typedef struct _asn1_ctx_t {
|
|||
int hf_index;
|
||||
const char *direct_reference;
|
||||
gint32 indirect_reference;
|
||||
guint32 encoding;
|
||||
gint encoding;
|
||||
/*
|
||||
0 : single-ASN1-type,
|
||||
1 : octet-aligned,
|
||||
|
@ -76,7 +76,7 @@ typedef struct _asn1_ctx_t {
|
|||
struct {
|
||||
tvbuff_t *data_value_descriptor;
|
||||
int hf_index;
|
||||
guint32 identification;
|
||||
gint identification;
|
||||
/*
|
||||
0 : syntaxes,
|
||||
1 : syntax,
|
||||
|
@ -110,20 +110,37 @@ typedef struct _rose_ctx_t {
|
|||
dissector_table_t res_global_dissector_table;
|
||||
dissector_table_t res_local_dissector_table;
|
||||
int apdu_depth;
|
||||
guint32 code;
|
||||
struct { /* "dynamic" data */
|
||||
gint pdu;
|
||||
/*
|
||||
1 : invoke,
|
||||
2 : returnResult,
|
||||
3 : returnError,
|
||||
4 : reject
|
||||
*/
|
||||
gint code;
|
||||
/*
|
||||
0 : local,
|
||||
1 : global
|
||||
*/
|
||||
gint32 local;
|
||||
const char *global;
|
||||
gint32 code_local;
|
||||
const char *code_global;
|
||||
proto_item *code_item;
|
||||
} d;
|
||||
void *private_data;
|
||||
} rose_ctx_t;
|
||||
|
||||
extern void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, gboolean aligned, packet_info *pinfo);
|
||||
extern gboolean asn1_ctx_check_signature(asn1_ctx_t *actx);
|
||||
extern void asn1_ctx_clean_external(asn1_ctx_t *actx);
|
||||
extern void asn1_ctx_clean_epdv(asn1_ctx_t *actx);
|
||||
|
||||
extern void rose_ctx_init(rose_ctx_t *rctx);
|
||||
extern gboolean rose_ctx_check_signature(rose_ctx_t *rctx);
|
||||
extern void rose_ctx_clean_data(rose_ctx_t *rctx);
|
||||
|
||||
extern asn1_ctx_t *get_asn1_ctx(void *ptr);
|
||||
extern rose_ctx_t *get_rose_ctx(void *ptr);
|
||||
|
||||
extern double asn1_get_real(const guint8 *real_ptr, gint real_len);
|
||||
|
||||
|
|
|
@ -1244,7 +1244,7 @@ dissect_per_real(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tr
|
|||
|
||||
/* 22 Encoding the choice type */
|
||||
guint32
|
||||
dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, guint32 *value)
|
||||
dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, gint *value)
|
||||
{
|
||||
gboolean extension_present, extension_flag;
|
||||
int extension_root_entries;
|
||||
|
@ -1258,6 +1258,8 @@ dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *
|
|||
|
||||
DEBUG_ENTRY("dissect_per_choice");
|
||||
|
||||
if (value) *value = -1;
|
||||
|
||||
/* 22.5 */
|
||||
if (choice[0].extension == ASN1_NO_EXTENSIONS){
|
||||
extension_present = FALSE;
|
||||
|
@ -1333,7 +1335,8 @@ DEBUG_ENTRY("dissect_per_choice");
|
|||
}
|
||||
}
|
||||
|
||||
if (value) *value = choice[index].value;
|
||||
if (value && (index != -1))
|
||||
*value = choice[index].value;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef int (*per_type_fn)(tvbuff_t*, int, asn1_ctx_t*, proto_tree*, int);
|
|||
#define ASN1_OPTIONAL ASN1_OPT
|
||||
|
||||
typedef struct _per_choice_t {
|
||||
int value;
|
||||
gint value;
|
||||
const int *p_id;
|
||||
int extension;
|
||||
per_type_fn func;
|
||||
|
@ -104,7 +104,7 @@ extern guint32 dissect_per_constrained_integer(tvbuff_t *tvb, guint32 offset, as
|
|||
|
||||
extern guint32 dissect_per_real(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, double *value);
|
||||
|
||||
extern guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, guint32 *value);
|
||||
extern guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, gint *value);
|
||||
|
||||
extern guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *sequence);
|
||||
|
||||
|
|
|
@ -44,14 +44,13 @@
|
|||
#include <epan/asn1.h>
|
||||
|
||||
#include "packet-ber.h"
|
||||
#include "packet-q932-ros.h"
|
||||
|
||||
#define PNAME "Q.932 Operations Service Element"
|
||||
#define PSNAME "Q932.ROS"
|
||||
#define PFNAME "q932.ros"
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
int proto_rose = -1;
|
||||
int proto_q932_ros = -1;
|
||||
|
||||
/*--- Included file: packet-q932-ros-hf.c ---*/
|
||||
#line 1 "packet-q932-ros-hf.c"
|
||||
|
@ -82,7 +81,7 @@ static int hf_q932_ros_gfpROS = -1; /* ROS */
|
|||
static int hf_q932_ros_InvokeId_present = -1; /* InvokeId_present */
|
||||
|
||||
/*--- End of included file: packet-q932-ros-hf.c ---*/
|
||||
#line 48 "packet-q932-ros-template.c"
|
||||
#line 47 "packet-q932-ros-template.c"
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
|
||||
|
@ -101,7 +100,7 @@ static gint ett_q932_ros_InvokeId = -1;
|
|||
static gint ett_q932_ros_Components = -1;
|
||||
|
||||
/*--- End of included file: packet-q932-ros-ett.c ---*/
|
||||
#line 51 "packet-q932-ros-template.c"
|
||||
#line 50 "packet-q932-ros-template.c"
|
||||
|
||||
/* Preferences */
|
||||
|
||||
|
@ -109,11 +108,8 @@ static gint ett_q932_ros_Components = -1;
|
|||
static dissector_handle_t data_handle = NULL;
|
||||
|
||||
/* Gloabl variables */
|
||||
static rose_ctx_t *rose_ctx;
|
||||
static rose_ctx_t *rose_ctx_tmp;
|
||||
|
||||
static gint32 code_choice;
|
||||
static guint32 code_local;
|
||||
static const gchar *code_global;
|
||||
static guint32 problem_val;
|
||||
static gchar problem_str[64];
|
||||
static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
|
||||
|
@ -127,10 +123,7 @@ static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
|
|||
static int
|
||||
dissect_q932_ros_T_local(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_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||||
&code_local);
|
||||
|
||||
#line 31 "q932-ros.cnf"
|
||||
code_choice = 0;
|
||||
&actx->rose_ctx->d.code_local);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -139,10 +132,7 @@ dissect_q932_ros_T_local(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
|
|||
|
||||
static int
|
||||
dissect_q932_ros_T_global(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_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &code_global);
|
||||
|
||||
#line 33 "q932-ros.cnf"
|
||||
code_choice = 1;
|
||||
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->rose_ctx->d.code_global);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -162,14 +152,12 @@ static const ber_choice_t Code_choice[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_Code(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 24 "q932-ros.cnf"
|
||||
code_choice = -1;
|
||||
code_local = -1;
|
||||
code_global = "";
|
||||
|
||||
offset = dissect_ber_choice(actx, tree, tvb, offset,
|
||||
Code_choice, hf_index, ett_q932_ros_Code,
|
||||
NULL);
|
||||
&actx->rose_ctx->d.code);
|
||||
|
||||
#line 38 "q932-ros.cnf"
|
||||
actx->rose_ctx->d.code_item = actx->created_item;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -270,7 +258,7 @@ dissect_q932_ros_T_linkedId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
|
|||
|
||||
static int
|
||||
dissect_q932_ros_InvokeArgument(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 59 "q932-ros.cnf"
|
||||
#line 64 "q932-ros.cnf"
|
||||
gint len;
|
||||
|
||||
len = tvb_length_remaining(tvb, offset);
|
||||
|
@ -296,7 +284,7 @@ static const ber_sequence_t Invoke_sequence[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_Invoke(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 69 "q932-ros.cnf"
|
||||
#line 74 "q932-ros.cnf"
|
||||
dissector_handle_t arg_handle = NULL;
|
||||
|
||||
arg_next_tvb = NULL;
|
||||
|
@ -304,25 +292,25 @@ dissect_q932_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
|||
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
||||
Invoke_sequence, hf_index, ett_q932_ros_Invoke);
|
||||
|
||||
#line 73 "q932-ros.cnf"
|
||||
if (code_choice == 0) {
|
||||
arg_handle = dissector_get_port_handle(rose_ctx->arg_local_dissector_table, code_local);
|
||||
} else if (code_choice == 1) {
|
||||
arg_handle = dissector_get_string_handle(rose_ctx->arg_global_dissector_table, code_global);
|
||||
#line 78 "q932-ros.cnf"
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
arg_handle = dissector_get_port_handle(actx->rose_ctx->arg_local_dissector_table, actx->rose_ctx->d.code_local);
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
arg_handle = dissector_get_string_handle(actx->rose_ctx->arg_global_dissector_table, actx->rose_ctx->d.code_global);
|
||||
} else {
|
||||
arg_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " INV:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " INV:");
|
||||
if (!arg_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(arg_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (arg_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
|
||||
|
@ -333,7 +321,7 @@ dissect_q932_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
|||
|
||||
static int
|
||||
dissect_q932_ros_ResultArgument(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 102 "q932-ros.cnf"
|
||||
#line 107 "q932-ros.cnf"
|
||||
gint len;
|
||||
|
||||
len = tvb_length_remaining(tvb, offset);
|
||||
|
@ -372,7 +360,7 @@ static const ber_sequence_t ReturnResult_sequence[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_ReturnResult(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 112 "q932-ros.cnf"
|
||||
#line 117 "q932-ros.cnf"
|
||||
dissector_handle_t res_handle = NULL;
|
||||
|
||||
res_next_tvb = NULL;
|
||||
|
@ -380,25 +368,25 @@ dissect_q932_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
|
|||
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
||||
ReturnResult_sequence, hf_index, ett_q932_ros_ReturnResult);
|
||||
|
||||
#line 116 "q932-ros.cnf"
|
||||
if (code_choice == 0) {
|
||||
res_handle = dissector_get_port_handle(rose_ctx->res_local_dissector_table, code_local);
|
||||
} else if (code_choice == 1) {
|
||||
res_handle = dissector_get_string_handle(rose_ctx->res_global_dissector_table, code_global);
|
||||
#line 121 "q932-ros.cnf"
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
res_handle = dissector_get_port_handle(actx->rose_ctx->res_local_dissector_table, actx->rose_ctx->d.code_local);
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
res_handle = dissector_get_string_handle(actx->rose_ctx->res_global_dissector_table, actx->rose_ctx->d.code_global);
|
||||
} else {
|
||||
res_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " RES:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " RES:");
|
||||
if (!res_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(res_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (res_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((res_handle)?res_handle:data_handle, res_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
|
||||
|
@ -409,7 +397,7 @@ dissect_q932_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
|
|||
|
||||
static int
|
||||
dissect_q932_ros_T_parameter(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 144 "q932-ros.cnf"
|
||||
#line 149 "q932-ros.cnf"
|
||||
|
||||
gint len;
|
||||
|
||||
|
@ -435,7 +423,7 @@ static const ber_sequence_t ReturnError_sequence[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_ReturnError(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 155 "q932-ros.cnf"
|
||||
#line 160 "q932-ros.cnf"
|
||||
dissector_handle_t err_handle = NULL;
|
||||
|
||||
err_next_tvb = NULL;
|
||||
|
@ -443,25 +431,25 @@ dissect_q932_ros_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
|
|||
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
||||
ReturnError_sequence, hf_index, ett_q932_ros_ReturnError);
|
||||
|
||||
#line 159 "q932-ros.cnf"
|
||||
if (code_choice == 0) {
|
||||
/*err_handle = dissector_get_port_handle(rose_ctx->err_local_dissector_table, code_local);*/
|
||||
} else if (code_choice == 1) {
|
||||
/*err_handle = dissector_get_string_handle(rose_ctx->err_global_dissector_table, code_global);*/
|
||||
#line 164 "q932-ros.cnf"
|
||||
if (actx->rose_ctx->d.code == 0) {
|
||||
/*err_handle = dissector_get_port_handle(actx->rose_ctx->err_local_dissector_table, actx->rose_ctx->d.code_local);*/
|
||||
} else if (actx->rose_ctx->d.code == 1) {
|
||||
/*err_handle = dissector_get_string_handle(actx->rose_ctx->err_global_dissector_table, actx->rose_ctx->d.code_global);*/
|
||||
} else {
|
||||
err_handle = NULL;
|
||||
}
|
||||
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " ERR:");
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " ERR:");
|
||||
if (!err_handle ||
|
||||
!proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(err_handle)))) {
|
||||
if (code_choice == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %d", code_local);
|
||||
else if (code_choice == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " %s", code_global);
|
||||
if (actx->rose_ctx->d.code == 0)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %d", actx->rose_ctx->d.code_local);
|
||||
else if (actx->rose_ctx->d.code == 1)
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", actx->rose_ctx->d.code_global);
|
||||
}
|
||||
if (err_next_tvb) {
|
||||
actx->pinfo->private_data = rose_ctx;
|
||||
actx->pinfo->private_data = actx->rose_ctx;
|
||||
call_dissector((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree);
|
||||
}
|
||||
|
||||
|
@ -482,7 +470,7 @@ dissect_q932_ros_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
|
|||
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||||
&problem_val);
|
||||
|
||||
#line 44 "q932-ros.cnf"
|
||||
#line 49 "q932-ros.cnf"
|
||||
strcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_GeneralProblem_vals), ""));
|
||||
|
||||
return offset;
|
||||
|
@ -507,7 +495,7 @@ dissect_q932_ros_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
|
|||
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||||
&problem_val);
|
||||
|
||||
#line 46 "q932-ros.cnf"
|
||||
#line 51 "q932-ros.cnf"
|
||||
strcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_InvokeProblem_vals), ""));
|
||||
|
||||
return offset;
|
||||
|
@ -527,7 +515,7 @@ dissect_q932_ros_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U
|
|||
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||||
&problem_val);
|
||||
|
||||
#line 48 "q932-ros.cnf"
|
||||
#line 53 "q932-ros.cnf"
|
||||
strcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""));
|
||||
|
||||
return offset;
|
||||
|
@ -549,7 +537,7 @@ dissect_q932_ros_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
|
|||
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||||
&problem_val);
|
||||
|
||||
#line 50 "q932-ros.cnf"
|
||||
#line 55 "q932-ros.cnf"
|
||||
strcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""));
|
||||
|
||||
return offset;
|
||||
|
@ -590,14 +578,14 @@ static const ber_sequence_t Reject_sequence[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_Reject(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 184 "q932-ros.cnf"
|
||||
#line 189 "q932-ros.cnf"
|
||||
problem_str[0] = '\0';
|
||||
|
||||
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
||||
Reject_sequence, hf_index, ett_q932_ros_Reject);
|
||||
|
||||
#line 186 "q932-ros.cnf"
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rose_ctx->apdu_depth), " REJ: %s", problem_str);
|
||||
#line 191 "q932-ros.cnf"
|
||||
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " REJ: %s", problem_str);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -621,9 +609,14 @@ static const ber_choice_t ROS_choice[] = {
|
|||
|
||||
static int
|
||||
dissect_q932_ros_ROS(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 26 "q932-ros.cnf"
|
||||
/* will be moved to ROS_PDU when PDU function can be alternated from conformance file */
|
||||
actx->rose_ctx = rose_ctx_tmp;
|
||||
rose_ctx_clean_data(actx->rose_ctx);
|
||||
|
||||
offset = dissect_ber_choice(actx, tree, tvb, offset,
|
||||
ROS_choice, hf_index, ett_q932_ros_ROS,
|
||||
NULL);
|
||||
&actx->rose_ctx->d.pdu);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -702,17 +695,17 @@ static int dissect_ROS_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree
|
|||
|
||||
|
||||
/*--- End of included file: packet-q932-ros-fn.c ---*/
|
||||
#line 69 "packet-q932-ros-template.c"
|
||||
#line 65 "packet-q932-ros-template.c"
|
||||
|
||||
/*--- dissect_rose_apdu -----------------------------------------------------*/
|
||||
int dissect_rose_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rose_ctx_t *rctx) {
|
||||
if (rctx)
|
||||
rose_ctx = rctx;
|
||||
/*--- dissect_q932_ros -----------------------------------------------------*/
|
||||
static int dissect_q932_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
||||
rose_ctx_tmp = get_rose_ctx(pinfo->private_data);
|
||||
DISSECTOR_ASSERT(rose_ctx_tmp);
|
||||
return dissect_ROS_PDU(tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
/*--- proto_register_rose ---------------------------------------------------*/
|
||||
void proto_register_rose(void) {
|
||||
/*--- proto_register_q932_ros -----------------------------------------------*/
|
||||
void proto_register_q932_ros(void) {
|
||||
|
||||
/* List of fields */
|
||||
static hf_register_info hf[] = {
|
||||
|
@ -821,7 +814,7 @@ void proto_register_rose(void) {
|
|||
"q932_ros.InvokeId_present", HFILL }},
|
||||
|
||||
/*--- End of included file: packet-q932-ros-hfarr.c ---*/
|
||||
#line 83 "packet-q932-ros-template.c"
|
||||
#line 79 "packet-q932-ros-template.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
|
@ -842,21 +835,22 @@ void proto_register_rose(void) {
|
|||
&ett_q932_ros_Components,
|
||||
|
||||
/*--- End of included file: packet-q932-ros-ettarr.c ---*/
|
||||
#line 88 "packet-q932-ros-template.c"
|
||||
#line 84 "packet-q932-ros-template.c"
|
||||
};
|
||||
|
||||
/* Register protocol and dissector */
|
||||
proto_rose = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
||||
proto_set_cant_toggle(proto_rose);
|
||||
proto_q932_ros = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
||||
proto_set_cant_toggle(proto_q932_ros);
|
||||
|
||||
/* Register fields and subtrees */
|
||||
proto_register_field_array(proto_rose, hf, array_length(hf));
|
||||
proto_register_field_array(proto_q932_ros, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_dissector(PFNAME, dissect_q932_ros, proto_q932_ros);
|
||||
}
|
||||
|
||||
/*--- proto_reg_handoff_rose ------------------------------------------------*/
|
||||
void proto_reg_handoff_rose(void) {
|
||||
/*--- proto_reg_handoff_q932_ros --------------------------------------------*/
|
||||
void proto_reg_handoff_q932_ros(void) {
|
||||
data_handle = find_dissector("data");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* Do not modify this file. */
|
||||
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
|
||||
/* .\packet-q932-ros.h */
|
||||
/* ../../tools/asn2wrs.py -b -T -X -p q932.ros -c q932-ros.cnf -o q932-ros -s packet-q932-ros-template ../ros/Remote-Operations-Information-Objects.asn Facility-Information-Element-Components.asn */
|
||||
|
||||
/* Input file: packet-q932-ros-template.h */
|
||||
|
||||
#line 1 "packet-q932-ros-template.h"
|
||||
/* packet-q932-ros.h
|
||||
* Routines for Q.932 packet dissection
|
||||
* 2007 Tomas Kukosa
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef PACKET_ROSE_H
|
||||
#define PACKET_ROSE_H
|
||||
|
||||
#include "epan/asn1.h"
|
||||
|
||||
int dissect_rose_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rose_ctx_t *rctx);
|
||||
|
||||
#endif /* PACKET_ROSE_H */
|
||||
|
|
@ -42,7 +42,6 @@
|
|||
#include <epan/asn1.h>
|
||||
|
||||
#include "packet-ber.h"
|
||||
#include "packet-q932-ros.h"
|
||||
#include "packet-q932.h"
|
||||
|
||||
#define PNAME "Q.932"
|
||||
|
@ -98,7 +97,7 @@ static int hf_q932_destinationEntity = -1; /* EntityType */
|
|||
static int hf_q932_destinationEntityAddress = -1; /* AddressInformation */
|
||||
|
||||
/*--- End of included file: packet-q932-hf.c ---*/
|
||||
#line 52 "packet-q932-template.c"
|
||||
#line 51 "packet-q932-template.c"
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_q932 = -1;
|
||||
|
@ -121,7 +120,7 @@ static gint ett_q932_UserSpecifiedSubaddress = -1;
|
|||
static gint ett_q932_NetworkFacilityExtension_U = -1;
|
||||
|
||||
/*--- End of included file: packet-q932-ett.c ---*/
|
||||
#line 57 "packet-q932-template.c"
|
||||
#line 56 "packet-q932-template.c"
|
||||
|
||||
/* Preferences */
|
||||
|
||||
|
@ -130,6 +129,7 @@ static rose_ctx_t q932_rose_ctx;
|
|||
|
||||
/* Subdissectors */
|
||||
static dissector_handle_t data_handle = NULL;
|
||||
static dissector_handle_t q932_ros_handle = NULL;
|
||||
|
||||
/* Gloabl variables */
|
||||
|
||||
|
@ -680,7 +680,8 @@ dissect_q932_facility_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
|
|||
case 3 : /* returnError */
|
||||
case 4 : /* reject */
|
||||
q932_rose_ctx.apdu_depth = 1;
|
||||
dissect_rose_apdu(next_tvb, pinfo, tree, &q932_rose_ctx);
|
||||
pinfo->private_data = &q932_rose_ctx;
|
||||
call_dissector(q932_ros_handle, next_tvb, pinfo, tree);
|
||||
break;
|
||||
/* DSE APDU */
|
||||
case 12 : /* begin */
|
||||
|
@ -784,7 +785,7 @@ dissect_q932_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
/*--- dissect_q932_apdu -----------------------------------------------------*/
|
||||
static void
|
||||
dissect_q932_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
||||
dissect_rose_apdu(tvb, pinfo, tree, pinfo->private_data);
|
||||
call_dissector(q932_ros_handle, tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
/*--- proto_register_q932 ---------------------------------------------------*/
|
||||
|
@ -960,7 +961,7 @@ void proto_register_q932(void) {
|
|||
"q932.AddressInformation", HFILL }},
|
||||
|
||||
/*--- End of included file: packet-q932-hfarr.c ---*/
|
||||
#line 297 "packet-q932-template.c"
|
||||
#line 298 "packet-q932-template.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
|
@ -985,7 +986,7 @@ void proto_register_q932(void) {
|
|||
&ett_q932_NetworkFacilityExtension_U,
|
||||
|
||||
/*--- End of included file: packet-q932-ettarr.c ---*/
|
||||
#line 304 "packet-q932-template.c"
|
||||
#line 305 "packet-q932-template.c"
|
||||
};
|
||||
|
||||
/* Register protocol and dissector */
|
||||
|
@ -996,6 +997,8 @@ void proto_register_q932(void) {
|
|||
proto_register_field_array(proto_q932, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
rose_ctx_init(&q932_rose_ctx);
|
||||
|
||||
/* Register dissector tables */
|
||||
q932_rose_ctx.arg_global_dissector_table = register_dissector_table("q932.ros.global.arg", "Q.932 Operation Argument (global opcode)", FT_STRING, BASE_NONE);
|
||||
q932_rose_ctx.res_global_dissector_table = register_dissector_table("q932.ros.global.res", "Q.932 Operation Result (global opcode)", FT_STRING, BASE_NONE);
|
||||
|
@ -1013,6 +1016,7 @@ void proto_reg_handoff_q932(void) {
|
|||
/* Notification indicator */
|
||||
dissector_add("q931.ie", (0x00 << 8) | Q932_IE_NOTIFICATION_INDICATOR, q932_ie_handle);
|
||||
|
||||
q932_ros_handle = find_dissector("q932.ros");
|
||||
data_handle = find_dissector("data");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue