From gonzalocas:

GSSE message dissector.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4370

svn path=/trunk/; revision=31442
This commit is contained in:
Anders Broman 2010-01-04 23:17:37 +00:00
parent 38b0b13b23
commit e8042d8eec
11 changed files with 377 additions and 88 deletions

View File

@ -40,7 +40,7 @@ AARE-apdu/_untag/protocol-version aARE_protocol_version
AARQ-apdu/_untag/aSO-context-name aARQ_aSO_context_name
AARE-apdu/_untag/aSO-context-name aARE_aSO_context_name
ACRQ-apdu/_untag/aSO-context-name aCRQ_aSO_context_name
PDV-list/presentation-data-values/octet-aligned pDVList_octet_aligned
#.FN_PARS Authentication-value-other/other-mechanism-name
FN_VARIANT = _str VAL_PTR = &object_identifier_id

View File

@ -58,10 +58,19 @@
#define PSNAME "ACSE"
#define PFNAME "acse"
#define CLPNAME "ISO 10035-1 OSI Connectionless Association Control Service"
#define CLPSNAME "CLACSE"
#define CLPFNAME "clacse"
#define ACSE_APDU_OID "2.2.1.0.1"
/* Initialize the protocol and registered fields */
static int proto_acse = -1;
int proto_acse = -1;
int proto_clacse = -1;
#include "packet-acse-hf.c"
/* Initialize the subtree pointers */
@ -196,6 +205,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
case SES_DISCONNECT: /* RLRQ */
case SES_FINISH: /* RLRE */
case SES_ABORT: /* ABRT */
case CLSES_UNIT_DATA: /* AARQ Connetctionless session */
break;
case SES_DATA_TRANSFER:
oid=find_oid_by_pres_ctx_id(pinfo, indir_ref);
@ -217,14 +227,28 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
return;
}
/* create display subtree for the protocol */
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
if(session->spdu_type == CLSES_UNIT_DATA)
{
/* create display subtree for the connectionless protocol */
if(parent_tree)
{
item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
else
{
/* create display subtree for the protocol */
if(parent_tree)
{
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE");
col_clear(pinfo->cinfo, COL_INFO);
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
@ -258,6 +282,10 @@ void proto_register_acse(void) {
proto_acse = proto_register_protocol(PNAME, PSNAME, PFNAME);
register_dissector("acse", dissect_acse, proto_acse);
/* Register connectionless protocol */
proto_clacse = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME);
/* Register fields and subtrees */
proto_register_field_array(proto_acse, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));

View File

@ -388,5 +388,45 @@ User-session-requirements ::= BIT STRING {
END
-- Module ISO9576-PRESENTATION (X.236)
ISO9576-CONNECTIONLESS-PRESENTATION DEFINITIONS ::=
BEGIN
--
-- The value of the SS-user data parameter of the S-UNIT-DATA request and indication
-- session-service primitives shall be a UD-type value, followed as a requestors
-- option by zero or more UDC-type values.
--
UD-type ::= SEQUENCE {
protocol-version [0] IMPLICIT Protocol-version DEFAULT {version-1},
calling-presentation-selector [1] IMPLICIT Calling-presentation-selector OPTIONAL,
called-presentation-selector [2] IMPLICIT Called-presentation-selector OPTIONAL,
presentation-context-definition-list [4] IMPLICIT
Presentation-context-definition-list OPTIONAL,
user-data User-data
}
-- Shall be the parameters of the UD PPDU.
--
-- As an initiators option, the presentation data values contained in a UD PPDU may be
-- encoded more than once, using UDC-type values, to allow the transfer of the same
-- presentation data values using a number of different transfer syntaxes.
--
UDC-type ::= User-data
-- Shall not be present if the Presentation context definition list parameter is not present
-- in the UD PPDU. Each instance of this data type shall contain all of the presentation data
-- values which were contained in the User data parameter of the UD PPDU.
-- This shall be the same set of presentation data values which were contained in the UD-type.
--
-- WS: trunkated here as the rest is present in the previous ASN1 def.
END
-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D

View File

@ -1,6 +1,6 @@
/* packet-pres.c
* Routine to dissect ISO 8823 OSI Presentation Protocol packets
* Based on the dissector by
* Based on the dissector by
* Yuriy Sidelnikov <YSidelnikov@hotmail.com>
*
* $Id$
@ -51,9 +51,17 @@
#define PSNAME "PRES"
#define PFNAME "pres"
#define CLPNAME "ISO 9576-1 OSI Connectionless Presentation Protocol"
#define CLPSNAME "CLPRES"
#define CLPFNAME "clpres"
/* Initialize the protocol and registered fields */
static int proto_pres = -1;
/* Initialize the connectionles protocol */
static int proto_clpres = -1;
/* type of session envelop */
static struct SESSION_DATA_STRUCTURE* session = NULL;
@ -137,7 +145,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pco=se_alloc(sizeof(pres_ctx_oid_t));
pco->ctx_id=idx;
pco->oid=se_strdup(oid);
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (conversation) {
pco->index = conversation->index;
@ -161,7 +169,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo _U_, guint32 idx)
conversation_t *conversation;
pco.ctx_id=idx;
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (conversation) {
pco.index = conversation->index;
@ -201,7 +209,7 @@ pres_try_users_table(guint32 ctx_id, tvbuff_t *tvb, int offset, packet_info *pin
{
tvbuff_t *next_tvb;
guint i;
for (i = 0; i < num_pres_users; i++) {
pres_user_t *u = &(pres_users[i]);
@ -300,25 +308,48 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
int offset = 0, old_offset;
session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data));
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data));
if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
proto_tree_add_text(parent_tree, tvb, offset,
proto_tree_add_text(parent_tree, tvb, offset,
tvb_reported_length_remaining(tvb,offset),"User data");
return; /* no, it isn't a presentation PDU */
}
}
/* save pointers for calling the acse dissector */
global_tree = parent_tree;
global_pinfo = pinfo;
/* if the session unit-data packet then we process it */
/* as a connectionless presentation protocol unit data */
if(session && session->spdu_type == CLSES_UNIT_DATA)
{
proto_tree * clpres_tree = NULL;
proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-PRES");
col_clear(pinfo->cinfo, COL_INFO);
if (parent_tree)
{
ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, FALSE);
clpres_tree = proto_item_add_subtree(ti, ett_pres);
}
/* dissect the packet */
dissect_UD_type_PDU(tvb, pinfo, clpres_tree);
return;
}
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PRES");
col_clear(pinfo->cinfo, COL_INFO);
/* save pointers for calling the acse dissector */
global_tree = parent_tree;
global_pinfo = pinfo;
if (session && session->spdu_type == SES_MAJOR_SYNC_POINT) {
/* This is a reassembly initiated in packet-ses */
@ -326,12 +357,12 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if (oid) {
call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree);
} else {
proto_tree_add_text(parent_tree, tvb, offset,
proto_tree_add_text(parent_tree, tvb, offset,
tvb_reported_length_remaining(tvb,offset),"User data");
}
return;
}
while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree);
@ -378,7 +409,7 @@ void proto_register_pres(void) {
&ett_pres,
#include "packet-pres-ettarr.c"
};
static uat_field_t users_flds[] = {
UAT_FLD_DEC(pres_users,ctx_id,"Context Id","Presentation Context Identifier"),
UAT_FLD_CSTRING(pres_users,oid,"Syntax Name OID","Abstract Syntax Name (Object Identifier)"),
@ -397,12 +428,16 @@ void proto_register_pres(void) {
NULL,
pres_free_cb,
users_flds);
static module_t *pres_module;
/* Register protocol */
proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME);
register_dissector("pres", dissect_pres, proto_pres);
/* Register connectionless protocol (just for the description) */
proto_clpres = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME);
/* Register fields and subtrees */
proto_register_field_array(proto_pres, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@ -420,7 +455,7 @@ void proto_register_pres(void) {
/*--- proto_reg_handoff_pres ---------------------------------------*/
void proto_reg_handoff_pres(void) {
/* register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres,
/* register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres,
"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) abstractSyntax(1) pres(1) version1(1)"); */
}

View File

@ -8,6 +8,8 @@
#.EXPORTS
#.PDU
UD-type
UDC-type
#.NO_EMIT

View File

@ -66,10 +66,19 @@
#define PSNAME "ACSE"
#define PFNAME "acse"
#define CLPNAME "ISO 10035-1 OSI Connectionless Association Control Service"
#define CLPSNAME "CLACSE"
#define CLPFNAME "clacse"
#define ACSE_APDU_OID "2.2.1.0.1"
/* Initialize the protocol and registered fields */
static int proto_acse = -1;
int proto_acse = -1;
int proto_clacse = -1;
/*--- Included file: packet-acse-hf.c ---*/
#line 1 "packet-acse-hf.c"
@ -167,7 +176,7 @@ static int hf_acse_fully_encoded_data = -1; /* PDV_list */
static int hf_acse_presentation_context_identifier = -1; /* Presentation_context_identifier */
static int hf_acse_presentation_data_values = -1; /* T_presentation_data_values */
static int hf_acse_simple_ASN1_type = -1; /* T_simple_ASN1_type */
static int hf_acse_octet_aligned_01 = -1; /* OCTET_STRING */
static int hf_acse_pDVList_octet_aligned = -1; /* OCTET_STRING */
static int hf_acse_other_mechanism_name = -1; /* T_other_mechanism_name */
static int hf_acse_other_mechanism_value = -1; /* T_other_mechanism_value */
static int hf_acse_charstring = -1; /* GraphicString */
@ -183,7 +192,7 @@ static int hf_acse_ACSE_requirements_higher_level_association = -1;
static int hf_acse_ACSE_requirements_nested_association = -1;
/*--- End of included file: packet-acse-hf.c ---*/
#line 66 "packet-acse-template.c"
#line 75 "packet-acse-template.c"
/* Initialize the subtree pointers */
static gint ett_acse = -1;
@ -227,7 +236,7 @@ static gint ett_acse_Authentication_value_other = -1;
static gint ett_acse_Authentication_value = -1;
/*--- End of included file: packet-acse-ett.c ---*/
#line 70 "packet-acse-template.c"
#line 79 "packet-acse-template.c"
static struct SESSION_DATA_STRUCTURE* session = NULL;
@ -1406,7 +1415,7 @@ static const value_string acse_T_presentation_data_values_vals[] = {
static const ber_choice_t T_presentation_data_values_choice[] = {
{ 0, &hf_acse_simple_ASN1_type, BER_CLASS_CON, 0, 0, dissect_acse_T_simple_ASN1_type },
{ 1, &hf_acse_octet_aligned_01, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_acse_OCTET_STRING },
{ 1, &hf_acse_pDVList_octet_aligned, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_acse_OCTET_STRING },
{ 2, &hf_acse_arbitrary , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_acse_BIT_STRING },
{ 0, NULL, 0, 0, 0, NULL }
};
@ -1645,7 +1654,7 @@ dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
/*--- End of included file: packet-acse-fn.c ---*/
#line 146 "packet-acse-template.c"
#line 155 "packet-acse-template.c"
/*
@ -1699,6 +1708,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
case SES_DISCONNECT: /* RLRQ */
case SES_FINISH: /* RLRE */
case SES_ABORT: /* ABRT */
case CLSES_UNIT_DATA: /* AARQ Connetctionless session */
break;
case SES_DATA_TRANSFER:
oid=find_oid_by_pres_ctx_id(pinfo, indir_ref);
@ -1720,14 +1730,28 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
return;
}
/* create display subtree for the protocol */
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
if(session->spdu_type == CLSES_UNIT_DATA)
{
/* create display subtree for the connectionless protocol */
if(parent_tree)
{
item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
else
{
/* create display subtree for the protocol */
if(parent_tree)
{
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_acse);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE");
col_clear(pinfo->cinfo, COL_INFO);
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
@ -2127,7 +2151,7 @@ void proto_register_acse(void) {
{ "simple-ASN1-type", "acse.simple_ASN1_type",
FT_NONE, BASE_NONE, NULL, 0,
"acse.T_simple_ASN1_type", HFILL }},
{ &hf_acse_octet_aligned_01,
{ &hf_acse_pDVList_octet_aligned,
{ "octet-aligned", "acse.octet_aligned",
FT_BYTES, BASE_NONE, NULL, 0,
"acse.OCTET_STRING", HFILL }},
@ -2181,7 +2205,7 @@ void proto_register_acse(void) {
NULL, HFILL }},
/*--- End of included file: packet-acse-hfarr.c ---*/
#line 249 "packet-acse-template.c"
#line 273 "packet-acse-template.c"
};
/* List of subtrees */
@ -2227,13 +2251,17 @@ void proto_register_acse(void) {
&ett_acse_Authentication_value,
/*--- End of included file: packet-acse-ettarr.c ---*/
#line 255 "packet-acse-template.c"
#line 279 "packet-acse-template.c"
};
/* Register protocol */
proto_acse = proto_register_protocol(PNAME, PSNAME, PFNAME);
register_dissector("acse", dissect_acse, proto_acse);
/* Register connectionless protocol */
proto_clacse = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME);
/* Register fields and subtrees */
proto_register_field_array(proto_acse, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));

View File

@ -248,6 +248,8 @@ static int hf_cotp_vp_dst_tsap_bytes = -1;
static heur_dissector_list_t cotp_is_heur_subdissector_list;
/* List of dissectors to call for COTP packets put atop CLNP */
static heur_dissector_list_t cotp_heur_subdissector_list;
/* List of dissectors to call for CLTP packets put atop CLNP */
static heur_dissector_list_t cltp_heur_subdissector_list;
/*
* Reassembly of COTP.
@ -1555,7 +1557,8 @@ static int ositp_decode_ER(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
} /* ositp_decode_ER */
static int ositp_decode_UD(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
packet_info *pinfo, proto_tree *tree)
packet_info *pinfo, proto_tree *tree,
gboolean *subdissector_found)
{
proto_item *ti;
proto_tree *cltp_tree = NULL;
@ -1581,7 +1584,19 @@ static int ositp_decode_UD(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
offset += li;
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle,next_tvb, pinfo, tree);
if (dissector_try_heuristic(cltp_heur_subdissector_list, next_tvb,
pinfo, tree)) {
*subdissector_found = TRUE;
} else {
call_dissector(data_handle,next_tvb, pinfo, tree);
}
/*call_dissector(data_handle,next_tvb, pinfo, tree); */
offset += tvb_length_remaining(tvb, offset);
/* we dissected all of the containing PDU */
@ -1669,7 +1684,7 @@ static gint dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo,
new_offset = ositp_decode_ER(tvb, offset, li, tpdu, pinfo, tree);
break;
case UD_TPDU :
new_offset = ositp_decode_UD(tvb, offset, li, tpdu, pinfo, tree);
new_offset = ositp_decode_UD(tvb, offset, li, tpdu, pinfo, tree, &subdissector_found);
is_cltp = TRUE;
break;
default :
@ -1859,6 +1874,9 @@ void proto_register_cltp(void)
proto_cltp = proto_register_protocol(PROTO_STRING_CLTP, "CLTP", "cltp");
proto_register_field_array(proto_cltp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_heur_dissector_list("cltp", &cltp_heur_subdissector_list);
}
void

View File

@ -8,7 +8,7 @@
#line 1 "packet-pres-template.c"
/* packet-pres.c
* Routine to dissect ISO 8823 OSI Presentation Protocol packets
* Based on the dissector by
* Based on the dissector by
* Yuriy Sidelnikov <YSidelnikov@hotmail.com>
*
* $Id$
@ -59,9 +59,17 @@
#define PSNAME "PRES"
#define PFNAME "pres"
#define CLPNAME "ISO 9576-1 OSI Connectionless Presentation Protocol"
#define CLPSNAME "CLPRES"
#define CLPFNAME "clpres"
/* Initialize the protocol and registered fields */
static int proto_pres = -1;
/* Initialize the connectionles protocol */
static int proto_clpres = -1;
/* type of session envelop */
static struct SESSION_DATA_STRUCTURE* session = NULL;
@ -97,6 +105,8 @@ static int hf_pres_Typed_data_type = -1;
/*--- Included file: packet-pres-hf.c ---*/
#line 1 "packet-pres-hf.c"
static int hf_pres_UD_type_PDU = -1; /* UD_type */
static int hf_pres_UDC_type_PDU = -1; /* UDC_type */
static int hf_pres_mode_selector = -1; /* Mode_selector */
static int hf_pres_x410_mode_parameters = -1; /* RTORQapdu */
static int hf_pres_normal_mode_parameters = -1; /* T_normal_mode_parameters */
@ -176,7 +186,7 @@ static int hf_pres_User_session_requirements_symmetric_synchronize = -1;
static int hf_pres_User_session_requirements_data_separation = -1;
/*--- End of included file: packet-pres-hf.c ---*/
#line 90 "packet-pres-template.c"
#line 98 "packet-pres-template.c"
/* Initialize the subtree pointers */
static gint ett_pres = -1;
@ -219,9 +229,10 @@ static gint ett_pres_Fully_encoded_data = -1;
static gint ett_pres_PDV_list = -1;
static gint ett_pres_T_presentation_data_values = -1;
static gint ett_pres_User_session_requirements = -1;
static gint ett_pres_UD_type = -1;
/*--- End of included file: packet-pres-ett.c ---*/
#line 95 "packet-pres-template.c"
#line 103 "packet-pres-template.c"
UAT_DEC_CB_DEF(pres_users, ctx_id, pres_user_t)
UAT_CSTRING_CB_DEF(pres_users, oid, pres_user_t)
@ -267,7 +278,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pco=se_alloc(sizeof(pres_ctx_oid_t));
pco->ctx_id=idx;
pco->oid=se_strdup(oid);
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (conversation) {
pco->index = conversation->index;
@ -291,7 +302,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo _U_, guint32 idx)
conversation_t *conversation;
pco.ctx_id=idx;
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
conversation=find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (conversation) {
pco.index = conversation->index;
@ -331,7 +342,7 @@ pres_try_users_table(guint32 ctx_id, tvbuff_t *tvb, int offset, packet_info *pin
{
tvbuff_t *next_tvb;
guint i;
for (i = 0; i < num_pres_users; i++) {
pres_user_t *u = &(pres_users[i]);
@ -428,7 +439,7 @@ dissect_pres_Called_presentation_selector(gboolean implicit_tag _U_, tvbuff_t *t
static int
dissect_pres_Presentation_context_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 75 "pres.cnf"
#line 77 "pres.cnf"
const char *name;
char *oid;
@ -491,13 +502,13 @@ static const ber_sequence_t Context_list_item_sequence[] = {
static int
dissect_pres_Context_list_item(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 90 "pres.cnf"
#line 92 "pres.cnf"
abstract_syntax_name_oid=NULL;
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
Context_list_item_sequence, hf_index, ett_pres_Context_list_item);
#line 93 "pres.cnf"
#line 95 "pres.cnf"
register_ctx_id_and_oid(actx->pinfo, presentation_context_identifier, abstract_syntax_name_oid);
return offset;
@ -627,7 +638,7 @@ dissect_pres_Simply_encoded_data(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
static int
dissect_pres_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 35 "pres.cnf"
#line 37 "pres.cnf"
tvbuff_t *next_tvb;
char *oid;
@ -654,7 +665,7 @@ dissect_pres_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_pres_T_octet_aligned(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 51 "pres.cnf"
#line 53 "pres.cnf"
tvbuff_t *next_tvb;
char *oid;
@ -1322,8 +1333,48 @@ dissect_pres_RSA_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
}
static const ber_sequence_t UD_type_sequence[] = {
{ &hf_pres_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Protocol_version },
{ &hf_pres_calling_presentation_selector, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Calling_presentation_selector },
{ &hf_pres_called_presentation_selector, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Called_presentation_selector },
{ &hf_pres_presentation_context_definition_list, BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_definition_list },
{ &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
{ NULL, 0, 0, 0, NULL }
};
static int
dissect_pres_UD_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
UD_type_sequence, hf_index, ett_pres_UD_type);
return offset;
}
static int
dissect_pres_UDC_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_pres_User_data(implicit_tag, tvb, offset, actx, tree, hf_index);
return offset;
}
/*--- PDUs ---*/
static void dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
dissect_pres_UD_type(FALSE, tvb, 0, &asn1_ctx, tree, hf_pres_UD_type_PDU);
}
static void dissect_UDC_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
dissect_pres_UDC_type(FALSE, tvb, 0, &asn1_ctx, tree, hf_pres_UDC_type_PDU);
}
/*--- End of included file: packet-pres-fn.c ---*/
#line 222 "packet-pres-template.c"
#line 230 "packet-pres-template.c"
/*
@ -1405,25 +1456,48 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
int offset = 0, old_offset;
session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data));
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data));
if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
proto_tree_add_text(parent_tree, tvb, offset,
proto_tree_add_text(parent_tree, tvb, offset,
tvb_reported_length_remaining(tvb,offset),"User data");
return; /* no, it isn't a presentation PDU */
}
}
/* save pointers for calling the acse dissector */
global_tree = parent_tree;
global_pinfo = pinfo;
/* if the session unit-data packet then we process it */
/* as a connectionless presentation protocol unit data */
if(session && session->spdu_type == CLSES_UNIT_DATA)
{
proto_tree * clpres_tree = NULL;
proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-PRES");
col_clear(pinfo->cinfo, COL_INFO);
if (parent_tree)
{
ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, FALSE);
clpres_tree = proto_item_add_subtree(ti, ett_pres);
}
/* dissect the packet */
dissect_UD_type_PDU(tvb, pinfo, clpres_tree);
return;
}
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PRES");
col_clear(pinfo->cinfo, COL_INFO);
/* save pointers for calling the acse dissector */
global_tree = parent_tree;
global_pinfo = pinfo;
if (session && session->spdu_type == SES_MAJOR_SYNC_POINT) {
/* This is a reassembly initiated in packet-ses */
@ -1431,12 +1505,12 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if (oid) {
call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree);
} else {
proto_tree_add_text(parent_tree, tvb, offset,
proto_tree_add_text(parent_tree, tvb, offset,
tvb_reported_length_remaining(tvb,offset),"User data");
}
return;
}
while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree);
@ -1478,6 +1552,14 @@ void proto_register_pres(void) {
/*--- Included file: packet-pres-hfarr.c ---*/
#line 1 "packet-pres-hfarr.c"
{ &hf_pres_UD_type_PDU,
{ "UD-type", "pres.UD_type",
FT_NONE, BASE_NONE, NULL, 0,
"pres.UD_type", HFILL }},
{ &hf_pres_UDC_type_PDU,
{ "UDC-type", "pres.UDC_type",
FT_UINT32, BASE_DEC, VALS(pres_User_data_vals), 0,
"pres.UDC_type", HFILL }},
{ &hf_pres_mode_selector,
{ "mode-selector", "pres.mode_selector",
FT_NONE, BASE_NONE, NULL, 0,
@ -1784,7 +1866,7 @@ void proto_register_pres(void) {
NULL, HFILL }},
/*--- End of included file: packet-pres-hfarr.c ---*/
#line 374 "packet-pres-template.c"
#line 405 "packet-pres-template.c"
};
/* List of subtrees */
@ -1828,11 +1910,12 @@ void proto_register_pres(void) {
&ett_pres_PDV_list,
&ett_pres_T_presentation_data_values,
&ett_pres_User_session_requirements,
&ett_pres_UD_type,
/*--- End of included file: packet-pres-ettarr.c ---*/
#line 380 "packet-pres-template.c"
#line 411 "packet-pres-template.c"
};
static uat_field_t users_flds[] = {
UAT_FLD_DEC(pres_users,ctx_id,"Context Id","Presentation Context Identifier"),
UAT_FLD_CSTRING(pres_users,oid,"Syntax Name OID","Abstract Syntax Name (Object Identifier)"),
@ -1851,12 +1934,16 @@ void proto_register_pres(void) {
NULL,
pres_free_cb,
users_flds);
static module_t *pres_module;
/* Register protocol */
proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME);
register_dissector("pres", dissect_pres, proto_pres);
/* Register connectionless protocol (just for the description) */
proto_clpres = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME);
/* Register fields and subtrees */
proto_register_field_array(proto_pres, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@ -1874,7 +1961,7 @@ void proto_register_pres(void) {
/*--- proto_reg_handoff_pres ---------------------------------------*/
void proto_reg_handoff_pres(void) {
/* register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres,
/* register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres,
"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) abstractSyntax(1) pres(1) version1(1)"); */
}

View File

@ -56,12 +56,6 @@ static int hf_ses_reserved = -1;
static gint ett_ses = -1;
static gint ett_ses_param = -1;
/*
----------------------------------------------------------------------------------------------------------*/
static dissector_handle_t pres_handle = NULL;
/*
----------------------------------------------------------------------------------------------------------*/
/* flags */
static int hf_connect_protocol_options_flags = -1;
@ -167,6 +161,19 @@ static int hf_large_initial_serial_number = -1;
/* large second initial serial number */
static int hf_large_second_initial_serial_number = -1;
static int hf_cltp_li = -1;
static int hf_cltp_type = -1;
/* clses header fields */
static int proto_clses = -1;
#define PROTO_STRING_CLSES "ISO 9548-1 OSI Connectionless Session Protocol"
static dissector_handle_t pres_handle = NULL;
const value_string ses_vals[] =
{
{SES_CONNECTION_REQUEST, "CONNECT (CN) SPDU" }, /* 13 */
@ -200,6 +207,7 @@ const value_string ses_vals[] =
{SES_ACTIVITY_DISCARD_ACK, "ACTIVITY DISCARD ACK (ADA) SPDU" },/* 58 */
{SES_CAPABILITY, "CAPABILITY DATA (CD) SPDU" }, /* 61 */
{SES_CAPABILITY_DATA_ACK, "CAPABILITY DATA ACK (CDA) SPDU" }, /* 62 */
{CLSES_UNIT_DATA, "UNIT DATA (UD) SPDU" }, /* 64 */
{0, NULL }
};
@ -975,7 +983,7 @@ dissect_parameters(tvbuff_t *tvb, int offset, guint16 len, proto_tree *tree,
*/
static int
dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
gboolean tokens)
gboolean tokens, gboolean connectionless)
{
gboolean has_user_information = FALSE;
guint8 type;
@ -997,7 +1005,20 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
session.ros_op = 0;
session.rtse_reassemble = FALSE;
if (tokens) {
if(connectionless) {
if (check_col(pinfo->cinfo, COL_INFO))
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(type, ses_vals, "Unknown SPDU type (0x%02x)"));
if (tree) {
ti = proto_tree_add_item(tree, proto_clses, tvb, offset,
-1, FALSE);
ses_tree = proto_item_add_subtree(ti, ett_ses);
proto_tree_add_uint(ses_tree, hf_ses_type, tvb,
offset, 1, type);
}
has_user_information = TRUE;
}
else if (tokens) {
if (check_col(pinfo->cinfo, COL_INFO))
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(type, ses_category0_vals, "Unknown SPDU type (0x%02x)"));
@ -1014,17 +1035,16 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
val_to_str(type, ses_vals, "Unknown SPDU type (0x%02x)"));
if (tree) {
ti = proto_tree_add_item(tree, proto_ses, tvb, offset,
-1, FALSE);
-1, FALSE);
ses_tree = proto_item_add_subtree(ti, ett_ses);
proto_tree_add_uint(ses_tree, hf_ses_type, tvb,
offset, 1, type);
offset, 1, type);
}
/*
* Might this SPDU have a User Information field?
*/
switch (type) {
case SES_DATA_TRANSFER:
case SES_EXPEDITED:
case SES_TYPED_DATA:
@ -1068,12 +1088,10 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
if (has_user_information) {
if (tvb_reported_length_remaining(tvb, offset) > 0 || type == SES_MAJOR_SYNC_POINT) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
/* do we have OSI presentation packet dissector ? */
if(!pres_handle)
{
call_dissector(data_handle, next_tvb, pinfo,
tree);
tree);
}
else
{
@ -1081,7 +1099,7 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
save_private_data = pinfo->private_data;
pinfo->private_data = &session;
call_dissector(pres_handle, next_tvb, pinfo,
tree);
tree);
pinfo->private_data = save_private_data;
}
@ -1107,10 +1125,17 @@ dissect_ses(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset = 0;
guint8 type;
gboolean is_clsp = FALSE;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SES");
type = tvb_get_guint8(tvb, offset);
if(type == CLSES_UNIT_DATA)
is_clsp = TRUE;
col_set_str(pinfo->cinfo, COL_PROTOCOL, is_clsp ? "CLSES" : "SES");
col_clear(pinfo->cinfo, COL_INFO);
/*
* Do we have a category 0 SPDU (GIVE_TOKENS/PLEASE_TOKENS) as
* the first SPDU?
@ -1118,13 +1143,13 @@ dissect_ses(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* If so, dissect it as such (GIVE_TOKENS and DATA_TRANSFER have
* the same SPDU type value).
*/
type = tvb_get_guint8(tvb, offset);
if (type == SES_PLEASE_TOKENS || type == SES_GIVE_TOKENS)
offset = dissect_spdu(tvb, offset, pinfo, tree, TOKENS_SPDU);
offset = dissect_spdu(tvb, offset, pinfo, tree, TOKENS_SPDU, FALSE);
/* Dissect the remaining SPDUs. */
while (tvb_reported_length_remaining(tvb, offset) > 0)
offset = dissect_spdu(tvb, offset, pinfo, tree, NON_TOKENS_SPDU);
offset = dissect_spdu(tvb, offset, pinfo, tree, NON_TOKENS_SPDU, is_clsp);
}
void
@ -1788,6 +1813,7 @@ proto_register_ses(void)
proto_register_field_array(proto_ses, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/*
ses_module = prefs_register_protocol(proto_ses, NULL);
@ -1878,3 +1904,18 @@ proto_reg_handoff_ses(void)
heur_dissector_add("cotp", dissect_ses_heur, proto_ses);
heur_dissector_add("cotp_is", dissect_ses_heur, proto_ses);
}
void proto_register_clses(void)
{
proto_clses = proto_register_protocol(PROTO_STRING_CLSES, "CLSP", "clsp");
}
void
proto_reg_handoff_clses(void)
{
/* add our session dissector to cltp dissector list */
heur_dissector_add("cltp", dissect_ses_heur, proto_clses);
}

View File

@ -25,8 +25,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define PROTO_STRING_SES "ISO 8327-1 OSI Session Protocol"
#define PROTO_STRING_SES_INFO "ISO 8327-1 OSI Session Protocol."
/*
* Dissect ses-encapsulated data in a TCP stream.
*/
@ -99,6 +103,7 @@
#define SES_ACTIVITY_DISCARD_ACK 58
#define SES_CAPABILITY 61
#define SES_CAPABILITY_DATA_ACK 62
#define CLSES_UNIT_DATA 64
/*
reason code

View File

@ -188,7 +188,12 @@ print_area_buf(const guint8 *ad, int length, gchar *buf, int buf_len)
g_snprintf(buf, buf_len, "%02x.%02x%02x", ad[0], ad[1], ad[2] );
return;
}
if ( 4 < length ) {
if(length == 4)
{
g_snprintf(buf, buf_len, "%02x%02x%02x%02x", ad[0], ad[1], ad[2], ad[3] );
}
if ( 4 < length )
{
while ( tmp < length / 4 ) { /* 16/4==4 > four Octets left to print */
cur += g_snprintf(cur, (gulong) (buf_len-(cur-buf)), "%02x", ad[tmp++] );
cur += g_snprintf(cur, (gulong) (buf_len-(cur-buf)), "%02x", ad[tmp++] );