diff options
Diffstat (limited to 'epan')
67 files changed, 861 insertions, 1353 deletions
diff --git a/epan/conversation.c b/epan/conversation.c index 5a2e435277..2b2d4b198a 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -1108,3 +1108,27 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const p } return FALSE; } + +/* A helper function that calls find_conversation() and, if a conversation is + * not found, calls conversation_new(). + * The frame number and addresses are taken from pinfo. + * No options are used, though we could extend this API to include an options + * parameter. + */ +conversation_t * +find_or_create_conversation(packet_info *pinfo) +{ + conversation_t *conv=NULL; + + /* Have we seen this conversation before? */ + if((conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, + pinfo->ptype, pinfo->srcport, + pinfo->destport, 0)) == NULL) { + /* No, this is a new conversation. */ + conv = conversation_new(pinfo->fd->num, &pinfo->src, + &pinfo->dst, pinfo->ptype, + pinfo->srcport, pinfo->destport, 0); + } + + return conv; +} diff --git a/epan/conversation.h b/epan/conversation.h index d19065a1e2..2329b261b4 100644 --- a/epan/conversation.h +++ b/epan/conversation.h @@ -86,6 +86,8 @@ extern conversation_t *conversation_new(const guint32 setup_frame, const address extern conversation_t *find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b, const port_type ptype, const guint32 port_a, const guint32 port_b, const guint options); +extern conversation_t *find_or_create_conversation(packet_info *pinfo); + extern void conversation_add_proto_data(conversation_t *conv, const int proto, void *proto_data); extern void *conversation_get_proto_data(const conversation_t *conv, const int proto); diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c index b87ee37e8f..4ebeb74717 100644 --- a/epan/dissectors/packet-afp.c +++ b/epan/dissectors/packet-afp.c @@ -4095,14 +4095,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP"); col_clear(pinfo->cinfo, COL_INFO); - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); request_key.conversation = conversation->index; request_key.seq = aspinfo->seq; diff --git a/epan/dissectors/packet-afs.c b/epan/dissectors/packet-afs.c index a311f226ed..675dda0106 100644 --- a/epan/dissectors/packet-afs.c +++ b/epan/dissectors/packet-afs.c @@ -1442,13 +1442,7 @@ dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * packets from A:X to B:Y as being part of the same conversation as * packets from B:Y to A:X. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* It's not part of any conversation - create a new one. */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); request_key.conversation = conversation->index; request_key.service = rxinfo->serviceid; diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c index 3d6f221e10..64e0c3f5be 100644 --- a/epan/dissectors/packet-ajp13.c +++ b/epan/dissectors/packet-ajp13.c @@ -667,12 +667,8 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* conversational state really only does us good during the first * in-order traversal */ - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!conv) { - conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conv = find_or_create_conversation(pinfo); + cd = (ajp13_conv_data*)conversation_get_proto_data(conv, proto_ajp13); if (!cd) { cd = se_alloc(sizeof(ajp13_conv_data)); diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c index 7c6ba83224..a47da68747 100644 --- a/epan/dissectors/packet-aoe.c +++ b/epan/dissectors/packet-aoe.c @@ -219,15 +219,7 @@ dissect_ata_pdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, conversation_t *conversation; /* only create a conversation for ATA commands */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if( !(pinfo->fd->flags.visited) ){ if(!response){ diff --git a/epan/dissectors/packet-applemidi.c b/epan/dissectors/packet-applemidi.c index 20e25cba04..23fdf303a1 100644 --- a/epan/dissectors/packet-applemidi.c +++ b/epan/dissectors/packet-applemidi.c @@ -248,12 +248,7 @@ dissect_applemidi_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) { } /* call dissect_applemidi() from now on for UDP packets on this "connection" */ - p_conv=find_conversation( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0 ); - if( !p_conv ) { - p_conv = conversation_new( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0 ); - } + p_conv = find_or_create_conversation(pinfo); conversation_set_dissector( p_conv, applemidi_handle ); dissect_applemidi_common( tvb, pinfo, tree, command ); diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index e1ec7ddec1..1e441dcb26 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -794,14 +794,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { aspinfo.code = 0; query = (!aspinfo.reply && !aspinfo.release); - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if (atp_defragment) { asp_request_key request_key; diff --git a/epan/dissectors/packet-beep.c b/epan/dissectors/packet-beep.c index b0c881ee66..6647b1c5f5 100644 --- a/epan/dissectors/packet-beep.c +++ b/epan/dissectors/packet-beep.c @@ -863,13 +863,7 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!beep_frame_data) { - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { /* No conversation, create one */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - } + conversation = find_or_create_conversation(pinfo); /* * Check for and insert an entry in the request table if does not exist diff --git a/epan/dissectors/packet-classicstun.c b/epan/dissectors/packet-classicstun.c index dca57967ba..6997c28de3 100644 --- a/epan/dissectors/packet-classicstun.c +++ b/epan/dissectors/packet-classicstun.c @@ -273,17 +273,8 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Do we have a conversation for this connection? */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 6230629911..a1a05660c0 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -1,7 +1,7 @@ /* packet-dcerpc.c * Routines for DCERPC packet disassembly - * Copyright 2001, Todd Sabin <tas@webspan.net> - * Copyright 2003, Tim Potter <tpot@samba.org> + * Copyright 2001, Todd Sabin <tas[AT]webspan.net> + * Copyright 2003, Tim Potter <tpot[AT]samba.org> * * $Id$ * @@ -2803,12 +2803,7 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, } if (!saw_ctx_item) { - conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conv == NULL) { - conv = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conv = find_or_create_conversation(pinfo); } /* if this is the first time we see this packet, we need to @@ -3083,8 +3078,8 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, /* Start out assuming we won't succeed in decrypting. */ decrypted_tvb = NULL; - /* Schannel needs informations into the footer (verifier) in order to setup decryptions keys - * so we call it in order to have a chance to decypher the data + /* Schannel needs informations into the footer (verifier) in order to setup decryptions keys + * so we call it in order to have a chance to decypher the data */ if (DCE_C_RPC_AUTHN_PROTOCOL_SEC_CHAN == auth_info->auth_type) { dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, auth_info); @@ -5082,12 +5077,7 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * activity_id and seqnum. I haven't seen anywhere that it would * make a difference, but for future reference... */ - conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!conv) { - conv = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conv = find_or_create_conversation(pinfo); /* * Packet type specific stuff is next. diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 3d5708d500..5a4a55132a 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -772,17 +772,7 @@ dissect_diameter_common(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) * multi-homed SCTP connections. This will probably need to be fixed at some point. */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); diameter_conv_info = conversation_get_proto_data(conversation, proto_diameter); if (!diameter_conv_info) { diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 39cb023a1e..d719f37297 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -65,12 +65,12 @@ * * Several command codes were missing, causing the dissector to abort decoding * on valid packets. Those commands have been added. - * - * The semantics of Variation 0 have been cleaned up. Variation 0 is the + * + * The semantics of Variation 0 have been cleaned up. Variation 0 is the * "Default Variation". It is used only in Master -> Slave read commands - * to request the data in whatever variation the Slave is configured to use by - * default. Decoder strings have been added to the Binary Output and - * Analog Output objects (10 and 40) so that group read commands will + * to request the data in whatever variation the Slave is configured to use by + * default. Decoder strings have been added to the Binary Output and + * Analog Output objects (10 and 40) so that group read commands will * decode properly. * * Roy M. Silvernail <roy@rant-central.com> 01/05/2009 @@ -2523,14 +2523,7 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->fragmented = TRUE; /* Look up the conversation to get the fragment reassembly id */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) { - /* No conversation yet, so make one */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conv_data_ptr = (dnp3_conv_t*)conversation_get_proto_data(conversation, proto_dnp3); diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 960231e979..79d9aa8ba7 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -108,7 +108,7 @@ static int hf_dns_time = -1; static int hf_dns_sshfp_fingerprint = -1; static int hf_dns_hip_hit = -1; static int hf_dns_hip_pk = -1; -static int hf_dns_dhcid_rdata = -1; +static int hf_dns_dhcid_rdata = -1; static int hf_dns_apl_coded_prefix = -1; static int hf_dns_apl_negation = -1; static int hf_dns_apl_afdlength = -1; @@ -490,7 +490,7 @@ static const value_string dns_types[] = { - { T_SPF, "SPF" }, /* SPF RR (RFC 4408) section 3 */ + { T_SPF, "SPF" }, /* SPF RR (RFC 4408) section 3 */ { 100, "UINFO" }, { 101, "UID" }, { 102, "GID" }, @@ -2713,7 +2713,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, if (data_len < 1) goto bad_rr; proto_tree_add_item(rr_tree, hf_dns_dhcid_rdata, tvb, cur_offset, data_len, FALSE); - + } break; @@ -2750,7 +2750,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, if (rr_len < 1) goto bad_rr; - afdpart_len = tvb_get_guint8(tvb, cur_offset) & DNS_APL_AFDLENGTH; + afdpart_len = tvb_get_guint8(tvb, cur_offset) & DNS_APL_AFDLENGTH; proto_tree_add_item(rr_tree, hf_dns_apl_negation, tvb, cur_offset, 1, FALSE); proto_tree_add_item(rr_tree, hf_dns_apl_afdlength, tvb, cur_offset, 1, FALSE); cur_offset += 1; @@ -2772,7 +2772,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, cur_offset += afdpart_len; rr_len -= afdpart_len; } - } + } break; case T_GPOS: @@ -2852,7 +2852,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, { guint8 isdn_address_len, isdn_sa_len; int rr_len = data_len; - + if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name); if (rr_len < 1) @@ -3106,17 +3106,8 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* * Do we have a conversation for this connection? */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ @@ -3245,7 +3236,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (flags & F_RESPONSE) { proto_tree_add_item(field_tree, hf_dns_flags_rcode, tvb, offset + DNS_FLAGS, 2, FALSE); - } + } } quest = tvb_get_ntohs(tvb, offset + DNS_QUEST); diff --git a/epan/dissectors/packet-drda.c b/epan/dissectors/packet-drda.c index 30ffb9820b..21abce0b9d 100644 --- a/epan/dissectors/packet-drda.c +++ b/epan/dissectors/packet-drda.c @@ -37,7 +37,7 @@ * * Documentation: * DRDA Version 3 Vol. 3: Distributed Relational Database Architecture, -* Open Group. +* Open Group. * Reference for Remote DRDA Requesters and Servers, IBM. */ @@ -334,13 +334,13 @@ static const value_string drda_opcode_vals[] = { { DRDA_CP_MGRLVLLS, "Manager-Level List" }, { DRDA_CP_SUPERVISOR, "Supervisor" }, { DRDA_CP_SECMGR, "Security Manager" }, - { DRDA_CP_EXCSATRD, "Server Attributes Reply Data" }, - { DRDA_CP_CMNAPPC, "LU 6.2 Conversational Communications Manager" }, - { DRDA_CP_DICTIONARY, "Dictionary" }, - { DRDA_CP_MGRLVLN, "Manager-Level Number Attribute" }, - { DRDA_CP_CMNTCPIP, "TCP/IP CommunicationManager" }, - { DRDA_CP_FDODTA, "FD:OCA Data" }, - { DRDA_CP_CMNSYNCPT, + { DRDA_CP_EXCSATRD, "Server Attributes Reply Data" }, + { DRDA_CP_CMNAPPC, "LU 6.2 Conversational Communications Manager" }, + { DRDA_CP_DICTIONARY, "Dictionary" }, + { DRDA_CP_MGRLVLN, "Manager-Level Number Attribute" }, + { DRDA_CP_CMNTCPIP, "TCP/IP CommunicationManager" }, + { DRDA_CP_FDODTA, "FD:OCA Data" }, + { DRDA_CP_CMNSYNCPT, "SNA LU 6.2 Sync Point Conversational Communications Manager" }, { DRDA_CP_ACCSECRD, "Access Security Reply Data" }, { DRDA_CP_SYNCPTMGR, "Sync Point Manager" }, @@ -375,12 +375,12 @@ static const value_string drda_opcode_vals[] = { { DRDA_CP_RDBCOLID, "RDB Collection Identifier" }, { DRDA_CP_PKGID, "RDB Package Identifier" }, { DRDA_CP_PKGCNSTKN, "RDB Package Consistency Token" }, - { DRDA_CP_RTNSETSTT, "Return SET Statement" }, + { DRDA_CP_RTNSETSTT, "Return SET Statement" }, { DRDA_CP_RDBACCCL, "RDB Access Manager Class" }, { DRDA_CP_RDBNAM, "Relational Database Name" }, { DRDA_CP_OUTEXP, "Output Expected" }, { DRDA_CP_PKGNAMCT, "RDB Package Name and Consistency Token" }, - { DRDA_CP_PKGNAMCSN, + { DRDA_CP_PKGNAMCSN, "RDB Package Name, Consistency Token, and Section Number" }, { DRDA_CP_QRYBLKSZ, "Query Block Size" }, { DRDA_CP_UOWDSP, "Unit of Work Disposition" }, @@ -463,186 +463,186 @@ static const value_string drda_opcode_vals[] = { }; static const value_string drda_opcode_abbr[] = { - { DRDA_CP_DATA, "DATA" }, - { DRDA_CP_CODPNT, "CODPNT" }, - { DRDA_CP_FDODSC, "FDODSC" }, - { DRDA_CP_TYPDEFNAM, "TYPDEFNAM" }, - { DRDA_CP_TYPDEFOVR, "TYPDEFOVR" }, - { DRDA_CP_CODPNTDR, "CODPNTDR" }, - { DRDA_CP_EXCSAT, "EXCSAT" }, - { DRDA_CP_SYNCCTL, "SYNCCTL" }, - { DRDA_CP_SYNCRSY, "SYNCRSY" }, - { DRDA_CP_ACCSEC, "ACCSEC" }, - { DRDA_CP_SECCHK, "SECCHK" }, - { DRDA_CP_SYNCLOG, "SYNCLOG" }, - { DRDA_CP_RSCTYP, "RSCTYP" }, - { DRDA_CP_RSNCOD, "RSNCOD" }, - { DRDA_CP_RSCNAM, "RSCNAM" }, - { DRDA_CP_PRDID, "PRDID" }, - { DRDA_CP_PRCCNVCD, "PRCCNVCD" }, - { DRDA_CP_VRSNAM, "VRSNAM" }, - { DRDA_CP_SRVCLSNM, "SRVCLSNM" }, - { DRDA_CP_SVRCOD, "SVRCOD" }, - { DRDA_CP_SYNERRCD, "SYNERRCD" }, - { DRDA_CP_SRVDGN, "SRVDGN" }, - { DRDA_CP_SRVRLSLV, "SRVRLSLV" }, - { DRDA_CP_SPVNAM, "SPVNAM" }, - { DRDA_CP_EXTNAM, "EXTNAM" }, - { DRDA_CP_SRVNAM, "SRVNAM" }, - { DRDA_CP_SECMGRNM, "SECMGRNM" }, - { DRDA_CP_DEPERRCD, "DEPERRCD" }, - { DRDA_CP_CCSIDSBC, "CCSIDSBC" }, - { DRDA_CP_CCSIDDBC, "CCSIDDBC" }, - { DRDA_CP_CCSIDMBC, "CCSIDMBC" }, - { DRDA_CP_USRID, "USRID" }, - { DRDA_CP_PASSWORD, "PASSWORD" }, - { DRDA_CP_SECMEC, "SECMEC" }, - { DRDA_CP_SECCHKCD, "SECCHKCD" }, - { DRDA_CP_SVCERRNO, "SVCERRNO" }, - { DRDA_CP_SECTKN, "SECTKN" }, - { DRDA_CP_NEWPASSWORD, "NEWPASSWORD" }, - { DRDA_CP_MGRLVLRM, "MGRLVLRM" }, - { DRDA_CP_MGRDEPRM, "MGRDEPRM" }, - { DRDA_CP_SECCHKRM, "SECCHKRM" }, - { DRDA_CP_CMDATHRM, "CMDATHRM" }, - { DRDA_CP_AGNPRMRM, "AGNPRMRM" }, - { DRDA_CP_RSCLMTRM, "RSCLMTRM" }, - { DRDA_CP_PRCCNVRM, "PRCCNVRM" }, - { DRDA_CP_CMDCMPRM, "CMDCMPRM" }, - { DRDA_CP_SYNTAXRM, "SYNTAXRM" }, - { DRDA_CP_CMDNSPRM, "CMDNSPRM" }, - { DRDA_CP_PRMNSPRM, "PRMNSPRM" }, - { DRDA_CP_VALNSPRM, "VALNSPRM" }, - { DRDA_CP_OBJNSPRM, "OBJNSPRM" }, - { DRDA_CP_CMDCHKRM, "CMDCHKRM" }, - { DRDA_CP_TRGNSPRM, "TRGNSPRM" }, - { DRDA_CP_AGENT, "AGENT" }, - { DRDA_CP_MGRLVLLS, "MGRLVLLS" }, - { DRDA_CP_SUPERVISOR, "SUPERVISOR" }, - { DRDA_CP_SECMGR, "SECMGR" }, - { DRDA_CP_EXCSATRD, "EXCSATRD" }, - { DRDA_CP_CMNAPPC, "CMNAPPC" }, - { DRDA_CP_DICTIONARY, "DICTIONARY" }, - { DRDA_CP_MGRLVLN, "MGRLVLN" }, - { DRDA_CP_CMNTCPIP, "CMNTCPIP" }, - { DRDA_CP_FDODTA, "FDODTA" }, - { DRDA_CP_CMNSYNCPT, "CMNSYNCPT" }, - { DRDA_CP_ACCSECRD, "ACCSECRD" }, - { DRDA_CP_SYNCPTMGR, "SYNCPTMGR" }, - { DRDA_CP_RSYNCMGR, "RSYNCMGR" }, - { DRDA_CP_CCSIDMGR, "CCSIDMGR" }, - { DRDA_CP_MONITOR, "MONITOR" }, - { DRDA_CP_MONITORRD, "MONITORRD" }, - { DRDA_CP_XAMGR, "XAMGR" }, - { DRDA_CP_ACCRDB, "ACCRDB" }, - { DRDA_CP_BGNBND, "BGNBND" }, - { DRDA_CP_BNDSQLSTT, "BNDSQLSTT" }, - { DRDA_CP_CLSQRY, "CLSQRY" }, - { DRDA_CP_CNTQRY, "CNTQRY" }, - { DRDA_CP_DRPPKG, "DRPPKG" }, - { DRDA_CP_DSCSQLSTT, "DSCSQLSTT" }, - { DRDA_CP_ENDBND, "ENDBND" }, - { DRDA_CP_EXCSQLIMM, "EXCSQLIMM" }, - { DRDA_CP_EXCSQLSTT, "EXCSQLSTT" }, - { DRDA_CP_EXCSQLSET, "EXCSQLSET" }, - { DRDA_CP_OPNQRY, "OPNQRY" }, - { DRDA_CP_PRPSQLSTT, "PRPSQLSTT" }, - { DRDA_CP_RDBCMM, "RDBCMM" }, - { DRDA_CP_RDBRLLBCK, "RDBRLLBCK" }, - { DRDA_CP_REBIND, "REBIND" }, - { DRDA_CP_DSCRDBTBL, "DSCRDBTBL" }, - { DRDA_CP_EXCSQLSET, "EXCSQLSET" }, - { DRDA_CP_DSCERRCD, "DSCERRCD" }, - { DRDA_CP_QRYPRCTYP, "QRYPRCTYP" }, - { DRDA_CP_RDBINTTKN, "RDBINTTKN" }, - { DRDA_CP_PRDDTA, "PRDDTA" }, - { DRDA_CP_RDBCMTOK, "RDBCMTOK" }, - { DRDA_CP_RDBCOLID, "RDBCOLID" }, - { DRDA_CP_PKGID, "PKGID" }, - { DRDA_CP_PKGCNSTKN, "PKGCNSTKN" }, - { DRDA_CP_RTNSETSTT, "RTNSETSTT" }, - { DRDA_CP_RDBACCCL, "RDBACCCL" }, - { DRDA_CP_RDBNAM, "RDBNAM" }, - { DRDA_CP_OUTEXP, "OUTEXP" }, - { DRDA_CP_PKGNAMCT, "PKGNAMCT" }, - { DRDA_CP_PKGNAMCSN, "PKGNAMCSN" }, - { DRDA_CP_QRYBLKSZ, "QRYBLKSZ" }, - { DRDA_CP_UOWDSP, "UOWDSP" }, - { DRDA_CP_RTNSQLDA, "RTNSQLDA" }, - { DRDA_CP_RDBALWUPD, "RDBALWUPD" }, - { DRDA_CP_SQLCSRHLD, "SQLCSRHLD" }, - { DRDA_CP_STTSTRDEL, "STTSTRDEL" }, - { DRDA_CP_STTDECDEL, "STTDECDEL" }, - { DRDA_CP_PKGDFTCST, "PKGDFTCST" }, - { DRDA_CP_QRYBLKCTL, "QRYBLKCTL" }, - { DRDA_CP_CRRTKN, "CRRTKN" }, - { DRDA_CP_PRCNAM, "PRCNAM" }, - { DRDA_CP_PKGSNLST, "PKGSNLST" }, - { DRDA_CP_NBRROW, "NBRROW" }, - { DRDA_CP_TRGDFTRT, "TRGDFTRT" }, - { DRDA_CP_QRYRELSCR, "QRYRELSCR" }, - { DRDA_CP_QRYROWNBR, "QRYROWNBR" }, - { DRDA_CP_QRYRFRTBL, "QRYRFRTBL" }, - { DRDA_CP_MAXRSLCNT, "MAXRSLCNT" }, - { DRDA_CP_MAXBLKEXT, "MAXBLKEXT" }, - { DRDA_CP_RSLSETFLG, "RSLSETFLG" }, - { DRDA_CP_TYPSQLDA, "TYPSQLDA" }, - { DRDA_CP_OUTOVROPT, "OUTOVROPT" }, - { DRDA_CP_RTNEXTDTA, "RTNEXTDTA" }, - { DRDA_CP_QRYATTSCR, "QRYATTSCR" }, - { DRDA_CP_QRYATTUPD, "QRYATTUPD" }, - { DRDA_CP_QRYSCRORN, "QRYSCRORN" }, - { DRDA_CP_QRYROWSNS, "QRYROWSNS" }, - { DRDA_CP_QRYBLKRST, "QRYBLKRST" }, - { DRDA_CP_QRYRTNDTA, "QRYRTNDTA" }, - { DRDA_CP_QRYROWSET, "QRYROWSET" }, - { DRDA_CP_QRYATTSNS, "QRYATTSNS" }, - { DRDA_CP_QRYINSID, "QRYINSID" }, - { DRDA_CP_QRYCLSIMP, "QRYCLSIMP" }, - { DRDA_CP_QRYCLSRLS, "QRYCLSRLS" }, - { DRDA_CP_QRYOPTVAL, "QRYOPTVAL" }, - { DRDA_CP_DIAGLVL, "DIAGLVL" }, - { DRDA_CP_ACCRDBRM, "ACCRDBRM" }, - { DRDA_CP_QRYNOPRM, "QRYNOPRM" }, - { DRDA_CP_RDBNACRM, "RDBNACRM" }, - { DRDA_CP_OPNQRYRM, "OPNQRYRM" }, - { DRDA_CP_PKGBNARM, "PKGBNARM" }, - { DRDA_CP_RDBACCRM, "RDBACCRM" }, - { DRDA_CP_BGNBNDRM, "BGNBNDRM" }, - { DRDA_CP_PKGBPARM, "PKGBPARM" }, - { DRDA_CP_DSCINVRM, "DSCINVRM" }, - { DRDA_CP_ENDQRYRM, "ENDQRYRM" }, - { DRDA_CP_ENDUOWRM, "ENDUOWRM" }, - { DRDA_CP_ABNUOWRM, "ABNUOWRM" }, - { DRDA_CP_DTAMCHRM, "DTAMCHRM" }, - { DRDA_CP_QRYPOPRM, "QRYPOPRM" }, - { DRDA_CP_RDBNFNRM, "RDBNFNRM" }, - { DRDA_CP_OPNQFLRM, "OPNQFLRM" }, - { DRDA_CP_SQLERRRM, "SQLERRRM" }, - { DRDA_CP_RDBUPDRM, "RDBUPDRM" }, - { DRDA_CP_OPNQFLRM, "OPNQFLRM" }, - { DRDA_CP_RSLSETRM, "RSLSETRM" }, - { DRDA_CP_RDBAFLRM, "RDBAFLRM" }, - { DRDA_CP_CMDVLTRM, "CMDVLTRM" }, - { DRDA_CP_CMMRQSRM, "CMMRQSRM" }, - { DRDA_CP_RDBATHRM, "RDBATHRM" }, - { DRDA_CP_SQLAM, "SQLAM" }, - { DRDA_CP_SQLCARD, "SQLCARD" }, - { DRDA_CP_SQLCINRD, "SQLCINRD" }, - { DRDA_CP_SQLRSLRD, "SQLRSLRD" }, - { DRDA_CP_RDB, "RDB" }, - { DRDA_CP_FRCFIXROW, "FRCFIXROW" }, - { DRDA_CP_SQLDARD, "SQLDARD" }, - { DRDA_CP_SQLDTA, "SQLDTA" }, - { DRDA_CP_SQLDTARD, "SQLDTARD" }, - { DRDA_CP_SQLSTT, "SQLSTT" }, - { DRDA_CP_OUTOVR, "OUTOVR" }, - { DRDA_CP_LMTBLKPRC, "LMTBLKPRC" }, - { DRDA_CP_FIXROWPRC, "FIXROWPRC" }, - { DRDA_CP_SQLSTTVRB, "SQLSTTVRB" }, - { DRDA_CP_QRYDSC, "QRYDSC" }, - { DRDA_CP_QRYDTA, "QRYDTA" }, - { DRDA_CP_SQLATTR, "SQLATTR" }, + { DRDA_CP_DATA, "DATA" }, + { DRDA_CP_CODPNT, "CODPNT" }, + { DRDA_CP_FDODSC, "FDODSC" }, + { DRDA_CP_TYPDEFNAM, "TYPDEFNAM" }, + { DRDA_CP_TYPDEFOVR, "TYPDEFOVR" }, + { DRDA_CP_CODPNTDR, "CODPNTDR" }, + { DRDA_CP_EXCSAT, "EXCSAT" }, + { DRDA_CP_SYNCCTL, "SYNCCTL" }, + { DRDA_CP_SYNCRSY, "SYNCRSY" }, + { DRDA_CP_ACCSEC, "ACCSEC" }, + { DRDA_CP_SECCHK, "SECCHK" }, + { DRDA_CP_SYNCLOG, "SYNCLOG" }, + { DRDA_CP_RSCTYP, "RSCTYP" }, + { DRDA_CP_RSNCOD, "RSNCOD" }, + { DRDA_CP_RSCNAM, "RSCNAM" }, + { DRDA_CP_PRDID, "PRDID" }, + { DRDA_CP_PRCCNVCD, "PRCCNVCD" }, + { DRDA_CP_VRSNAM, "VRSNAM" }, + { DRDA_CP_SRVCLSNM, "SRVCLSNM" }, + { DRDA_CP_SVRCOD, "SVRCOD" }, + { DRDA_CP_SYNERRCD, "SYNERRCD" }, + { DRDA_CP_SRVDGN, "SRVDGN" }, + { DRDA_CP_SRVRLSLV, "SRVRLSLV" }, + { DRDA_CP_SPVNAM, "SPVNAM" }, + { DRDA_CP_EXTNAM, "EXTNAM" }, + { DRDA_CP_SRVNAM, "SRVNAM" }, + { DRDA_CP_SECMGRNM, "SECMGRNM" }, + { DRDA_CP_DEPERRCD, "DEPERRCD" }, + { DRDA_CP_CCSIDSBC, "CCSIDSBC" }, + { DRDA_CP_CCSIDDBC, "CCSIDDBC" }, + { DRDA_CP_CCSIDMBC, "CCSIDMBC" }, + { DRDA_CP_USRID, "USRID" }, + { DRDA_CP_PASSWORD, "PASSWORD" }, + { DRDA_CP_SECMEC, "SECMEC" }, + { DRDA_CP_SECCHKCD, "SECCHKCD" }, + { DRDA_CP_SVCERRNO, "SVCERRNO" }, + { DRDA_CP_SECTKN, "SECTKN" }, + { DRDA_CP_NEWPASSWORD, "NEWPASSWORD" }, + { DRDA_CP_MGRLVLRM, "MGRLVLRM" }, + { DRDA_CP_MGRDEPRM, "MGRDEPRM" }, + { DRDA_CP_SECCHKRM, "SECCHKRM" }, + { DRDA_CP_CMDATHRM, "CMDATHRM" }, + { DRDA_CP_AGNPRMRM, "AGNPRMRM" }, + { DRDA_CP_RSCLMTRM, "RSCLMTRM" }, + { DRDA_CP_PRCCNVRM, "PRCCNVRM" }, + { DRDA_CP_CMDCMPRM, "CMDCMPRM" }, + { DRDA_CP_SYNTAXRM, "SYNTAXRM" }, + { DRDA_CP_CMDNSPRM, "CMDNSPRM" }, + { DRDA_CP_PRMNSPRM, "PRMNSPRM" }, + { DRDA_CP_VALNSPRM, "VALNSPRM" }, + { DRDA_CP_OBJNSPRM, "OBJNSPRM" }, + { DRDA_CP_CMDCHKRM, "CMDCHKRM" }, + { DRDA_CP_TRGNSPRM, "TRGNSPRM" }, + { DRDA_CP_AGENT, "AGENT" }, + { DRDA_CP_MGRLVLLS, "MGRLVLLS" }, + { DRDA_CP_SUPERVISOR, "SUPERVISOR" }, + { DRDA_CP_SECMGR, "SECMGR" }, + { DRDA_CP_EXCSATRD, "EXCSATRD" }, + { DRDA_CP_CMNAPPC, "CMNAPPC" }, + { DRDA_CP_DICTIONARY, "DICTIONARY" }, + { DRDA_CP_MGRLVLN, "MGRLVLN" }, + { DRDA_CP_CMNTCPIP, "CMNTCPIP" }, + { DRDA_CP_FDODTA, "FDODTA" }, + { DRDA_CP_CMNSYNCPT, "CMNSYNCPT" }, + { DRDA_CP_ACCSECRD, "ACCSECRD" }, + { DRDA_CP_SYNCPTMGR, "SYNCPTMGR" }, + { DRDA_CP_RSYNCMGR, "RSYNCMGR" }, + { DRDA_CP_CCSIDMGR, "CCSIDMGR" }, + { DRDA_CP_MONITOR, "MONITOR" }, + { DRDA_CP_MONITORRD, "MONITORRD" }, + { DRDA_CP_XAMGR, "XAMGR" }, + { DRDA_CP_ACCRDB, "ACCRDB" }, + { DRDA_CP_BGNBND, "BGNBND" }, + { DRDA_CP_BNDSQLSTT, "BNDSQLSTT" }, + { DRDA_CP_CLSQRY, "CLSQRY" }, + { DRDA_CP_CNTQRY, "CNTQRY" }, + { DRDA_CP_DRPPKG, "DRPPKG" }, + { DRDA_CP_DSCSQLSTT, "DSCSQLSTT" }, + { DRDA_CP_ENDBND, "ENDBND" }, + { DRDA_CP_EXCSQLIMM, "EXCSQLIMM" }, + { DRDA_CP_EXCSQLSTT, "EXCSQLSTT" }, + { DRDA_CP_EXCSQLSET, "EXCSQLSET" }, + { DRDA_CP_OPNQRY, "OPNQRY" }, + { DRDA_CP_PRPSQLSTT, "PRPSQLSTT" }, + { DRDA_CP_RDBCMM, "RDBCMM" }, + { DRDA_CP_RDBRLLBCK, "RDBRLLBCK" }, + { DRDA_CP_REBIND, "REBIND" }, + { DRDA_CP_DSCRDBTBL, "DSCRDBTBL" }, + { DRDA_CP_EXCSQLSET, "EXCSQLSET" }, + { DRDA_CP_DSCERRCD, "DSCERRCD" }, + { DRDA_CP_QRYPRCTYP, "QRYPRCTYP" }, + { DRDA_CP_RDBINTTKN, "RDBINTTKN" }, + { DRDA_CP_PRDDTA, "PRDDTA" }, + { DRDA_CP_RDBCMTOK, "RDBCMTOK" }, + { DRDA_CP_RDBCOLID, "RDBCOLID" }, + { DRDA_CP_PKGID, "PKGID" }, + { DRDA_CP_PKGCNSTKN, "PKGCNSTKN" }, + { DRDA_CP_RTNSETSTT, "RTNSETSTT" }, + { DRDA_CP_RDBACCCL, "RDBACCCL" }, + { DRDA_CP_RDBNAM, "RDBNAM" }, + { DRDA_CP_OUTEXP, "OUTEXP" }, + { DRDA_CP_PKGNAMCT, "PKGNAMCT" }, + { DRDA_CP_PKGNAMCSN, "PKGNAMCSN" }, + { DRDA_CP_QRYBLKSZ, "QRYBLKSZ" }, + { DRDA_CP_UOWDSP, "UOWDSP" }, + { DRDA_CP_RTNSQLDA, "RTNSQLDA" }, + { DRDA_CP_RDBALWUPD, "RDBALWUPD" }, + { DRDA_CP_SQLCSRHLD, "SQLCSRHLD" }, + { DRDA_CP_STTSTRDEL, "STTSTRDEL" }, + { DRDA_CP_STTDECDEL, "STTDECDEL" }, + { DRDA_CP_PKGDFTCST, "PKGDFTCST" }, + { DRDA_CP_QRYBLKCTL, "QRYBLKCTL" }, + { DRDA_CP_CRRTKN, "CRRTKN" }, + { DRDA_CP_PRCNAM, "PRCNAM" }, + { DRDA_CP_PKGSNLST, "PKGSNLST" }, + { DRDA_CP_NBRROW, "NBRROW" }, + { DRDA_CP_TRGDFTRT, "TRGDFTRT" }, + { DRDA_CP_QRYRELSCR, "QRYRELSCR" }, + { DRDA_CP_QRYROWNBR, "QRYROWNBR" }, + { DRDA_CP_QRYRFRTBL, "QRYRFRTBL" }, + { DRDA_CP_MAXRSLCNT, "MAXRSLCNT" }, + { DRDA_CP_MAXBLKEXT, "MAXBLKEXT" }, + { DRDA_CP_RSLSETFLG, "RSLSETFLG" }, + { DRDA_CP_TYPSQLDA, "TYPSQLDA" }, + { DRDA_CP_OUTOVROPT, "OUTOVROPT" }, + { DRDA_CP_RTNEXTDTA, "RTNEXTDTA" }, + { DRDA_CP_QRYATTSCR, "QRYATTSCR" }, + { DRDA_CP_QRYATTUPD, "QRYATTUPD" }, + { DRDA_CP_QRYSCRORN, "QRYSCRORN" }, + { DRDA_CP_QRYROWSNS, "QRYROWSNS" }, + { DRDA_CP_QRYBLKRST, "QRYBLKRST" }, + { DRDA_CP_QRYRTNDTA, "QRYRTNDTA" }, + { DRDA_CP_QRYROWSET, "QRYROWSET" }, + { DRDA_CP_QRYATTSNS, "QRYATTSNS" }, + { DRDA_CP_QRYINSID, "QRYINSID" }, + { DRDA_CP_QRYCLSIMP, "QRYCLSIMP" }, + { DRDA_CP_QRYCLSRLS, "QRYCLSRLS" }, + { DRDA_CP_QRYOPTVAL, "QRYOPTVAL" }, + { DRDA_CP_DIAGLVL, "DIAGLVL" }, + { DRDA_CP_ACCRDBRM, "ACCRDBRM" }, + { DRDA_CP_QRYNOPRM, "QRYNOPRM" }, + { DRDA_CP_RDBNACRM, "RDBNACRM" }, + { DRDA_CP_OPNQRYRM, "OPNQRYRM" }, + { DRDA_CP_PKGBNARM, "PKGBNARM" }, + { DRDA_CP_RDBACCRM, "RDBACCRM" }, + { DRDA_CP_BGNBNDRM, "BGNBNDRM" }, + { DRDA_CP_PKGBPARM, "PKGBPARM" }, + { DRDA_CP_DSCINVRM, "DSCINVRM" }, + { DRDA_CP_ENDQRYRM, "ENDQRYRM" }, + { DRDA_CP_ENDUOWRM, "ENDUOWRM" }, + { DRDA_CP_ABNUOWRM, "ABNUOWRM" }, + { DRDA_CP_DTAMCHRM, "DTAMCHRM" }, + { DRDA_CP_QRYPOPRM, "QRYPOPRM" }, + { DRDA_CP_RDBNFNRM, "RDBNFNRM" }, + { DRDA_CP_OPNQFLRM, "OPNQFLRM" }, + { DRDA_CP_SQLERRRM, "SQLERRRM" }, + { DRDA_CP_RDBUPDRM, "RDBUPDRM" }, + { DRDA_CP_OPNQFLRM, "OPNQFLRM" }, + { DRDA_CP_RSLSETRM, "RSLSETRM" }, + { DRDA_CP_RDBAFLRM, "RDBAFLRM" }, + { DRDA_CP_CMDVLTRM, "CMDVLTRM" }, + { DRDA_CP_CMMRQSRM, "CMMRQSRM" }, + { DRDA_CP_RDBATHRM, "RDBATHRM" }, + { DRDA_CP_SQLAM, "SQLAM" }, + { DRDA_CP_SQLCARD, "SQLCARD" }, + { DRDA_CP_SQLCINRD, "SQLCINRD" }, + { DRDA_CP_SQLRSLRD, "SQLRSLRD" }, + { DRDA_CP_RDB, "RDB" }, + { DRDA_CP_FRCFIXROW, "FRCFIXROW" }, + { DRDA_CP_SQLDARD, "SQLDARD" }, + { DRDA_CP_SQLDTA, "SQLDTA" }, + { DRDA_CP_SQLDTARD, "SQLDTARD" }, + { DRDA_CP_SQLSTT, "SQLSTT" }, + { DRDA_CP_OUTOVR, "OUTOVR" }, + { DRDA_CP_LMTBLKPRC, "LMTBLKPRC" }, + { DRDA_CP_FIXROWPRC, "FIXROWPRC" }, + { DRDA_CP_SQLSTTVRB, "SQLSTTVRB" }, + { DRDA_CP_QRYDSC, "QRYDSC" }, + { DRDA_CP_QRYDTA, "QRYDTA" }, + { DRDA_CP_SQLATTR, "SQLATTR" }, { 0, NULL } }; @@ -690,7 +690,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iCommand = tvb_get_ntohs(tvb, offset + 8); iLength = tvb_get_ntohs(tvb, offset + 0); - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { col_append_str(pinfo->cinfo, COL_INFO, val_to_str(iCommand, drda_opcode_abbr, "Unknown (0x%02x)")); } @@ -717,7 +717,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(drda_tree, hf_drda_ddm_format, tvb, offset + 3, 1, FALSE); drda_tree_sub = proto_item_add_subtree(ti, ett_drda_ddm_format); - proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_reserved, tvb, offset + 3, 1, iDSSFlags); + proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_reserved, tvb, offset + 3, 1, iDSSFlags); proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_chained, tvb, offset + 3, 1, iDSSFlags); proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_errcont, tvb, offset + 3, 1, iDSSFlags); proto_tree_add_boolean(drda_tree_sub, hf_drda_ddm_fmt_samecorr, tvb, offset + 3, 1, iDSSFlags); @@ -755,7 +755,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement, next_tvb, 0, iLengthParam - 5, FALSE); proto_tree_add_item(drdaroot_tree, hf_drda_sqlstatement_ebcdic, next_tvb, 0, iLengthParam - 4, FALSE); } - } + } offset += iLengthParam; } else @@ -797,12 +797,7 @@ dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((tvb_get_guint8(tvb, 2) == DRDA_MAGIC) && ((cOuterLength - cInnerLength) == 6)) { /* Register this dissector for this conversation */ - conversation = NULL; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conversation_set_dissector(conversation, drda_tcp_handle); /* Dissect the packet */ @@ -871,7 +866,7 @@ proto_register_drda(void) }; static gint *ett[] = { &ett_drda, - &ett_drda_ddm, + &ett_drda_ddm, &ett_drda_ddm_format, &ett_drda_param }; @@ -881,7 +876,7 @@ proto_register_drda(void) proto_drda = proto_register_protocol("DRDA", "DRDA", "drda"); proto_register_field_array(proto_drda, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + drda_module = prefs_register_protocol(proto_drda, NULL); prefs_register_bool_preference(drda_module, "desegment", "Reassemble DRDA messages spanning multiple TCP segments", diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index c38df9610b..5cc1bd437e 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -343,14 +343,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * the conv_version, must set the copy in the conversation * in addition to conv_version */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!conversation) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conv_data = conversation_get_proto_data(conversation, proto_dtls); /* manage dtls decryption data */ @@ -1837,15 +1830,7 @@ ssl_set_conv_version(packet_info *pinfo, guint version) return; } - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if (conversation_get_proto_data(conversation, proto_dtls) != NULL) { diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index 5468890c47..de78102631 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -512,21 +512,8 @@ enip_conv_info_t *enip_info; g_hash_table_insert(enip_conn_hashtable, conn_key, conn_val ); - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ @@ -1060,22 +1047,10 @@ dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * We need to track some state for this protocol on a per conversation * basis so we can do neat things like request/response tracking */ + conversation = find_or_create_conversation(pinfo); + /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } - /* - * No. Attach that information to the conversation, and add + * Attach that information to the conversation, and add * it to the list of information structures later before dissection. */ memset( &request_key, 0, sizeof(enip_request_key_t) ); diff --git a/epan/dissectors/packet-exec.c b/epan/dissectors/packet-exec.c index 86715cebd7..da57e0ae0c 100644 --- a/epan/dissectors/packet-exec.c +++ b/epan/dissectors/packet-exec.c @@ -9,17 +9,17 @@ * Copyright 1998 Gerald Combs * * Based on BSD rexecd code/man page and parts of packet-rlogin.c - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -79,7 +79,7 @@ typedef enum { WAIT_FOR_COMMAND = 4, WAIT_FOR_DATA = 5 } exec_session_state_t; - + typedef struct { /* Packet number within the conversation */ @@ -118,20 +118,15 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conversation_t *conversation; exec_hash_entry_t *hash_info; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); + conversation = find_or_create_conversation(pinfo); - if(!conversation){ /* Conversation does not exist yet - create it */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } - - - /* Retrieve information from conversation + /* Retrieve information from conversation * or add it if it isn't there yet */ hash_info = conversation_get_proto_data(conversation, proto_exec); if(!hash_info){ hash_info = se_alloc(sizeof(exec_hash_entry_t)); - + hash_info->first_packet_number = pinfo->fd->num; hash_info->second_packet_number = 0; hash_info->third_packet_number = 0; @@ -143,7 +138,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hash_info->username=NULL; hash_info->command=NULL; - /* These will be set on the first pass by the first + /* These will be set on the first pass by the first * four packets of the conversation */ hash_info->first_packet_state = NONE; @@ -183,7 +178,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hash_info->state = hash_info->first_packet_state; } } - + if(pinfo->fd->num == hash_info->second_packet_number){ if(hash_info->second_packet_state == NONE){ hash_info->second_packet_state = hash_info->state; @@ -191,7 +186,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hash_info->state = hash_info->second_packet_state; } } - + if(pinfo->fd->num == hash_info->third_packet_number){ if(hash_info->third_packet_state == NONE){ hash_info->third_packet_state = hash_info->state; @@ -199,7 +194,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hash_info->state = hash_info->third_packet_state; } } - + if(pinfo->fd->num == hash_info->fourth_packet_number){ if(hash_info->fourth_packet_state == NONE){ hash_info->fourth_packet_state = hash_info->state; @@ -218,13 +213,13 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(hash_info->username && preference_info_show_username == TRUE){ col_append_fstr(pinfo->cinfo, COL_INFO, "Username:%s ", hash_info->username); } - + /* Command */ if(hash_info->command && preference_info_show_command == TRUE){ col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); } } - + /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_exec, tvb, 0, -1, FALSE); exec_tree = proto_item_add_subtree(ti, ett_exec); @@ -250,26 +245,26 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_string(exec_tree, hf_exec_stderr_port, tvb, offset, length, (gchar*)field_stringz); /* Next field we need */ hash_info->state = WAIT_FOR_USERNAME; - } else { + } else { /* Since the data doesn't match this field, it must be data only */ hash_info->state = WAIT_FOR_DATA; } - + /* Used if the next field is in the same packet */ offset += length; } - - + + if(hash_info->state == WAIT_FOR_USERNAME && tvb_length_remaining(tvb, offset)){ field_stringz = tvb_get_ephemeral_stringz(tvb, offset, &length); - + /* Check if this looks like the username field */ if(length != 1 && length <= EXEC_USERNAME_LEN && exec_isprint_string(field_stringz)){ proto_tree_add_string(exec_tree, hf_exec_username, tvb, offset, length, (gchar*)field_stringz); - /* Store the username so we can display it in the + /* Store the username so we can display it in the * info column of the entire conversation */ if(!hash_info->username){ @@ -278,20 +273,20 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Next field we need */ hash_info->state = WAIT_FOR_PASSWORD; - } else { + } else { /* Since the data doesn't match this field, it must be data only */ hash_info->state = WAIT_FOR_DATA; } - + /* Used if the next field is in the same packet */ offset += length; } - + if(hash_info->state == WAIT_FOR_PASSWORD && tvb_length_remaining(tvb, offset)){ field_stringz = tvb_get_ephemeral_stringz(tvb, offset, &length); - + /* Check if this looks like the password field */ if(length != 1 && length <= EXEC_PASSWORD_LEN && exec_isprint_string(field_stringz)){ @@ -303,24 +298,24 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Since the data doesn't match this field, it must be data only */ hash_info->state = WAIT_FOR_DATA; } - + /* Used if the next field is in the same packet */ offset += length; /* Next field we are looking for */ hash_info->state = WAIT_FOR_COMMAND; } - + if(hash_info->state == WAIT_FOR_COMMAND && tvb_length_remaining(tvb, offset)){ field_stringz = tvb_get_ephemeral_stringz(tvb, offset, &length); - + /* Check if this looks like the command field */ if(length != 1 && length <= EXEC_COMMAND_LEN && exec_isprint_string(field_stringz)){ proto_tree_add_string(exec_tree, hf_exec_command, tvb, offset, length, (gchar*)field_stringz); - - /* Store the username so we can display it in the + + /* Store the username so we can display it in the * info column of the entire conversation */ if(!hash_info->command){ @@ -333,20 +328,20 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - + if(hash_info->state == WAIT_FOR_DATA && tvb_length_remaining(tvb, offset)){ if(pinfo->destport == EXEC_PORT){ /* Packet going to the server */ /* offset = 0 since the whole packet is data */ proto_tree_add_text(exec_tree, tvb, 0, -1, "Client -> Server Data"); - + col_append_str(pinfo->cinfo, COL_INFO, "Client -> Server data"); } else { /* This packet must be going back to the client */ /* offset = 0 since the whole packet is data */ proto_tree_add_text(exec_tree, tvb, 0, -1, "Server -> Client Data"); - + col_append_str(pinfo->cinfo, COL_INFO, "Server -> Client Data"); } } @@ -365,31 +360,31 @@ proto_register_exec(void) { &hf_exec_stderr_port, { "Stderr port (optional)", "exec.stderr_port", FT_STRINGZ, BASE_NONE, NULL, 0, "Client port that is listening for stderr stream from server", HFILL } }, - + { &hf_exec_username, { "Client username", "exec.username", FT_STRINGZ, BASE_NONE, NULL, 0, "Username client uses to log in to the server.", HFILL } }, - + { &hf_exec_password, { "Client password", "exec.password", FT_STRINGZ, BASE_NONE, NULL, 0, "Password client uses to log in to the server.", HFILL } }, - + { &hf_exec_command, { "Command to execute", "exec.command", FT_STRINGZ, BASE_NONE, NULL, 0, "Command client is requesting the server to run.", HFILL } } }; - static gint *ett[] = - { - &ett_exec + static gint *ett[] = + { + &ett_exec }; module_t *exec_module; /* Register the protocol name and description */ proto_exec = proto_register_protocol("Remote Process Execution", "EXEC", "exec"); - + /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_exec, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index 7253262c51..84ddf3565f 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -1,7 +1,7 @@ /* packet-fc.c - * Routines for Fibre Channel Decoding (FC Header, Link Ctl & Basic Link Svc) + * Routines for Fibre Channel Decoding (FC Header, Link Ctl & Basic Link Svc) * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com> - * Copyright 2003 Ronnie Sahlberg, exchange first/last matching and + * Copyright 2003 Ronnie Sahlberg, exchange first/last matching and * tap listener and misc updates * * $Id$ @@ -9,17 +9,17 @@ * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -58,7 +58,7 @@ #define FC_HEADER_SIZE 24 #define FC_RCTL_VFT 0x50 -#define MDSHDR_TRAILER_SIZE 6 +#define MDSHDR_TRAILER_SIZE 6 /* Size of various fields in FC header in bytes */ #define FC_RCTL_SIZE 1 @@ -193,9 +193,9 @@ fcseq_hash (gconstpointer v) { const fcseq_conv_key_t *key = v; guint val; - + val = key->conv_idx; - + return val; } @@ -206,7 +206,7 @@ fc_exchange_init_protocol(void) if (fcseq_req_hash) g_hash_table_destroy(fcseq_req_hash); - + fcseq_req_hash = g_hash_table_new(fcseq_hash, fcseq_equal); } @@ -291,7 +291,7 @@ static const value_string fc_iu_val[] = { #define FC_SOFC4 0xBCB51919 #define FC_SOFI4 0xBCB55959 #define FC_SOFN4 0xBCB53939 -#define FC_SOFF 0xBCB55858 +#define FC_SOFF 0xBCB55858 #define EOFT_NEG 0xBC957575 #define EOFT_POS 0xBCB57575 @@ -431,7 +431,7 @@ fc_get_ftype (guint8 r_ctl, guint8 type) case FC_RCTL_ELS: if (((r_ctl & 0x0F) == 0x2) || ((r_ctl & 0x0F) == 0x3)) return FC_FTYPE_ELS; - else if (type == FC_TYPE_ELS) + else if (type == FC_TYPE_ELS) return FC_FTYPE_OHMS; else return FC_FTYPE_UNDEF; @@ -548,7 +548,7 @@ dissect_fc_vft(proto_tree *parent_tree, if (parent_tree) { item = proto_tree_add_uint_format(parent_tree, hf_fc_vft, tvb, offset, - 8, vf_id, "VFT Header: " + 8, vf_id, "VFT Header: " "VF_ID %d Pri %d Hop Count %d", vf_id, pri, hop_ct); tree = proto_item_add_subtree(item, ett_fc_vft); @@ -704,7 +704,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean guint32 frag_size; guint8 df_ctl, seq_id; guint32 f_ctl; - + guint32 param; guint16 real_seqcnt; guint8 ftype; @@ -743,11 +743,11 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean * the src/dst ids are undefined(==semi-random) in the FC header. * This means we can no track conversations for FC over iFCP by using * the FC src/dst addresses. - * For iFCP: Do not update the pinfo src/dst struct and let it remain + * For iFCP: Do not update the pinfo src/dst struct and let it remain * being tcpip src/dst so that request/response matching in the FCP layer * will use ip addresses instead and still work. */ - if(!is_ifcp){ + if(!is_ifcp){ SET_ADDRESS (&pinfo->dst, AT_FC, 3, tvb_get_ptr(tvb,offset+1,3)); SET_ADDRESS (&pinfo->src, AT_FC, 3, tvb_get_ptr(tvb,offset+5,3)); pinfo->srcport=0; @@ -773,14 +773,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean /* set up a conversation and conversation data */ /* TODO treat the fc address s_id==00.00.00 as a wildcard matching anything */ - conversation=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if(!conversation){ - conversation=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation=find_or_create_conversation(pinfo); fchdr.conversation=conversation; fc_conv_data=conversation_get_proto_data(conversation, proto_fc); if(!fc_conv_data){ @@ -859,7 +852,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_1frame_inseq = (((pinfo->sof_eof & PINFO_SOF_FIRST_FRAME) == PINFO_SOF_FIRST_FRAME) || (((pinfo->sof_eof & PINFO_SOF_SOFF) == PINFO_SOF_SOFF) && (fchdr.seqcnt == 0))); - + is_lastframe_inseq = ((pinfo->sof_eof & PINFO_EOF_LAST_FRAME) == PINFO_EOF_LAST_FRAME); is_lastframe_inseq |= fchdr.fctl & FC_FCTL_SEQ_LAST; @@ -894,7 +887,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean val_to_str ((fchdr.r_ctl & 0xF0), fc_routing_val, "0x%x"), val_to_str ((fchdr.r_ctl & 0x0F), - fc_iu_val, "0x%x")); + fc_iu_val, "0x%x")); break; case FC_RCTL_LINK_CTL: @@ -906,7 +899,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean val_to_str ((fchdr.r_ctl & 0xF0), fc_routing_val, "0x%x"), val_to_str ((fchdr.r_ctl & 0x0F), - fc_lctl_proto_val, "0x%x")); + fc_lctl_proto_val, "0x%x")); break; case FC_RCTL_BLS: @@ -921,7 +914,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean val_to_str ((fchdr.r_ctl & 0xF0), fc_routing_val, "0x%x"), val_to_str ((fchdr.r_ctl & 0x0F), - fc_bls_proto_val, "0x%x")); + fc_bls_proto_val, "0x%x")); break; default: @@ -948,7 +941,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean val_to_str ((fchdr.r_ctl & 0xF0), fc_routing_val, "0x%x"), val_to_str ((fchdr.r_ctl & 0x0F), - fc_els_proto_val, "0x%x")); + fc_els_proto_val, "0x%x")); break; default: @@ -975,7 +968,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean } hidden_item = proto_tree_add_uint (fc_tree, hf_fc_ftype, tvb, offset, 1, - ftype); + ftype); PROTO_ITEM_SET_HIDDEN(hidden_item); /* XXX - use "fc_wka_vals[]" on this? */ @@ -1002,7 +995,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean */ proto_tree_add_uint_format (fc_tree, hf_fc_type, tvb, offset+8, FC_TYPE_SIZE, - fchdr.type,"Type: 0x%x(%s)", fchdr.type, + fchdr.type,"Type: 0x%x(%s)", fchdr.type, fclctl_get_typestr ((guint8) (fchdr.r_ctl & 0x0F), fchdr.type)); } else { @@ -1044,7 +1037,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean } else if (ftype == FC_FTYPE_BLS) { if ((fchdr.r_ctl & 0x0F) == FC_BLS_ABTS) { proto_tree_add_uint_format (fc_tree, hf_fc_param, tvb, - offset+20, 4, param, + offset+20, 4, param, "Parameter: 0x%x(%s)", param, ((param & 0x0F) == 1 ? "Abort Sequence" : "Abort Exchange")); @@ -1137,7 +1130,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean * determine the actual offset into a frame. */ ckey.conv_idx = conversation->index; - + cdata = (fcseq_conv_data_t *)g_hash_table_lookup (fcseq_req_hash, &ckey); @@ -1145,17 +1138,17 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean if (cdata) { /* Since we never free the memory used by an exchange, this maybe a * case of another request using the same exchange as a previous - * req. + * req. */ cdata->seq_cnt = fchdr.seqcnt; } else { req_key = se_alloc (sizeof(fcseq_conv_key_t)); req_key->conv_idx = conversation->index; - + cdata = se_alloc (sizeof(fcseq_conv_data_t)); cdata->seq_cnt = fchdr.seqcnt; - + g_hash_table_insert (fcseq_req_hash, req_key, cdata); } real_seqcnt = 0; @@ -1176,7 +1169,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean next_tvb = tvb_new_subset_remaining (tvb, next_offset); col_append_str (pinfo->cinfo, COL_INFO, " (Bogus Fragment)"); } else { - + frag_id = ((pinfo->oxid << 16) ^ seq_id) | is_exchg_resp ; /* We assume that all frames are of the same max size */ @@ -1185,15 +1178,15 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean real_seqcnt * fc_max_frame_size, frag_size, !is_lastframe_inseq); - + if (fcfrag_head) { next_tvb = tvb_new_child_real_data(tvb, fcfrag_head->data, fcfrag_head->datalen, fcfrag_head->datalen); - + /* Add the defragmented data to the data source list. */ add_new_data_source(pinfo, next_tvb, "Reassembled FC"); - + if (tree) { hidden_item = proto_tree_add_boolean (fc_tree, hf_fc_reassembled, tvb, offset+9, 1, 1); @@ -1229,7 +1222,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean void *saved_private_data; saved_private_data = pinfo->private_data; pinfo->private_data = &fchdr; - if (!dissector_try_port (fcftype_dissector_table, ftype, + if (!dissector_try_port (fcftype_dissector_table, ftype, next_tvb, pinfo, tree)) { call_dissector (data_handle, next_tvb, pinfo, tree); } @@ -1352,7 +1345,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { void proto_register_fc(void) -{ +{ /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { @@ -1567,7 +1560,7 @@ proto_register_fc(void) "This is the size of non-last frames in a " "multi-frame sequence", 10, &fc_max_frame_size); - + register_init_routine (fc_exchange_init_protocol); diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index 07f1cc395b..86d936fa8c 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -44,7 +44,7 @@ typedef struct _fix_field { int tag; /* FIX tag */ int hf_id; int type; /* */ - const void *table; + const void *table; } fix_field; typedef struct _fix_parameter { @@ -69,9 +69,9 @@ static gint ett_badfield = -1; static gint ett_checksum = -1; static int hf_fix_data = -1; /* continuation data */ -static int hf_fix_checksum_good = -1; -static int hf_fix_checksum_bad = -1; -static int hf_fix_field_value = -1; +static int hf_fix_checksum_good = -1; +static int hf_fix_checksum_bad = -1; +static int hf_fix_field_value = -1; static int hf_fix_field_tag = -1; static range_t *global_fix_tcp_range = NULL; @@ -79,7 +79,7 @@ static range_t *fix_tcp_range = NULL; /* 8=FIX */ #define MARKER_TAG "8=FIX" -#define MARKER_LEN 5 +#define MARKER_LEN 5 static int fix_marker(tvbuff_t *tvb, int offset) { return tvb_strneql(tvb, offset, MARKER_TAG, MARKER_LEN); @@ -88,7 +88,7 @@ static int fix_marker(tvbuff_t *tvb, int offset) /* * Fields and messages generated from http://www.quickfixengine.org/ xml (slightly modified) */ - + #include "packet-fix.h" static void dissect_fix_init(void) { @@ -120,8 +120,8 @@ static int fix_next_header(tvbuff_t *tvb, int offset) /* try to resynch to the next start */ guint min_len = tvb_length_remaining(tvb, offset); const guint8 *data = tvb_get_ephemeral_string(tvb, offset, min_len); - const guint8 *start = data; - + const guint8 *start = data; + while ((start = strstr(start, "\0018"))) { min_len = (guint) (start +1 -data); /* if remaining length < 6 return and let the next desegment round @@ -136,7 +136,7 @@ static int fix_next_header(tvbuff_t *tvb, int offset) return min_len; } -/* ---------------------------------------------- +/* ---------------------------------------------- Format: name=value\001 */ static fix_parameter *fix_param(tvbuff_t *tvb, int offset) @@ -168,9 +168,9 @@ static int fix_header_len(tvbuff_t *tvb, int offset) char *value; int size; fix_parameter *tag; - + base_offset = offset; - + /* get at least the fix version: 8=FIX.x.x */ if (fix_marker(tvb, offset) != 0) { return fix_next_header(tvb, offset); @@ -179,7 +179,7 @@ static int fix_header_len(tvbuff_t *tvb, int offset) /* begin string */ ctrla_offset = tvb_find_guint8(tvb, offset, -1, 0x01); if (ctrla_offset == -1) { - /* it should be there, (minimum size is big enough) + /* it should be there, (minimum size is big enough) * if not maybe it's not really * a FIX packet but it's too late to bail out. */ @@ -195,7 +195,7 @@ static int fix_header_len(tvbuff_t *tvb, int offset) value = tvb_get_ephemeral_string(tvb, tag->value_offset, tag->value_len); /* Fix version, msg type, length and checksum aren't in body length. - * If the packet is big enough find the checksum + * If the packet is big enough find the checksum */ size = atoi(value) +tag->ctrla_offset - base_offset +1; if (tvb_length_remaining(tvb, base_offset) > size +4) { @@ -273,7 +273,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_INFO)) { const char *msg_type; - + value = tvb_get_ephemeral_string(tvb, tag->value_offset, tag->value_len); msg_type = str_to_str(value, messages_val, "FIX Message (%s)"); col_add_str(pinfo->cinfo, COL_INFO, msg_type); @@ -286,7 +286,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) while(field_offset < pdu_len && (tag = fix_param(tvb, field_offset)) ) { int i, found; - + if (tag->tag_len < 1) { field_offset = tag->ctrla_offset + 1; continue; @@ -315,22 +315,22 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((i = tag_search(tag_value)) >= 0) { found = 1; } - + value = tvb_get_ephemeral_string(tvb, tag->value_offset, tag->value_len); if (found) { if (fix_fields[i].table) { if (tree) { switch (fix_fields[i].type) { case 1: /* strings */ - proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, + proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, "%s (%s)", value, str_to_str(value, fix_fields[i].table, "unknow %s")); break; case 2: /* char */ - proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, + proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, "%s (%s)", value, val_to_str(*value, fix_fields[i].table, "unknow %d")); break; default: - proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, + proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, "%s (%s)", value, val_to_str(atoi(value), fix_fields[i].table, "unknow %d")); break; } @@ -355,11 +355,11 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) check_sum = 1; sum_ok = (atoi(value) == sum); if (sum_ok) { - item = proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, + item = proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, "%s [correct]", value); } else { - item = proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, + item = proto_tree_add_string_format_value(fix_tree, fix_fields[i].hf_id, tvb, field_offset, tag->field_len, value, "%s [incorrect should be %d]", value, sum); } checksum_tree = proto_item_add_subtree(item, ett_checksum); @@ -379,7 +379,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if (tree) { proto_tree *field_tree; - + /* XXX - it could be -1 if the tag isn't a number */ ti = proto_tree_add_text(fix_tree, tvb, field_offset, tag->field_len, "%i: %s", tag_value, value); field_tree = proto_item_add_subtree(ti, ett_unknow); @@ -441,12 +441,9 @@ dissect_fix_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return FALSE; } - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); + conv = find_or_create_conversation(pinfo); + conversation_set_dissector(conv, fix_handle); - if (NULL == conv) { - conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - conversation_set_dissector(conv, fix_handle); - } dissect_fix_pdus(tvb, pinfo, tree); return TRUE; } @@ -460,12 +457,12 @@ static void range_add_fix_tcp_callback(guint32 port) { dissector_add("tcp.port", port, fix_handle); } -static void fix_prefs(void) +static void fix_prefs(void) { range_foreach(fix_tcp_range, range_delete_fix_tcp_callback); g_free(fix_tcp_range); fix_tcp_range = range_copy(global_fix_tcp_range); - range_foreach(fix_tcp_range, range_add_fix_tcp_callback); + range_foreach(fix_tcp_range, range_add_fix_tcp_callback); } /* this format is require because a script is used to build the C function @@ -481,11 +478,11 @@ proto_register_fix(void) { "Continuation Data", "fix.data", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL } }, - + { &hf_fix_field_tag, { "Field Tag", "fix.field.tag", FT_UINT16, BASE_DEC, NULL, 0x0, "Field length.", HFILL }}, - + { &hf_fix_field_value, { "Field Value", "fix.field.value", FT_STRING, BASE_NONE, NULL, 0x0, "Field value", HFILL }}, @@ -520,7 +517,7 @@ proto_register_fix(void) proto_register_field_array(proto_fix, hf, array_length(hf)); proto_register_field_array(proto_fix, hf_FIX, array_length(hf_FIX)); proto_register_subtree_array(ett, array_length(ett)); - + fix_module = prefs_register_protocol(proto_fix, fix_prefs); prefs_register_bool_preference(fix_module, "desegment", "Reassemble FIX messages spanning multiple TCP segments", diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 869eb36629..4858bd63e3 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -1414,7 +1414,7 @@ static void giop_init(void) { /* * Free giop_complete_request_list (if necessary) - * Note: The data elements are se_alloc'd so only the + * Note: The data elements are se_alloc'd so only the * actual list elements need to be freed. */ @@ -1756,7 +1756,7 @@ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, if (len == 0) return FALSE; - + { guint32 message_size; gboolean stream_is_big_endian = is_big_endian (header); @@ -3402,7 +3402,7 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, if(tree) { - proto_tree_add_item (request_tree, hf_giop_objekt_key, tvb, + proto_tree_add_item (request_tree, hf_giop_objekt_key, tvb, offset - objkey_len, objkey_len, FALSE); } } @@ -3417,7 +3417,7 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, { /* XXX: Get operation string, create a copy in ep memory and then g_free the string returned from get_CDR_string(). This is a hack so that - a lexically nested CLEANUP_PUSH & etc is not req'd below. + a lexically nested CLEANUP_PUSH & etc is not req'd below. [The nested CLEANUP_PUSH causes a gcc -Wshadow warning :( ] */ gchar *tmp; /* length of operation string and string */ @@ -3992,7 +3992,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree { case 2: case 1: - ti = proto_tree_add_bitmask(clnp_tree, giop_header_tvb, 6, + ti = proto_tree_add_bitmask(clnp_tree, giop_header_tvb, 6, hf_giop_message_flags, ett_giop_message_flags, giop_message_flags, FALSE); if ((header.flags & GIOP_MESSAGE_FLAGS_ENDIANNESS) == 0) @@ -4046,7 +4046,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree switch (header.message_type) { - + case Request: if(header.GIOP_version.minor < 2) { @@ -4058,10 +4058,10 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree dissect_giop_request_1_2 (payload_tvb, pinfo, tree, &header, stream_is_big_endian); } - + break; - - + + case Reply: if(header.GIOP_version.minor < 2) { @@ -4092,7 +4092,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree break; default: break; - + } /* switch message_type */ @@ -4186,13 +4186,8 @@ dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { */ if (!pinfo->fd->flags.visited) { - conversation = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* Set dissector */ conversation_set_dissector(conversation, giop_tcp_handle); } diff --git a/epan/dissectors/packet-gssapi.c b/epan/dissectors/packet-gssapi.c index c9d19863ae..e99b1f93ca 100644 --- a/epan/dissectors/packet-gssapi.c +++ b/epan/dissectors/packet-gssapi.c @@ -1,7 +1,7 @@ /* packet-gssapi.c * Dissector for GSS-API tokens as described in rfc2078, section 3.1 * Copyright 2002, Tim Potter <tpot@samba.org> - * Copyright 2002, Richard Sharpe <rsharpe@samba.org> Added a few + * Copyright 2002, Richard Sharpe <rsharpe@samba.org> Added a few * bits and pieces ... * * $Id$ @@ -75,7 +75,7 @@ typedef struct _gssapi_conv_info_t { gboolean do_reassembly; /* this field is used on first sequential scan of packets to help indicate when the next blob is a fragment continuing a previous one */ int first_frame; - int frag_offset; + int frag_offset; } gssapi_conv_info_t; typedef struct _gssapi_frag_info_t { @@ -210,16 +210,8 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* * We need a conversation for later */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if(!conversation){ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, - pinfo->ptype, - pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + gss_info = conversation_get_proto_data(conversation, proto_gssapi); if (!gss_info) { gss_info = se_alloc(sizeof(gssapi_conv_info_t)); @@ -283,7 +275,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Is this blob part of reassembly or a normal blob ? */ if( (pinfo->fd->flags.visited) - && (gssapi_reassembly) ){ + && (gssapi_reassembly) ){ fi=se_tree_lookup32(gss_info->frags, pinfo->fd->num); if(fi){ fd_head=fragment_get(pinfo, fi->first_frame, gssapi_fragment_table); @@ -309,7 +301,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (!(class == BER_CLASS_APP && pc && tag == 0)) { - /* It could be NTLMSSP, with no OID. This can happen + /* It could be NTLMSSP, with no OID. This can happen for anything that microsoft calls 'Negotiate' or GSS-SPNEGO */ if ((tvb_length_remaining(gss_tvb, start_offset)>7) && (tvb_strneql(gss_tvb, start_offset, "NTLMSSP", 7) == 0)) { return_offset = call_dissector(ntlmssp_handle, @@ -329,8 +321,8 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if ((tvb_length_remaining(gss_tvb, start_offset)==16) && ((tvb_memeql(gss_tvb, start_offset, "\x01\x00\x00\x00", 4) == 0))) { if( is_verifier ) { - return_offset = call_dissector(ntlmssp_verf_handle, - tvb_new_subset(gss_tvb, start_offset, -1, -1), + return_offset = call_dissector(ntlmssp_verf_handle, + tvb_new_subset(gss_tvb, start_offset, -1, -1), pinfo, subtree); } else if( pinfo->gssapi_encrypted_tvb ) { @@ -352,7 +344,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, goto done; } - /* + /* * If we do not recognise an Application class, * then we are probably dealing with an inner context * token or a wrap token, and we should retrieve the @@ -425,7 +417,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, && (oidvalue) && (tvb_length(gss_tvb)==tvb_reported_length(gss_tvb)) && (len1>(guint32)tvb_length_remaining(gss_tvb, oid_start_offset)) - && (gssapi_reassembly) ){ + && (gssapi_reassembly) ){ fi=se_alloc(sizeof(gssapi_frag_info_t)); fi->first_frame=pinfo->fd->num; fi->reassembled_in=0; @@ -462,7 +454,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ /* - * Now add the proto data ... + * Now add the proto data ... * but only if it is not already there. */ if(!gss_info->oid){ @@ -529,35 +521,35 @@ void proto_register_gssapi(void) { static hf_register_info hf[] = { - { &hf_gssapi_oid, + { &hf_gssapi_oid, { "OID", "gss-api.OID", FT_STRING, BASE_NONE, NULL, 0, "This is a GSS-API Object Identifier", HFILL }}, { &hf_gssapi_segment, - { "GSSAPI Segment", "gss-api.segment", FT_FRAMENUM, BASE_NONE, + { "GSSAPI Segment", "gss-api.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gssapi_segments, - { "GSSAPI Segments", "gss-api.segment.segments", FT_NONE, BASE_NONE, + { "GSSAPI Segments", "gss-api.segment.segments", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gssapi_segment_overlap, - { "Fragment overlap", "gss-api.segment.overlap", FT_BOOLEAN, BASE_NONE, + { "Fragment overlap", "gss-api.segment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment overlaps with other fragments", HFILL }}, { &hf_gssapi_segment_overlap_conflict, - { "Conflicting data in fragment overlap", "gss-api.segment.overlap.conflict", FT_BOOLEAN, BASE_NONE, + { "Conflicting data in fragment overlap", "gss-api.segment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Overlapping fragments contained conflicting data", HFILL }}, { &hf_gssapi_segment_multiple_tails, - { "Multiple tail fragments found", "gss-api.segment.multipletails", FT_BOOLEAN, BASE_NONE, + { "Multiple tail fragments found", "gss-api.segment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Several tails were found when defragmenting the packet", HFILL }}, { &hf_gssapi_segment_too_long_fragment, - { "Fragment too long", "gss-api.segment.toolongfragment", FT_BOOLEAN, BASE_NONE, + { "Fragment too long", "gss-api.segment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment contained data past end of packet", HFILL }}, { &hf_gssapi_segment_error, - { "Defragmentation error", "gss-api.segment.error", FT_FRAMENUM, BASE_NONE, + { "Defragmentation error", "gss-api.segment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "Defragmentation error due to illegal fragments", HFILL }}, { &hf_gssapi_reassembled_in, - { "Reassembled In", "gss-api.reassembled_in", FT_FRAMENUM, BASE_NONE, + { "Reassembled In", "gss-api.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The frame where this pdu is reassembled", HFILL }}, { &hf_gssapi_reassembled_length, - { "Reassembled GSSAPI length", "gss-api.reassembled.length", FT_UINT32, BASE_DEC, + { "Reassembled GSSAPI length", "gss-api.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0, "The total length of the reassembled payload", HFILL }}, }; @@ -587,8 +579,8 @@ proto_register_gssapi(void) register_init_routine(gssapi_reassembly_init); } -static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset, - packet_info *pinfo, +static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, guint8 *drep _U_) { tvbuff_t *auth_tvb; @@ -600,8 +592,8 @@ static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset, return tvb_length_remaining(tvb, offset); } -int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, - packet_info *pinfo, +int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, guint8 *drep _U_) { tvbuff_t *auth_tvb; @@ -612,16 +604,16 @@ int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, } tvbuff_t * -wrap_dissect_gssapi_payload(tvbuff_t *data_tvb, +wrap_dissect_gssapi_payload(tvbuff_t *data_tvb, tvbuff_t *auth_tvb, int offset _U_, - packet_info *pinfo, + packet_info *pinfo, dcerpc_auth_info *auth_info _U_) { tvbuff_t *result; /* we need a full auth and a full data tvb or else we cant - decrypt anything + decrypt anything */ if((!auth_tvb)||(!data_tvb)){ return NULL; diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 6e45ecbd71..2e85f4e64b 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -6323,15 +6323,8 @@ static void dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* * Do we have a conversation for this connection? */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already know this conversation? */ diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index e7c3257678..be0ac3cd86 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -536,11 +536,7 @@ get_http_conversation_data(packet_info *pinfo) conversation_t *conversation; http_conv_t *conv_data; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - - if(!conversation) { /* Conversation does not exist yet - create it */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* Retrieve information from conversation * or add it if it isn't there yet diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c index 5430c41228..072c5930c9 100644 --- a/epan/dissectors/packet-ifcp.c +++ b/epan/dissectors/packet-ifcp.c @@ -44,7 +44,7 @@ #include "packet-tcp.h" #define iFCP_ENCAP_HEADER_LEN 28 -#define iFCP_MIN_HEADER_LEN 16 /* upto frame len field */ +#define iFCP_MIN_HEADER_LEN 16 /* upto frame len field */ typedef enum { iFCP_EOFn = 0x41, @@ -103,9 +103,9 @@ static const value_string fcencap_proto_vals[] = { {0, NULL}, }; -/* RFC 4172 section 5.3.1 shows a chart of the iFCP encapsulated Header Format. - * It says that bytes 4-7 MUST be zeros. In reality most vendors are putting - * some information in these 4 bytes, particularly Nishon. +/* RFC 4172 section 5.3.1 shows a chart of the iFCP encapsulated Header Format. + * It says that bytes 4-7 MUST be zeros. In reality most vendors are putting + * some information in these 4 bytes, particularly Nishon. */ static const guint8 ifcp_header_4_bytes[4] = { 0x02, 0x01, 0xFD, 0xFE @@ -179,7 +179,7 @@ ifcp_header_test(tvbuff_t *tvb, int offset) * * As per the iFCP standard, in addition, at least 3 of the following * set of tests must be performed to identify that we've located the - * start of an iFCP frame. + * start of an iFCP frame. * a) Protocol# ones complement field (1 test); * b) Version ones complement field (1 test); * c) Replication of encapsulation word 0 in word 1 (1 test); @@ -322,11 +322,11 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree *tree = NULL; tvbuff_t *next_tvb; guint8 protocol; - proto_tree *protocol_tree=NULL; - proto_tree *version_tree=NULL; - proto_tree *frame_len_tree=NULL; - proto_tree *sof_tree=NULL; - proto_tree *eof_tree=NULL; + proto_tree *protocol_tree=NULL; + proto_tree *version_tree=NULL; + proto_tree *frame_len_tree=NULL; + proto_tree *sof_tree=NULL; + proto_tree *eof_tree=NULL; /* verify we have a full header (do we need to do this? */ if(tvb_length(tvb)<iFCP_ENCAP_HEADER_LEN){ @@ -352,7 +352,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) "0x%x")); } else { sof = tvb_get_guint8 (tvb, offset+iFCP_ENCAP_HEADER_LEN); - + ti = proto_tree_add_protocol_format (parent_tree, proto_ifcp, tvb, offset, iFCP_ENCAP_HEADER_LEN, "iFCP (%s/%s)", @@ -489,7 +489,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } - + next_tvb=tvb_new_subset(tvb, offset, frame_len-offset-4, frame_len-offset-4); if(fc_handle){ @@ -505,7 +505,7 @@ static guint get_ifcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { guint pdu_len; - + if(!ifcp_header_test(tvb, offset)){ return 0; } @@ -548,12 +548,7 @@ dissect_ifcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(ifcp_handle){ conversation_t* ifcp_conv; - ifcp_conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if(!ifcp_conv){ - ifcp_conv=conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + ifcp_conv=find_or_create_conversation(pinfo); /* XXX why does this not work? it doesnt result in dissect_ifcp_handle being called look into later*/ conversation_set_dissector(ifcp_conv, ifcp_handle); } @@ -611,17 +606,17 @@ proto_register_ifcp (void) { &hf_ifcp_ls_command_acc, {"Ls Command Acc", "ifcp.ls_command_acc", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, - { &hf_ifcp_common_flags, + { &hf_ifcp_common_flags, {"Flags", "ifcp.common_flags", FT_UINT8, BASE_HEX , NULL, 0xfc, NULL, HFILL }}, - { &hf_ifcp_common_flags_crcv, + { &hf_ifcp_common_flags_crcv, {"CRCV", "ifcp.common_flags.crcv", FT_BOOLEAN, 8, TFS(&ifcp_common_flags_crcv_tfs), IFCP_COMMON_FLAGS_CRCV, "Is the CRC field valid?", HFILL }}, - { &hf_ifcp_flags, + { &hf_ifcp_flags, {"iFCP Flags", "ifcp.flags", FT_UINT8, BASE_HEX , NULL, 0, NULL, HFILL }}, - { &hf_ifcp_flags_ses, + { &hf_ifcp_flags_ses, {"SES", "ifcp.flags.ses", FT_BOOLEAN, 8, TFS(&ifcp_flags_ses_tfs), IFCP_FLAGS_SES, "Is this a Session control frame", HFILL }}, - { &hf_ifcp_flags_trp, + { &hf_ifcp_flags_trp, {"TRP", "ifcp.flags.trp", FT_BOOLEAN, 8, TFS(&ifcp_flags_trp_tfs), IFCP_FLAGS_TRP, "Is address transparent mode enabled", HFILL }}, - { &hf_ifcp_flags_spc, + { &hf_ifcp_flags_spc, {"SPC", "ifcp.flags.spc", FT_BOOLEAN, 8, TFS(&ifcp_flags_spc_tfs), IFCP_FLAGS_SPC, "Is frame part of link service", HFILL }}, }; @@ -635,7 +630,7 @@ proto_register_ifcp (void) &ett_ifcp_flags, &ett_ifcp_common_flags, }; - + module_t *ifcp_module; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-ipmi.c b/epan/dissectors/packet-ipmi.c index 5e02b9056d..08767b3628 100644 --- a/epan/dissectors/packet-ipmi.c +++ b/epan/dissectors/packet-ipmi.c @@ -61,7 +61,7 @@ struct ipmi_netfn_root { #define NSAVED_DATA 2 -/* We need more than a conversation. Over the same RMCP session +/* We need more than a conversation. Over the same RMCP session (or IPMB), there may be several addresses/SWIDs. Thus, in a single Wireshark-maintained conversation we might need to find our own... */ struct ipmi_saved_data { @@ -123,9 +123,9 @@ static guint selected_oem = IPMI_OEM_NONE; static gint hf_ipmi_message = -1; static gint hf_ipmi_session_handle = -1; static gint hf_ipmi_header_broadcast = -1; -static gint hf_ipmi_header_trg = -1; +static gint hf_ipmi_header_trg = -1; static gint hf_ipmi_header_trg_lun = -1; -static gint hf_ipmi_header_netfn = -1; +static gint hf_ipmi_header_netfn = -1; static gint hf_ipmi_header_crc = -1; static gint hf_ipmi_header_src = -1; static gint hf_ipmi_header_src_lun = -1; @@ -351,14 +351,7 @@ maybe_insert_reqresp(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr) struct ipmi_reqresp *rr; guint32 key, i; - cnv = find_conversation(current_pinfo->fd->num, ¤t_pinfo->src, - ¤t_pinfo->dst, current_pinfo->ptype, - current_pinfo->srcport, current_pinfo->destport, 0); - if (!cnv) { - cnv = conversation_new(current_pinfo->fd->num, ¤t_pinfo->src, - ¤t_pinfo->dst, current_pinfo->ptype, - current_pinfo->srcport, current_pinfo->destport, 0); - } + cnv = find_or_create_conversation(current_pinfo); kt = conversation_get_proto_data(cnv, proto_ipmi); if (!kt) { @@ -880,7 +873,7 @@ ipmi_getnetfn(guint32 netfn, const guint8 *sig) inr = &ipmi_cmd_tab[netfn >> 1]; for (inh = inr->list; inh; inh = inh->next) { - if ((inh->oem_selector == selected_oem || inh->oem_selector == IPMI_OEM_NONE) + if ((inh->oem_selector == selected_oem || inh->oem_selector == IPMI_OEM_NONE) && (!inr->siglen || !memcmp(sig, inh->sig, inr->siglen))) { return inh; } @@ -1196,7 +1189,7 @@ ipmi_do_dissect(tvbuff_t *tvb, proto_tree *ipmi_tree, ipmi_dissect_format_t *dfm bcast = " (BROADCAST)"; } - + /* Save globals - we may be called recursively */ saved_hdr = ipmi_current_hdr; ipmi_current_hdr = &hdr; @@ -1259,7 +1252,7 @@ ipmi_do_dissect(tvbuff_t *tvb, proto_tree *ipmi_tree, ipmi_dissect_format_t *dfm "Target LUN: 0x%02x, NetFN: %s %s (0x%02x)", hdr.trg_lun, ndesc, is_resp ? "Response" : "Request", hdr.netfn); s_tree = proto_item_add_subtree(ti, ett_header_byte_1); - + proto_tree_add_item(s_tree, hf_ipmi_header_trg_lun, tvb, offs, 1, TRUE); proto_tree_add_uint_format(s_tree, hf_ipmi_header_netfn, tvb, offs, 1, hdr.netfn << 2, "%sNetFn: %s %s (0x%02x)", @@ -1328,7 +1321,7 @@ ipmi_do_dissect(tvbuff_t *tvb, proto_tree *ipmi_tree, ipmi_dissect_format_t *dfm data_exp_crc += tvb_get_guint8(tvb, i); } data_exp_crc = (0 - data_exp_crc) & 0xff; - + if (data_crc == data_exp_crc) { proto_tree_add_uint_format(ipmi_tree, hf_ipmi_data_crc, tvb, len, 1, data_crc, "Data checksum: 0x%02x (correct)", data_crc); diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 11be3d89a3..6357dd20e6 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -2321,14 +2321,8 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec } /* make sure we have a conversation for this session */ - conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (!conversation) { - conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + iscsi_session=conversation_get_proto_data(conversation, proto_iscsi); if(!iscsi_session){ iscsi_session=se_alloc(sizeof(iscsi_session_t)); diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index 7240a73028..0afdad6a9a 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -346,15 +346,7 @@ is_mpa_req(tvbuff_t *tvb, packet_info *pinfo) || tvb_get_ntoh64(tvb, 8) != MPA_ID_REQ_FRAME) return FALSE; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - - if (!conversation) { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if (!get_mpa_state(conversation)) { diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index ac3b2b9df5..0459532a27 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -407,16 +407,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr guint available; gint needed = 0; - conversation_t *conversation = - find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) { - /* - * No conversation exists yet - create one. - */ - conversation = - conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation_t *conversation = find_or_create_conversation(pinfo); DISSECTOR_ASSERT(find_dissector("jxta.udp")); diff --git a/epan/dissectors/packet-kingfisher.c b/epan/dissectors/packet-kingfisher.c index 83c4322e19..762e250600 100644 --- a/epan/dissectors/packet-kingfisher.c +++ b/epan/dissectors/packet-kingfisher.c @@ -197,9 +197,9 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean */ if(is_conv_dissector && (tvb_reported_length(tvb)==1)){ /* - Perform a check to see if the message is a single byte acknowledgement - message - Note that in this instance there is no information in the packet - with regard to source or destination RTU address which can be used in the + Perform a check to see if the message is a single byte acknowledgement + message - Note that in this instance there is no information in the packet + with regard to source or destination RTU address which can be used in the population of dissector fields. */ switch(tvb_get_guint8(tvb, 0)){ @@ -334,20 +334,8 @@ dissect_kingfisher_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissector for this tcp/udp socket and attach a conversation dissector to it. */ - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + conversation_set_dissector(conversation, kingfisher_conv_handle); } @@ -376,7 +364,7 @@ proto_register_kingfisher( void ) { &hf_kingfisher_checksum, { "Checksum", "kingfisher.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, }; - static gint *ett[] = { + static gint *ett[] = { &ett_kingfisher }; diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c index 374f6988dd..3410e63f89 100644 --- a/epan/dissectors/packet-mp2t.c +++ b/epan/dissectors/packet-mp2t.c @@ -53,7 +53,7 @@ static gint ett_mp2t = -1; static gint ett_mp2t_header = -1; static gint ett_mp2t_af = -1; static gint ett_mp2t_analysis = -1; -static gint ett_dmpt = -1; +static gint ett_dmpt = -1; static int hf_mp2t_header = -1; static int hf_mp2t_sync_byte = -1; @@ -131,7 +131,7 @@ static int hf_mp2t_af_e_pr_flag = -1; static int hf_mp2t_af_e_ss_flag = -1; static int hf_mp2t_af_e_reserved = -1; -#define MP2T_AF_E_LTW_FLAG_MASK 0x80 +#define MP2T_AF_E_LTW_FLAG_MASK 0x80 #define MP2T_AF_E_PR_FLAG_MASK 0x40 #define MP2T_AF_E_SS_FLAG_MASK 0x20 @@ -527,23 +527,6 @@ typedef struct frame_analysis_data { } frame_analysis_data_t; -static conversation_t * -get_the_conversation(packet_info *pinfo) -{ - conversation_t *conv = NULL; - - conv = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conv == NULL) { /* Create a new conversation */ - conv = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } - return conv; -} - static mp2t_analysis_data_t * init_mp2t_conversation_data(void) { @@ -831,10 +814,10 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, afc = (header & MP2T_AFC_MASK) >> MP2T_AFC_SHIFT; - if (afc == 2 || afc == 3) + if (afc == 2 || afc == 3) { gint af_start_offset = offset; - + guint8 af_length; guint8 af_flags; gint stuffing_len; @@ -844,17 +827,17 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, proto_tree_add_item( mp2t_tree, hf_mp2t_af_length, tvb, offset, 1, FALSE); offset += 1; - /* fix issues where afc==3 but af_length==0 - * Adaptaion field...spec section 2.4.3.5: The value 0 is for inserting a single - * stuffing byte in a Transport Stream packet. When the adaptation_field_control + /* fix issues where afc==3 but af_length==0 + * Adaptaion field...spec section 2.4.3.5: The value 0 is for inserting a single + * stuffing byte in a Transport Stream packet. When the adaptation_field_control * value is '11', the value of the adaptation_field_length shall be in the range 0 to 182. */ if (af_length > 0 ) { hi = proto_tree_add_item( mp2t_tree, hf_mp2t_af, tvb, offset, af_length, FALSE); mp2t_af_tree = proto_item_add_subtree( hi, ett_mp2t_af ); - + af_flags = tvb_get_guint8(tvb, offset); - + proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_di, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_rai, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_espi, tvb, offset, 1, FALSE); @@ -863,9 +846,9 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_sp_flag, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_tpd_flag, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_afe_flag, tvb, offset, 1, FALSE); - + offset += 1; - + if (af_flags & MP2T_AF_PCR_MASK) { guint64 pcr_base = 0; guint32 pcr_ext = 0; @@ -874,15 +857,15 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, tmp = tvb_get_guint8(tvb, offset); pcr_base = (pcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); pcr_base = (pcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); pcr_base = (pcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); pcr_base = (pcr_base << 8) | tmp; offset += 1; @@ -896,8 +879,8 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, pcr_ext = (pcr_ext << 8) | tmp; offset += 1; - proto_tree_add_none_format(mp2t_af_tree, hf_mp2t_af_pcr, tvb, offset - 6, 6, - "Program Clock Reference: base(%" G_GINT64_MODIFIER "u) * 300 + ext(%u) = %" G_GINT64_MODIFIER "u", + proto_tree_add_none_format(mp2t_af_tree, hf_mp2t_af_pcr, tvb, offset - 6, 6, + "Program Clock Reference: base(%" G_GINT64_MODIFIER "u) * 300 + ext(%u) = %" G_GINT64_MODIFIER "u", pcr_base, pcr_ext, pcr_base * 300 + pcr_ext); } @@ -909,15 +892,15 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, tmp = tvb_get_guint8(tvb, offset); opcr_base = (opcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); opcr_base = (opcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); opcr_base = (opcr_base << 8) | tmp; offset += 1; - + tmp = tvb_get_guint8(tvb, offset); opcr_base = (opcr_base << 8) | tmp; offset += 1; @@ -931,13 +914,13 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, opcr_ext = (opcr_ext << 8) | tmp; offset += 1; - proto_tree_add_none_format(mp2t_af_tree, hf_mp2t_af_opcr, tvb, offset - 6, 6, - "Original Program Clock Reference: base(%" G_GINT64_MODIFIER "u) * 300 + ext(%u) = %" G_GINT64_MODIFIER "u", + proto_tree_add_none_format(mp2t_af_tree, hf_mp2t_af_opcr, tvb, offset - 6, 6, + "Original Program Clock Reference: base(%" G_GINT64_MODIFIER "u) * 300 + ext(%u) = %" G_GINT64_MODIFIER "u", opcr_base, opcr_ext, opcr_base * 300 + opcr_ext); - + offset += 6; } - + if (af_flags & MP2T_AF_SP_MASK) { proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_sc, tvb, offset, 1, FALSE); offset += 1; @@ -945,7 +928,7 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, if (af_flags & MP2T_AF_TPD_MASK) { guint8 tpd_len; - + tpd_len = tvb_get_guint8(tvb, offset); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_tpd_length, tvb, offset, 1, FALSE); offset += 1; @@ -968,9 +951,9 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo, proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_ltw_flag, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_pr_flag, tvb, offset, 1, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_ss_flag, tvb, offset, 1, FALSE); - proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_reserved, tvb, offset, 1, FALSE); + proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_reserved, tvb, offset, 1, FALSE); offset += 1; - + if (e_flags & MP2T_AF_E_LTW_FLAG_MASK) { proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_ltwv_flag, tvb, offset, 2, FALSE); proto_tree_add_item( mp2t_af_tree, hf_mp2t_af_e_ltwo, tvb, offset, 2, FALSE); @@ -1060,7 +1043,7 @@ dissect_mp2t( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) { guint offset = 0; conversation_t *conv; - conv = get_the_conversation(pinfo); + conv = find_or_create_conversation(pinfo); while ( tvb_reported_length_remaining(tvb, offset) >= MP2T_PACKET_SIZE ) { offset = dissect_tsp(tvb, offset, pinfo, tree, conv); @@ -1089,7 +1072,7 @@ heur_dissect_mp2t( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) void proto_register_mp2t(void) { - static hf_register_info hf[] = { + static hf_register_info hf[] = { { &hf_mp2t_header, { "Header", "mp2t.header", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL @@ -1098,7 +1081,7 @@ proto_register_mp2t(void) "Sync Byte", "mp2t.sync_byte", FT_UINT32, BASE_HEX, VALS(mp2t_sync_byte_vals), MP2T_SYNC_BYTE_MASK, NULL, HFILL } } , - { &hf_mp2t_tei, { + { &hf_mp2t_tei, { "Transport Error Indicator", "mp2t.tei", FT_UINT32, BASE_DEC, NULL, MP2T_TEI_MASK, NULL, HFILL } } , @@ -1324,7 +1307,7 @@ proto_register_mp2t(void) FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } } }; - + static gint *ett[] = { &ett_mp2t, diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c index d567220896..5ee897d216 100644 --- a/epan/dissectors/packet-mq.c +++ b/epan/dissectors/packet-mq.c @@ -2429,12 +2429,9 @@ dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto && (cEndian == MQ_LITTLE_ENDIAN || cEndian == MQ_BIG_ENDIAN)) { /* Register this dissector for this conversation */ - conversation_t *conversation = NULL; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation_t *conversation; + + conversation = find_or_create_conversation(pinfo); if (iProto == MQ_XPT_TCP) conversation_set_dissector(conversation, mq_tcp_handle); /* Dissect the packet */ diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index 0b4d4cfd65..676a97e469 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -1086,13 +1086,8 @@ static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSproxy"); col_clear(pinfo->cinfo, COL_INFO); - conversation = find_conversation( pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); + conversation = find_or_create_conversation(pinfo); - if ( !conversation) { - conversation = conversation_new( pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } hash_info = conversation_get_proto_data(conversation, proto_msproxy); if ( !hash_info) { hash_info = se_alloc(sizeof(hash_entry_t)); diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index e5d9c1e5bc..49fcf0e4c7 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -1144,15 +1144,7 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) struct mysql_frame_data *mysql_frame_data_p; /* get conversation, create if neccessary*/ - conversation= find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - - if (!conversation) { - conversation= conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation= find_or_create_conversation(pinfo); /* get associated state information, create if neccessary */ conn_data= conversation_get_proto_data(conversation, proto_mysql); diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c index 121feb9f5c..4f83f16287 100644 --- a/epan/dissectors/packet-nbd.c +++ b/epan/dissectors/packet-nbd.c @@ -111,9 +111,9 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) /* * Do we have a conversation for this connection? */ - conversation = find_conversation(pinfo->fd->num, + conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, + pinfo->ptype, pinfo->srcport, pinfo->destport, 0); if (conversation == NULL) { /* No, so just return the rest of the current packet */ @@ -160,7 +160,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) } } /* If this is a read response we must add the datalen to - * the pdu size + * the pdu size */ if(nbd_trans->type==NBD_CMD_READ){ return 16+nbd_trans->datalen; @@ -213,20 +213,8 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) return; } - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ @@ -331,7 +319,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) it=proto_tree_add_time(tree, hf_nbd_time, tvb, 0, 0, &ns); PROTO_ITEM_SET_GENERATED(it); } - } + } switch(magic){ @@ -440,35 +428,35 @@ void proto_register_nbd(void) { static hf_register_info hf[] = { { &hf_nbd_magic, - { "Magic", "nbd.magic", FT_UINT32, BASE_HEX, + { "Magic", "nbd.magic", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_nbd_type, - { "Type", "nbd.type", FT_UINT32, BASE_DEC, + { "Type", "nbd.type", FT_UINT32, BASE_DEC, VALS(nbd_type_vals), 0x0, NULL, HFILL }}, { &hf_nbd_error, - { "Error", "nbd.error", FT_UINT32, BASE_DEC, + { "Error", "nbd.error", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_nbd_len, - { "Length", "nbd.len", FT_UINT32, BASE_DEC, + { "Length", "nbd.len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_nbd_handle, - { "Handle", "nbd.handle", FT_UINT64, BASE_HEX, + { "Handle", "nbd.handle", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_nbd_from, - { "From", "nbd.from", FT_UINT64, BASE_HEX, + { "From", "nbd.from", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_nbd_response_in, - { "Response In", "nbd.response_in", FT_FRAMENUM, BASE_NONE, + { "Response In", "nbd.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this NBD request is in this frame", HFILL }}, { &hf_nbd_response_to, - { "Request In", "nbd.response_to", FT_FRAMENUM, BASE_NONE, + { "Request In", "nbd.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the NBD request in this frame", HFILL }}, { &hf_nbd_time, - { "Time", "nbd.time", FT_RELATIVE_TIME, BASE_NONE, + { "Time", "nbd.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Call and the Reply", HFILL }}, { &hf_nbd_data, - { "Data", "nbd.data", FT_BYTES, BASE_NONE, + { "Data", "nbd.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index b466aa8e6e..8eb6dceae0 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -395,7 +395,7 @@ static const value_string msg_type_vals[] = { #define NDMP_XDR_ENCODE_ERR 0x15 #define NDMP_NO_MEM_ERR 0x16 #define NDMP_CONNECT_ERR 0x17 -#define NDMP_SEQUENCE_NUM_ERR 0x18 +#define NDMP_SEQUENCE_NUM_ERR 0x18 #define NDMP_READ_IN_PROGRESS_ERR 0x19 #define NDMP_PRECONDITION_ERR 0x1a #define NDMP_CLASS_NOT_SUPPORTED_ERR 0x1b @@ -429,7 +429,7 @@ static const value_string error_vals[] = { {NDMP_NO_MEM_ERR, "NO_MEM_ERR"}, {NDMP_CONNECT_ERR, "CONNECT_ERR"}, {NDMP_SEQUENCE_NUM_ERR, "NDMP_SEQUENCE_NUM_ERR"}, - {NDMP_READ_IN_PROGRESS_ERR, "NDMP_READ_IN_PROGRESS_ERR"}, + {NDMP_READ_IN_PROGRESS_ERR, "NDMP_READ_IN_PROGRESS_ERR"}, {NDMP_PRECONDITION_ERR, "NDMP_PRECONDITION_ERR"}, {NDMP_CLASS_NOT_SUPPORTED_ERR, "NDMP_CLASS_NOT_SUPPORTED_ERR"}, {NDMP_VERSION_NOT_SUPPORTED_ERR,"NDMP_VERSION_NOT_SUPPORTED_ERR"}, @@ -1262,7 +1262,7 @@ dissect_class_version(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, return offset; } -static int +static int dissect_set_ext_list_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint32 seq _U_) { @@ -1274,7 +1274,7 @@ dissect_set_ext_list_request(tvbuff_t *tvb, int offset, packet_info *pinfo, } -static int +static int dissect_set_ext_list_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint32 seq _U_) { @@ -3107,7 +3107,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) emem_tree_t *frags; conversation_t *conversation; proto_item *vers_item; - gboolean save_fragmented, save_writable; + gboolean save_fragmented, save_writable; gboolean do_frag = TRUE; tvbuff_t* new_tvb = NULL; fragment_data *frag_msg = NULL; @@ -3118,12 +3118,8 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * We need to keep track of conversations so that we can track NDMP * versions. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + ndmp_conv_data=conversation_get_proto_data(conversation, proto_ndmp); if(!ndmp_conv_data){ ndmp_conv_data=se_alloc(sizeof(ndmp_conv_data_t)); @@ -3160,7 +3156,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (ndmp_defragment && ndmp_desegment) { - /* + /* * Determine the direction of the flow, so we can use the correct fragment tree */ direction=CMP_ADDRESS(&pinfo->src, &pinfo->dst); @@ -3184,9 +3180,9 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len = (ndmp_rm & RPC_RM_FRAGLEN) + 4; nxt = seq + len; - /* + /* * In case there are multiple PDUs in the same frame, advance the tcp seq - * so that they can be distinguished from one another + * so that they can be distinguished from one another */ tcpinfo->seq = nxt; @@ -3198,7 +3194,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * If nfi doesn't exist, then there are no fragments before this one. - * If there are fragments after this one, create the entry in the frag + * If there are fragments after this one, create the entry in the frag * tree so the next fragment can find it. * If we've already seen this frame, no need to create the entry again. */ @@ -3212,10 +3208,10 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) se_tree_insert32(frags, nxt, (void *)nfi); } } - /* + /* * If this is both the first and the last fragment, then there * is no reason to even engage the reassembly routines. Just - * create the new_tvb directly from tvb. + * create the new_tvb directly from tvb. */ else { @@ -3225,7 +3221,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { - /* + /* * An entry was found, so we know the offset of this fragment */ frag_num = nfi->offset; @@ -3246,7 +3242,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } - + /* If fragmentation is neccessary */ if (do_frag) { @@ -3271,14 +3267,14 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Update the column info. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDMP"); - + if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); col_append_fstr(pinfo->cinfo, COL_INFO, "[NDMP fragment] "); } - /* - * Add the record marker information to the tree + /* + * Add the record marker information to the tree */ if (tree) { ndmp_item = proto_tree_add_item(tree, proto_ndmp, tvb, 0, -1, FALSE); @@ -3292,8 +3288,8 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(hdr_tree, hf_ndmp_lastfrag, tvb, 0, 4, ndmp_rm); proto_tree_add_uint(hdr_tree, hf_ndmp_fraglen, tvb, 0, 4, ndmp_rm); - /* - * Decode the remaining bytes as generic NDMP fragment data + /* + * Decode the remaining bytes as generic NDMP fragment data */ nbytes = tvb_reported_length_remaining(tvb, 4); proto_tree_add_text(ndmp_tree, tvb, 4, nbytes, "NDMP fragment data (%u byte%s)", nbytes, plurality(nbytes, "", "s")); @@ -3316,9 +3312,9 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; } - /* + /* * If it doesn't look like a valid NDMP header at this point, there is - * no reason to move forward + * no reason to move forward */ if (!check_ndmp_hdr(new_tvb)) { @@ -3335,7 +3331,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* When the last fragment is small and the final frame contains * multiple fragments, the column becomes unwritable. - * Temporarily change that so that the correct header can be + * Temporarily change that so that the correct header can be * applied */ save_writable = col_get_writable(pinfo->cinfo); col_set_writable(pinfo->cinfo, TRUE); @@ -3495,7 +3491,7 @@ check_if_ndmp(tvbuff_t *tvb, packet_info *pinfo) return TRUE; } -/* Called because the frame has been identified as part of a conversation +/* Called because the frame has been identified as part of a conversation * assigned to the NDMP protocol. * At this point we may have either an NDMP PDU or an NDMP PDU fragment. */ @@ -3503,7 +3499,7 @@ static int dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* If we are doing defragmentation, don't check more than the record mark here, - * because if this is a continuation of a fragmented NDMP PDU there won't be a + * because if this is a continuation of a fragmented NDMP PDU there won't be a * NDMP header after the RM */ if(ndmp_defragment && !check_ndmp_rm(tvb, pinfo)) { return 0; @@ -3520,10 +3516,10 @@ dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return tvb_length(tvb); } -/* Called when doing a heuristic check; +/* Called when doing a heuristic check; * Accept as NDMP only if the full header seems reasonable. * Note that once the first PDU (or PDU fragment) has been found - * dissect_ndmp_message will register a dissect_ndmp NDMP handle + * dissect_ndmp_message will register a dissect_ndmp NDMP handle * as the protocol dissector for this conversation. */ static int @@ -3539,7 +3535,7 @@ dissect_ndmp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } static void -ndmp_init(void) +ndmp_init(void) { fragment_table_init(&ndmp_fragment_table); reassembled_table_init(&ndmp_reassembled_table); @@ -4247,7 +4243,7 @@ proto_register_ndmp(void) "Class Version", "ndmp.class.version", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, {&hf_ndmp_fragments, { - "NDMP fragments", "ndmp.fragments", FT_NONE, BASE_NONE, + "NDMP fragments", "ndmp.fragments", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_ndmp_fragment, {"NDMP fragment", "ndmp.fragment", diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index bde4531bd5..7f846df44f 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -437,7 +437,7 @@ get_keyexchange_key(unsigned char keyexchangekey[NTLMSSP_KEY_LEN],const unsigned static guint32 get_md4pass_list(md4_pass** p_pass_list,const char* nt_password) { - + guint32 nb_pass = 0; enc_key_t *ek; unsigned char nt_password_hash[NTLMSSP_KEY_LEN]; @@ -1438,13 +1438,8 @@ dissect_ntlmssp_challenge (tvbuff_t *tvb, packet_info *pinfo, int offset, * Store the flags and the RC4 state information with the conversation, * as they're needed in order to dissect subsequent messages. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (!conversation) { /* Create one */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + tvb_memcpy(tvb, tmp, offset, 8); /* We can face more than one NTLM exchange over the same couple of IP and ports ...*/ conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp); diff --git a/epan/dissectors/packet-pana.c b/epan/dissectors/packet-pana.c index a0bfc5fc20..dd2857cae0 100644 --- a/epan/dissectors/packet-pana.c +++ b/epan/dissectors/packet-pana.c @@ -551,20 +551,8 @@ dissect_pana_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * We need to track some state for this protocol on a per conversation * basis so we can do neat things like request/response tracking */ - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c index 82bf3fb3be..34b1007cb3 100644 --- a/epan/dissectors/packet-pgsql.c +++ b/epan/dissectors/packet-pgsql.c @@ -170,12 +170,7 @@ dissect_pgsql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) first_message = TRUE; /* We don't use conversation data yet, but... */ - cv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!cv) { - cv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + cv = find_or_create_conversation(pinfo); col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGSQL"); if (check_col(pinfo->cinfo, COL_INFO)) diff --git a/epan/dissectors/packet-pop.c b/epan/dissectors/packet-pop.c index 117eeafe6e..d2027af9e5 100644 --- a/epan/dissectors/packet-pop.c +++ b/epan/dissectors/packet-pop.c @@ -160,16 +160,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!frame_data_p) { - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) { /* No conversation, create one */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); data_val = conversation_get_proto_data(conversation, proto_pop); @@ -179,7 +170,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * No - create one and attach it. */ data_val = se_alloc0(sizeof(struct pop_data_val)); - + conversation_add_proto_data(conversation, proto_pop, data_val); } } @@ -193,7 +184,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (is_continuation) { length_remaining = tvb_length_remaining(tvb, offset); - col_add_fstr(pinfo->cinfo, COL_INFO, "S: DATA fragment, %d byte%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "S: DATA fragment, %d byte%s", length_remaining, plurality (length_remaining, "", "s")); } else @@ -217,19 +208,19 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) frame_data_p->conversation_id = conversation->index; frame_data_p->more_frags = data_val->msg_read_len < data_val->msg_tot_len; - p_add_proto_data(pinfo->fd, proto_pop, frame_data_p); + p_add_proto_data(pinfo->fd, proto_pop, frame_data_p); } - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, - frame_data_p->conversation_id, - pop_data_segment_table, - pop_data_reassembled_table, - tvb_length(tvb), + frag_msg = fragment_add_seq_next(tvb, 0, pinfo, + frame_data_p->conversation_id, + pop_data_segment_table, + pop_data_reassembled_table, + tvb_length(tvb), frame_data_p->more_frags); - next_tvb = process_reassembled_data(tvb, offset, pinfo, + next_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled DATA", - frag_msg, &pop_data_frag_items, + frag_msg, &pop_data_frag_items, NULL, pop_tree); if (next_tvb) { @@ -239,9 +230,9 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (data_val) { /* we have read everything - reset */ - + data_val->msg_read_len = 0; - data_val->msg_tot_len = 0; + data_val->msg_tot_len = 0; } pinfo->fragmented = FALSE; } else { @@ -254,7 +245,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Put the whole packet into the tree as data. */ call_dissector(data_handle,tvb, pinfo, pop_tree); - + } return; } @@ -310,7 +301,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } - if (tree) { + if (tree) { /* * Add the rest of the first line as request or * reply param/description. @@ -347,7 +338,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_format_text(tvb, offset, next_offset - offset)); offset = next_offset; } - } + } } static gboolean response_is_continuation(const guchar *data) diff --git a/epan/dissectors/packet-rlogin.c b/epan/dissectors/packet-rlogin.c index d416e91835..f110389f5c 100644 --- a/epan/dissectors/packet-rlogin.c +++ b/epan/dissectors/packet-rlogin.c @@ -1,6 +1,6 @@ /* packet-rlogin.c * Routines for unix rlogin packet dissection - * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> + * Copyright 2000, Jeffrey C. Foster <jfoste[AT]woodward.com> * * $Id$ * @@ -115,7 +115,7 @@ rlogin_state_machine(rlogin_hash_entry_t *hash_info, tvbuff_t *tvb, packet_info { return; } - + /* exit if already passed username in conversation */ if (hash_info->state == DONE) { @@ -138,7 +138,7 @@ rlogin_state_machine(rlogin_hash_entry_t *hash_info, tvbuff_t *tvb, packet_info hash_info->state = DONE; return; } - else + else { if (length <= 1) { @@ -264,7 +264,7 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, gint slash_offset; /* First frame of conversation, assume user info... */ - + info_len = tvb_length_remaining(tvb, offset); /* User info tree */ @@ -295,7 +295,7 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, proto_tree_add_item(user_info_tree, hf_user_info_terminal_type, tvb, offset, slash_offset-offset, FALSE); offset = slash_offset + 1; - + /* Terminal speed */ str_len = tvb_strsize(tvb, offset); proto_tree_add_uint(user_info_tree, hf_user_info_terminal_speed, @@ -321,7 +321,7 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, tvb_get_guint8(tvb, ti_offset + 1) == 0xff) { guint16 rows, columns; - + /* Have found terminal info. */ if (ti_offset > offset) { @@ -364,7 +364,7 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, proto_tree_add_item(window_tree, hf_window_info_y_pixels, tvb, offset, 2, FALSE); offset += 2; - + /* Show setting highlights in info column */ if (check_col(pinfo->cinfo, COL_INFO)) { @@ -393,18 +393,8 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint length; gint ti_offset; - /* Get conversation */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, - 0); - - /* Create if didn't previously exist */ - if (!conversation) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, - 0); - } + /* Get or create conversation */ + conversation = find_or_create_conversation(pinfo); /* Get or create data associated with this conversation */ hash_info = conversation_get_proto_data(conversation, proto_rlogin); @@ -475,7 +465,7 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Truncate to 128 bytes for display */ bytes_to_copy = 128; } - + /* Add data into info column */ col_append_fstr(pinfo->cinfo, COL_INFO, "Data: %s", @@ -546,7 +536,7 @@ void proto_register_rlogin(void) { "Control message", "rlogin.control_message", FT_UINT8, BASE_HEX, VALS(control_message_vals), 0x0, NULL, HFILL } - }, + }, { &hf_window_info, { "Window Info", "rlogin.window_size", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL @@ -556,7 +546,7 @@ void proto_register_rlogin(void) { "Window size marker", "rlogin.window_size.ss", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } - }, + }, { &hf_window_info_rows, { "Rows", "rlogin.window_size.rows", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 56f42f7b28..29b2999bdf 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -5812,17 +5812,7 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Find out what conversation this packet is part of. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - - if (conversation == NULL) { - /* Not part of any conversation; create a new one. */ - conversation = - conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* Now build the request key */ memset(&request_key, 0, sizeof(request_key)); diff --git a/epan/dissectors/packet-rsync.c b/epan/dissectors/packet-rsync.c index a80e0707ff..7e6217893f 100644 --- a/epan/dissectors/packet-rsync.c +++ b/epan/dissectors/packet-rsync.c @@ -13,12 +13,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -104,13 +104,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_clear(pinfo->cinfo, COL_INFO); - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conversation_data = conversation_get_proto_data(conversation, proto_rsync); @@ -121,7 +115,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } conversation_set_dissector(conversation, rsync_handle); - + ti = proto_tree_add_item(tree, proto_rsync, tvb, 0, -1, FALSE); rsync_tree = proto_item_add_subtree(ti, ett_rsync); @@ -328,7 +322,7 @@ proto_reg_handoff_rsync(void) } else { dissector_delete("tcp.port", saved_rsync_tcp_port, rsync_handle); } - + dissector_add("tcp.port", glb_rsync_tcp_port, rsync_handle); saved_rsync_tcp_port = glb_rsync_tcp_port; } diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c index 1eb1956429..198c482630 100644 --- a/epan/dissectors/packet-rtmpt.c +++ b/epan/dissectors/packet-rtmpt.c @@ -24,7 +24,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This dissector is called RTMPT to avoid a conflict with +/* This dissector is called RTMPT to avoid a conflict with * the other RTMP protocol (Routing Table Maintenance Protocol) implemented in packet-atalk.c * (RTMPT normally stands for RTMP-Tunnel via http) * @@ -197,7 +197,7 @@ static const value_string rtmpt_type_vals[] = { { 0, NULL } }; -static gint rtmpt_header_length_from_type(gint iHeaderType) +static gint rtmpt_header_length_from_type(gint iHeaderType) { gint iHeaderLength = 0; switch (iHeaderType) { @@ -208,8 +208,8 @@ static gint rtmpt_header_length_from_type(gint iHeaderType) case 4: iHeaderLength = 1; break; /* Handshake */ } return iHeaderLength; -} - +} + static void dissect_rtmpt_amf(tvbuff_t *tvb, proto_tree *rtmpt_tree) @@ -743,11 +743,7 @@ dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) #if 0 conversation_t * conversation; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); #endif tcp_dissect_pdus(tvb, pinfo, tree, 1, 1, get_rtmpt_pdu_len, dissect_rtmpt); @@ -792,10 +788,10 @@ proto_register_rtmpt(void) }; static gint *ett[] = { &ett_rtmpt, - &ett_rtmpt_header, - &ett_rtmpt_body, - &ett_rtmpt_object, - &ett_rtmpt_property + &ett_rtmpt_header, + &ett_rtmpt_body, + &ett_rtmpt_object, + &ett_rtmpt_property }; module_t *rtmpt_module; @@ -810,7 +806,7 @@ proto_register_rtmpt(void) "Whether the RTMPT dissector should reassemble messages spanning multiple TCP segments." " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &rtmpt_desegment); - + } void diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 93bd6b1353..aee9bccb4c 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -356,7 +356,7 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, memcpy(buf, line_begin, line_len); buf[line_len] = '\0'; - /* Get past "Transport:" and spaces */ + /* Get past "Transport:" and spaces */ tmp = buf + STRLEN_CONST(rtsp_transport); while (*tmp && isspace(*tmp)) tmp++; @@ -373,10 +373,10 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, /* Give up on unknown transport types */ return; } - + c_data_port = c_mon_port = 0; s_data_port = s_mon_port = 0; - + /* Look for server port */ if ((tmp = strstr(buf, rtsp_sps))) { tmp += strlen(rtsp_sps); @@ -395,8 +395,8 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, return; } } - - + + /* Deal with RTSP TCP-interleaved conversations. */ if (!c_data_port) { rtsp_conversation_data_t *data; @@ -411,7 +411,7 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, */ return; } - + /* Move tmp to beyone interleaved string */ tmp += strlen(rtsp_inter); /* Look for channel number(s) */ @@ -421,19 +421,10 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, g_warning("Frame %u: rtsp: bad interleaved", pinfo->fd->num); return; } - + /* At least data channel present, look for conversation (presumably TCP) */ - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); + conv = find_or_create_conversation(pinfo); - /* Create new conversation if necessary */ - if (!conv) - { - conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, - 0); - } - /* Look for previous data */ data = conversation_get_proto_data(conv, proto_rtsp); @@ -479,7 +470,7 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, /* There is always data for RTP */ rtp_add_address(pinfo, &pinfo->dst, c_data_port, s_data_port, "RTSP", pinfo->fd->num, is_video, NULL); - + /* RTCP only if indicated */ if (c_mon_port) { @@ -846,11 +837,11 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, case RTSP_REQUEST: process_rtsp_request(tvb, offset, line, linelen, next_offset, rtsp_tree); break; - + case RTSP_REPLY: process_rtsp_reply(tvb, offset, line, linelen, next_offset, rtsp_tree); break; - + case RTSP_NOT_FIRST_LINE: /* Drop through, it may well be a header line */ break; @@ -860,7 +851,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, if (is_header) { /* We know that colon_offset must be set */ - + /* Skip whitespace after the colon. */ value_offset = colon_offset + 1; while ((value_offset < line_end_offset) && @@ -979,7 +970,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, next_offset - offset, "%s", tvb_format_text(tvb, offset, next_offset - offset)); } - + offset = next_offset; } @@ -1065,11 +1056,11 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, new_tvb = tvb_new_subset(tvb, offset, datalen, reported_datalen); - if (media_type_str_lower_case && + if (media_type_str_lower_case && dissector_try_string(media_type_dissector_table, media_type_str_lower_case, new_tvb, pinfo, rtsp_tree)){ - + }else { /* * Fix up the top-level item so that it doesn't @@ -1139,7 +1130,7 @@ process_rtsp_request(tvbuff_t *tvb, int offset, const guchar *data, tvb_format_text(tvb, offset, (gint) (next_line_offset - offset))); sub_tree = proto_item_add_subtree(ti, ett_rtsp_method); - + /* Add method name to tree */ proto_tree_add_string(sub_tree, hf_rtsp_method, tvb, offset, (gint) strlen(rtsp_methods[ii]), rtsp_methods[ii]); @@ -1159,7 +1150,7 @@ process_rtsp_request(tvbuff_t *tvb, int offset, const guchar *data, url++; /* Create a URL-sized buffer and copy contents */ tmp_url = ep_strndup(url_start, url - url_start); - + /* Add URL to tree */ proto_tree_add_string(sub_tree, hf_rtsp_url, tvb, offset + (gint) (url_start - data), (gint) (url - url_start), tmp_url); @@ -1185,7 +1176,7 @@ process_rtsp_reply(tvbuff_t *tvb, int offset, const guchar *data, /* status code */ - + /* Skip protocol/version */ while (status < lineend && !isspace(*status)) status++; @@ -1198,7 +1189,7 @@ process_rtsp_reply(tvbuff_t *tvb, int offset, const guchar *data, status_i = 0; while (status < lineend && isdigit(*status)) status_i = status_i * 10 + *status++ - '0'; - + /* Add field to tree */ proto_tree_add_uint(sub_tree, hf_rtsp_status, tvb, offset + (gint) (status_start - data), diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c index 8e04577db7..86ee0e0873 100644 --- a/epan/dissectors/packet-sbus.c +++ b/epan/dissectors/packet-sbus.c @@ -564,14 +564,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return 0; } - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - - if (!conversation) { - /* create new conversation*/ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); request_key.conversation = conversation->index; request_key.sequence = tvb_get_ntohs(tvb,6); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index bbcf8b0be5..ee71c3156f 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -16715,13 +16715,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* find which conversation we are part of and get the tables for that conversation*/ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if(!conversation){ - /* OK this is a new conversation so lets create it */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* see if we already have the smb data for this conversation */ si->ct=conversation_get_proto_data(conversation, proto_smb); if(!si->ct){ diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index d32d31ca1f..35dbcd01da 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -951,7 +951,7 @@ dissect_smb2_ioctl_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *paren } ioctl_function=tvb_get_letohl(tvb, offset); - if (ioctlfunc) + if (ioctlfunc) *ioctlfunc=ioctl_function; if(ioctl_function){ /* device */ @@ -2068,11 +2068,11 @@ dissect_smb2_error_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t proto_tree_add_item(tree, hf_smb2_error_byte_count, tvb, offset, 4, TRUE); offset += 4; - /* If the ByteCount field is zero then the server MUST supply an ErrorData field + /* If the ByteCount field is zero then the server MUST supply an ErrorData field that is one byte in length */ if (byte_count == 0) byte_count = 1; - /* ErrorData (variable): A variable-length data field that contains extended + /* ErrorData (variable): A variable-length data field that contains extended error information.*/ proto_tree_add_item(tree, hf_smb2_error_data, tvb, offset, byte_count, TRUE); offset += byte_count; @@ -2428,7 +2428,7 @@ static void dissect_smb2_file_directory_info(tvbuff_t *tvb, packet_info *pinfo _ tree = proto_item_add_subtree(item, ett_smb2_file_directory_info); } - /* next offset */ + /* next offset */ next_offset = tvb_get_letohl(tvb, offset); proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE); offset += 4; @@ -2512,7 +2512,7 @@ static void dissect_smb2_full_directory_info(tvbuff_t *tvb, packet_info *pinfo _ tree = proto_item_add_subtree(item, ett_smb2_full_directory_info); } - /* next offset */ + /* next offset */ next_offset = tvb_get_letohl(tvb, offset); proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE); offset += 4; @@ -2602,7 +2602,7 @@ static void dissect_smb2_both_directory_info(tvbuff_t *tvb, packet_info *pinfo _ tree = proto_item_add_subtree(item, ett_smb2_both_directory_info); } - /* next offset */ + /* next offset */ next_offset = tvb_get_letohl(tvb, offset); proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE); offset += 4; @@ -2711,7 +2711,7 @@ static void dissect_smb2_file_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, p tree = proto_item_add_subtree(item, ett_smb2_both_directory_info); } - /* next offset */ + /* next offset */ next_offset = tvb_get_letohl(tvb, offset); proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE); offset += 4; @@ -2774,7 +2774,7 @@ static void dissect_smb2_id_both_directory_info(tvbuff_t *tvb, packet_info *pinf tree = proto_item_add_subtree(item, ett_smb2_id_both_directory_info); } - /* next offset */ + /* next offset */ next_offset = tvb_get_letohl(tvb, offset); proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE); offset += 4; @@ -2929,7 +2929,7 @@ dissect_smb2_find_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr si->saved->extra_info_type=SMB2_EI_NONE; si->saved->extra_info=NULL; } - + switch (si->status) { case 0x00000000: break; default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si); @@ -3505,7 +3505,7 @@ dissect_smb2_lock_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i while (lock_count--) { proto_item *lock_item=NULL; proto_tree *lock_tree=NULL; - static const int *lf_fields[] = { + static const int *lf_fields[] = { &hf_smb2_lock_flags_shared, &hf_smb2_lock_flags_exclusive, &hf_smb2_lock_flags_unlock, @@ -5203,7 +5203,7 @@ dissect_smb2_tid_sesid(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, item=proto_tree_add_uint(tid_tree, hf_smb2_share_type, tvb, tid_offset, 0, si->tree->share_type); PROTO_ITEM_SET_GENERATED(item); - + item=proto_tree_add_uint(tid_tree, hf_smb2_tcon_frame, tvb, tid_offset, 0, si->tree->connect_frame); PROTO_ITEM_SET_GENERATED(item); } @@ -5237,12 +5237,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea /* find which conversation we are part of and get the data for that * conversation */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if(!conversation){ - /* OK this is a new conversation so lets create it */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); si->conv=conversation_get_proto_data(conversation, proto_smb2); if(!si->conv){ /* no smb2_into_t structure for this conversation yet, @@ -6216,7 +6211,7 @@ proto_register_smb2(void) { &hf_smb2_short_name_len, { "Short Name Length", "smb2.short_name_len", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, - + { &hf_smb2_short_name, { "Short Name", "smb2.shortname", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index c1583b8ba3..49a2a02740 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -285,14 +285,9 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ /* - * Find the conversation for this. + * Find or create the conversation for this. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { /* No conversation, create one */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* * Is there a request structure attached to this conversation? @@ -315,7 +310,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Are we doing TLS? - * FIXME In my understanding of RFC 2487 client and server can send SMTP cmds + * FIXME In my understanding of RFC 2487 client and server can send SMTP cmds * after a rejected TLS negotiation */ if (session_state->last_nontls_frame != 0 && pinfo->fd->num > session_state->last_nontls_frame) { @@ -351,7 +346,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) spd_frame_data->conversation_id = conversation->index; spd_frame_data->more_frags = TRUE; - p_add_proto_data(pinfo->fd, proto_smtp, spd_frame_data); + p_add_proto_data(pinfo->fd, proto_smtp, spd_frame_data); } @@ -433,27 +428,27 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) spd_frame_data->pdu_type = SMTP_PDU_MESSAGE; if (session_state->msg_tot_len > 0) { - /* + /* * We are handling a BDAT message. * Check if we have reached end of the data chunk. */ session_state->msg_read_len += tvb_length_remaining(tvb, loffset); if (session_state->msg_read_len == session_state->msg_tot_len) { - /* + /* * We have reached end of BDAT data chunk. * Everything that comes after this is commands. */ session_state->smtp_state = SMTP_STATE_READING_CMDS; if (session_state->msg_last) { - /* + /* * We have found the LAST data chunk. * The message can now be reassembled. */ spd_frame_data->more_frags = FALSE; } - + break; /* no need to go through the remaining lines */ } } @@ -510,7 +505,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) session_state->msg_last = TRUE; if (msg_len == 0) { - /* + /* * No more data to expect. * The message can now be reassembled. */ @@ -589,7 +584,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) linelen = tvb_find_line_end(tvb, loffset, -1, &next_offset, FALSE); line = tvb_get_ptr(tvb, loffset, linelen); - if(loffset == offset) + if(loffset == offset) col_append_fstr(pinfo->cinfo, COL_INFO, "C: %s", format_text(line, linelen)); else { @@ -610,7 +605,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) linelen = tvb_find_line_end(tvb, loffset, -1, &next_offset, FALSE); line = tvb_get_ptr(tvb, loffset, linelen); - if (loffset == offset) + if (loffset == offset) col_append_fstr(pinfo->cinfo, COL_INFO, "S: %s", format_text(line, linelen)); else { @@ -645,8 +640,8 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case SMTP_PDU_MESSAGE: if (smtp_data_desegment) { - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, spd_frame_data->conversation_id, - smtp_data_segment_table, smtp_data_reassembled_table, + frag_msg = fragment_add_seq_next(tvb, 0, pinfo, spd_frame_data->conversation_id, + smtp_data_segment_table, smtp_data_reassembled_table, tvb_length(tvb), spd_frame_data->more_frags); } else { /* @@ -748,7 +743,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ dissect_smtp_data(tvb, offset, smtp_tree); } - + pinfo->fragmented = FALSE; } else { pinfo->fragmented = TRUE; @@ -853,15 +848,15 @@ proto_register_smtp(void) { static hf_register_info hf[] = { { &hf_smtp_req, - { "Request", "smtp.req", + { "Request", "smtp.req", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_smtp_rsp, - { "Response", "smtp.rsp", + { "Response", "smtp.rsp", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_smtp_req_command, - { "Command", "smtp.req.command", + { "Command", "smtp.req.command", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_smtp_req_parameter, @@ -903,7 +898,7 @@ proto_register_smtp(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Message fragment too long", HFILL } }, { &hf_smtp_data_fragment_error, - { "DATA defragmentation error", "smtp.data.fragment.error", + { "DATA defragmentation error", "smtp.data.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x00, "Message defragmentation error", HFILL } }, { &hf_smtp_data_reassembled_in, diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index ea24d6b39d..033a36307f 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -641,7 +641,7 @@ display_socks_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_item( tree, hf_gssapi_command, tvb, offset, 1, FALSE); proto_tree_add_item( tree, hf_gssapi_length, tvb, offset+1, 2, FALSE); len = tvb_get_ntohs(tvb, offset+1); - if (len > 0) + if (len > 0) proto_tree_add_item( tree, hf_gssapi_payload, tvb, offset+3, len, FALSE); } else if ((compare_packet( hash_info->command_row)) || @@ -902,7 +902,7 @@ state_machine_v5( socks_hash_entry_t *hash_info, tvbuff_t *tvb, " GSSAPI Authentication reply"); if (tvb_get_ntohs(tvb, offset+2) == 0) hash_info->state = V5Command; - else + else hash_info->state = GssApiAuth; hash_info->gssapi_auth_reply_row = get_packet_ptr; } @@ -1041,13 +1041,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { return; } - conversation = find_conversation( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if ( !conversation){ - conversation = conversation_new( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); hash_info = conversation_get_proto_data(conversation,proto_socks); if ( !hash_info){ hash_info = se_alloc(sizeof(socks_hash_entry_t)); diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c index de1955f7f7..0cedb83ace 100644 --- a/epan/dissectors/packet-ssh.c +++ b/epan/dissectors/packet-ssh.c @@ -248,14 +248,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_newdata = FALSE; this_data = p_get_proto_data(pinfo->fd, proto_ssh); - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (!conversation) { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); global_data = conversation_get_proto_data(conversation,proto_ssh); if(!global_data ) { diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 642f5eb917..467d01bcd6 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -537,16 +537,8 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * the conv_version, must set the copy in the conversation * in addition to conv_version */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); + conversation = find_or_create_conversation(pinfo); - if (!conversation) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - ssl_debug_printf(" new conversation = %p created\n", (void *)conversation); - } conv_data = conversation_get_proto_data(conversation, proto_ssl); /* PAOLO: manage ssl decryption data */ @@ -1292,7 +1284,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo, * message starts in the data it handed us, and how many * more bytes we need, and return. * Fix for bug 4535: Don't get just the data we need, get - * one more segment. Otherwise when the next segment does + * one more segment. Otherwise when the next segment does * not contain all the rest of the SSL PDU, reassembly will * break. */ @@ -1329,7 +1321,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo, /* Don't use: * pinfo->desegment_len = (record_length + 5) - available_bytes; - * as it will display two SSL subtrees when a frame contains + * as it will display two SSL subtrees when a frame contains * the continuation of a previous PDU together with a full new * PDU (and the info column would not show the message type * of the second PDU) @@ -3652,15 +3644,7 @@ ssl_set_conv_version(packet_info *pinfo, guint version) return; } - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if (conversation_get_proto_data(conversation, proto_ssl) != NULL) { diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c index 455d9a441f..2a4dd857fa 100644 --- a/epan/dissectors/packet-starteam.c +++ b/epan/dissectors/packet-starteam.c @@ -1,7 +1,7 @@ /* packet-starteam.c * Routines for Borland StarTeam packet dissection * - * metatech <metatech@flashmail.com> + * metatech <metatech[AT]flashmail.com> * * $Id$ * @@ -26,7 +26,7 @@ /* StarTeam in a nutshell * -* StarTeam is a Software Change & Configuration Management Tool (like CVS) +* StarTeam is a Software Change & Configuration Management Tool (like CVS) */ #ifdef HAVE_CONFIG_H @@ -498,15 +498,15 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_length(tvb) >= 16){ guint32 iCommand = 0; gboolean bRequest = FALSE; - if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ + if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* This packet is a response */ - bRequest = FALSE; + bRequest = FALSE; if(check_col(pinfo->cinfo, COL_INFO)){ col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb)); } } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* This packet is a request */ - bRequest = TRUE; + bRequest = TRUE; if(tvb_length_remaining(tvb, offset) >= 66){ iCommand = tvb_get_letohl(tvb, offset + 62); } @@ -524,7 +524,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_length_remaining(tvb, offset) >= 20){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 20, STARTEAM_TEXT_MDH); starteam_tree = proto_item_add_subtree(ti, ett_starteam_mdh); - + proto_tree_add_item(starteam_tree, hf_starteam_mdh_session_tag, tvb, offset + 0, 4, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_mdh_ctimestamp, tvb, offset + 4, 4, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_mdh_flags, tvb, offset + 8, 4, TRUE); @@ -537,18 +537,18 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_length_remaining(tvb, offset) >= 16){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 16, STARTEAM_TEXT_PH); starteam_tree = proto_item_add_subtree(ti, ett_starteam_ph); - + proto_tree_add_item(starteam_tree, hf_starteam_ph_signature, tvb, offset + 0, 4, FALSE); proto_tree_add_item(starteam_tree, hf_starteam_ph_packet_size, tvb, offset + 4, 4, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_ph_data_size, tvb, offset + 8, 4, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_ph_data_flags, tvb, offset + 12, 4, TRUE); offset += 16; - + if(bRequest){ if(tvb_length_remaining(tvb, offset) >= 38){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 38, STARTEAM_TEXT_ID); starteam_tree = proto_item_add_subtree(ti, ett_starteam_id); - + proto_tree_add_item(starteam_tree, hf_starteam_id_revision_level, tvb, offset + 0, 2, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_id_client, tvb, offset + 2, 16, TRUE); proto_tree_add_item(starteam_tree, hf_starteam_id_connect, tvb, offset + 18, 4, TRUE); @@ -562,7 +562,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_length_remaining(tvb, offset) > 0){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, -1, STARTEAM_TEXT_DATA); starteam_tree = proto_item_add_subtree(ti, ett_starteam_data); - proto_tree_add_item(starteam_tree, hf_starteam_data_data, tvb, offset, tvb_length_remaining(tvb, offset), TRUE); + proto_tree_add_item(starteam_tree, hf_starteam_data_data, tvb, offset, tvb_length_remaining(tvb, offset), TRUE); } } } @@ -573,13 +573,13 @@ static guint get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { guint32 iPDULength = 0; - if(tvb_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ + if(tvb_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* Response */ iPDULength = tvb_get_letohl(tvb, offset + 4) + 16; } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* Request */ - iPDULength = tvb_get_letohl(tvb, offset + 24) + 36; - } + iPDULength = tvb_get_letohl(tvb, offset + 24) + 36; + } return iPDULength; } @@ -599,22 +599,19 @@ dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iOffsetLengths = 4; } else if(tvb_get_ntohl(tvb, 20) == STARTEAM_MAGIC){ iOffsetLengths = 24; - } + } if(iOffsetLengths != -1){ guint32 iLengthPacket; guint32 iLengthData; iLengthPacket = tvb_get_letohl(tvb, iOffsetLengths); iLengthData = tvb_get_letohl(tvb, iOffsetLengths + 4); - + if(iLengthPacket == iLengthData){ /* Register this dissector for this conversation */ conversation_t *conversation = NULL; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if(conversation == NULL){ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conversation_set_dissector(conversation, starteam_tcp_handle); - + /* Dissect the packet */ dissect_starteam(tvb, pinfo, tree); return TRUE; @@ -681,7 +678,7 @@ proto_register_starteam(void) }; static gint *ett[] = { &ett_starteam, - &ett_starteam_mdh, + &ett_starteam_mdh, &ett_starteam_ph, &ett_starteam_id, &ett_starteam_data @@ -692,14 +689,14 @@ proto_register_starteam(void) proto_starteam = proto_register_protocol("StarTeam", "StarTeam", "starteam"); proto_register_field_array(proto_starteam, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + starteam_module = prefs_register_protocol(proto_starteam, NULL); prefs_register_bool_preference(starteam_module, "desegment", "Reassemble StarTeam messages spanning multiple TCP segments", "Whether the StarTeam dissector should reassemble messages spanning multiple TCP segments." " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &starteam_desegment); - + } void diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index f5c4232bcb..49cde99273 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -177,7 +177,7 @@ typedef struct _stun_conv_info_t { #define ICE_CONTROLLING 0x802a /* draft-ietf-mmusic-ice-19 */ #define RESPONSE_ORIGIN 0x802b /* draft-ietf-behave-nat-behavior-discovery-03 */ #define OTHER_ADDRESS 0x802c /* draft-ietf-behave-nat-behavior-discovery-03 */ - + /* divers */ #define PROTO_NUM_UDP 17 #define PROTO_NUM_TCP 6 @@ -396,7 +396,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* two first bits not NULL => should be a channel-data message */ if (msg_type == 0xFFFF) return 0; - /* note that padding is only mandatory over streaming + /* note that padding is only mandatory over streaming protocols */ msg_total_len = (guint) ((msg_length + CHANNEL_DATA_HDR_LEN +3) & -4) ; @@ -407,11 +407,11 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* recalculate the total length without padding */ msg_total_len = (guint) msg_length + CHANNEL_DATA_HDR_LEN; - if (len != msg_total_len) + if (len != msg_total_len) return 0; } } - else + else { /* Normal STUN message */ msg_total_len = (guint) msg_length + STUN_HDR_LEN; @@ -444,8 +444,8 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!tree) return tvb_length(tvb); ti = proto_tree_add_item( - tree, proto_stun, tvb, 0, - CHANNEL_DATA_HDR_LEN, + tree, proto_stun, tvb, 0, + CHANNEL_DATA_HDR_LEN, FALSE); proto_item_append_text(ti, ", TURN ChannelData Message"); stun_tree = proto_item_add_subtree(ti, ett_stun); @@ -455,16 +455,16 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) new_len = tvb_length_remaining(tvb, CHANNEL_DATA_HDR_LEN); - reported_len = tvb_reported_length_remaining(tvb, + reported_len = tvb_reported_length_remaining(tvb, CHANNEL_DATA_HDR_LEN); if (data_length < reported_len) { reported_len = data_length; } - next_tvb = tvb_new_subset(tvb, CHANNEL_DATA_HDR_LEN, new_len, + next_tvb = tvb_new_subset(tvb, CHANNEL_DATA_HDR_LEN, new_len, reported_len); - if (!dissector_try_heuristic(heur_subdissector_list, + if (!dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree)) { call_dissector_only(data_handle,next_tvb, pinfo, tree); } @@ -489,19 +489,8 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msg_type_class = ((msg_type & 0x0010) >> 4) | ((msg_type & 0x0100) >> 7) ; msg_type_method = (msg_type & 0x000F) | ((msg_type & 0x00E0) >> 1) | ((msg_type & 0x3E00) >> 2); - /* Do we already have a conversation ? */ - conversation = - find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ @@ -517,35 +506,35 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!pinfo->fd->flags.visited) { if ((stun_trans = - se_tree_lookup32_array(stun_info->transaction_pdus, + se_tree_lookup32_array(stun_info->transaction_pdus, transaction_id_key)) == NULL) { stun_trans=se_alloc(sizeof(stun_transaction_t)); stun_trans->req_frame=0; stun_trans->rep_frame=0; stun_trans->req_time=pinfo->fd->abs_ts; - se_tree_insert32_array(stun_info->transaction_pdus, - transaction_id_key, + se_tree_insert32_array(stun_info->transaction_pdus, + transaction_id_key, (void *)stun_trans); } - + if (msg_type_class == REQUEST) { /* This is a request */ if (stun_trans->req_frame == 0) { stun_trans->req_frame=pinfo->fd->num; } - + } else { /* This is a catch-all for all non-request messages */ if (stun_trans->rep_frame == 0) { stun_trans->rep_frame=pinfo->fd->num; } - + } } else { - stun_trans=se_tree_lookup32_array(stun_info->transaction_pdus, + stun_trans=se_tree_lookup32_array(stun_info->transaction_pdus, transaction_id_key); } - + if (!stun_trans) { /* create a "fake" pana_trans structure */ stun_trans=ep_alloc(sizeof(stun_transaction_t)); @@ -574,15 +563,15 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (msg_type_class == REQUEST) { if (stun_trans->req_frame != pinfo->fd->num) { proto_item *it; - it=proto_tree_add_uint(stun_tree, hf_stun_duplicate, - tvb, 0, 0, + it=proto_tree_add_uint(stun_tree, hf_stun_duplicate, + tvb, 0, 0, stun_trans->req_frame); PROTO_ITEM_SET_GENERATED(it); } if (stun_trans->rep_frame) { proto_item *it; - it=proto_tree_add_uint(stun_tree, hf_stun_response_in, - tvb, 0, 0, + it=proto_tree_add_uint(stun_tree, hf_stun_response_in, + tvb, 0, 0, stun_trans->rep_frame); PROTO_ITEM_SET_GENERATED(it); } @@ -591,8 +580,8 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Retransmission control */ if (stun_trans->rep_frame != pinfo->fd->num) { proto_item *it; - it=proto_tree_add_uint(stun_tree, hf_stun_duplicate, - tvb, 0, 0, + it=proto_tree_add_uint(stun_tree, hf_stun_duplicate, + tvb, 0, 0, stun_trans->rep_frame); PROTO_ITEM_SET_GENERATED(it); } @@ -610,7 +599,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) it=proto_tree_add_time(stun_tree, hf_stun_time, tvb, 0, 0, &ns); PROTO_ITEM_SET_GENERATED(it); } - + } } @@ -646,7 +635,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) att_type_str = match_strval(att_type, attributes); if (att_type_str == NULL) att_type_str = "Unknown"; - ti = proto_tree_add_uint_format(att_all_tree, hf_stun_attr, + ti = proto_tree_add_uint_format(att_all_tree, hf_stun_attr, tvb, offset, ATTR_HDR_LEN+att_length, att_type, "%s", att_type_str); att_tree = proto_item_add_subtree(ti, ett_stun_att); @@ -741,7 +730,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ); } if (att_length % 4 != 0) - proto_tree_add_uint(att_tree, stun_att_padding, + proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4)); break; @@ -900,13 +889,13 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) IPv6[3] = g_htonl(tvb_get_ntohl(tvb, offset+16) ^ transaction_id[2]); ti = proto_tree_add_ipv6(att_tree, stun_att_ipv6, tvb, offset+4, 16, (const guint8 *)IPv6); - PROTO_ITEM_SET_GENERATED(ti); + PROTO_ITEM_SET_GENERATED(ti); } break; } break; - + case REQUESTED_ADDRESS_TYPE: if (att_length < 1) break; @@ -978,15 +967,15 @@ case EVEN_PORT: pad = 4-(att_length % 4); proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, pad, pad); } - reported_len = att_length; - - - next_tvb = - tvb_new_subset(tvb, offset, - reported_len, + reported_len = att_length; + + + next_tvb = + tvb_new_subset(tvb, offset, + reported_len, reported_len); - if (!dissector_try_heuristic(heur_subdissector_list, + if (!dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, att_tree)) { call_dissector_only(data_handle,next_tvb, pinfo, att_tree); } @@ -1000,7 +989,7 @@ case EVEN_PORT: proto_tree_add_item(att_tree, stun_att_transp, tvb, offset, 1, FALSE); if (att_length < 4) break; - + { guint8 protoCode = tvb_get_guint8(tvb, offset); proto_item_append_text(att_tree, ": %s", val_to_str(protoCode, transportnames, "Unknown (0x%8x)")); @@ -1155,19 +1144,19 @@ proto_register_stun(void) BASE_HEX, NULL, 0, NULL, HFILL } }, { &hf_stun_response_in, - { "Response In", "stun.response-in", FT_FRAMENUM, + { "Response In", "stun.response-in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this STUN query is in this frame", HFILL } }, { &hf_stun_response_to, - { "Request In", "stun.response-to", FT_FRAMENUM, + { "Request In", "stun.response-to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the STUN Request in this frame", HFILL } }, { &hf_stun_time, - { "Time", "stun.time", FT_RELATIVE_TIME, + { "Time", "stun.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL } }, { &hf_stun_duplicate, - { "Duplicated original message in", "stun.reqduplicate", FT_FRAMENUM, + { "Duplicated original message in", "stun.reqduplicate", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a duplicate of STUN message in this frame", HFILL } }, /* ////////////////////////////////////// */ @@ -1286,11 +1275,11 @@ proto_register_stun(void) { &stun_att_change_port, { "Change Port","stun.att.change-port", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0002, NULL, HFILL} - }, + }, { &stun_att_reserve_next, { "Reserve next","stun.att.even-port.reserve-next", FT_UINT8, BASE_DEC, VALS(attributes_reserve_next), 0x80, NULL, HFILL} - }, + }, { &stun_att_cache_timeout, { "Cache timeout", "stun.att.cache-timeout", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index 7c74326dbe..09fbb31d89 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -3,7 +3,7 @@ * * Copyright 2008, Jens Steinhauser <jens.steinhauser@omicron.at> * - * $Id$ + * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> @@ -13,12 +13,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -38,7 +38,7 @@ #include <math.h> #define PROTOCOL_NAME "IEEE C37.118 Synchrophasor Protocol" -#define PROTOCOL_SHORT_NAME "SYNCHROPHASOR" +#define PROTOCOL_SHORT_NAME "SYNCHROPHASOR" #define PROTOCOL_ABBREV "synphasor" /* forward references */ @@ -130,7 +130,7 @@ enum FrameType { /* type to indicate the format for (D)FREQ/PHASORS/ANALOG in data frame */ typedef enum { integer, /* 16 bit signed integer */ floating_point /* single precision floating point */ -} data_format; +} data_format; typedef enum { rect, polar } phasor_notation; @@ -172,7 +172,7 @@ typedef struct { } config_frame; /* strings for type bits in SYNC */ -static const value_string typenames[] = { +static const value_string typenames[] = { { 0, "Data Frame" }, { 1, "Header Frame" }, { 2, "Configuration Frame 1" }, @@ -182,13 +182,13 @@ static const value_string typenames[] = { }; /* strings for version bits in SYNC */ -static const value_string versionnames[] = { +static const value_string versionnames[] = { { 1, "IEEE C37.118-2005 initial publication" }, { 0, NULL } }; /* strings for the time quality flags in FRACSEC */ -static const value_string timequalcodes[] = { +static const value_string timequalcodes[] = { { 0xF, "Clock failure, time not reliable" }, { 0xB, "Clock unlocked, time within 10 s" }, { 0xA, "Clock unlocked, time within 1 s" }, @@ -373,11 +373,11 @@ static config_frame* config_frame_fast(tvbuff_t *tvb) for (i = 0; i != num_ph; i++) { phasor_info pi; guint32 conv; - + /* copy the phasor name from the tvb, and add NULL byte */ tvb_memcpy(tvb, pi.name, offset, CHNAM_LEN); offset += CHNAM_LEN; pi.name[CHNAM_LEN] = '\0'; - + conv = tvb_get_ntohl(tvb, phunit + 4 * i); pi.unit = conv & 0xFF000000 ? A : V; pi.conv = conv & 0x00FFFFFF; @@ -460,7 +460,7 @@ static void synphasor_init(void) if (frame_chunks != NULL) { g_mem_chunk_destroy(frame_chunks); } - frame_chunks = g_mem_chunk_new("Frame_Chunks", + frame_chunks = g_mem_chunk_new("Frame_Chunks", sizeof(config_frame), 10*(sizeof(config_frame)), G_ALLOC_AND_FREE); @@ -495,7 +495,7 @@ static gboolean check_crc(tvbuff_t *tvb, guint16 *computedcrc) guint16 crc; guint len = tvb_get_ntohs(tvb, 2); - crc = tvb_get_ntohs(tvb, len - 2); + crc = tvb_get_ntohs(tvb, len - 2); *computedcrc = crc16_x25_ccitt_tvb(tvb, len - 2); if (crc == *computedcrc) @@ -557,18 +557,7 @@ static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) config_frame_list = g_slist_append(config_frame_list, frame); /* find a conversation, create a new if no one exists */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, - 0); - - if (!conversation) - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, - 0); + conversation = find_or_create_conversation(pinfo); /* remove data from a previous CFG-2 frame, only * the most recent configuration frame is relevant */ @@ -726,7 +715,7 @@ static int dissect_config_frame(tvbuff_t *tvb, proto_item *config_item) /* TIME_BASE and NUM_PMU */ offset += 1; /* skip the reserved byte */ proto_tree_add_item(config_tree, hf_conf_timebase, tvb, offset, 3, FALSE); offset += 3; - proto_tree_add_item(config_tree, hf_conf_numpmu, tvb, offset, 2, FALSE); + proto_tree_add_item(config_tree, hf_conf_numpmu, tvb, offset, 2, FALSE); /* add number of included PMUs to the text in the list view */ num_pmu = tvb_get_ntohs(tvb, offset); offset += 2; proto_item_append_text(config_item, ", %"G_GUINT16_FORMAT" PMU(s) included", num_pmu); @@ -991,7 +980,7 @@ static gint dissect_PHASORS(tvbuff_t *tvb, proto_tree *tree, config_block *block "Phasor #%u: \"%s\"", j + 1, pi->name); offset += dissect_single_phasor(tvb, offset, - &mag, &phase, + &mag, &phase, block->format_ph, block->phasor_notation); @@ -1097,7 +1086,7 @@ static gint dissect_DIGITAL(tvbuff_t *tvb, proto_tree *tree, config_block *block tree = proto_item_add_subtree(digital_item, ett_data_digital); for (j = 0; j < cnt; j++) { - guint16 tmp = tvb_get_ntohs(tvb, offset); + guint16 tmp = tvb_get_ntohs(tvb, offset); proto_tree_add_text(tree, tvb, offset, 2, "Digital status word #%u: 0x%04x", j + 1, tmp); offset += 2; } @@ -1276,7 +1265,7 @@ void proto_register_synphasor(void) /* Fraction of second */ { &hf_fracsec, - { "Fraction of second (raw)", PROTOCOL_ABBREV ".fracsec", FT_UINT24, BASE_DEC, + { "Fraction of second (raw)", PROTOCOL_ABBREV ".fracsec", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* Data types for configuration frames */ @@ -1292,7 +1281,7 @@ void proto_register_synphasor(void) { &hf_conf_formatb3, { "FREQ/DFREQ format", PROTOCOL_ABBREV ".conf.dfreq_format", FT_BOOLEAN, 16, TFS(&conf_formatb123names), 0x8, NULL, HFILL }}, - + { &hf_conf_formatb2, { "Analog values format", PROTOCOL_ABBREV ".conf.analog_format", FT_BOOLEAN, 16, TFS(&conf_formatb123names), 0x4, NULL, HFILL }}, diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 762d207a54..9f212578ba 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -280,19 +280,6 @@ init_tcp_conversation_data(packet_info *pinfo) return tcpd; } -conversation_t * -get_tcp_conversation(packet_info *pinfo) -{ - conversation_t *conv=NULL; - - /* Have we seen this conversation before? */ - if( (conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0)) == NULL){ - /* No this is a new conversation. */ - conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } - return conv; -} - struct tcp_analysis * get_tcp_conversation_data(conversation_t *conv, packet_info *pinfo) { @@ -301,7 +288,7 @@ get_tcp_conversation_data(conversation_t *conv, packet_info *pinfo) /* Did the caller supply the conversation pointer? */ if( conv==NULL ) - conv = get_tcp_conversation(pinfo); + conv = find_or_create_conversation(pinfo); /* Get the data for this conversation */ tcpd=conversation_get_proto_data(conv, proto_tcp); @@ -3106,7 +3093,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tcph->th_hlen = hi_nibble(th_off_x2) * 4; /* TCP header length, in bytes */ /* find(or create if needed) the conversation for this tcp session */ - conv=get_tcp_conversation(pinfo); + conv=find_or_create_conversation(pinfo); tcpd=get_tcp_conversation_data(conv,pinfo); item = proto_tree_add_uint(tcp_tree, hf_tcp_stream, tvb, offset, 0, conv->index); diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index b784d80b0b..b564a02f15 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -1944,15 +1944,7 @@ dissect_tds_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * OK, it passes the test; assume the rest of this conversation * is TDS. */ - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conv == NULL) { - /* - * No conversation exists yet - create one. - */ - conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conv = find_or_create_conversation(pinfo); conversation_set_dissector(conv, tds_tcp_handle); /* diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index d6a9f138cd..faee582ce8 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -164,7 +164,7 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, } static void dissect_tftp_message(tftp_conv_info_t *tftp_info, - tvbuff_t *tvb, packet_info *pinfo, + tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *tftp_tree = NULL; @@ -369,13 +369,7 @@ dissect_embeddedtftp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 opcode; tftp_conv_info_t *tftp_info; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if(conversation == NULL) { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport,pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); tftp_info = conversation_get_proto_data(conversation, proto_tftp); if (!tftp_info) { diff --git a/epan/dissectors/packet-tn3270.c b/epan/dissectors/packet-tn3270.c index 908c2533c5..736e281ed7 100644 --- a/epan/dissectors/packet-tn3270.c +++ b/epan/dissectors/packet-tn3270.c @@ -3882,21 +3882,10 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void add_tn3270_conversation(packet_info *pinfo, int tn3270e, int model) { - conversation_t *conversation; - tn3270_conv_info_t *tn3270_info = NULL; + conversation_t *conversation; + tn3270_conv_info_t *tn3270_info = NULL; - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* * Do we already have a type and mechanism? diff --git a/epan/dissectors/packet-tuxedo.c b/epan/dissectors/packet-tuxedo.c index 45fc84fd38..e629a704f3 100644 --- a/epan/dissectors/packet-tuxedo.c +++ b/epan/dissectors/packet-tuxedo.c @@ -107,9 +107,9 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti; guint32 magic; guint32 opcode; - - col_set_str(pinfo->cinfo, COL_PROTOCOL, "TUXEDO"); - + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "TUXEDO"); + if (tvb_length(tvb) >= 8) { magic = tvb_get_ntohl(tvb, 0); @@ -117,9 +117,9 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { opcode = tvb_get_ntohl(tvb, 4); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)")); + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)")); } if (tree) @@ -127,14 +127,14 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, FALSE); tuxedoroot_tree = proto_item_add_subtree(ti, ett_tuxedo); - proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_magic, tvb, 0, 4, FALSE); + proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_magic, tvb, 0, 4, FALSE); proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_opcode, tvb, 4, 4, FALSE); } } else { /* This packet is a continuation */ - col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); + col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); if (tree) { proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, FALSE); @@ -150,15 +150,11 @@ dissect_tuxedo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint32 magic; magic = tvb_get_ntohl(tvb, 0); - if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC) + if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC) { /* Register this dissector for this conversation */ conversation_t *conversation = NULL; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conversation_set_dissector(conversation, tuxedo_handle); dissect_tuxedo(tvb, pinfo, tree); diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index 1ff6be99e5..a0820f3280 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -1730,13 +1730,7 @@ dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * won't be called any more for this TCP connection. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conversation_set_dissector(conversation, ucp_handle); dissect_ucp_tcp(tvb, pinfo, tree); @@ -1863,7 +1857,7 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += UCP_OT_LEN; /* - * Variable part starts here. + * Variable part starts here. */ tmp_tvb = tvb_new_subset_remaining(tvb, offset); diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 40e2ba1659..d246db3040 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -120,19 +120,6 @@ init_udp_conversation_data(void) return udpd; } -static conversation_t * -get_udp_conversation(packet_info *pinfo) -{ - conversation_t *conv=NULL; - - /* Have we seen this conversation before? */ - if( (conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0)) == NULL){ - /* No this is a new conversation. */ - conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } - return conv; -} - static struct udp_analysis * get_udp_conversation_data(conversation_t *conv, packet_info *pinfo) { @@ -141,7 +128,7 @@ get_udp_conversation_data(conversation_t *conv, packet_info *pinfo) /* Did the caller supply the conversation pointer? */ if( conv==NULL ) - conv = get_udp_conversation(pinfo); + conv = find_or_create_conversation(pinfo); /* Get the data for this conversation */ udpd=conversation_get_proto_data(conv, proto_udp); @@ -244,7 +231,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, * to the payload tvb through the tap system. */ if(have_tap_listener(udp_follow_tap)) tap_queue_packet(udp_follow_tap, pinfo, next_tvb); - + /* determine if this packet is part of a conversation and call dissector */ /* for the conversation if available */ @@ -540,10 +527,10 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) pinfo->destport = udph->uh_dport; tap_queue_packet(udp_tap, pinfo, udph); - + /* find(or create if needed) the conversation for this udp session */ if (udp_process_info) { - conv=get_udp_conversation(pinfo); + conv=find_or_create_conversation(pinfo); udpd=get_udp_conversation_data(conv,pinfo); } diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 0052817c00..d0f0bde239 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -171,7 +171,7 @@ typedef enum { VNC_ENCODING_TYPE_COMPRESSION_6 = 0xFFFFFF06, VNC_ENCODING_TYPE_COMPRESSION_7 = 0xFFFFFF07, VNC_ENCODING_TYPE_COMPRESSION_8 = 0xFFFFFF08, - VNC_ENCODING_TYPE_COMPRESSION_9 = 0xFFFFFF09, + VNC_ENCODING_TYPE_COMPRESSION_9 = 0xFFFFFF09, VNC_ENCODING_TYPE_WMVi = 0x574D5669, VNC_ENCODING_TYPE_CACHE = 0xFFFF0000, VNC_ENCODING_TYPE_CACHE_ENABLE = 0xFFFF0001, @@ -618,16 +618,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conversation_t *conversation; vnc_conversation_t *per_conversation_info; - conversation = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if(!conversation) { /* Conversation does not exist yet - create it */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, - pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* Retrieve information from conversation, or add it if it isn't * there yet */ @@ -635,7 +626,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_vnc); if(!per_conversation_info) { per_conversation_info = se_alloc(sizeof(vnc_conversation_t)); - + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_VERSION; per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_INVALID; @@ -665,7 +656,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) vnc_set_bytes_per_pixel(pinfo, vnc_bytes_per_pixel); vnc_set_depth(pinfo, vnc_depth); - if(!ret) { + if(!ret) { if(DEST_PORT_VNC || per_conversation_info->server_port == pinfo->destport) vnc_client_to_server(tvb, pinfo, &offset, vnc_tree); else @@ -692,7 +683,7 @@ process_vendor(proto_tree *tree, gint hfindex, tvbuff_t *tvb, gint offset) else if(g_ascii_strcasecmp(vendor, "TGHT") == 0) proto_item_append_text(ti, " (Tight VNC vendor)"); } - + offset += 4; return offset; } @@ -724,7 +715,7 @@ process_tight_capabilities(proto_tree *tree, } /* Returns true if this looks like a client or server version packet: 12 bytes, in the format "RFB xxx.yyy\n" . -* Will check for the 12 bytes exact length, the 'RFB ' string and that it ends with a '\n'. +* Will check for the 12 bytes exact length, the 'RFB ' string and that it ends with a '\n'. * The exact 'xxx.yyy' is checked later, by trying to convert it to a double using g_ascii_strtod. */ static gboolean @@ -733,7 +724,7 @@ vnc_is_client_or_server_version_message(tvbuff_t *tvb) if(tvb_length(tvb) != 12) { return FALSE; } - + if(tvb_strncaseeql(tvb, 0, "RFB ", 4) != 0) { return FALSE; } @@ -741,7 +732,7 @@ vnc_is_client_or_server_version_message(tvbuff_t *tvb) if((tvb_get_guint8(tvb, 7) != 0x2e) || (tvb_get_guint8(tvb,11) != 0xa)) { return FALSE; } - + return TRUE; } @@ -749,7 +740,7 @@ static gboolean test_vnc_protocol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { conversation_t *conversation; - + if (vnc_is_client_or_server_version_message(tvb)) { conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, @@ -783,55 +774,55 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, per_packet_info->preferred_encoding = -1; p_add_proto_data(pinfo->fd, proto_vnc, per_packet_info); - } - + } + /* Packet dissection follows */ switch(per_packet_info->state) { case VNC_SESSION_STATE_SERVER_VERSION : if (!vnc_is_client_or_server_version_message(tvb)) return TRUE; /* we still hope to get a SERVER_VERSION message some day. Do not proceed yet */ - + proto_tree_add_item(tree, hf_vnc_server_proto_ver, tvb, 4, 7, FALSE); per_conversation_info->server_proto_ver = g_ascii_strtod((char *)tvb_get_ephemeral_string(tvb, 4, 7), NULL); per_conversation_info->server_port = pinfo->srcport; - + if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "Server protocol version: %s", tvb_format_text(tvb, 4, 7)); - + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_VERSION; break; - + case VNC_SESSION_STATE_CLIENT_VERSION : if (!vnc_is_client_or_server_version_message(tvb)) return TRUE; /* we still hope to get a CLIENT_VERSION message some day. Do not proceed yet */ - + proto_tree_add_item(tree, hf_vnc_client_proto_ver, tvb, 4, 7, FALSE); per_conversation_info->client_proto_ver = g_ascii_strtod((char *)tvb_get_ephemeral_string(tvb, 4, 7), NULL); - + if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "Client protocol version: %s", tvb_format_text(tvb, 4, 7)); - + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY; break; case VNC_SESSION_STATE_SECURITY : col_set_str(pinfo->cinfo, COL_INFO, "Security types supported"); - + /* We're checking against the client protocol version because * the client is the final decider on which version to use * after the server offers the highest version it supports. */ - + if(per_conversation_info->client_proto_ver >= 3.007) { num_security_types = tvb_get_guint8(tvb, offset); if (tree) { @@ -845,7 +836,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, offset, 1, FALSE); } } - per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_TYPES; + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_TYPES; } else { /* Version < 3.007: The server decides the * authentication type for us to use */ @@ -975,13 +966,13 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, case VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY: REPORT_DISSECTOR_BUG("Unimplemented case: TightVNC authentication reply"); /* FIXME: implement. See xserver/hw/vnc/auth.c:rfbProcessClientAuthType() */ - break; + break; case VNC_SESSION_STATE_TIGHT_AUTH_TYPE_AND_VENDOR_CODE : col_set_str(pinfo->cinfo, COL_INFO, "Authentication type / vendor code"); proto_tree_add_item(tree, hf_vnc_server_security_type, tvb, - offset, 4, FALSE); + offset, 4, FALSE); offset += 4; @@ -995,10 +986,10 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3; break; - + case VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3 : col_set_str(pinfo->cinfo, COL_INFO, "Unknown packet (TightVNC)"); - + proto_tree_add_text(tree, tvb, offset, -1, "Unknown packet (TightVNC)"); @@ -1009,7 +1000,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, case VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE : col_set_str(pinfo->cinfo, COL_INFO, "Authentication challenge from server"); - + proto_tree_add_item(tree, hf_vnc_auth_challenge, tvb, offset, 16, FALSE); @@ -1019,16 +1010,16 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, case VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE : col_set_str(pinfo->cinfo, COL_INFO, "Authentication response from client"); - + proto_tree_add_item(tree, hf_vnc_auth_response, tvb, offset, 16, FALSE); - + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_RESULT; break; case VNC_SESSION_STATE_SECURITY_RESULT : col_set_str(pinfo->cinfo, COL_INFO, "Authentication result"); - + proto_tree_add_item(tree, hf_vnc_auth_result, tvb, offset, 4, FALSE); auth_result = tvb_get_ntohl(tvb, offset); @@ -1045,7 +1036,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, text_len = tvb_get_ntohl(tvb, offset); proto_tree_add_text(tree, tvb, offset, 4, "Length of authentication error: %d", text_len); offset += 4; - + proto_tree_add_item(tree, hf_vnc_auth_error, tvb, offset, text_len, FALSE); } @@ -1053,7 +1044,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, return TRUE; /* All versions: Do not continue processing VNC packets as connection will be closed after this packet. */ - + break; } @@ -1064,14 +1055,14 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree_add_item(tree, hf_vnc_share_desktop_flag, tvb, offset, 1, FALSE); - + per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_INIT; break; - + case VNC_SESSION_STATE_SERVER_INIT : col_set_str(pinfo->cinfo, COL_INFO, "Server framebuffer parameters"); - + proto_tree_add_item(tree, hf_vnc_width, tvb, offset, 2, FALSE); offset += 2; @@ -1125,7 +1116,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree_add_item(tree, hf_vnc_padding, tvb, offset, 3, FALSE); offset += 3; /* Skip over 3 bytes of padding */ - + if(tvb_length_remaining(tvb, offset) > 4) { /* Sometimes the desktop name & length is skipped */ proto_tree_add_item(tree, hf_vnc_desktop_name_len, @@ -1144,7 +1135,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, else per_conversation_info->vnc_next_state = VNC_SESSION_STATE_NORMAL_TRAFFIC; break; - + case VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS : col_set_str(pinfo->cinfo, COL_INFO, "TightVNC Interaction Capabilities"); @@ -1219,7 +1210,7 @@ vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset += 1; switch(message_type) { - + case VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT : vnc_client_set_pixel_format(tvb, pinfo, offset, vnc_client_message_type_tree); @@ -1266,7 +1257,7 @@ vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, gint *offset, gint start_offset; guint8 message_type; gint bytes_needed = 0, length_remaining; - + proto_item *ti=NULL; proto_tree *vnc_server_message_type_tree; @@ -1325,11 +1316,11 @@ vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_INFO, "Client set pixel format"); - + proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, FALSE); *offset += 3; /* Skip over 3 bytes of padding */ - + proto_tree_add_item(tree, hf_vnc_client_bits_per_pixel, tvb, *offset, 1, FALSE); vnc_bytes_per_pixel = tvb_get_guint8(tvb, *offset)/8; @@ -1471,13 +1462,13 @@ vnc_client_key_event(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_INFO, "Client key event"); - + proto_tree_add_item(tree, hf_vnc_key_down, tvb, *offset, 1, FALSE); *offset += 1; - + proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 2, FALSE); *offset += 2; /* Skip over 2 bytes of padding */ - + proto_tree_add_item(tree, hf_vnc_key, tvb, *offset, 4, FALSE); *offset += 4; } @@ -1488,7 +1479,7 @@ vnc_client_pointer_event(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_INFO, "Client pointer event"); - + proto_tree_add_item(tree, hf_vnc_button_1_pos, tvb, *offset, 1, FALSE); proto_tree_add_item(tree, hf_vnc_button_2_pos, tvb, *offset, 1, FALSE); proto_tree_add_item(tree, hf_vnc_button_3_pos, tvb, *offset, 1, FALSE); @@ -1498,10 +1489,10 @@ vnc_client_pointer_event(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree_add_item(tree, hf_vnc_button_7_pos, tvb, *offset, 1, FALSE); proto_tree_add_item(tree, hf_vnc_button_8_pos, tvb, *offset, 1, FALSE); *offset += 1; - + proto_tree_add_item(tree, hf_vnc_pointer_x_pos, tvb, *offset, 2, FALSE); *offset += 2; - + proto_tree_add_item(tree, hf_vnc_pointer_y_pos, tvb, *offset, 2, FALSE); *offset += 2; } @@ -1540,17 +1531,17 @@ vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, gint *offset, guint32 encoding_type; proto_item *ti, *ti_x, *ti_y, *ti_width, *ti_height; proto_tree *vnc_rect_tree, *vnc_encoding_type_tree; - - col_set_str(pinfo->cinfo, COL_INFO, "Server framebuffer update"); + + col_set_str(pinfo->cinfo, COL_INFO, "Server framebuffer update"); proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 1, FALSE); *offset += 1; - + num_rects = tvb_get_ntohs(tvb, *offset); proto_tree_add_text(tree, tvb, *offset, 2, "Number of rectangles: %d", num_rects); *offset += 2; - + for(i = 1; i <= num_rects; i++) { VNC_BYTES_NEEDED(12); @@ -1564,16 +1555,16 @@ vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, gint *offset, ti_x = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_x_pos, tvb, *offset, 2, FALSE); *offset += 2; - + ti_y = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_y_pos, tvb, *offset, 2, FALSE); *offset += 2; - + ti_width = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_width, tvb, *offset, 2, FALSE); width = tvb_get_ntohs(tvb, *offset); *offset += 2; - + ti_height = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_height, tvb, *offset, 2, FALSE); height = tvb_get_ntohs(tvb, *offset); @@ -1593,34 +1584,34 @@ vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_item_add_subtree(ti, ett_vnc_encoding_type); switch(encoding_type) { - + case VNC_ENCODING_TYPE_RAW: bytes_needed = vnc_raw_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); break; - + case VNC_ENCODING_TYPE_COPY_RECT: bytes_needed = vnc_copyrect_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); break; - + case VNC_ENCODING_TYPE_RRE: - bytes_needed = + bytes_needed = vnc_rre_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); break; - + case VNC_ENCODING_TYPE_HEXTILE: bytes_needed = vnc_hextile_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); break; - + case VNC_ENCODING_TYPE_RLE: bytes_needed = vnc_zrle_encoding(tvb, pinfo, offset, @@ -1686,7 +1677,7 @@ vnc_raw_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, length = width * height * bytes_per_pixel; VNC_BYTES_NEEDED(length); - proto_tree_add_item(tree, hf_vnc_raw_pixel_data, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_raw_pixel_data, tvb, *offset, length, FALSE); *offset += length; @@ -1698,11 +1689,11 @@ static guint vnc_copyrect_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset, proto_tree *tree, const guint16 width _U_, const guint16 height _U_) { - proto_tree_add_item(tree, hf_vnc_copyrect_src_x_pos, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_copyrect_src_x_pos, tvb, *offset, 2, FALSE); *offset += 2; - proto_tree_add_item(tree, hf_vnc_copyrect_src_y_pos, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_copyrect_src_y_pos, tvb, *offset, 2, FALSE); *offset += 2; @@ -1721,13 +1712,13 @@ vnc_rre_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *subrect_tree; VNC_BYTES_NEEDED(4); - proto_tree_add_item(tree, hf_vnc_rre_num_subrects, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_rre_num_subrects, tvb, *offset, 4, FALSE); num_subrects = tvb_get_ntohl(tvb, *offset); *offset += 4; VNC_BYTES_NEEDED(bytes_per_pixel); - proto_tree_add_item(tree, hf_vnc_rre_bg_pixel, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_rre_bg_pixel, tvb, *offset, bytes_per_pixel, FALSE); *offset += bytes_per_pixel; @@ -1799,7 +1790,7 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, hf_vnc_hextile_subrectscolored, tvb, *offset, 1, FALSE); *offset += 1; - + if(subencoding_mask & 0x1) { /* Raw */ length = width * height * bytes_per_pixel; @@ -1808,7 +1799,7 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree_add_item(tree, hf_vnc_hextile_raw_value, tvb, *offset, length, FALSE); *offset += length; - } else { + } else { if(subencoding_mask & 0x2) { /* Background Specified */ VNC_BYTES_NEEDED(bytes_per_pixel); proto_tree_add_item(tree, hf_vnc_hextile_bg_value, @@ -1833,14 +1824,14 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, FALSE); num_subrects = tvb_get_guint8(tvb, *offset); *offset += 1; - - if(subencoding_mask & 0x16) + + if(subencoding_mask & 0x16) subrect_len = bytes_per_pixel + 2; else subrect_len = 2; bytes_needed = subrect_len * num_subrects; VNC_BYTES_NEEDED(bytes_needed); - + num_subrects_tree = proto_item_add_subtree(ti, ett_vnc_hextile_num_subrects); @@ -1849,13 +1840,13 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset, subrect_len, "Subrectangle #%d", i); - subrect_tree = + subrect_tree = proto_item_add_subtree(ti, ett_vnc_hextile_subrect); if(subencoding_mask & 0x16) { /* Subrects Colored */ proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_pixel_value, tvb, *offset, bytes_per_pixel, FALSE); - + *offset += bytes_per_pixel; } @@ -1874,7 +1865,7 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, } } } - + return 0; /* bytes_needed */ } @@ -1901,7 +1892,7 @@ vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset, #endif VNC_BYTES_NEEDED(4); - proto_tree_add_item(tree, hf_vnc_zrle_len, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_zrle_len, tvb, *offset, 4, FALSE); data_len = tvb_get_ntohl(tvb, *offset); @@ -1953,16 +1944,16 @@ vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset, proto_tree_add_item(zrle_subencoding_tree, hf_vnc_zrle_palette, uncomp_tvb, uncomp_offset, length, FALSE); - + /* XXX - Not complete! */ } - + } else { proto_tree_add_text(tree, tvb, *offset, data_len, "Decompression of ZRLE data failed"); } #endif /* HAVE_LIBZ */ - + *offset += data_len; return 0; /* bytes_needed */ @@ -2208,7 +2199,7 @@ decode_cursor(tvbuff_t *tvb, gint *offset, proto_tree *tree, total_bytes = pixels_bytes + mask_bytes; VNC_BYTES_NEEDED (total_bytes); - proto_tree_add_item(tree, hf_vnc_cursor_encoding_pixels, tvb, *offset, + proto_tree_add_item(tree, hf_vnc_cursor_encoding_pixels, tvb, *offset, pixels_bytes, FALSE); *offset += pixels_bytes; @@ -2287,7 +2278,7 @@ vnc_server_set_colormap_entries(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset, number_of_colors * 6, FALSE); vnc_colormap_num_groups = proto_item_add_subtree(ti, ett_vnc_colormap_num_groups); - + for(counter = 1; counter <= number_of_colors; counter++) { ti = proto_tree_add_text(vnc_colormap_num_groups, tvb, *offset, 6, @@ -2338,7 +2329,7 @@ vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, gint *offset, hf_vnc_server_cut_text_len, tvb, *offset, 4, FALSE); *offset += 4; - + VNC_BYTES_NEEDED(text_len); proto_tree_add_item(tree, hf_vnc_server_cut_text, tvb, *offset, @@ -2885,33 +2876,33 @@ proto_register_vnc(void) { "Cursor encoding pixels", "vnc.cursor_encoding_pixels", FT_BYTES, BASE_NONE, NULL, 0x0, "Cursor encoding pixel data", HFILL } - }, + }, { &hf_vnc_cursor_encoding_bitmask, { "Cursor encoding bitmask", "vnc.cursor_encoding_bitmask", FT_BYTES, BASE_NONE, NULL, 0x0, "Cursor encoding pixel bitmask", HFILL } - }, + }, /* Raw Encoding */ { &hf_vnc_raw_pixel_data, { "Pixel data", "vnc.raw_pixel_data", FT_BYTES, BASE_NONE, NULL, 0x0, "Raw pixel data.", HFILL } - }, + }, /* CopyRect Encoding*/ { &hf_vnc_copyrect_src_x_pos, { "Source x position", "vnc.copyrect_src_x_pos", FT_UINT16, BASE_DEC, NULL, 0x0, "X position of the rectangle to copy from", HFILL } - }, + }, { &hf_vnc_copyrect_src_y_pos, { "Source y position", "vnc.copyrect_src_y_pos", FT_UINT16, BASE_DEC, NULL, 0x0, "Y position of the rectangle to copy from", HFILL } - }, + }, /* RRE Encoding */ { &hf_vnc_rre_num_subrects, @@ -2962,19 +2953,19 @@ proto_register_vnc(void) { "Subencoding type", "vnc.hextile_subencoding", FT_UINT8, BASE_DEC, NULL, 0x0, "Hextile subencoding type.", HFILL } - }, + }, { &hf_vnc_hextile_raw, { "Raw", "vnc.hextile_raw", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x1, "Raw subencoding is used in this tile", HFILL } - }, + }, { &hf_vnc_hextile_raw_value, { "Raw pixel values", "vnc.hextile_raw_value", FT_BYTES, BASE_NONE, NULL, 0x0, "Raw subencoding pixel values", HFILL } - }, + }, { &hf_vnc_hextile_bg, { "Background Specified", "vnc.hextile_bg", @@ -2992,7 +2983,7 @@ proto_register_vnc(void) { "Foreground Specified", "vnc.hextile_fg", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x4, "Foreground Specified subencoding is used in this tile", HFILL } - }, + }, { &hf_vnc_hextile_fg_value, { "Foreground pixel value", "vnc.hextile_fg_value", @@ -3004,49 +2995,49 @@ proto_register_vnc(void) { "Any Subrects", "vnc.hextile_anysubrects", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x8, "Any subrects subencoding is used in this tile", HFILL } - }, + }, { &hf_vnc_hextile_num_subrects, { "Number of subrectangles", "vnc.hextile_num_subrects", FT_UINT8, BASE_DEC, NULL, 0x0, "Number of subrectangles that follow", HFILL } - }, + }, { &hf_vnc_hextile_subrectscolored, { "Subrects Colored", "vnc.hextile_subrectscolored", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, "Subrects colored subencoding is used in this tile", HFILL } - }, + }, { &hf_vnc_hextile_subrect_pixel_value, { "Pixel value", "vnc.hextile_subrect_pixel_value", FT_BYTES, BASE_NONE, NULL, 0x0, "Pixel value of this subrectangle", HFILL } - }, + }, { &hf_vnc_hextile_subrect_x_pos, { "X position", "vnc.hextile_subrect_x_pos", FT_UINT8, BASE_DEC, NULL, 0xF0, /* Top 4 bits */ "X position of this subrectangle", HFILL } - }, + }, { &hf_vnc_hextile_subrect_y_pos, { "Y position", "vnc.hextile_subrect_y_pos", FT_UINT8, BASE_DEC, NULL, 0xF, /* Bottom 4 bits */ "Y position of this subrectangle", HFILL } - }, + }, { &hf_vnc_hextile_subrect_width, { "Width", "vnc.hextile_subrect_width", FT_UINT8, BASE_DEC, NULL, 0xF0, /* Top 4 bits */ "Subrectangle width minus one", HFILL } - }, + }, { &hf_vnc_hextile_subrect_height, { "Height", "vnc.hextile_subrect_height", FT_UINT8, BASE_DEC, NULL, 0xF, /* Bottom 4 bits */ "Subrectangle height minus one", HFILL } - }, + }, /* ZRLE Encoding */ @@ -3098,13 +3089,13 @@ proto_register_vnc(void) FT_UINT16, BASE_DEC, NULL, 0x0, "First color that should be mapped to given RGB intensities", HFILL } }, - + { &hf_vnc_color_groups, { "Color groups", "vnc.color_groups", FT_NONE, BASE_NONE, NULL, 0x0, "Color groups", HFILL } }, - + { &hf_vnc_colormap_num_colors, { "Number of color groups", "vnc.colormap_groups", FT_UINT16, BASE_DEC, NULL, 0x0, @@ -3190,7 +3181,7 @@ proto_reg_handoff_vnc(void) dissector_add("tcp.port", 5501, vnc_handle); dissector_add("tcp.port", 5900, vnc_handle); dissector_add("tcp.port", 5901, vnc_handle); - + heur_dissector_add("tcp", test_vnc_protocol, proto_vnc); /* We don't register a port for the VNC HTTP server because * that simply provides a java program for download via the @@ -3215,7 +3206,7 @@ proto_reg_handoff_vnc(void) /* Register the new port setting */ if (vnc_preference_alternate_port != 0) { - dissector_add("tcp.port", + dissector_add("tcp.port", vnc_preference_alternate_port, vnc_handle); } diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index 49fbd68e65..7a95c6d4c8 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -4352,16 +4352,7 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo, * if we don't have one, and create the state if we don't have * any. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* - * No - create one. - */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* * Is there state attached to this conversation? @@ -4668,15 +4659,7 @@ dissect_x11_replies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * if we don't have one, and create the state if we don't have * any. */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* - * No - create one. - */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); /* * Is there state attached to this conversation? diff --git a/epan/dissectors/packet-x224.c b/epan/dissectors/packet-x224.c index 4c059215f7..1676e91bbd 100644 --- a/epan/dissectors/packet-x224.c +++ b/epan/dissectors/packet-x224.c @@ -164,7 +164,7 @@ dissect_x224_dt(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int off item = proto_tree_add_uint(tree, hf_x224_class, tvb, 0, 0, x224_info->class); PROTO_ITEM_SET_GENERATED(item); - + /* EOT / NR */ proto_tree_add_item(tree, hf_x224_eot, tvb, offset, 1, FALSE); @@ -219,20 +219,8 @@ dissect_x224(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) * We need to track some state for this protocol on a per conversation * basis so we can do neat things like request/response tracking */ - /* - * Do we have a conversation for this connection? - */ - conversation = find_conversation(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) { - /* We don't yet have a conversation, so create one. */ - conversation = conversation_new(pinfo->fd->num, - &pinfo->src, &pinfo->dst, - pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* * Do we already have a state structure for this conv */ diff --git a/epan/dissectors/packet-ziop.c b/epan/dissectors/packet-ziop.c index b38d05caa7..a61a914b9d 100644 --- a/epan/dissectors/packet-ziop.c +++ b/epan/dissectors/packet-ziop.c @@ -81,7 +81,7 @@ static dissector_handle_t data_handle; static dissector_handle_t ziop_tcp_handle; -static const value_string ziop_compressor_ids[] = { +static const value_string ziop_compressor_ids[] = { { 0, "None" }, { 1, "GZIP"}, { 2, "PKZIP"}, @@ -124,21 +124,21 @@ get_ziop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return 0; flags = tvb_get_guint8(tvb, offset + 6); - + stream_is_big_endian = ((flags & 0x1) == 0); - + if (stream_is_big_endian) message_size = tvb_get_ntohl(tvb, offset + 8); else message_size = tvb_get_letohl(tvb, offset + 8); - + return message_size + ZIOP_HEADER_SIZE; } static void dissect_ziop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { - + if ( tvb_memeql(tvb, 0, ZIOP_MAGIC ,4) != 0) { if ( tvb_memeql(tvb, 0, GIOP_MAGIC ,4) == 0) @@ -185,13 +185,8 @@ dissect_ziop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { */ if (!pinfo->fd->flags.visited) { - conversation = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) - { - conversation = conversation_new(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); + /* Set dissector */ conversation_set_dissector(conversation, ziop_tcp_handle); } @@ -207,11 +202,11 @@ dissect_ziop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { /* Main entry point */ -static void +static void dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { guint offset = 0; guint8 giop_version_major, giop_version_minor, message_type; - + proto_tree *ziop_tree = NULL; proto_item *ti; @@ -224,7 +219,7 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { giop_version_minor = tvb_get_guint8(tvb, 5); message_type = tvb_get_guint8(tvb, 7); - if ( (giop_version_major < 1) || + if ( (giop_version_major < 1) || (giop_version_minor < 2) ) /* earlier than GIOP 1.2 */ { col_add_fstr (pinfo->cinfo, COL_INFO, "Version %u.%u", @@ -242,8 +237,8 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { return; } - col_add_fstr (pinfo->cinfo, COL_INFO, "ZIOP %u.%u %s", - giop_version_major, + col_add_fstr (pinfo->cinfo, COL_INFO, "ZIOP %u.%u %s", + giop_version_major, giop_version_minor, val_to_str(message_type, giop_message_types, "Unknown message type (0x%02x)") @@ -291,7 +286,7 @@ void proto_register_ziop (void) { /* A header field is something you can search/filter on. - * + * * We create a structure to register our fields. It consists of an * array of hf_register_info structures, each of which are of the format * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}. @@ -342,7 +337,7 @@ void proto_reg_handoff_ziop (void) { ziop_tcp_handle = create_dissector_handle(dissect_ziop_tcp, proto_ziop); dissector_add_handle("udp.port", ziop_tcp_handle); /* For 'Decode As' */ - + heur_dissector_add("tcp", dissect_ziop_heur, proto_ziop); data_handle = find_dissector("data"); diff --git a/epan/libwireshark.def b/epan/libwireshark.def index c322ba9a12..a7f699fd98 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -419,6 +419,7 @@ filesystem_opt find_circuit find_codec find_conversation +find_or_create_conversation find_dissector find_dissector_table find_protocol_by_id |