aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/pres/packet-pres-template.c
diff options
context:
space:
mode:
Diffstat (limited to 'asn1/pres/packet-pres-template.c')
-rw-r--r--asn1/pres/packet-pres-template.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/asn1/pres/packet-pres-template.c b/asn1/pres/packet-pres-template.c
index f0ec1cee41..86d4ed192a 100644
--- a/asn1/pres/packet-pres-template.c
+++ b/asn1/pres/packet-pres-template.c
@@ -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;
}
}