asn1: Cleanup space usage

Fix space issues in some ASN.1 dissectors.

Change-Id: I4ceccfbe9a13c93fc91821d1bfe4b7d6bb39c435
Reviewed-on: https://code.wireshark.org/review/13791
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Stig Bjørlykke 2016-02-06 12:28:16 +01:00 committed by Alexis La Goutte
parent a86e210722
commit 47fc7ffcb0
12 changed files with 99 additions and 111 deletions

View File

@ -108,7 +108,7 @@ acse_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
static void
acse_init(void)
{
if( acse_ctx_oid_table ){
if (acse_ctx_oid_table) {
g_hash_table_destroy(acse_ctx_oid_table);
acse_ctx_oid_table = NULL;
}
@ -127,7 +127,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
/* if this ctx already exists, remove the old one first */
tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, aco);
if(tmpaco){
if (tmpaco) {
g_hash_table_remove(acse_ctx_oid_table, tmpaco);
}
g_hash_table_insert(acse_ctx_oid_table, aco, aco);
@ -138,7 +138,7 @@ find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
acse_ctx_oid_t aco, *tmpaco;
aco.ctx_id=idx;
tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, &aco);
if(tmpaco){
if (tmpaco) {
return tmpaco->oid;
}
return NULL;
@ -164,21 +164,21 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have spdu type from the session dissector? */
if( data == NULL){
if (data == NULL) {
return 0;
}
/* first, try to check length */
/* do we have at least 2 bytes */
if (!tvb_bytes_exist(tvb, 0, 2)){
if (!tvb_bytes_exist(tvb, 0, 2)) {
proto_tree_add_item(parent_tree, hf_acse_user_data, tvb, offset,
tvb_reported_length_remaining(tvb,offset), ENC_NA);
return 0; /* no, it isn't a ACSE PDU */
}
session = ( (struct SESSION_DATA_STRUCTURE*)data);
if(session->spdu_type == 0 ) {
if(parent_tree){
session = ( (struct SESSION_DATA_STRUCTURE*)data);
if (session->spdu_type == 0) {
if (parent_tree) {
REPORT_DISSECTOR_BUG(
wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type));
return 0;
@ -192,7 +192,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* ACSE has only AARQ,AARE,RLRQ,RLRE,ABRT type of pdu */
/* reject everything else */
/* data pdu is not ACSE pdu and has to go directly to app dissector */
switch(session->spdu_type){
switch (session->spdu_type) {
case SES_CONNECTION_REQUEST: /* AARQ */
case SES_CONNECTION_ACCEPT: /* AARE */
case SES_REFUSE: /* RLRE */
@ -203,8 +203,8 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
break;
case SES_DATA_TRANSFER:
oid=find_oid_by_pres_ctx_id(pinfo, indir_ref);
if(oid){
if(strcmp(oid, ACSE_APDU_OID) == 0){
if (oid) {
if (strcmp(oid, ACSE_APDU_OID) == 0) {
proto_tree_add_expert_format(parent_tree, pinfo, &ei_acse_invalid_oid, tvb, offset, -1,
"Invalid OID: %s", ACSE_APDU_OID);
}
@ -222,17 +222,14 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
return 0;
}
if(session->spdu_type == CLSES_UNIT_DATA)
{
if (session->spdu_type == CLSES_UNIT_DATA) {
/* create display subtree for the connectionless protocol */
item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_acse);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
else
{
} else {
/* create display subtree for the protocol */
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_acse);
@ -243,10 +240,10 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
int old_offset=offset;
offset = dissect_acse_ACSE_apdu(FALSE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset ){
if (offset == old_offset) {
proto_tree_add_expert(tree, pinfo, &ei_acse_malformed, tvb, offset, -1);
break;
}

View File

@ -220,7 +220,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* save parent_tree so subdissectors can create new top nodes */
p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p1);
}
@ -294,10 +294,10 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat
col_set_str(pinfo->cinfo, COL_INFO, p1_op_name);
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset=offset;
offset=(*p1_dissector)(FALSE, tvb, offset, &asn1_ctx , tree, hf_p1_index);
if(offset == old_offset){
if (offset == old_offset) {
proto_tree_add_expert(tree, pinfo, &ei_p1_zero_pdu, tvb, offset, -1);
break;
}
@ -448,13 +448,13 @@ prefs_register_p1(void)
/* de-register the old port */
/* port 102 is registered by TPKT - don't undo this! */
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
dissector_delete_uint("tcp.port", tcp_port, tpkt_handle);
/* Set our port number for future use */
tcp_port = global_p1_tcp_port;
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
dissector_add_uint("tcp.port", tcp_port, tpkt_handle);
}

View File

@ -97,7 +97,7 @@ dissect_p22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p22, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p22);
}

View File

@ -68,7 +68,7 @@ dissect_p772(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p772, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p772);
}

View File

@ -134,7 +134,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pres_ctx_oid_t *pco, *tmppco;
conversation_t *conversation;
if(!oid){
if (!oid) {
/* we did not get any oid name, malformed packet? */
return;
}
@ -144,8 +144,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pco->oid=wmem_strdup(wmem_file_scope(), oid);
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
}
else {
} else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@ -157,9 +156,8 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
/* if this ctx already exists, remove the old one first */
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
if(tmppco){
if (tmppco) {
g_hash_table_remove(pres_ctx_oid_table, tmppco);
}
g_hash_table_insert(pres_ctx_oid_table, pco, pco);
}
@ -191,7 +189,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
pco.ctx_id=idx;
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
}else{
} else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@ -202,7 +200,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
}
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
if(tmppco){
if (tmppco) {
return tmppco->oid;
}
@ -246,13 +244,13 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have spdu type from the session dissector? */
if( local_session == NULL ){
if (local_session == NULL) {
proto_tree_add_expert(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1);
return 0;
}
session = local_session;
if(session->spdu_type == 0 ){
if (session->spdu_type == 0) {
proto_tree_add_expert_format(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return 0;
@ -267,7 +265,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA);
pres_tree = proto_item_add_subtree(ti, ett_pres);
switch(session->spdu_type){
switch (session->spdu_type) {
case SES_CONNECTION_REQUEST:
offset = dissect_pres_CP_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
break;
@ -311,7 +309,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
if (!tvb_bytes_exist(tvb, 0, 4)) {
if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
proto_tree_add_item(parent_tree, hf_pres_user_data, tvb, offset,
tvb_reported_length_remaining(tvb,offset), ENC_NA);
@ -325,16 +323,14 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* 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)
{
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)
{
if (parent_tree) {
ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, ENC_NA);
clpres_tree = proto_item_add_subtree(ti, ett_pres);
}
@ -362,12 +358,12 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
return tvb_captured_length(tvb);
}
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session);
if(offset <= old_offset){
proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
break;
if (offset <= old_offset) {
proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
break;
}
}

View File

@ -129,12 +129,12 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
/* register RTSE with the BER (ACSE) */
register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
if(uses_ros) {
if (uses_ros) {
/* make sure we call ROS ... */
dissector_add_string("rtse.oid", oid, ros_handle);
/* and then tell ROS how to dissect the AS*/
if(dissector != NULL)
if (dissector != NULL)
register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
} else {
@ -151,7 +151,7 @@ call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *
next_tvb = tvb_new_subset_remaining(tvb, offset);
if((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
if ((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
proto_item *item;
proto_tree *next_tree;
@ -177,7 +177,7 @@ call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int o
oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference);
if(!oid)
if (!oid)
proto_tree_add_expert_format(tree, actx->pinfo, &ei_rtse_abstract_syntax, tvb, offset, tvb_captured_length_remaining(tvb, offset),
"Unable to determine abstract syntax for indirect reference: %d.", actx->external.indirect_reference);
} else if (actx->external.direct_ref_present) {
@ -217,7 +217,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* do we have application context from the acse dissector? */
if (data == NULL)
return 0;
session = (struct SESSION_DATA_STRUCTURE*)data;
session = (struct SESSION_DATA_STRUCTURE*)data;
/* save parent_tree so subdissectors can create new top nodes */
top_tree=parent_tree;
@ -229,7 +229,8 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
if (rtse_reassemble &&
((session->spdu_type == SES_DATA_TRANSFER) ||
(session->spdu_type == SES_MAJOR_SYNC_POINT))) {
(session->spdu_type == SES_MAJOR_SYNC_POINT)))
{
/* Use conversation index as fragment id */
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
@ -294,10 +295,10 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
}
if (!data_handled) {
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset=offset;
offset=dissect_rtse_RTSE_apdus(TRUE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset){
if (offset == old_offset) {
next_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
ett_rtse_unknown, &item, "Unknown RTSE PDU");
expert_add_info (pinfo, item, &ei_rtse_unknown_rtse_pdu);

View File

@ -269,7 +269,7 @@ acse_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
static void
acse_init(void)
{
if( acse_ctx_oid_table ){
if (acse_ctx_oid_table) {
g_hash_table_destroy(acse_ctx_oid_table);
acse_ctx_oid_table = NULL;
}
@ -288,7 +288,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
/* if this ctx already exists, remove the old one first */
tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, aco);
if(tmpaco){
if (tmpaco) {
g_hash_table_remove(acse_ctx_oid_table, tmpaco);
}
g_hash_table_insert(acse_ctx_oid_table, aco, aco);
@ -299,7 +299,7 @@ find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
acse_ctx_oid_t aco, *tmpaco;
aco.ctx_id=idx;
tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, &aco);
if(tmpaco){
if (tmpaco) {
return tmpaco->oid;
}
return NULL;
@ -1715,21 +1715,21 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have spdu type from the session dissector? */
if( data == NULL){
if (data == NULL) {
return 0;
}
/* first, try to check length */
/* do we have at least 2 bytes */
if (!tvb_bytes_exist(tvb, 0, 2)){
if (!tvb_bytes_exist(tvb, 0, 2)) {
proto_tree_add_item(parent_tree, hf_acse_user_data, tvb, offset,
tvb_reported_length_remaining(tvb,offset), ENC_NA);
return 0; /* no, it isn't a ACSE PDU */
}
session = ( (struct SESSION_DATA_STRUCTURE*)data);
if(session->spdu_type == 0 ) {
if(parent_tree){
session = ( (struct SESSION_DATA_STRUCTURE*)data);
if (session->spdu_type == 0) {
if (parent_tree) {
REPORT_DISSECTOR_BUG(
wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type));
return 0;
@ -1743,7 +1743,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* ACSE has only AARQ,AARE,RLRQ,RLRE,ABRT type of pdu */
/* reject everything else */
/* data pdu is not ACSE pdu and has to go directly to app dissector */
switch(session->spdu_type){
switch (session->spdu_type) {
case SES_CONNECTION_REQUEST: /* AARQ */
case SES_CONNECTION_ACCEPT: /* AARE */
case SES_REFUSE: /* RLRE */
@ -1754,8 +1754,8 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
break;
case SES_DATA_TRANSFER:
oid=find_oid_by_pres_ctx_id(pinfo, indir_ref);
if(oid){
if(strcmp(oid, ACSE_APDU_OID) == 0){
if (oid) {
if (strcmp(oid, ACSE_APDU_OID) == 0) {
proto_tree_add_expert_format(parent_tree, pinfo, &ei_acse_invalid_oid, tvb, offset, -1,
"Invalid OID: %s", ACSE_APDU_OID);
}
@ -1773,17 +1773,14 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
return 0;
}
if(session->spdu_type == CLSES_UNIT_DATA)
{
if (session->spdu_type == CLSES_UNIT_DATA) {
/* create display subtree for the connectionless protocol */
item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_acse);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE");
col_clear(pinfo->cinfo, COL_INFO);
}
else
{
} else {
/* create display subtree for the protocol */
item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_acse);
@ -1794,10 +1791,10 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* we can't make any additional checking here */
/* postpone it before dissector will have more information */
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
int old_offset=offset;
offset = dissect_acse_ACSE_apdu(FALSE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset ){
if (offset == old_offset) {
proto_tree_add_expert(tree, pinfo, &ei_acse_malformed, tvb, offset, -1);
break;
}
@ -2249,7 +2246,7 @@ void proto_register_acse(void) {
NULL, HFILL }},
/*--- End of included file: packet-acse-hfarr.c ---*/
#line 269 "../../asn1/acse/packet-acse-template.c"
#line 266 "../../asn1/acse/packet-acse-template.c"
};
/* List of subtrees */
@ -2295,7 +2292,7 @@ void proto_register_acse(void) {
&ett_acse_Authentication_value,
/*--- End of included file: packet-acse-ettarr.c ---*/
#line 275 "../../asn1/acse/packet-acse-template.c"
#line 272 "../../asn1/acse/packet-acse-template.c"
};
static ei_register_info ei[] = {

View File

@ -8519,7 +8519,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* save parent_tree so subdissectors can create new top nodes */
p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p1);
}
@ -8593,10 +8593,10 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat
col_set_str(pinfo->cinfo, COL_INFO, p1_op_name);
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset=offset;
offset=(*p1_dissector)(FALSE, tvb, offset, &asn1_ctx , tree, hf_p1_index);
if(offset == old_offset){
if (offset == old_offset) {
proto_tree_add_expert(tree, pinfo, &ei_p1_zero_pdu, tvb, offset, -1);
break;
}
@ -11346,13 +11346,13 @@ prefs_register_p1(void)
/* de-register the old port */
/* port 102 is registered by TPKT - don't undo this! */
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
dissector_delete_uint("tcp.port", tcp_port, tpkt_handle);
/* Set our port number for future use */
tcp_port = global_p1_tcp_port;
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
dissector_add_uint("tcp.port", tcp_port, tpkt_handle);
}

View File

@ -4684,7 +4684,7 @@ dissect_p22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p22, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p22);
}

View File

@ -1305,7 +1305,7 @@ dissect_p772(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
if(parent_tree){
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_p772, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p772);
}

View File

@ -266,7 +266,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pres_ctx_oid_t *pco, *tmppco;
conversation_t *conversation;
if(!oid){
if (!oid) {
/* we did not get any oid name, malformed packet? */
return;
}
@ -276,8 +276,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pco->oid=wmem_strdup(wmem_file_scope(), oid);
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
}
else {
} else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@ -289,9 +288,8 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
/* if this ctx already exists, remove the old one first */
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
if(tmppco){
if (tmppco) {
g_hash_table_remove(pres_ctx_oid_table, tmppco);
}
g_hash_table_insert(pres_ctx_oid_table, pco, pco);
}
@ -323,7 +321,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
pco.ctx_id=idx;
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
}else{
} else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@ -334,7 +332,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
}
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
if(tmppco){
if (tmppco) {
return tmppco->oid;
}
@ -1369,7 +1367,7 @@ static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
/*--- End of included file: packet-pres-fn.c ---*/
#line 234 "../../asn1/pres/packet-pres-template.c"
#line 232 "../../asn1/pres/packet-pres-template.c"
/*
@ -1385,13 +1383,13 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have spdu type from the session dissector? */
if( local_session == NULL ){
if (local_session == NULL) {
proto_tree_add_expert(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1);
return 0;
}
session = local_session;
if(session->spdu_type == 0 ){
if (session->spdu_type == 0) {
proto_tree_add_expert_format(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return 0;
@ -1406,7 +1404,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA);
pres_tree = proto_item_add_subtree(ti, ett_pres);
switch(session->spdu_type){
switch (session->spdu_type) {
case SES_CONNECTION_REQUEST:
offset = dissect_pres_CP_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
break;
@ -1450,7 +1448,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
if (!tvb_bytes_exist(tvb, 0, 4)) {
if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
proto_tree_add_item(parent_tree, hf_pres_user_data, tvb, offset,
tvb_reported_length_remaining(tvb,offset), ENC_NA);
@ -1464,16 +1462,14 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* 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)
{
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)
{
if (parent_tree) {
ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, ENC_NA);
clpres_tree = proto_item_add_subtree(ti, ett_pres);
}
@ -1501,12 +1497,12 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
return tvb_captured_length(tvb);
}
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session);
if(offset <= old_offset){
proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
break;
if (offset <= old_offset) {
proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
break;
}
}
@ -1853,7 +1849,7 @@ void proto_register_pres(void) {
NULL, HFILL }},
/*--- End of included file: packet-pres-hfarr.c ---*/
#line 405 "../../asn1/pres/packet-pres-template.c"
#line 401 "../../asn1/pres/packet-pres-template.c"
};
/* List of subtrees */
@ -1900,7 +1896,7 @@ void proto_register_pres(void) {
&ett_pres_UD_type,
/*--- End of included file: packet-pres-ettarr.c ---*/
#line 411 "../../asn1/pres/packet-pres-template.c"
#line 407 "../../asn1/pres/packet-pres-template.c"
};
static ei_register_info ei[] = {

View File

@ -179,12 +179,12 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
/* register RTSE with the BER (ACSE) */
register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
if(uses_ros) {
if (uses_ros) {
/* make sure we call ROS ... */
dissector_add_string("rtse.oid", oid, ros_handle);
/* and then tell ROS how to dissect the AS*/
if(dissector != NULL)
if (dissector != NULL)
register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
} else {
@ -201,7 +201,7 @@ call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *
next_tvb = tvb_new_subset_remaining(tvb, offset);
if((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
if ((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
proto_item *item;
proto_tree *next_tree;
@ -227,7 +227,7 @@ call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int o
oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference);
if(!oid)
if (!oid)
proto_tree_add_expert_format(tree, actx->pinfo, &ei_rtse_abstract_syntax, tvb, offset, tvb_captured_length_remaining(tvb, offset),
"Unable to determine abstract syntax for indirect reference: %d.", actx->external.indirect_reference);
} else if (actx->external.direct_ref_present) {
@ -764,7 +764,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* do we have application context from the acse dissector? */
if (data == NULL)
return 0;
session = (struct SESSION_DATA_STRUCTURE*)data;
session = (struct SESSION_DATA_STRUCTURE*)data;
/* save parent_tree so subdissectors can create new top nodes */
top_tree=parent_tree;
@ -776,7 +776,8 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
if (rtse_reassemble &&
((session->spdu_type == SES_DATA_TRANSFER) ||
(session->spdu_type == SES_MAJOR_SYNC_POINT))) {
(session->spdu_type == SES_MAJOR_SYNC_POINT)))
{
/* Use conversation index as fragment id */
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
@ -841,10 +842,10 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
}
if (!data_handled) {
while (tvb_reported_length_remaining(tvb, offset) > 0){
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset=offset;
offset=dissect_rtse_RTSE_apdus(TRUE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset){
if (offset == old_offset) {
next_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
ett_rtse_unknown, &item, "Unknown RTSE PDU");
expert_add_info (pinfo, item, &ei_rtse_unknown_rtse_pdu);
@ -1013,7 +1014,7 @@ void proto_register_rtse(void) {
NULL, HFILL }},
/*--- End of included file: packet-rtse-hfarr.c ---*/
#line 369 "../../asn1/rtse/packet-rtse-template.c"
#line 370 "../../asn1/rtse/packet-rtse-template.c"
};
/* List of subtrees */
@ -1035,7 +1036,7 @@ void proto_register_rtse(void) {
&ett_rtse_CallingSSuserReference,
/*--- End of included file: packet-rtse-ettarr.c ---*/
#line 378 "../../asn1/rtse/packet-rtse-template.c"
#line 379 "../../asn1/rtse/packet-rtse-template.c"
};
static ei_register_info ei[] = {