Treat TVBs as opaque: use the accessor functions instead of accessing the fields
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 27 May 2011 01:57:33 +0000 (01:57 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 27 May 2011 01:57:33 +0000 (01:57 +0000)
directly.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37420 f5534014-38df-0310-8fa8-9805f1628bb7

14 files changed:
asn1/gsm_map/gsm_map.cnf
epan/dissectors/packet-aim-messaging.c
epan/dissectors/packet-ansi_637.c
epan/dissectors/packet-dcm.c
epan/dissectors/packet-etch.c
epan/dissectors/packet-gsm_map.c
epan/dissectors/packet-gsm_sms.c
epan/dissectors/packet-http.c
epan/dissectors/packet-infiniband.c
epan/dissectors/packet-lsc.c
epan/dissectors/packet-ntlmssp.c
epan/dissectors/packet-sebek.c
epan/dissectors/packet-smb.c
epan/dissectors/packet-smpp.c

index 07c597fbf83bd2487f79e606ba34e0e82a10f4b9..547915b2c8143928d1d79cc699fd17b76baf9d32 100644 (file)
@@ -1,6 +1,6 @@
 
 #.OPT
--b 
+-b
 #-d satcom
 #-s packet-gsm_map-tmp
 -k
@@ -8,10 +8,10 @@
 #.END
 
 #.MODULE
-MAP-BS-Code             gsm_map        
-MAP-TS-Code             gsm_map        
-MAP-SS-Code             gsm_map        
-MAP-ExtensionDataTypes  gsm_map        
+MAP-BS-Code             gsm_map
+MAP-TS-Code             gsm_map
+MAP-SS-Code             gsm_map
+MAP-ExtensionDataTypes  gsm_map
 MAP-CommonDataTypes     gsm_map
 
 MAP-SS-DataTypes        gsm_map.ss
@@ -151,7 +151,7 @@ MAP-DialoguePDU                             B "0.4.0.0.1.1.1.1" "map-DialogueAS"
 #.END
 
 #.TABLE2_BODY ERROR
-       { %(&errorCode)s, "%(_ident)s" },  
+       { %(&errorCode)s, "%(_ident)s" },
 #.END
 
 
@@ -172,7 +172,7 @@ MAP-DialoguePDU                             B "0.4.0.0.1.1.1.1" "map-DialogueAS"
 
 #.FN_BODY  GSMMAPOperationLocalvalue
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
   col_append_str(actx->pinfo->cinfo, COL_INFO, gsm_map_opr_code(opcode));
   col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
 
@@ -184,14 +184,14 @@ MAP-DialoguePDU                           B "0.4.0.0.1.1.1.1" "map-DialogueAS"
 
 #.FN_PARS PrivateExtension/extId  FN_VARIANT = _str  VAL_PTR = &obj_id
 
-#.FN_BODY PrivateExtension/extType     
+#.FN_BODY PrivateExtension/extType
   proto_tree_add_text(tree, tvb, offset, -1, "Extension Data");
   if (obj_id){
         offset=call_ber_oid_callback(obj_id, tvb, offset, actx->pinfo, tree);
   }else{
         call_dissector(data_handle, tvb, actx->pinfo, tree);
         offset = tvb_length_remaining(tvb,offset);
-  }    
+  }
 
 #.FN_PARS  AccessNetworkProtocolId
 
@@ -243,7 +243,7 @@ MAP-DialoguePDU                             B "0.4.0.0.1.1.1.1" "map-DialogueAS"
  if (!parameter_tvb)
        return offset;
 
- subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo); 
+ subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo);
 
  switch (AccessNetworkProtocolId){
        /* ts3G-48006 */
@@ -262,12 +262,12 @@ MAP-DialoguePDU                           B "0.4.0.0.1.1.1.1" "map-DialogueAS"
                        proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 2,1,FALSE);
                        length = tvb_get_guint8(parameter_tvb,0);
                        next_tvb = tvb_new_subset_remaining(parameter_tvb, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        /* ts3G-25413 */
        case 2:
-               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree); 
+               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree);
                break;
        default:
                break;
@@ -382,12 +382,12 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 #.FN_BODY Ext-SS-Status VAL_PTR = &parameter_tvb
  /* Note Ext-SS-Status can have more than one byte */
@@ -403,12 +403,12 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 #.END
 
@@ -432,12 +432,12 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
   tvbuff_t     *parameter_tvb;
   int                  length;
   guint8               out_len;
-  /* XXX - The maximum item label length is 240.  Does this really need to be 1024? 
+  /* XXX - The maximum item label length is 240.  Does this really need to be 1024?
    * use ep_alloc ?
    */
   static unsigned char msgbuf[1024];
   gchar *utf8_text = NULL;
-  GIConv cd;   
+  GIConv cd;
   GError *l_conv_error = NULL;
 
 %(DEFAULT_BODY)s
@@ -463,21 +463,21 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
     case SMS_ENCODING_UCS2_LANG:
        if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1)
        {
-           utf8_text = g_convert_with_iconv(parameter_tvb->real_data, length, cd, NULL, NULL, &l_conv_error);
+           utf8_text = g_convert_with_iconv(tvb_get_ptr(parameter_tvb, 0, length), length, cd, NULL, NULL, &l_conv_error);
            if(!l_conv_error)
                proto_tree_add_text(tree, tvb, 0, length, "USSD String: %%s", utf8_text);
            else
                proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_convert_with_iconv FAILED");
 
            g_free(utf8_text);
-           g_iconv_close(cd);                          
+           g_iconv_close(cd);
        }
        else
            proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark");
 
        break;
     default:
-       break;  
+       break;
   }
 
 #.FN_FTR ForwardingOptions
@@ -575,35 +575,35 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
 
 #.FN_BODY LAIFixedLength VAL_PTR = &parameter_tvb
 
-        tvbuff_t        *parameter_tvb; 
-        proto_tree *subtree; 
+        tvbuff_t        *parameter_tvb;
+        proto_tree *subtree;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-         if (!parameter_tvb) 
-                return offset; 
-        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength); 
-        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE); 
+         if (!parameter_tvb)
+                return offset;
+        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength);
+        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE);
 
-#.FN_BODY RadioResourceInformation VAL_PTR = &parameter_tvb 
-    tvbuff_t        *parameter_tvb; 
+#.FN_BODY RadioResourceInformation VAL_PTR = &parameter_tvb
+    tvbuff_t        *parameter_tvb;
        proto_tree *subtree;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
-                return offset; 
+       if (!parameter_tvb)
+                return offset;
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation); 
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation);
        be_chan_type(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0);
 
 #.FN_BODY RANAP-ServiceHandover VAL_PTR = &parameter_tvb
     tvbuff_t        *parameter_tvb;
        asn1_ctx_t              asn1_ctx;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -613,9 +613,9 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
     tvbuff_t        *parameter_tvb;
        asn1_ctx_t              asn1_ctx;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -625,9 +625,9 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
     tvbuff_t        *parameter_tvb;
        asn1_ctx_t              asn1_ctx;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -647,7 +647,7 @@ and GSM 09.10. The Protocol ID indicates that the message or messages are accord
 For the coding of the messages see GSM 08.06 and GSM 08.08.
 */
  ProtocolId = 0xffffffff;
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -667,7 +667,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, actx->pinfo, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -690,8 +690,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP -- Value 3 is reserved and must not be used*/
@@ -726,9 +726,9 @@ MAP interfaces
  guint8                length;
  tvbuff_t      *next_tvb;
  proto_tree *subtree;
+
  ProtocolId = 0xffffffff;
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -748,7 +748,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, actx->pinfo, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -771,8 +771,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP TODO Is it correct to stripp off two first octets here?*/
@@ -794,29 +794,29 @@ if (!actx->value_ptr)
                break;
        }/*switch (ProtocolId)*/
 
-#.FN_BODY GlobalCellId VAL_PTR = &parameter_tvb 
-    tvbuff_t   *parameter_tvb; 
+#.FN_BODY GlobalCellId VAL_PTR = &parameter_tvb
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
-                return offset; 
+       if (!parameter_tvb)
+                return offset;
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId); 
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId);
        be_cell_id_aux(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0, 0);
 
-#.FN_BODY Ext-GeographicalInformation VAL_PTR = &parameter_tvb 
-    tvbuff_t   *parameter_tvb; 
+#.FN_BODY Ext-GeographicalInformation VAL_PTR = &parameter_tvb
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
-%(DEFAULT_BODY)s 
+%(DEFAULT_BODY)s
 
-       if (!parameter_tvb) 
-                return offset; 
+       if (!parameter_tvb)
+                return offset;
 
     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GeographicalInformation);
-       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree); 
+       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree);
 
 #----------------------------------------------------------------------------------------
 #.TYPE_ATTR
index 00e325e34778719f27935b7c359d3254cb2d9132..66c0a3a640905e06db576f4164b5cf25587434e0 100644 (file)
@@ -302,16 +302,16 @@ dissect_aim_tlv_value_rendezvous(proto_item *ti, guint16 valueid _U_, tvbuff_t *
 {
        int offset = 0;
        proto_tree *entry = proto_item_add_subtree(ti, ett_aim_rendezvous_data);
-    proto_tree_add_item(entry, hf_aim_rendezvous_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN);
-       offset+=2;
+       proto_tree_add_item(entry, hf_aim_rendezvous_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+       offset += 2;
 
-    proto_tree_add_item(entry, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
+       proto_tree_add_item(entry, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
        offset += 8;
 
        offset = dissect_aim_capability(entry, tvb, offset);
 
        return dissect_aim_tlv_sequence(tvb, pinfo, offset, entry,
-                                                       aim_rendezvous_tlvs);
+                                       aim_rendezvous_tlvs);
 }
 
 static int
@@ -324,20 +324,20 @@ dissect_aim_msg_outgoing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tree
        int buddyname_length;
 
        /* ICBM Cookie */
-    proto_tree_add_item(msg_tree, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
+       proto_tree_add_item(msg_tree, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
        offset += 8;
 
        /* Message Channel ID */
        channel_id = tvb_get_ntohs(tvb, offset);
        proto_tree_add_item(msg_tree, hf_aim_message_channel_id, tvb, offset, 2,
-                        ENC_BIG_ENDIAN);
+                           ENC_BIG_ENDIAN);
        offset += 2;
 
        /* Add the outgoing username to the info column */
        buddyname_length = aim_get_buddyname(buddyname, tvb, offset,
                                                          offset + 1);
        col_append_fstr(pinfo->cinfo, COL_INFO, " to: %s",
-                           format_text(buddyname, buddyname_length));
+                       format_text(buddyname, buddyname_length));
 
        offset = dissect_aim_buddyname(tvb, pinfo, offset, msg_tree);
 
@@ -359,7 +359,7 @@ dissect_aim_msg_incoming(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tree
        guint16 channel_id;
 
        /* ICBM Cookie */
-    proto_tree_add_item(msg_tree, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
+       proto_tree_add_item(msg_tree, hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
        offset += 8;
 
        /* Message Channel ID */
@@ -383,12 +383,12 @@ static int
 dissect_aim_msg_params(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *msg_tree)
 {
        int offset = 0;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_msg_flags, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_max_snac_size, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_max_sender_warnlevel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_max_receiver_warnlevel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_min_msg_interval, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_msg_flags, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_max_snac_size, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_max_sender_warnlevel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_max_receiver_warnlevel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_min_msg_interval, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
        return offset;
 }
 
@@ -396,7 +396,7 @@ static int
 dissect_aim_msg_evil_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tree)
 {
        int offset = 0;
-    proto_tree_add_item(msg_tree, hf_aim_icbm_evil, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_evil, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        return dissect_aim_buddyname(tvb, pinfo, offset, msg_tree);
 }
 
@@ -405,8 +405,8 @@ static int
 dissect_aim_msg_evil_repl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *msg_tree)
 {
        int offset = 0;
-    proto_tree_add_item(msg_tree, hf_aim_evil_warn_level, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_evil_new_warn_level, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_evil_warn_level, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_evil_new_warn_level, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        return offset;
 }
 
@@ -414,10 +414,10 @@ static int
 dissect_aim_msg_minityping(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tree)
 {
        int offset = 0;
-    proto_tree_add_item(msg_tree,hf_aim_icbm_notification_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
-    proto_tree_add_item(msg_tree,hf_aim_icbm_notification_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_notification_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_notification_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        offset = dissect_aim_buddyname(tvb, pinfo, offset, msg_tree);
-    proto_tree_add_item(msg_tree,hf_aim_icbm_notification_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_notification_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        return offset;
 }
 
@@ -430,11 +430,11 @@ typedef struct _aim_client_plugin
 static const aim_client_plugin known_client_plugins[] = {
        { "None",
         {0x0, 0x0, 0x0,
-               {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}},
+        {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}},
 
        { "Status Manager",
         {0xD140CF10, 0xE94F, 0x11D3,
-               {0xBC, 0xD2, 0x00, 0x04, 0xAC, 0x96, 0xDD, 0x96}}},
+        {0xBC, 0xD2, 0x00, 0x04, 0xAC, 0x96, 0xDD, 0x96}}},
 
        { NULL, {0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } }
 };
@@ -475,7 +475,7 @@ dissect_aim_plugin(proto_tree *entry, tvbuff_t *tvb, int offset, e_uuid_t* out_p
                plugin ? plugin->name:"Unknown", uuid.Data1, uuid.Data2,
                uuid.Data3, uuid.Data4[0], uuid.Data4[1], uuid.Data4[2],
                uuid.Data4[3], uuid.Data4[4],   uuid.Data4[5], uuid.Data4[6],
-                       uuid.Data4[7]
+               uuid.Data4[7]
        );
 
        return offset+16;
@@ -493,7 +493,7 @@ dissect_aim_rendezvous_extended_message(tvbuff_t *tvb, proto_tree *msg_tree)
 
        /* TODO: parse and present message_type */
        /* message_type = tvb_get_guint8(tvb, offset); */
-    proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1;
+       proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1;
        message_flags = tvb_get_guint8(tvb, offset);
        ti_flags = proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_flags, tvb, offset, 1, message_flags);
        flags_entry = proto_item_add_subtree(ti_flags, ett_aim_extended_data_message_flags);
@@ -501,13 +501,13 @@ dissect_aim_rendezvous_extended_message(tvbuff_t *tvb, proto_tree *msg_tree)
        proto_tree_add_boolean(flags_entry, hf_aim_rendezvous_extended_data_message_flags_auto, tvb, offset, 1, message_flags);
        proto_tree_add_boolean(flags_entry, hf_aim_rendezvous_extended_data_message_flags_multi, tvb, offset, 1, message_flags);
        offset+=1;
-    proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_status_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-    proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_priority_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_status_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_priority_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        text_length = tvb_get_letohs(tvb, offset);
-    proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_text_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_text_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        text = tvb_get_ephemeral_string(tvb, offset, text_length);
        proto_tree_add_text(msg_tree, tvb, offset, text_length, "Text: %s", text); offset+=text_length;
-       offset = tvb->length;
+       offset = tvb_length(tvb);
 
        return offset;
 }
@@ -543,11 +543,11 @@ dissect_aim_tlv_value_extended_data(proto_item *ti, guint16 valueid _U_, tvbuff_
        start_offset = offset;
        /* TODO: parse and present protocol version */
        /* protocol_version = tvb_get_ntohs(tvb, offset); */
-    proto_tree_add_item(entry, hf_aim_icbm_client_err_protocol_version, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(entry, hf_aim_icbm_client_err_protocol_version, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
 
        offset = dissect_aim_plugin(entry, tvb, offset, &plugin_uuid);
        proto_tree_add_text(entry, tvb, offset, 2, "Unknown"); offset += 2;
-    proto_tree_add_item(entry, hf_aim_icbm_client_err_client_caps_flags, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
+       proto_tree_add_item(entry, hf_aim_icbm_client_err_client_caps_flags, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
        proto_tree_add_text(entry, tvb, offset, 1, "Unknown");  offset += 1;
        proto_tree_add_text(entry, tvb, offset, 2, "Downcounter?"); offset += 2;
 
@@ -571,7 +571,7 @@ dissect_aim_tlv_value_extended_data(proto_item *ti, guint16 valueid _U_, tvbuff_
                /* plugin-specific data follows */
                proto_tree_add_text(entry, tvb, offset, -1, "Plugin-specific data");
        }
-       offset = tvb->length;
+       offset = tvb_length(tvb);
 
        return offset;
 }
@@ -581,7 +581,7 @@ dissect_aim_msg_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tree)
 {
        int offset = 0;
 
-    proto_tree_add_item(msg_tree,hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
 
        proto_tree_add_item(msg_tree, hf_aim_message_channel_id, tvb, offset, 2,
                         ENC_BIG_ENDIAN); offset += 2;
@@ -597,29 +597,29 @@ dissect_aim_msg_client_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *msg_tr
        int offset = 0;
        guint16 channel, reason;
 
-    proto_tree_add_item(msg_tree,hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_cookie, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8;
        channel = tvb_get_ntohs(tvb, offset);
-    proto_tree_add_item(msg_tree,hf_aim_icbm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree,hf_aim_icbm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
        offset = dissect_aim_buddyname(tvb, pinfo, offset, msg_tree);
        reason = tvb_get_ntohs(tvb, offset);
-    proto_tree_add_item(msg_tree, hf_aim_icbm_client_err_reason, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+       proto_tree_add_item(msg_tree, hf_aim_icbm_client_err_reason, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
 
        if (reason == CLIENT_ERR__REASON_CHANNEL_SPECIFIC && tvb_length_remaining(tvb, offset) > 0)
        {
                switch (channel)
                {
                case ICBM_CHANNEL_RENDEZVOUS:
-            proto_tree_add_item(msg_tree, hf_aim_icbm_rendezvous_nak_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
-            proto_tree_add_item(msg_tree, hf_aim_icbm_rendezvous_nak, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+                       proto_tree_add_item(msg_tree, hf_aim_icbm_rendezvous_nak_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
+                       proto_tree_add_item(msg_tree, hf_aim_icbm_rendezvous_nak, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
                        break;
 
                default:
-                 {
-                   tvbuff_t *subtvb = tvb_new_subset_remaining(tvb, offset);
-                   proto_item *ti_extended_data = proto_tree_add_text(msg_tree, tvb, offset, -1, "Extended Data");
-                   dissect_aim_tlv_value_extended_data(ti_extended_data, 0, subtvb, pinfo);
-                   break;
-                 }
+                   {
+                       tvbuff_t *subtvb = tvb_new_subset_remaining(tvb, offset);
+                       proto_item *ti_extended_data = proto_tree_add_text(msg_tree, tvb, offset, -1, "Extended Data");
+                       dissect_aim_tlv_value_extended_data(ti_extended_data, 0, subtvb, pinfo);
+                       break;
+                   }
                }
        }
 
index 3c20368227adcf5e0816fcf75b59380e985d53aa..a51fee76639a2192e0e49cd93b972711d85dc514 100644 (file)
@@ -733,7 +733,7 @@ tele_param_user_data(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
 
         if ((cd = g_iconv_open("UTF-8","iso-8859-8")) != (GIConv)-1)
         {
-            utf8_text = g_convert_with_iconv(tvb->real_data +  offset, num_fields , cd , NULL , NULL , &l_conv_error);
+            utf8_text = g_convert_with_iconv(tvb_get_ptr(tvb, offset, num_fields), num_fields , cd , NULL , NULL , &l_conv_error);
             if(!l_conv_error)
             {
                 proto_tree_add_text(tree, tvb, offset, num_fields, "Encoded user data: %s", utf8_text);
index 2e5691c38ff08d08632a7316441d31a33f79dcc5..33a8958067202217e40f4a87d1669fdde924b297 100644 (file)
@@ -5146,11 +5146,11 @@ dissect_dcm_pdv_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     /* Create PDV structure:
 
        Since we can have multiple PDV per packet (offset) and
-       multiple merged packets per PDV (tvb->raw_offset)
+       multiple merged packets per PDV (the tvb raw_offset)
        we need both values to uniquely identify a PDV
     */
 
-    *pdv = dcm_state_pdv_get(pctx, pinfo->fd->num, tvb->raw_offset+offset, TRUE);
+    *pdv = dcm_state_pdv_get(pctx, pinfo->fd->num, TVB_RAW_OFFSET(tvb)+offset, TRUE);
     if (*pdv == NULL) {
        return 0;                   /* Failed to allocate memory */
     }
@@ -6280,6 +6280,7 @@ dissect_dcm_pdv_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                offset += pdv_body_len;
            }
            else {
+               guint next_tvb_length = tvb_length(next_tvb);
                /* Decode reassembled data */
 
                if (tree || have_tap_listener(dicom_eo_tap)) {
@@ -6289,15 +6290,15 @@ dissect_dcm_pdv_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                       i.e Class & Instance UID, so the export dialog has all information and
                       that the dicome header is complete
                    */
-                   offset += dissect_dcm_pdv_body(next_tvb, pinfo, tree, pdv, 0, next_tvb->length, pdv_description);
+                   offset += dissect_dcm_pdv_body(next_tvb, pinfo, tree, pdv, 0, next_tvb_length, pdv_description);
                }
 
                if (have_tap_listener(dicom_eo_tap)) {
                    /* Copy pure DICOM data to buffer, no PDV flags */
 
-                   pdv->data = g_malloc(next_tvb->length);      /* will be freed in dcm_export_create_object() */
-                    tvb_memcpy(next_tvb, pdv->data, 0, next_tvb->length);
-                    pdv->data_len = next_tvb->length;
+                   pdv->data = g_malloc(next_tvb_length);      /* will be freed in dcm_export_create_object() */
+                    tvb_memcpy(next_tvb, pdv->data, 0, next_tvb_length);
+                    pdv->data_len = next_tvb_length;
 
                    /* Copy to export buffer */
                    dcm_export_create_object(pinfo, assoc, pdv);
index 875736faab9b34eee7f4cb95833d08165bd91ea2..69885ef972951ecde6e26114e488db72b2091e9d 100644 (file)
@@ -610,7 +610,7 @@ read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
   int i;
 
   ti = proto_tree_add_item(etch_tree, hf_etch_struct, tvb, *offset,
-                           tvb->length - *offset, ENC_NA);
+                           tvb_length(tvb) - *offset, ENC_NA);
   new_tree = proto_item_add_subtree(ti, ett_etch_struct);
 
   if (add_type_field) {
index 5d1ae5249464f89bff94bd5a394a6bf4ef011941..6a12c77a95e35509fdc8e7d076d77c8afc980ce8 100644 (file)
@@ -2856,7 +2856,7 @@ dissect_gsm_map_T_extType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
   }else{
         call_dissector(data_handle, tvb, actx->pinfo, tree);
         offset = tvb_length_remaining(tvb,offset);
-  }    
+  }
 
 
 
@@ -3104,11 +3104,11 @@ MAP interfaces
  guint8                length;
  tvbuff_t      *next_tvb;
  proto_tree *subtree;
+
  ProtocolId = 0xffffffff;
   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    gsm_map_ExternalSignalInfo_sequence, hf_index, ett_gsm_map_ExternalSignalInfo);
+
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -3128,7 +3128,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, actx->pinfo, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -3151,8 +3151,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP TODO Is it correct to stripp off two first octets here?*/
@@ -3246,7 +3246,7 @@ dissect_gsm_map_LongSignalInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
  if (!parameter_tvb)
        return offset;
 
- subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo); 
+ subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo);
 
  switch (AccessNetworkProtocolId){
        /* ts3G-48006 */
@@ -3265,12 +3265,12 @@ dissect_gsm_map_LongSignalInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
                        proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 2,1,FALSE);
                        length = tvb_get_guint8(parameter_tvb,0);
                        next_tvb = tvb_new_subset_remaining(parameter_tvb, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        /* ts3G-25413 */
        case 2:
-               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree); 
+               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree);
                break;
        default:
                break;
@@ -3453,17 +3453,17 @@ dissect_gsm_map_HLR_List(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 int
 dissect_gsm_map_GlobalCellId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 798 "../../asn1/gsm_map/gsm_map.cnf"
-    tvbuff_t   *parameter_tvb; 
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId); 
+       if (!parameter_tvb)
+                return offset;
+
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId);
        be_cell_id_aux(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0, 0);
 
 
@@ -3721,17 +3721,17 @@ int
 dissect_gsm_map_LAIFixedLength(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 577 "../../asn1/gsm_map/gsm_map.cnf"
 
-        tvbuff_t        *parameter_tvb; 
-        proto_tree *subtree; 
+        tvbuff_t        *parameter_tvb;
+        proto_tree *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-         if (!parameter_tvb) 
-                return offset; 
-        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength); 
-        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE); 
+
+         if (!parameter_tvb)
+                return offset;
+        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength);
+        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE);
 
 
 
@@ -3861,12 +3861,12 @@ dissect_gsm_map_Ext_SS_Status(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 
 
@@ -3993,12 +3993,12 @@ dissect_gsm_map_ss_SS_Status(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 
 
@@ -4362,12 +4362,12 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
   tvbuff_t     *parameter_tvb;
   int                  length;
   guint8               out_len;
-  /* XXX - The maximum item label length is 240.  Does this really need to be 1024? 
+  /* XXX - The maximum item label length is 240.  Does this really need to be 1024?
    * use ep_alloc ?
    */
   static unsigned char msgbuf[1024];
   gchar *utf8_text = NULL;
-  GIConv cd;   
+  GIConv cd;
   GError *l_conv_error = NULL;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -4395,21 +4395,21 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
     case SMS_ENCODING_UCS2_LANG:
        if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1)
        {
-           utf8_text = g_convert_with_iconv(parameter_tvb->real_data, length, cd, NULL, NULL, &l_conv_error);
+           utf8_text = g_convert_with_iconv(tvb_get_ptr(parameter_tvb, 0, length), length, cd, NULL, NULL, &l_conv_error);
            if(!l_conv_error)
                proto_tree_add_text(tree, tvb, 0, length, "USSD String: %s", utf8_text);
            else
                proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_convert_with_iconv FAILED");
 
            g_free(utf8_text);
-           g_iconv_close(cd);                          
+           g_iconv_close(cd);
        }
        else
            proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark");
 
        break;
     default:
-       break;  
+       break;
   }
 
 
@@ -7723,9 +7723,9 @@ dissect_gsm_map_ms_IntegrityProtectionInformation(gboolean implicit_tag _U_, tvb
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -7746,9 +7746,9 @@ dissect_gsm_map_ms_EncryptionInformation(gboolean implicit_tag _U_, tvbuff_t *tv
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -7826,17 +7826,17 @@ dissect_gsm_map_ms_AllowedUMTS_Algorithms(gboolean implicit_tag _U_, tvbuff_t *t
 static int
 dissect_gsm_map_ms_RadioResourceInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 589 "../../asn1/gsm_map/gsm_map.cnf"
-    tvbuff_t        *parameter_tvb; 
+    tvbuff_t        *parameter_tvb;
        proto_tree *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation); 
+       if (!parameter_tvb)
+                return offset;
+
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation);
        be_chan_type(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0);
 
 
@@ -7902,9 +7902,9 @@ dissect_gsm_map_ms_RANAP_ServiceHandover(gboolean implicit_tag _U_, tvbuff_t *tv
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -13934,18 +13934,18 @@ dissect_gsm_map_lcs_ProvideSubscriberLocation_Arg(gboolean implicit_tag _U_, tvb
 int
 dissect_gsm_map_lcs_Ext_GeographicalInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 810 "../../asn1/gsm_map/gsm_map.cnf"
-    tvbuff_t   *parameter_tvb; 
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
+
+       if (!parameter_tvb)
+                return offset;
 
     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GeographicalInformation);
-       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree); 
+       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree);
 
 
 
@@ -14895,7 +14895,7 @@ dissect_gsm_old_GSMMAPOperationLocalvalue(gboolean implicit_tag _U_, tvbuff_t *t
 
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                                 &opcode);
+
   col_append_str(actx->pinfo->cinfo, COL_INFO, gsm_map_opr_code(opcode));
   col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
 
@@ -15348,7 +15348,7 @@ For the coding of the messages see GSM 08.06 and GSM 08.08.
  ProtocolId = 0xffffffff;
   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    gsm_old_Bss_APDU_sequence, hf_index, ett_gsm_old_Bss_APDU);
+
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -15368,7 +15368,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, actx->pinfo, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -15391,8 +15391,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP -- Value 3 is reserved and must not be used*/
index e0eee73df5911d3e41a1c55c8a19b8ea79730aff..c6af50821da903b0706121bf7e3d63efb65c720b 100644 (file)
@@ -2695,7 +2695,7 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
                 */
                out_len = 0;
 
-               total_sms_len = sm_tvb->length;
+               total_sms_len = tvb_length(sm_tvb);
                for(i = 0 ; i < g_frags; i++)
                {
                    /* maximum len msg in 7 bit with csm8 header*/
@@ -2739,10 +2739,12 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
        {
            if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv)-1)
            {
+               guint8 rep_len = tvb_reported_length(sm_tvb);
+
                if(!(reassembled && g_pinfo->fd->num == reassembled_in))
                {
                    /* Show unreassembled SMS */
-                   utf8_text = g_convert_with_iconv(sm_tvb->real_data, sm_tvb->reported_length , cd , NULL , NULL , &l_conv_error);
+                   utf8_text = g_convert_with_iconv(tvb_get_ptr(sm_tvb, 0, rep_len), rep_len , cd , NULL , NULL , &l_conv_error);
                    if(!l_conv_error) {
                        /* XXX - using proto_tree_add_string() doesn't work */
                        ucs2_item = proto_tree_add_string_format_value(subtree, hf_gsm_sms_text, tvb,
@@ -2756,7 +2758,7 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
                     *  so that the text doesn't get truncated when we add it to
                     *  the tree.
                     */
-                   utf8_text = g_convert_with_iconv(sm_tvb->real_data, sm_tvb->reported_length , cd , NULL , NULL , &l_conv_error);
+                   utf8_text = g_convert_with_iconv(tvb_get_ptr(sm_tvb, 0, rep_len), rep_len , cd , NULL , NULL , &l_conv_error);
                    if(!l_conv_error)
                    {
                        len_sms = (int)strlen(utf8_text);
index 317a74e5819b4d974025f3780a0ce182ae6ba312..71f1151d945f9f20b5be769c52dac13c0d3460b8 100644 (file)
@@ -1179,8 +1179,8 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
                        eo_info->hostname = conv_data->http_host;
                        eo_info->filename = conv_data->request_uri;
                        eo_info->content_type = headers.content_type;
-                       eo_info->payload_len = next_tvb->length;
-                       eo_info->payload_data = next_tvb->real_data;
+                       eo_info->payload_len = tvb_length(next_tvb);
+                       eo_info->payload_data = tvb_get_ptr(next_tvb, 0, eo_info->payload_len);
 
                        tap_queue_packet(http_eo_tap, pinfo, eo_info);
                }
index a82c144f5e460c3dfe1291cd9cef99a18680bf80..75dd567d557c516485d2c8bfdc39f05a452382e7 100644 (file)
@@ -1618,7 +1618,7 @@ dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
     gint32 nextHeaderSequence = -1; /* defined by this dissector. #define which indicates the upcoming header sequence from OpCode */
     guint16 payloadLength = 0;      /* Payload Length should it exist */
     guint8 nxtHdr = 0;              /* Keyed off for header dissection order */
-    guint16 packetLength = 0;       /* Packet Length.  We track this as tvb->length - offset.   */
+    guint16 packetLength = 0;       /* Packet Length.  We track this as tvb_length - offset.   */
                                     /*  It provides the parsing methods a known size            */
                                     /*   that must be available for that header.                */
     struct e_in6_addr SRCgid;       /* Structures to hold GIDs should we need them */
@@ -2479,7 +2479,7 @@ static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
     {
 
         /* Calculation for Payload:
-        * (tvb->length) Length of entire packet - (local_offset) Starting byte of Payload Data
+        * (tvb_length) Length of entire packet - (local_offset) Starting byte of Payload Data
         * offset addition is more complex for the payload.
         * We need the total length of the packet, - length of previous headers, + offset where payload started.
         * We also need  to reserve 6 bytes for the CRCs which are not actually part of the payload.  */
index c578022d48bc56c32d7df3b687d948431c8dbcfe..d725dd981ab63b17d51d46c125459cf139bc2c2b 100644 (file)
@@ -152,7 +152,7 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   col_clear(pinfo->cinfo, COL_INFO);
 
   /* Too little data? */
-  if (tvb->length < LSC_MIN_LEN)
+  if (tvb_length(tvb) < LSC_MIN_LEN)
   {
     col_set_str(pinfo->cinfo, COL_INFO, "[Too short]");
     return;
@@ -205,9 +205,9 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                  val_to_str(op_code, op_code_vals, "Unknown op code (0x%x)"),
                  stream);
 
-    if (tvb->length < expected_len)
+    if (tvb_length(tvb) < expected_len)
       col_append_str(pinfo->cinfo, COL_INFO, " [Too short]");
-    else if (tvb->length > expected_len)
+    else if (tvb_length(tvb) > expected_len)
       col_append_str(pinfo->cinfo, COL_INFO, " [Too long]");
   }
 
@@ -346,64 +346,64 @@ dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 /* Register the protocol with Wireshark */
 void
 proto_register_lsc(void)
-{                 
+{
   module_t *lsc_module;
 
   /* Setup list of header fields */
   static hf_register_info hf[] = {
     { &hf_lsc_version,
       { "Version", "lsc.version",
-        FT_UINT8, BASE_DEC, NULL, 0,          
+        FT_UINT8, BASE_DEC, NULL, 0,
         "Version of the Pegasus LSC protocol", HFILL }
     },
     { &hf_lsc_trans_id,
       { "Transaction ID", "lsc.trans_id",
-        FT_UINT8, BASE_DEC, NULL, 0,          
+        FT_UINT8, BASE_DEC, NULL, 0,
         NULL, HFILL }
     },
     { &hf_lsc_op_code,
       { "Op Code", "lsc.op_code",
-        FT_UINT8, BASE_HEX, VALS(op_code_vals), 0,          
+        FT_UINT8, BASE_HEX, VALS(op_code_vals), 0,
         "Operation Code", HFILL }
     },
     { &hf_lsc_status_code,
       { "Status Code", "lsc.status_code",
-        FT_UINT8, BASE_HEX, VALS(status_code_vals), 0,          
+        FT_UINT8, BASE_HEX, VALS(status_code_vals), 0,
         NULL, HFILL }
     },
     { &hf_lsc_stream_handle,
       { "Stream Handle", "lsc.stream_handle",
-        FT_UINT32, BASE_DEC, NULL, 0,          
+        FT_UINT32, BASE_DEC, NULL, 0,
         "Stream identification handle", HFILL }
     },
     { &hf_lsc_start_npt,
       { "Start NPT", "lsc.start_npt",
-        FT_INT32, BASE_DEC, NULL, 0,          
+        FT_INT32, BASE_DEC, NULL, 0,
         "Start Time (milliseconds)", HFILL }
     },
     { &hf_lsc_stop_npt,
       { "Stop NPT", "lsc.stop_npt",
-        FT_INT32, BASE_DEC, NULL, 0,          
+        FT_INT32, BASE_DEC, NULL, 0,
         "Stop Time (milliseconds)", HFILL }
     },
     { &hf_lsc_current_npt,
       { "Current NPT", "lsc.current_npt",
-        FT_INT32, BASE_DEC, NULL, 0,          
+        FT_INT32, BASE_DEC, NULL, 0,
         "Current Time (milliseconds)", HFILL }
     },
     { &hf_lsc_scale_num,
       { "Scale Numerator", "lsc.scale_num",
-        FT_INT16, BASE_DEC, NULL, 0,          
+        FT_INT16, BASE_DEC, NULL, 0,
         NULL, HFILL }
     },
     { &hf_lsc_scale_denom,
       { "Scale Denominator", "lsc.scale_denum",
-        FT_UINT16, BASE_DEC, NULL, 0,          
+        FT_UINT16, BASE_DEC, NULL, 0,
         NULL, HFILL }
     },
     { &hf_lsc_mode,
       { "Server Mode", "lsc.mode",
-        FT_UINT8, BASE_HEX, VALS(mode_vals), 0,          
+        FT_UINT8, BASE_HEX, VALS(mode_vals), 0,
         "Current Server Mode", HFILL }
     }
   };
@@ -421,10 +421,10 @@ proto_register_lsc(void)
   proto_register_field_array(proto_lsc, hf, array_length(hf));
   proto_register_subtree_array(ett, array_length(ett));
 
-  /* Register preferences module */       
+  /* Register preferences module */
   lsc_module = prefs_register_protocol(proto_lsc, proto_reg_handoff_lsc);
-     
-  /* Register preferences */        
+
+  /* Register preferences */
   prefs_register_uint_preference(lsc_module, "port",
                            "LSC Port",
                            "Set the TCP or UDP port for Pegasus LSC messages",
index 0e61af1f72150a4b42a568e54c98e61fc37e1181..8fcb6763328ebafcf05a1173ef517a662bdee9e4 100644 (file)
@@ -970,7 +970,7 @@ dissect_ntlmssp_blob (tvbuff_t *tvb, int offset,
     if (blob_length < MAX_BLOB_SIZE)
     {
       tvb_memcpy(tvb, result->contents, blob_offset, blob_length);
-      if (blob_hf == hf_ntlmssp_auth_lmresponse && !(memcmp(tvb->real_data+blob_offset+8,"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",NTLMSSP_KEY_LEN)))
+      if (blob_hf == hf_ntlmssp_auth_lmresponse && !(tvb_memeql(tvb, blob_offset+8, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", NTLMSSP_KEY_LEN)))
       {
         proto_tree_add_item (ntlmssp_tree,
                              hf_ntlmssp_ntlm_client_challenge,
index 5c28e44be088fe57ef734a783b0bf1cd409b9c8e..96f1ec73bc488d85c3c491f362786ec418b1b2df 100644 (file)
@@ -136,7 +136,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        {
                col_set_str(pinfo->cinfo, COL_INFO, "SEBEK - ");
 
-               if (tvb->length<6)
+               if (tvb_length(tvb)<6)
                        sebek_ver = 0;
                 else
                        sebek_ver = tvb_get_ntohs(tvb, 4);
@@ -167,7 +167,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                sebek_tree = proto_item_add_subtree(ti, ett_sebek);
 
                /* check for minimum length before deciding where to go*/
-               if (tvb->length<6)
+               if (tvb_length(tvb)<6)
                        sebek_ver = 0;
                else
                        sebek_ver = tvb_get_ntohs(tvb, 4);
index 78318d214745a5b155fa2f7c0d87d406b456146e..4be2a3ad17576af4a5dc89a7e016728f1f7af30e 100644 (file)
@@ -6575,22 +6575,29 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                                 if (fid_info->fsi->filename)
                                         eo_info->filename = (gchar *) fid_info->fsi->filename;
                         if(!eo_info->filename) eo_info->filename = ep_strdup_printf("\\FILEID_%i",fid);
-                        eo_info->fid_type = fid_info->type;                                             eo_info->end_of_file = fid_info->end_of_file;
-                } else {                                                                                eo_info->fid_type=SMB_FID_TYPE_UNKNOWN;
-                        eo_info->filename = ep_strdup_printf("\\FILEID_%i",fid);                        eo_info->end_of_file = 0;
-                }                                                                               eo_info->fid=fid;
-                eo_info->tid=si->tid;                                                           eo_info->uid=si->uid;
-                eo_info->payload_len = datalen;                                                 eo_info->payload_data = data_tvb->real_data;
-                eo_info->smb_file_offset=rwi->offset;                                           eo_info->smb_chunk_len=rwi->len;
+                        eo_info->fid_type = fid_info->type;
+                        eo_info->end_of_file = fid_info->end_of_file;
+                } else {
+                        eo_info->fid_type=SMB_FID_TYPE_UNKNOWN;
+                        eo_info->filename = ep_strdup_printf("\\FILEID_%i",fid);
+                        eo_info->end_of_file = 0;
+                }
+                eo_info->fid=fid;
+                eo_info->tid=si->tid;
+                eo_info->uid=si->uid;
+                eo_info->payload_len = datalen;
+                eo_info->payload_data = tvb_get_ptr(data_tvb, 0, datalen);
+                eo_info->smb_file_offset=rwi->offset;
+                eo_info->smb_chunk_len=rwi->len;
                 eo_info->cmd=SMB_COM_READ_ANDX;
                 /* Queue data to the listener */
 
                 tap_queue_packet(smb_eo_tap, pinfo, eo_info);
         }
 
-       END_OF_SMB
+        END_OF_SMB
 
-       if (cmd != 0xff) {      /* there is an andX command */
+        if (cmd != 0xff) {   /* there is an andX command */
                if (andxoffset < offset)
                        THROW(ReportedBoundsError);
                dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE);
@@ -6815,7 +6822,7 @@ d);) */
                 eo_info->tid=si->tid;
                 eo_info->uid=si->uid;
                 eo_info->payload_len = datalen;
-                eo_info->payload_data = data_tvb->real_data;
+                eo_info->payload_data = tvb_get_ptr(data_tvb, 0, datalen);
                 eo_info->smb_file_offset=rwi->offset;
                 eo_info->smb_chunk_len=rwi->len;
                 eo_info->cmd=SMB_COM_WRITE_ANDX;
index 256694e06acdf5d804b750842c541666ecf3566a..7e3a047675bb9b44874e3eaf946f36b23d268ef3 100644 (file)
@@ -2288,7 +2288,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
      * Create display subtree for the protocol
      */
     if (tree) {
-        ti = proto_tree_add_item (tree, proto_smpp, tvb, 0, tvb->length, FALSE);
+        ti = proto_tree_add_item (tree, proto_smpp, tvb, 0, tvb_length(tvb), FALSE);
         smpp_tree = proto_item_add_subtree (ti, ett_smpp);
     }