use "type function" instead of "field function" in PER CHOICE and SEQUENCE tables

it matches asn2wrs approach and makes generated dissectors source shorter

svn path=/trunk/; revision=18612
This commit is contained in:
Tomas Kukosa 2006-06-29 15:26:41 +00:00
parent 8c8a4ce877
commit 9be9eb8e14
26 changed files with 12095 additions and 20853 deletions

View File

@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/oid_resolv.h>
#include <stdio.h>
#include <string.h>
@ -50,7 +51,7 @@ int proto_h235 = -1;
#include "packet-h235-ett.c"
static guint32
dissect_xxx_ToBeSigned(tvbuff_t *tvb, guint32 offset, asn_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
dissect_xxx_ToBeSigned(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
PER_NOT_DECODED_YET("ToBeSigned");
return offset;
}

View File

@ -135,6 +135,7 @@ static dissector_handle_t h4501_handle=NULL;
static int proto_h4501 = -1;
static int hf_h4501 = -1;
static int hf_h4501_dummy = -1;
static int hf_h4501_constrained_invokeId = -1;
static int hf_h4501_invokeId = -1;
static int hf_h4501_localOpcode = -1;
@ -298,7 +299,7 @@ static const value_string localOpcode_vals[] = {
{ 0, NULL }
};
static int dissect_h4501_argument(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree);
static int dissect_h4501_Argument(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index);
static int dissect_ros_ROSxxx(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_ind _U_);
@ -317,9 +318,9 @@ static const value_string InvokeProblem_vals[] = {
{ 0, NULL }
};
static int
dissect_h4501_InvokeProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_InvokeProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_h4501_InvokeProblem, 0, 7, NULL, FALSE);
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0, 7, NULL, FALSE);
return offset;
}
@ -331,9 +332,9 @@ static const value_string ReturnResultProblem_vals[] = {
{ 0, NULL }
};
static int
dissect_h4501_ReturnResultProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ReturnResultProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_h4501_ReturnResultProblem, 0, 2, NULL, FALSE);
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0, 2, NULL, FALSE);
return offset;
}
@ -347,9 +348,9 @@ static const value_string ReturnErrorProblem_vals[] = {
{ 0, NULL }
};
static int
dissect_h4501_ReturnErrorProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ReturnErrorProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_h4501_ReturnErrorProblem, 0, 4, NULL, FALSE);
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0, 4, NULL, FALSE);
return offset;
}
@ -360,13 +361,13 @@ static const value_string GeneralProblem_vals[] = {
{ 0, NULL }
};
static int
dissect_h4501_GeneralProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_GeneralProblem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_h4501_GeneralProblem, 0, 2, NULL, FALSE);
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0, 2, NULL, FALSE);
return offset;
}
static int
dissect_h4501_ReturnResult_result(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ReturnResult_result(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
tvbuff_t *result_tvb = NULL;
@ -422,18 +423,18 @@ PER_NOT_DECODED_YET("Unrecognized H.450.x return result");
}
static int
dissect_h4501_localOpcode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_LocalOpcode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_integer(tvb, offset, actx, tree, hf_h4501_localOpcode, &localOpcode);
offset=dissect_per_integer(tvb, offset, actx, tree, hf_index, &localOpcode);
is_globalcode = FALSE;
return offset;
}
static int
dissect_h4501_globalCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_GlobalCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_object_identifier_str(tvb, offset, actx, tree, hf_h4501_globalCode, &globalcode_oid_str);
offset=dissect_per_object_identifier_str(tvb, offset, actx, tree, hf_index, &globalcode_oid_str);
is_globalcode = TRUE;
return offset;
}
@ -445,38 +446,38 @@ static const value_string opcode_vals[] = {
{ 0, NULL}
};
static const per_choice_t opcode_choice[] = {
{ 0, "local", ASN1_NO_EXTENSIONS,
dissect_h4501_localOpcode },
{ 1, "global", ASN1_NO_EXTENSIONS,
dissect_h4501_globalCode },
{ 0, &hf_h4501_localOpcode, ASN1_NO_EXTENSIONS,
dissect_h4501_LocalOpcode },
{ 1, &hf_h4501_globalCode, ASN1_NO_EXTENSIONS,
dissect_h4501_GlobalCode },
{ 0, NULL, 0, NULL }
};
static int
dissect_h4501_opcode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Opcode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_choice(tvb, offset, actx, tree, hf_h4501_opcode, ett_h4501_opcode, opcode_choice, NULL);
offset=dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_h4501_opcode, opcode_choice, NULL);
return offset;
}
static const per_sequence_t result_sequence[] = {
{ "opcode", ASN1_EXTENSION_ROOT, ASN1_NOT_OPTIONAL,
dissect_h4501_opcode },
{ "result", ASN1_EXTENSION_ROOT, ASN1_NOT_OPTIONAL,
{ "opcode", &hf_h4501_opcode, ASN1_EXTENSION_ROOT, ASN1_NOT_OPTIONAL,
dissect_h4501_Opcode },
{ "result", &hf_h4501_dummy, ASN1_EXTENSION_ROOT, ASN1_NOT_OPTIONAL,
dissect_h4501_ReturnResult_result },
{ NULL, 0, 0, NULL }
};
static int
dissect_h4501_result(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Result(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_h4501_result, ett_h4501_result, result_sequence);
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h4501_result, result_sequence);
return offset;
}
static int
dissect_h4501_parameter(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Parameter(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
/* TODO - decode return error parameter based on localErrorCode */
offset=dissect_per_octet_string(tvb, offset, actx, tree, hf_h4501_parameter, NO_BOUND, NO_BOUND, NULL);
offset=dissect_per_octet_string(tvb, offset, actx, tree, hf_index, NO_BOUND, NO_BOUND, NULL);
return offset;
}
static const value_string localErrorCode_vals[] = {
@ -528,9 +529,9 @@ static const value_string localErrorCode_vals[] = {
{ 0, NULL }
};
static int
dissect_h4501_localErrorCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_LocalErrorCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_integer(tvb, offset, actx, tree, hf_h4501_localErrorCode, &localErrorCode);
offset=dissect_per_integer(tvb, offset, actx, tree, hf_index, &localErrorCode);
return offset;
}
@ -541,16 +542,16 @@ static const value_string errorCode_vals[] = {
{ 0, NULL}
};
static const per_choice_t errorCode_choice[] = {
{ 0, "local", ASN1_NO_EXTENSIONS,
dissect_h4501_localErrorCode },
{ 1, "global", ASN1_NO_EXTENSIONS,
dissect_h4501_globalCode },
{ 0, &hf_h4501_localErrorCode, ASN1_NO_EXTENSIONS,
dissect_h4501_LocalErrorCode },
{ 1, &hf_h4501_globalCode, ASN1_NO_EXTENSIONS,
dissect_h4501_GlobalCode },
{ 0, NULL, 0, NULL }
};
static int
dissect_h4501_errorCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ErrorCode(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_choice(tvb, offset, actx, tree, hf_h4501_errorCode, ett_h4501_errorCode, errorCode_choice, NULL);
offset=dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_h4501_errorCode, errorCode_choice, NULL);
return offset;
}
@ -562,96 +563,96 @@ static const value_string problem_vals[] = {
{ 0, NULL}
};
static const per_choice_t problem_choice[] = {
{ 0, "general", ASN1_NO_EXTENSIONS,
{ 0, &hf_h4501_GeneralProblem, ASN1_NO_EXTENSIONS,
dissect_h4501_GeneralProblem },
{ 1, "invoke", ASN1_NO_EXTENSIONS,
{ 1, &hf_h4501_InvokeProblem, ASN1_NO_EXTENSIONS,
dissect_h4501_InvokeProblem },
{ 2, "returnResult", ASN1_NO_EXTENSIONS,
{ 2, &hf_h4501_ReturnResultProblem, ASN1_NO_EXTENSIONS,
dissect_h4501_ReturnResultProblem },
{ 3, "returnError", ASN1_NO_EXTENSIONS,
{ 3, &hf_h4501_ReturnErrorProblem, ASN1_NO_EXTENSIONS,
dissect_h4501_ReturnErrorProblem },
{ 0, NULL, 0, NULL }
};
static int
dissect_h4501_problem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Problem(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_choice(tvb, offset, actx, tree, hf_h4501_problem, ett_h4501_problem, problem_choice, NULL);
offset=dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_h4501_problem, problem_choice, NULL);
return offset;
}
static int
dissect_h4501_constrained_invokeId(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Constrained_invokeId(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_h4501_constrained_invokeId, 0, 65535, NULL, FALSE);
offset=dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0, 65535, NULL, FALSE);
return offset;
}
static int
dissect_h4501_invokeId(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_InvokeId(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_integer(tvb, offset, actx, tree, hf_h4501_invokeId, NULL);
offset=dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
return offset;
}
static const per_sequence_t Reject_sequence[] = {
{ "invokeID", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_invokeId },
{ "problem", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_problem },
{ "invokeID", &hf_h4501_invokeId, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_InvokeId },
{ "problem", &hf_h4501_problem, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_Problem },
{ NULL, 0, 0, NULL }
};
static int
dissect_h4501_Reject(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Reject(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_h4501_Reject, ett_h4501_Reject, Reject_sequence);
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h4501_Reject, Reject_sequence);
return offset;
}
static const per_sequence_t ReturnError_sequence[] = {
{ "invokeID", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_invokeId },
{ "errorCode", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_errorCode },
{ "parameter", ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_parameter },
{ "invokeID", &hf_h4501_invokeId, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_InvokeId },
{ "errorCode", &hf_h4501_errorCode, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_ErrorCode },
{ "parameter", &hf_h4501_parameter, ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_Parameter },
{ NULL, 0, 0, NULL }
};
static int
dissect_h4501_ReturnError(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ReturnError(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_h4501_ReturnError, ett_h4501_ReturnError, ReturnError_sequence);
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h4501_ReturnError, ReturnError_sequence);
return offset;
}
static const per_sequence_t ReturnResult_sequence[] = {
{ "invokeID", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_invokeId },
{ "result", ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_result },
{ "invokeID", &hf_h4501_invokeId, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_InvokeId },
{ "result", &hf_h4501_result, ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_Result },
{ NULL, 0, 0, NULL }
};
static int
dissect_h4501_ReturnResult(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_ReturnResult(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_h4501_ReturnResult, ett_h4501_ReturnResult, ReturnResult_sequence);
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h4501_ReturnResult, ReturnResult_sequence);
return offset;
}
static const per_sequence_t Invoke_sequence[] = {
{ "invokeID", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_constrained_invokeId },
{ "linkedId", ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_invokeId },
{ "opcode", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_opcode },
{ "argument", ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_argument },
{ "invokeID", &hf_h4501_constrained_invokeId, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_Constrained_invokeId },
{ "linkedId", &hf_h4501_invokeId, ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_InvokeId },
{ "opcode", &hf_h4501_opcode, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_h4501_Opcode },
{ "argument", &hf_h4501_dummy, ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_h4501_Argument },
{ NULL, 0, 0, NULL }
};
static int
dissect_h4501_Invoke(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Invoke(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_h4501_Invoke, ett_h4501_Invoke, Invoke_sequence);
offset=dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h4501_Invoke, Invoke_sequence);
return offset;
}
@ -663,13 +664,13 @@ static const value_string ROS_vals[] = {
{ 0, NULL}
};
static const per_choice_t ROS_choice[] = {
{ 1, "invoke", ASN1_NO_EXTENSIONS,
{ 1, &hf_h4501_Invoke, ASN1_NO_EXTENSIONS,
dissect_h4501_Invoke },
{ 2, "returnResult", ASN1_NO_EXTENSIONS,
{ 2, &hf_h4501_ReturnResult, ASN1_NO_EXTENSIONS,
dissect_h4501_ReturnResult },
{ 3, "returnError", ASN1_NO_EXTENSIONS,
{ 3, &hf_h4501_ReturnError, ASN1_NO_EXTENSIONS,
dissect_h4501_ReturnError },
{ 4, "reject", ASN1_NO_EXTENSIONS,
{ 4, &hf_h4501_Reject, ASN1_NO_EXTENSIONS,
dissect_h4501_Reject },
{ 0, NULL, 0, NULL }
};
@ -681,7 +682,7 @@ dissect_h4501_ROS(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
}
static int
dissect_h4501_argument(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_h4501_Argument(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
tvbuff_t *argument_tvb = NULL;

View File

@ -7,7 +7,7 @@ all: generate_dissector
generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py nbap.asn packet-nbap-template.c packet-nbap-template.h nbap.cnf
python ../../tools/asn2wrs.py -e -p nbap -c nbap.cnf -s packet-nbap-template nbap.asn
python ../../tools/asn2wrs.py -e -F -p nbap -c nbap.cnf -s packet-nbap-template nbap.asn
clean:
rm -f parsetab.py $(DISSECTOR_FILES)

View File

@ -15,7 +15,7 @@ generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py nbap.asn packet-nbap-template.c packet-nbap-template.h nbap.cnf
!IFDEF PYTHON
$(PYTHON) ../../tools/asn2wrs.py -e -p $(PROTOCOL_NAME) -c nbap.cnf -s packet-nbap-template nbap.asn
$(PYTHON) ../../tools/asn2wrs.py -e -F -p $(PROTOCOL_NAME) -c nbap.cnf -s packet-nbap-template nbap.asn
!ELSE
@echo Error: You need Python to use asn2wrs.py
@exit 1

View File

@ -7,7 +7,7 @@ all: generate_dissector
generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py packet-ranap-template.c packet-ranap-template.h ranap.cnf
python ../../tools/asn2wrs.py -e -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn
python ../../tools/asn2wrs.py -e -F -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn
clean:
rm -f parsetab.py $(DISSECTOR_FILES)

View File

@ -15,7 +15,7 @@ generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py ranap.asn packet-$(PROTOCOL_NAME)-template.c packet-$(PROTOCOL_NAME)-template.h ranap.cnf
!IFDEF PYTHON
$(PYTHON) ../../tools/asn2wrs.py -e -p $(PROTOCOL_NAME) -c ranap.cnf -s packet-$(PROTOCOL_NAME)-template ranap.asn
$(PYTHON) ../../tools/asn2wrs.py -e -F -p $(PROTOCOL_NAME) -c ranap.cnf -s packet-$(PROTOCOL_NAME)-template ranap.asn
!ELSE
@echo Error: You need Python to use asn2wrs.py
@exit 1

View File

@ -1,7 +1,7 @@
# Do not modify this file.
# It is created automatically by the ASN.1 to Wireshark dissector compiler
# .\ranap-exp.cnf
# ../../tools/asn2wrs.py -e -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn
# ../../tools/asn2wrs.py -e -F -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn
#.MODULE
RANAP-PDU-Descriptions ranap

View File

@ -7,7 +7,7 @@ all: generate_dissector
generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py rnsap.asn packet-rnsap-template.c packet-rnsap-template.h rnsap.cnf
python ../../tools/asn2wrs.py -e -p rnsap -c rnsap.cnf -s packet-rnsap-template rnsap.asn
python ../../tools/asn2wrs.py -e -F -p rnsap -c rnsap.cnf -s packet-rnsap-template rnsap.asn
clean:
rm -f parsetab.py $(DISSECTOR_FILES)

View File

@ -15,7 +15,7 @@ generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2wrs.py rnsap.asn packet-rnsap-template.c packet-rnsap-template.h rnsap.cnf
!IFDEF PYTHON
$(PYTHON) ../../tools/asn2wrs.py -e -p $(PROTOCOL_NAME) -c rnsap.cnf -s packet-rnsap-template rnsap.asn
$(PYTHON) ../../tools/asn2wrs.py -e -F -p $(PROTOCOL_NAME) -c rnsap.cnf -s packet-rnsap-template rnsap.asn
!ELSE
@echo Error: You need Python to use asn2wrs.py
@exit 1

View File

@ -42,7 +42,7 @@
#include "packet-ber.h"
#include "packet-per.h"
#include "packet-rnsap.h"
#include "packet-umts_rrc.h"
/*#include "packet-umts_rrc.h"*/
#define PNAME "UTRAN Iur interface Radio Network Subsystem Application Part"
#define PSNAME "RNSAP"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* .\packet-nbap.h */
/* ../../tools/asn2wrs.py -e -p nbap -c nbap.cnf -s packet-nbap-template nbap.asn */
/* ../../tools/asn2wrs.py -e -F -p nbap -c nbap.cnf -s packet-nbap-template nbap.asn */
/* Input file: packet-nbap-template.h */

View File

@ -255,7 +255,7 @@ dissect_per_null(tvbuff_t *tvb, guint32 offset, asn_ctx_t *actx _U_, proto_tree
/* 19 this function dissects a sequence of */
static guint32
dissect_per_sequence_of_helper(tvbuff_t *tvb, guint32 offset, asn_ctx_t *actx, proto_tree *tree, int (*func)(tvbuff_t *, int , asn_ctx_t *, proto_tree *), guint32 length)
dissect_per_sequence_of_helper(tvbuff_t *tvb, guint32 offset, asn_ctx_t *actx, proto_tree *tree, per_type_fn func, int hf_index, guint32 length)
{
guint32 i;
@ -268,7 +268,7 @@ DEBUG_ENTRY("dissect_per_sequence_of_helper");
litem=proto_tree_add_text(tree, tvb, offset>>3, 0, "Item %d", i);
ltree=proto_item_add_subtree(litem, ett_per_sequence_of_item);
offset=(*func)(tvb, offset, actx, ltree);
offset=(*func)(tvb, offset, actx, ltree, hf_index);
proto_item_set_len(litem, (offset>>3)!=(lold_offset>>3)?(offset>>3)-(lold_offset>>3):1);
}
@ -299,7 +299,7 @@ DEBUG_ENTRY("dissect_per_sequence_of");
}
tree=proto_item_add_subtree(item, ett_index);
offset=dissect_per_sequence_of_helper(tvb, offset, actx, tree, seq->func, length);
offset=dissect_per_sequence_of_helper(tvb, offset, actx, tree, seq->func, *seq->p_id, length);
proto_item_set_len(item, (offset>>3)!=(old_offset>>3)?(offset>>3)-(old_offset>>3):1);
@ -593,7 +593,7 @@ call_sohelper:
}
tree=proto_item_add_subtree(item, ett_index);
offset=dissect_per_sequence_of_helper(tvb, offset, actx, tree, seq->func, length);
offset=dissect_per_sequence_of_helper(tvb, offset, actx, tree, seq->func, *seq->p_id, length);
proto_item_set_len(item, (offset>>3)!=(old_offset>>3)?(offset>>3)-(old_offset>>3):1);
@ -1081,7 +1081,7 @@ DEBUG_ENTRY("dissect_per_choice");
/* count the number of entries in the extension root and extension addition */
extension_root_entries = 0;
extension_addition_entries = 0;
for (i=0; choice[i].func; i++) {
for (i=0; choice[i].p_id; i++) {
switch(choice[i].extension){
case ASN1_NO_EXTENSIONS:
case ASN1_EXTENSION_ROOT:
@ -1104,7 +1104,7 @@ DEBUG_ENTRY("dissect_per_choice");
}
index = -1; cidx = choice_index;
for (i=0; choice[i].func; i++) {
for (i=0; choice[i].p_id; i++) {
if(choice[i].extension != ASN1_NOT_EXTENSION_ROOT){
if (!cidx) { index = i; break; }
cidx--;
@ -1115,7 +1115,7 @@ DEBUG_ENTRY("dissect_per_choice");
offset = dissect_per_length_determinant(tvb, offset, actx, tree, hf_per_open_type_length, &ext_length);
index = -1; cidx = choice_index;
for (i=0; choice[i].func; i++) {
for (i=0; choice[i].p_id; i++) {
if(choice[i].extension == ASN1_NOT_EXTENSION_ROOT){
if (!cidx) { index = i; break; }
cidx--;
@ -1127,9 +1127,9 @@ DEBUG_ENTRY("dissect_per_choice");
choice_item = proto_tree_add_uint(tree, hf_index, tvb, old_offset>>3, 0, choice[index].value);
choice_tree = proto_item_add_subtree(choice_item, ett_index);
if (!extension_flag) {
offset = choice[index].func(tvb, offset, actx, choice_tree);
offset = choice[index].func(tvb, offset, actx, choice_tree, *choice[index].p_id);
} else {
choice[index].func(tvb, offset, actx, choice_tree);
choice[index].func(tvb, offset, actx, choice_tree, *choice[index].p_id);
offset += ext_length * 8;
}
proto_item_set_len(choice_item, BLEN(old_offset, offset));
@ -1257,7 +1257,7 @@ DEBUG_ENTRY("dissect_per_sequence");
}
}
if(sequence[i].func){
offset=sequence[i].func(tvb, offset, actx, tree);
offset=sequence[i].func(tvb, offset, actx, tree, *sequence[i].p_id);
} else {
PER_NOT_DECODED_YET(sequence[i].name);
}
@ -1344,7 +1344,7 @@ DEBUG_ENTRY("dissect_per_sequence");
}
if(sequence[extension_index].func){
new_offset=sequence[extension_index].func(tvb, offset, actx, tree);
new_offset=sequence[extension_index].func(tvb, offset, actx, tree, *sequence[extension_index].p_id);
} else {
PER_NOT_DECODED_YET(sequence[extension_index].name);
}

View File

@ -77,16 +77,17 @@ typedef int (*per_type_fn)(tvbuff_t*, int, asn_ctx_t*, proto_tree*, int);
typedef struct _per_choice_t {
int value;
const char *name_to_remove;
const int *p_id;
int extension;
per_callback func;
per_type_fn func;
} per_choice_t;
typedef struct _per_sequence_t {
const char *name;
const int *p_id;
int extension;
int optional;
per_callback func;
per_type_fn func;
} per_sequence_t;
extern guint32 dissect_per_length_determinant(tvbuff_t *tvb, guint32 offset, asn_ctx_t *actx, proto_tree *tree, int hf_index, guint32 *length);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* .\packet-ranap.h */
/* ../../tools/asn2wrs.py -e -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn */
/* ../../tools/asn2wrs.py -e -F -p ranap -c ranap.cnf -s packet-ranap-template ranap.asn */
/* Input file: packet-ranap-template.h */

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* ./packet-rnsap.h */
/* ../../tools/asn2wrs.py -e -p rnsap -c rnsap.cnf -s packet-rnsap-template rnsap.asn */
/* .\packet-rnsap.h */
/* ../../tools/asn2wrs.py -e -F -p rnsap -c rnsap.cnf -s packet-rnsap-template rnsap.asn */
/* Input file: packet-rnsap-template.h */

File diff suppressed because it is too large Load Diff

View File

@ -235,6 +235,8 @@ static guint32 T30ind_value;
static guint32 Data_Field_item_num;
static int proto_t38 = -1;
static int hf_t38_null = -1;
static int hf_t38_dummy = -1;
static int hf_t38_IFPPacket = -1;
static int hf_t38_Type_of_msg = -1;
static int hf_t38_t30_indicator = -1;
@ -1233,57 +1235,57 @@ dissect_t30_hdlc(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
/* T38 Routines */
static int
dissect_t38_NULL(tvbuff_t *tvb _U_, int offset, asn_ctx_t *actx _U_, proto_tree *tree _U_)
dissect_t38_NULL(tvbuff_t *tvb _U_, int offset, asn_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_)
{
return offset;
}
static const per_choice_t t30_indicator_choice[] = {
{ 0, "no-signal", ASN1_EXTENSION_ROOT,
{ 0, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 1, "cng", ASN1_EXTENSION_ROOT,
{ 1, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 2, "ced", ASN1_EXTENSION_ROOT,
{ 2, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 3, "v21-preamble", ASN1_EXTENSION_ROOT,
{ 3, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 4, "v27-2400-training", ASN1_EXTENSION_ROOT,
{ 4, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 5, "v27-4800-training", ASN1_EXTENSION_ROOT,
{ 5, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 6, "v29-7200-training", ASN1_EXTENSION_ROOT,
{ 6, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 7, "v29-9600-training", ASN1_EXTENSION_ROOT,
{ 7, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 8, "v17-7200-short-training", ASN1_EXTENSION_ROOT,
{ 8, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 9, "v17-7200-long-training", ASN1_EXTENSION_ROOT,
{ 9, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 10, "v17-9600-short-training", ASN1_EXTENSION_ROOT,
{ 10, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 11, "v17-9600-long-training", ASN1_EXTENSION_ROOT,
{ 11, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 12, "v17-12000-short-training", ASN1_EXTENSION_ROOT,
{ 12, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 13, "v17-12000-long-training", ASN1_EXTENSION_ROOT,
{ 13, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 14, "v17-14400-short-training", ASN1_EXTENSION_ROOT,
{ 14, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 15, "v17-14400-long-training", ASN1_EXTENSION_ROOT,
{ 15, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 16, "v8-ansam", ASN1_NOT_EXTENSION_ROOT,
{ 16, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 17, "v8-signal", ASN1_NOT_EXTENSION_ROOT,
{ 17, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 18, "v34-cntl-channel-1200", ASN1_NOT_EXTENSION_ROOT,
{ 18, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 19, "v34-pri-channel", ASN1_NOT_EXTENSION_ROOT,
{ 19, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 20, "v34-CC-retrain", ASN1_NOT_EXTENSION_ROOT,
{ 20, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 21, "v33-12000-training", ASN1_NOT_EXTENSION_ROOT,
{ 21, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 22, "v33-14400-training", ASN1_NOT_EXTENSION_ROOT,
{ 22, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 0, NULL, 0, NULL }
};
@ -1316,10 +1318,10 @@ const value_string t30_indicator_vals[] = {
};
static int
dissect_t38_t30_indicator(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_T30_Indicator(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_choice(tvb, offset, actx,
tree, hf_t38_t30_indicator, ett_t38_t30_indicator,
tree, hf_index, ett_t38_t30_indicator,
t30_indicator_choice, &T30ind_value);
if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
@ -1335,35 +1337,35 @@ dissect_t38_t30_indicator(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree
}
static const per_choice_t data_choice[] = {
{ 0, "v21", ASN1_EXTENSION_ROOT,
{ 0, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 1, "v27-2400", ASN1_EXTENSION_ROOT,
{ 1, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 2, "v27-4800", ASN1_EXTENSION_ROOT,
{ 2, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 3, "v29-7200", ASN1_EXTENSION_ROOT,
{ 3, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 4, "v29-9600", ASN1_EXTENSION_ROOT,
{ 4, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 5, "v17-7200", ASN1_EXTENSION_ROOT,
{ 5, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 6, "v17-9600", ASN1_EXTENSION_ROOT,
{ 6, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 7, "v17-12000", ASN1_EXTENSION_ROOT,
{ 7, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 8, "v17-14400", ASN1_EXTENSION_ROOT,
{ 8, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 9, "v8", ASN1_NOT_EXTENSION_ROOT,
{ 9, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 10, "v34-pri-rate", ASN1_NOT_EXTENSION_ROOT,
{ 10, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 11, "v34-CC-1200", ASN1_NOT_EXTENSION_ROOT,
{ 11, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 12, "v34-pri-ch", ASN1_NOT_EXTENSION_ROOT,
{ 12, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 13, "v33-12000", ASN1_NOT_EXTENSION_ROOT,
{ 13, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 14, "v33-14400", ASN1_NOT_EXTENSION_ROOT,
{ 14, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 0, NULL, 0, NULL }
};
@ -1388,10 +1390,10 @@ const value_string t30_data_vals[] = {
};
static int
dissect_t38_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_choice(tvb, offset, actx,
tree, hf_t38_data, ett_t38_data,
tree, hf_index, ett_t38_data,
data_choice, &Data_value);
if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
@ -1408,10 +1410,10 @@ dissect_t38_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
}
static const per_choice_t Type_of_msg_choice[] = {
{ 0, "t30-indicator", ASN1_NO_EXTENSIONS,
dissect_t38_t30_indicator},
{ 1, "data", ASN1_NO_EXTENSIONS,
dissect_t38_data},
{ 0, &hf_t38_t30_indicator, ASN1_NO_EXTENSIONS,
dissect_t38_T30_Indicator},
{ 1, &hf_t38_data, ASN1_NO_EXTENSIONS,
dissect_t38_Data},
{ 0, NULL, 0, NULL }
};
@ -1433,55 +1435,51 @@ dissect_t38_Type_of_msg(tvbuff_t *tvb, int offset, asn_ctx_t *actx _U_, proto_tr
return offset;
}
static int dissect_type_of_msg(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree) {
return dissect_t38_Type_of_msg(tvb, offset, actx, tree, hf_t38_Type_of_msg);
}
static const per_choice_t Data_Field_field_type_PreCorrigendum_choice[] = {
{ 0, "hdlc-data", ASN1_NO_EXTENSIONS,
{ 0, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 1, "hdlc-sig-end", ASN1_NO_EXTENSIONS,
{ 1, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 2, "hdlc-fcs-OK", ASN1_NO_EXTENSIONS,
{ 2, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 3, "hdlc-fcs-BAD", ASN1_NO_EXTENSIONS,
{ 3, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 4, "hdlc-fcs-OK-sig-end", ASN1_NO_EXTENSIONS,
{ 4, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 5, "hdlc-fcs-BAD-sig-end", ASN1_NO_EXTENSIONS,
{ 5, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 6, "t4-non-ecm-data", ASN1_NO_EXTENSIONS,
{ 6, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 7, "t4-non-ecm-sig-end", ASN1_NO_EXTENSIONS,
{ 7, &hf_t38_null, ASN1_NO_EXTENSIONS,
dissect_t38_NULL},
{ 0, NULL, 0, NULL }
};
static const per_choice_t Data_Field_field_type_choice[] = {
{ 0, "hdlc-data", ASN1_EXTENSION_ROOT,
{ 0, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 1, "hdlc-sig-end", ASN1_EXTENSION_ROOT,
{ 1, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 2, "hdlc-fcs-OK", ASN1_EXTENSION_ROOT,
{ 2, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 3, "hdlc-fcs-BAD", ASN1_EXTENSION_ROOT,
{ 3, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 4, "hdlc-fcs-OK-sig-end", ASN1_EXTENSION_ROOT,
{ 4, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 5, "hdlc-fcs-BAD-sig-end", ASN1_EXTENSION_ROOT,
{ 5, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 6, "t4-non-ecm-data", ASN1_EXTENSION_ROOT,
{ 6, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 7, "t4-non-ecm-sig-end", ASN1_EXTENSION_ROOT,
{ 7, &hf_t38_null, ASN1_EXTENSION_ROOT,
dissect_t38_NULL},
{ 8, "cm-message", ASN1_NOT_EXTENSION_ROOT,
{ 8, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 9, "jm-message", ASN1_NOT_EXTENSION_ROOT,
{ 9, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 10, "ci-message", ASN1_NOT_EXTENSION_ROOT,
{ 10, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 11, "v34-rate", ASN1_NOT_EXTENSION_ROOT,
{ 11, &hf_t38_null, ASN1_NOT_EXTENSION_ROOT,
dissect_t38_NULL},
{ 0, NULL, 0, NULL }
};
@ -1606,16 +1604,16 @@ force_reassmeble_seq(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
}
static int
dissect_t38_Data_Field_field_type(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Data_Field_field_type(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
if(use_pre_corrigendum_asn1_specification){
offset=dissect_per_choice(tvb, offset, actx,
tree, hf_t38_Data_Field_field_type, ett_t38_Data_Field_field_type,
tree, hf_index, ett_t38_Data_Field_field_type,
Data_Field_field_type_PreCorrigendum_choice, &Data_Field_field_type_value);
}
else{
offset=dissect_per_choice(tvb, offset, actx,
tree, hf_t38_Data_Field_field_type, ett_t38_Data_Field_field_type,
tree, hf_index, ett_t38_Data_Field_field_type,
Data_Field_field_type_choice, &Data_Field_field_type_value);
}
@ -1711,13 +1709,13 @@ dissect_t38_Data_Field_field_type(tvbuff_t *tvb, int offset, asn_ctx_t *actx, pr
}
static int
dissect_t38_Data_Field_field_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Data_Field_field_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
tvbuff_t *value_tvb = NULL;
guint32 value_len;
offset=dissect_per_octet_string(tvb, offset, actx,
tree, hf_t38_Data_Field_field_data, 1, 65535,
tree, hf_index, 1, 65535,
&value_tvb);
value_len = tvb_length(value_tvb);
@ -1786,18 +1784,18 @@ dissect_t38_Data_Field_field_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, pr
}
static const per_sequence_t Data_Field_item_sequence[] = {
{ "field-type", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
{ "field-type", &hf_t38_Data_Field_field_type, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Data_Field_field_type },
{ "field-data", ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
{ "field-data", &hf_t38_Data_Field_field_data, ASN1_NO_EXTENSIONS, ASN1_OPTIONAL,
dissect_t38_Data_Field_field_data },
{ NULL, 0, 0, NULL }
};
static int
dissect_t38_Data_Field_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Data_Field_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx,
tree, hf_t38_Data_Field_item, ett_t38_Data_Field_item,
tree, hf_index, ett_t38_Data_Field_item,
Data_Field_item_sequence);
if (primary_part) Data_Field_item_num++;
@ -1806,7 +1804,7 @@ dissect_t38_Data_Field_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tr
}
static const per_sequence_t t38_Data_Field_sequence_of[1] = {
{ "" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Data_Field_item },
{ "", &hf_t38_Data_Field_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Data_Field_item },
};
static int
@ -1816,13 +1814,10 @@ dissect_t38_Data_Field(tvbuff_t *tvb, int offset, asn_ctx_t *actx _U_, proto_tre
return offset;
}
static int dissect_data_field(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree) {
return dissect_t38_Data_Field(tvb, offset, actx, tree, hf_t38_Data_Field);
}
static const per_sequence_t IFPPacket_sequence[] = {
{ "type-of-msg" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_type_of_msg },
{ "data-field" , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_data_field },
{ "type-of-msg", &hf_t38_Type_of_msg, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Type_of_msg },
{ "data-field" , &hf_t38_Data_Field , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_Data_Field },
{ NULL, 0, 0, NULL }
};
@ -1836,10 +1831,10 @@ dissect_t38_IFPPacket(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tr
}
static int
dissect_t38_seq_number(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Seq_number(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_constrained_integer(tvb, offset, actx,
tree, hf_t38_seq_number, 0, 65535,
tree, hf_index, 0, 65535,
&seq_number, FALSE);
/* info for tap */
@ -1853,7 +1848,7 @@ dissect_t38_seq_number(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *t
}
static int
dissect_t38_primary_ifp_packet(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Primary_ifp_packet(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
guint32 length;
@ -1873,7 +1868,7 @@ dissect_t38_primary_ifp_packet(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto
}
static int
dissect_t38_secondary_ifp_packets_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Secondary_ifp_packets_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
guint32 length;
@ -1884,11 +1879,11 @@ dissect_t38_secondary_ifp_packets_item(tvbuff_t *tvb, int offset, asn_ctx_t *act
}
static const per_sequence_t SEQUENCE_OF_t38_secondary_ifp_packets_sequence_of[1] = {
{ "" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_secondary_ifp_packets_item },
{ "", &hf_t38_dummy, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Secondary_ifp_packets_item },
};
static int
dissect_t38_secondary_ifp_packets(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Secondary_ifp_packets(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
/* When the field-data is not present, we MUST offset 1 byte*/
if((Data_Field_field_type_value != 0) &&
@ -1899,60 +1894,60 @@ dissect_t38_secondary_ifp_packets(tvbuff_t *tvb, int offset, asn_ctx_t *actx, pr
}
offset=dissect_per_sequence_of(tvb, offset, actx,
tree, hf_t38_secondary_ifp_packets, ett_t38_secondary_ifp_packets,
tree, hf_index, ett_t38_secondary_ifp_packets,
SEQUENCE_OF_t38_secondary_ifp_packets_sequence_of);
return offset;
}
static int
dissect_t38_fec_npackets(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Fec_npackets(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_integer(tvb, offset, actx, tree, hf_t38_fec_npackets, NULL);
offset=dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
return offset;
}
static int
dissect_t38_fec_data_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Fec_data_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_octet_string(tvb, offset, actx,
tree, hf_t38_fec_data_item, NO_BOUND, NO_BOUND,
tree, hf_index, NO_BOUND, NO_BOUND,
NULL);
return offset;
}
static const per_sequence_t T_t38_fec_data_sequence_of[1] = {
{ "" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_fec_data_item },
{ "", &hf_t38_fec_data_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Fec_data_item },
};
static int
dissect_t38_fec_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Fec_data(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence_of(tvb, offset, actx,
tree, hf_t38_fec_data, ett_t38_fec_data,
tree, hf_index, ett_t38_fec_data,
T_t38_fec_data_sequence_of);
return offset;
}
static const per_sequence_t fec_info_sequence[] = {
{ "fec-npackets", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_fec_npackets },
{ "fec-data", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_fec_data },
{ "fec-npackets", &hf_t38_fec_npackets, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Fec_npackets },
{ "fec-data", &hf_t38_fec_data, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Fec_data },
{ NULL, 0, 0, NULL }
};
static int
dissect_t38_fec_info(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Fec_info(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
offset=dissect_per_sequence(tvb, offset, actx,
tree, hf_t38_fec_info, ett_t38_fec_info,
tree, hf_index, ett_t38_fec_info,
fec_info_sequence);
return offset;
}
static const per_choice_t error_recovery_choice[] = {
{ 0, "secondary-ifp-packets", ASN1_NO_EXTENSIONS,
dissect_t38_secondary_ifp_packets},
{ 1, "fec-info", ASN1_NO_EXTENSIONS,
dissect_t38_fec_info},
{ 0, &hf_t38_secondary_ifp_packets, ASN1_NO_EXTENSIONS,
dissect_t38_Secondary_ifp_packets},
{ 1, &hf_t38_fec_info, ASN1_NO_EXTENSIONS,
dissect_t38_Fec_info},
{ 0, NULL, 0, NULL }
};
@ -1963,12 +1958,12 @@ static const value_string error_recovery_vals[] = {
};
static int
dissect_t38_error_recovery(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree)
dissect_t38_Error_recovery(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tree *tree, int hf_index)
{
primary_part = FALSE;
offset=dissect_per_choice(tvb, offset, actx,
tree, hf_t38_error_recovery, ett_t38_error_recovery,
tree, hf_index, ett_t38_error_recovery,
error_recovery_choice, NULL);
primary_part = TRUE;
@ -1977,12 +1972,12 @@ dissect_t38_error_recovery(tvbuff_t *tvb, int offset, asn_ctx_t *actx, proto_tre
}
static const per_sequence_t UDPTLPacket_sequence[] = {
{ "seq-number", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_seq_number },
{ "primary-ifp-packet", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_primary_ifp_packet },
{ "error-recovery", ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_error_recovery },
{ "seq-number", &hf_t38_seq_number, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Seq_number },
{ "primary-ifp-packet", &hf_t38_dummy, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Primary_ifp_packet },
{ "error-recovery", &hf_t38_error_recovery, ASN1_NO_EXTENSIONS, ASN1_NOT_OPTIONAL,
dissect_t38_Error_recovery },
{ NULL, 0, 0, NULL }
};

File diff suppressed because it is too large Load Diff

View File

@ -436,6 +436,7 @@ class EthCtx:
def Ber(self): return self.encoding == 'ber'
def Aligned(self): return self.aligned
def Unaligned(self): return not self.aligned
def Fld(self): return self.Ber() or self.fld_opt
def NAPI(self): return False # disable planned features
def dbg(self, d):
@ -1108,7 +1109,7 @@ class EthCtx:
if self.dep_cycle_eth_type[t][0] != i: i += 1; continue
fx.write(''.join(map(lambda i: '/* %s */\n' % ' -> '.join(self.eth_dep_cycle[i]), self.dep_cycle_eth_type[t])))
fx.write(self.eth_type_fn_h(t))
if (not self.NAPI()):
if (self.Fld()):
fx.write('\n')
for f in self.eth_hf_ord:
if (self.eth_hf[f]['ethtype'] == t):
@ -1116,7 +1117,7 @@ class EthCtx:
fx.write('\n')
i += 1
fx.write('\n')
if (not self.NAPI()): # fields for imported types
if (self.Fld()): # fields for imported types
fx.write('/*--- Fields for imported types ---*/\n\n')
for f in self.eth_hf_ord:
if (self.eth_type[self.eth_hf[f]['ethtype']]['import']):
@ -1138,7 +1139,7 @@ class EthCtx:
fx.write(self.eth_type_fn_h(t))
else:
fx.write(self.eth_type[t]['val'].eth_type_fn(self.eth_type[t]['proto'], t, self))
if (not self.NAPI() and not self.dep_cycle_eth_type.has_key(t)):
if (self.Fld() and not self.dep_cycle_eth_type.has_key(t)):
for f in self.eth_hf_ord:
if (self.eth_hf[f]['ethtype'] == t):
fx.write(out_field(f))
@ -2346,6 +2347,7 @@ class Type_Ref (Type):
class SqType (Type):
def out_item(self, f, val, optional, ext, ectx):
ef = ectx.field[f]['ethname']
t = ectx.eth_hf[ef]['ethtype']
efd = ef
if (ectx.Ber() and ectx.field[f]['impl']):
efd += '_impl'
@ -2375,8 +2377,8 @@ class SqType (Type):
out = ' { %-13s, %s, %s, dissect_%s },\n' \
% (tc, tn, opt, efd)
elif (ectx.Per()):
out = ' { %-30s, %-23s, %-17s, dissect_%s },\n' \
% ('"'+(val.name or '')+'"', ext, opt, efd)
out = ' { %-24s, %-24s, %-23s, %-17s, dissect_%s_%s },\n' \
% ('"'+(val.name or '')+'"', '&'+ectx.eth_hf[ef]['fullname'], ext, opt, ectx.eth_type[t]['proto'], t)
else:
out = ''
return out
@ -2765,6 +2767,7 @@ class ChoiceType (Type):
def out_item(val, e, ext, ectx):
f = fname + '/' + e.name
ef = ectx.field[f]['ethname']
t = ectx.eth_hf[ef]['ethtype']
efd = ef
if (ectx.field[f]['impl']):
efd += '_impl'
@ -2781,8 +2784,8 @@ class ChoiceType (Type):
out = ' { %3s, %-13s, %s, %s, dissect_%s },\n' \
% (val, tc, tn, opt, efd)
elif (ectx.Per()):
out = ' { %3s, %-30s, %-23s, dissect_%s },\n' \
% (val, '"'+e.name+'"', ext, efd)
out = ' { %3s, %-24s, %-23s, dissect_%s_%s },\n' \
% (val, '&'+ectx.eth_hf[ef]['fullname'], ext, ectx.eth_type[t]['proto'], t)
else:
out = ''
return out
@ -4743,6 +4746,7 @@ asn2wrs [-h|?] [-d dbg] [-b] [-p proto] [-c conform_file] [-e] input_file(s) ...
-u : unaligned (default is aligned)
-p proto : protocol name (implies -S)
default is module-name from input_file (renamed by #.MODULE if present)
-F : create 'field functions'
-o name : output files name core (default is <proto>)
-O dir : output directory
-c conform_file : conformation file
@ -4766,7 +4770,7 @@ asn2wrs [-h|?] [-d dbg] [-b] [-p proto] [-c conform_file] [-e] input_file(s) ...
def eth_main():
print "ASN.1 to Wireshark dissector compiler";
try:
opts, args = getopt.getopt(sys.argv[1:], "h?d:buXp:o:O:c:eSs:k");
opts, args = getopt.getopt(sys.argv[1:], "h?d:buXp:Fo:O:c:eSs:k");
except getopt.GetoptError:
eth_usage(); sys.exit(2)
if len(args) < 1:
@ -4777,6 +4781,7 @@ def eth_main():
ectx = EthCtx(conform, output)
ectx.encoding = 'per'
ectx.proto_opt = None
ectx.fld_opt = False
ectx.outnm_opt = None
ectx.aligned = True
ectx.dbgopt = ''
@ -4793,6 +4798,8 @@ def eth_main():
if o in ("-p",):
ectx.proto_opt = a
ectx.merge_modules = True
if o in ("-F",):
ectx.fld_opt = True
if o in ("-c",):
ectx.conform.read(a)
if o in ("-u",):