Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 11 Sep 2005 21:25:37 +0000 (21:25 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 11 Sep 2005 21:25:37 +0000 (21:25 +0000)
and that extract IPv6 addresses into a "struct e_in6_addr", with
tvb_get_ipv4() and tvb_get_ipv6() calls - except for some that we
remove, by using proto_tree_add_item(), rather than replacing.

Have epan/tvbuff.h include epan/ipv6-utils.h, to define "struct
e_in6_addr" (not necessary to declare the tvbuff routines, but including
it there means "struct e_in6_addr" is guaranteed to be defined before
those declarations, so we don't get compiler complaints if we define it
*after* those declarations).

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

47 files changed:
asn1/h225/h225.cnf
asn1/h245/h245.cnf
epan/addr_and_mask.c
epan/dissectors/packet-aodv.c
epan/dissectors/packet-arp.c
epan/dissectors/packet-auto_rp.c
epan/dissectors/packet-bgp.c
epan/dissectors/packet-bootp.c
epan/dissectors/packet-cdp.c
epan/dissectors/packet-chdlc.c
epan/dissectors/packet-cops.c
epan/dissectors/packet-dhcpv6.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-gsm_a.c
epan/dissectors/packet-gtp.c
epan/dissectors/packet-h225.c
epan/dissectors/packet-h245.c
epan/dissectors/packet-h245.h
epan/dissectors/packet-icmpv6.c
epan/dissectors/packet-igmp.c
epan/dissectors/packet-ip.c
epan/dissectors/packet-isakmp.c
epan/dissectors/packet-isis-lsp.c
epan/dissectors/packet-isup.c
epan/dissectors/packet-ldp.c
epan/dissectors/packet-manolito.c
epan/dissectors/packet-msdp.c
epan/dissectors/packet-msnip.c
epan/dissectors/packet-msproxy.c
epan/dissectors/packet-nbns.c
epan/dissectors/packet-netflow.c
epan/dissectors/packet-nsip.c
epan/dissectors/packet-ntp.c
epan/dissectors/packet-olsr.c
epan/dissectors/packet-quake3.c
epan/dissectors/packet-skinny.c
epan/dissectors/packet-socks.c
epan/dissectors/packet-teredo.c
epan/dissectors/packet-uma.c
epan/dissectors/packet-wccp.c
epan/dissectors/packet-wsp.c
epan/packet.c
epan/proto.c
epan/tvbuff.c
epan/tvbuff.h
plugins/opsi/packet-opsi.c
plugins/profinet/packet-pn-dcp.c

index 8b34881265923439c606181f0914bc7472320412..b746a1d88e2736d49fc4724c6341ad7a19118721 100644 (file)
@@ -231,7 +231,7 @@ CallIdentifier/guid guid
   ipv4_address = 0;
 %(DEFAULT_BODY)s
   if (value_tvb)
-    tvb_memcpy(value_tvb, (guint8*)&ipv4_address, 0, 4);
+    ipv4_address = tvb_get_ipv4(value_tvb, 0);
 #.END
 #----------------------------------------------------------------------------------------
 #.FN_PARS H245TransportAddress/h245ipAddress/h245ipv4port
index 1b7f77e942603dcdb4ed7f1b6c7c999f3716b956..d6722364ca9d42e037ebb1992eb5ba603cb4f744 100644 (file)
@@ -280,10 +280,10 @@ OpenLogicalChannel
 
 %(DEFAULT_BODY)s
   if ( media_channel )
-    tvb_memcpy(value_tvb, (guint8*)&ipv4_address, 0, 4);
+    ipv4_address = tvb_get_ipv4(value_tvb, 0);
 
   if ( media_control_channel )
-    tvb_memcpy(value_tvb, (guint8*)&rtcp_ipv4_address, 0, 4);
+    rtcp_ipv4_address = tvb_get_ipv4(value_tvb, 0);
 
 #.END
 #----------------------------------------------------------------------------------------
@@ -815,4 +815,4 @@ VendorIdentification/versionNumber TYPE = FT_STRING DISPLAY = BASE_HEX STRINGS =
 #----------------------------------------------------------------------------------------
 #.FIELD_ATTR
 AlternativeCapabilitySet/_item NAME = "alternativeCapability"
-#----------------------------------------------------------------------------------------
\ No newline at end of file
+#----------------------------------------------------------------------------------------
index 2e3eaf25880f10eb3325ccd8124cc7c3b40197ee..3dd2941034f57b82149030c7de6d204b87a6b52b 100644 (file)
@@ -31,7 +31,6 @@
 #include <string.h>
 
 #include "tvbuff.h"
-#include "ipv6-utils.h"
 #include "addr_and_mask.h"
 
 /*
index 5f38393be74c1cc9ece5a0f83345bd51a1b231ab..f2f705e4026cdee2f3e5f2aae9c8ac1d4f48eabe 100644 (file)
@@ -35,7 +35,6 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 
 #ifndef offsetof
 #define        offsetof(type, member)  ((size_t)(&((type *)0)->member))
@@ -265,7 +264,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
     offset += 4;
 
     if (is_ipv6) {
-       tvb_memcpy(tvb, (guint8 *)&dest_addr_v6, offset, INET6_ADDRLEN);
+       tvb_get_ipv6(tvb, offset, &dest_addr_v6);
        if (aodv_tree) {
            proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset,
                                INET6_ADDRLEN, (guint8 *)&dest_addr_v6);
@@ -277,7 +276,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
                            ip6_to_str(&dest_addr_v6));
        offset += INET6_ADDRLEN;
     } else {
-       tvb_memcpy(tvb, (guint8 *)&dest_addr_v4, offset, 4);
+       dest_addr_v4 = tvb_get_ipv4(tvb, offset);
        if (aodv_tree) {
            proto_tree_add_ipv4(aodv_tree, hf_aodv_dest_ip, tvb, offset, 4,
                                dest_addr_v4);
@@ -297,7 +296,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
     offset += 4;
 
     if (is_ipv6) {
-       tvb_memcpy(tvb, (guint8 *)&orig_addr_v6, offset, INET6_ADDRLEN);
+       tvb_get_ipv6(tvb, offset, &orig_addr_v6);
        if (aodv_tree) {
            proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset,
                                INET6_ADDRLEN, (guint8 *)&orig_addr_v6);
@@ -309,7 +308,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
                            ip6_to_str(&orig_addr_v6));
        offset += INET6_ADDRLEN;
     } else {
-       tvb_memcpy(tvb, (guint8 *)&orig_addr_v4, offset, 4);
+       orig_addr_v4 = tvb_get_ipv4(tvb, offset);
        if (aodv_tree) {
            proto_tree_add_ipv4(aodv_tree, hf_aodv_orig_ip, tvb, offset, 4,
                                orig_addr_v4);
@@ -387,7 +386,7 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
     offset += 1;
 
     if (is_ipv6) {
-       tvb_memcpy(tvb, (guint8 *)&dest_addr_v6, offset, INET6_ADDRLEN);
+       tvb_get_ipv6(tvb, offset, &dest_addr_v6);
        if (aodv_tree) {
            proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset,
                                INET6_ADDRLEN, (guint8 *)&dest_addr_v6);
@@ -399,7 +398,7 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
                            ip6_to_str(&dest_addr_v6));
        offset += INET6_ADDRLEN;
     } else {
-       tvb_memcpy(tvb, (guint8 *)&dest_addr_v4, offset, 4);
+       dest_addr_v4 = tvb_get_ipv4(tvb, offset);
        if (aodv_tree) {
            proto_tree_add_ipv4(aodv_tree, hf_aodv_dest_ip, tvb, offset, 4,
                                dest_addr_v4);
@@ -419,7 +418,7 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
     offset += 4;
 
     if (is_ipv6) {
-       tvb_memcpy(tvb, (guint8 *)&orig_addr_v6, offset, INET6_ADDRLEN);
+       tvb_get_ipv6(tvb, offset, &orig_addr_v6);
        if (aodv_tree) {
            proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset,
                                INET6_ADDRLEN, (guint8 *)&orig_addr_v6);
@@ -431,7 +430,7 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree,
                            ip6_to_str(&orig_addr_v6));
        offset += INET6_ADDRLEN;
     } else {
-       tvb_memcpy(tvb, (guint8 *)&orig_addr_v4, offset, 4);
+       orig_addr_v4 = tvb_get_ipv4(tvb, offset);
        if (aodv_tree) {
            proto_tree_add_ipv4(aodv_tree, hf_aodv_orig_ip, tvb, offset, 4,
                                orig_addr_v4);
@@ -592,7 +591,7 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo,
                            orig_seqno);
     offset += 4;
 
-    tvb_memcpy(tvb, (guint8 *)&dest_addr_v6, offset, INET6_ADDRLEN);
+    tvb_get_ipv6(tvb, offset, &dest_addr_v6);
     if (aodv_tree) {
        proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset,
                            INET6_ADDRLEN, (guint8 *)&dest_addr_v6);
@@ -604,7 +603,7 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo,
                        ip6_to_str(&dest_addr_v6));
     offset += INET6_ADDRLEN;
 
-    tvb_memcpy(tvb, (guint8 *)&orig_addr_v6, offset, INET6_ADDRLEN);
+    tvb_get_ipv6(tvb, offset, &orig_addr_v6);
     if (aodv_tree) {
        proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset,
                            INET6_ADDRLEN, (guint8 *)&orig_addr_v6);
@@ -677,7 +676,7 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo,
                            dest_seqno);
     offset += 4;
 
-    tvb_memcpy(tvb, (guint8 *)&dest_addr_v6, offset, INET6_ADDRLEN);
+    tvb_get_ipv6(tvb, offset, &dest_addr_v6);
     if (aodv_tree) {
        proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset,
                            INET6_ADDRLEN, (guint8 *)&dest_addr_v6);
@@ -689,7 +688,7 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo,
                        ip6_to_str(&dest_addr_v6));
     offset += INET6_ADDRLEN;
 
-    tvb_memcpy(tvb, (guint8 *)&orig_addr_v6, offset, INET6_ADDRLEN);
+    tvb_get_ipv6(tvb, offset, &orig_addr_v6);
     if (aodv_tree) {
        proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset,
                            INET6_ADDRLEN, (guint8 *)&orig_addr_v6);
index 63588aa1532f61c1019863034bd3e08b03387e89..a223bf8723f138799413b6ca5a921b5642d648e5 100644 (file)
@@ -713,7 +713,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     /* Add sender address if sender MAC address is neither a broadcast/
        multicast address nor an all-zero address and if sender IP address
        isn't all zeroes. */
-    tvb_memcpy(tvb, (guint8 *)&ip, spa_offset, sizeof(ip));
+    ip = tvb_get_ipv4(tvb, spa_offset);
     mac = tvb_get_ptr(tvb, sha_offset, 6);
     if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0)
       add_ether_byip(ip, mac);
@@ -725,7 +725,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     /* Do not add target address if the packet is a Request. According to the RFC,
        target addresses in requests have no meaning */
        
-    tvb_memcpy(tvb, (guint8 *)&ip, tpa_offset, sizeof(ip));
+    ip = tvb_get_ipv4(tvb, tpa_offset);
     mac = tvb_get_ptr(tvb, tha_offset, 6);
     if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0 
       && ar_op != ARPOP_REQUEST)
index 8033fac6f915f0eb782b44b82caf8977214b0013..1064b1b6486e2aefd176df7ffa4965e4e5a90e08 100644 (file)
@@ -252,7 +252,7 @@ static int do_auto_rp_map(tvbuff_t *tvb, int offset, proto_tree *auto_rp_tree)
         guint32 rp_addr;      /* In network byte order */
         int i;
 
-        tvb_memcpy(tvb, (guint8 *)&rp_addr, offset, 4);
+        rp_addr = tvb_get_ipv4(tvb, offset);
         group_count = tvb_get_guint8(tvb, offset + 5);
 
                                /* sizeof map header + n * sizeof encoded group addresses */
@@ -276,7 +276,7 @@ static int do_auto_rp_map(tvbuff_t *tvb, int offset, proto_tree *auto_rp_tree)
 
                 sign = tvb_get_guint8(tvb, offset);
                 mask_len = tvb_get_guint8(tvb, offset + 1);
-                tvb_memcpy(tvb, (guint8 *)&group_addr, offset + 2, 4);
+                group_addr = tvb_get_ipv4(tvb, offset + 2);
                 gi = proto_tree_add_text(map_tree, tvb, offset, 6, "Group %s/%u (%s)",
                                          ip_to_str((void *)&group_addr), mask_len,
                                          val_to_str(sign&AUTO_RP_SIGN_MASK, auto_rp_mask_sign_vals, ""));
index b106121f886ccf05271d6e8037b0c1953a241c4b..ae47708b74d6ab37fcfdd2319872723b0546a42f 100644 (file)
@@ -573,7 +573,7 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, char *buf,
                         case SAFNUM_MPLS_LABEL:
                        case SAFNUM_TUNNEL:
                             length = 16 ;
-                            tvb_memcpy(tvb, ip6addr.u6_addr.u6_addr8,offset, 16);
+                            tvb_get_ipv6(tvb, offset, &ip6addr);
                             strptr += g_snprintf(strptr, buf_len-(strptr-buf), "%s", ip6_to_str(&ip6addr));
                             break;
                         case SAFNUM_LAB_VPNUNICAST:
@@ -583,7 +583,7 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, char *buf,
                                 switch (rd_type) {
                                         case FORMAT_AS2_LOC:
                                                 length = 8 + 16;
-                                                tvb_memcpy(tvb, ip6addr.u6_addr.u6_addr8, offset + 8, 16); /* Next Hop */
+                                                tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
                                                 strptr += g_snprintf(strptr, buf_len-(strptr-buf), "Empty Label Stack RD=%u:%u IPv6=%s",
                                                                 tvb_get_ntohs(tvb, offset + 2),
                                                                 tvb_get_ntohl(tvb, offset + 4),
@@ -592,7 +592,7 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, char *buf,
                                         case FORMAT_IP_LOC:
                                                 length = 8 + 16;
                                                 tvb_memcpy(tvb, ip4addr, offset + 2, sizeof(ip4addr));   /* IP part of the RD            */
-                                                tvb_memcpy(tvb, ip6addr.u6_addr.u6_addr8, offset + 8, 16); /* Next Hop */
+                                                tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
                                                 strptr += g_snprintf(strptr, buf_len-(strptr-buf), "Empty Label Stack RD=%s:%u IPv6=%s",
                                                                 ip_to_str(ip4addr),
                                                                 tvb_get_ntohs(tvb, offset + 6),
index 782fd2553af103ae3716def8f9dab2088c2ff3c4..a839da93e99d38fc0659103da18ae7cd288df05d 100644 (file)
@@ -2843,7 +2843,7 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        if (tvb_bytes_exist(tvb, voff, 4)) {
                if (tvb_get_ntohl(tvb, voff) == 0x63825363) {
                        if (tree) {
-                               tvb_memcpy(tvb, (void *)&ip_addr, voff, sizeof(ip_addr));
+                               ip_addr = tvb_get_ipv4(tvb, voff);
                                proto_tree_add_ipv4_format(bp_tree, hf_bootp_cookie, tvb,
                                    voff, 4, ip_addr,
                                    "Magic cookie: (OK)");
index ffcbf816ac517e85e2a9935e7c1400776f21e975..a24e48505821cc7ab82df0d6cf83cfe8efc9c733 100644 (file)
@@ -360,10 +360,10 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                /*              proto_tree_add_text(tlv_tree, tvb, offset+9,
                                    length - 9, "Cluster Management");
                */
-               tvb_memcpy(tvb, (guint8 *)&ip_addr, offset+9, 4);
+               ip_addr = tvb_get_ipv4(tvb, offset+9);
                proto_tree_add_text(tlv_tree, tvb, offset+9, 4,
                                    "Cluster Master IP: %s",ip_to_str((guint8 *)&ip_addr));
-               tvb_memcpy(tvb, (guint8 *)&ip_addr, offset+13, 4);
+               ip_addr = tvb_get_ipv4(tvb, offset+13);
                proto_tree_add_text(tlv_tree, tvb, offset+13, 4,
                                    "UNKNOWN (IP?): 0x%08X (%s)",
                                    ip_addr, ip_to_str((guint8 *)&ip_addr));
index 9550544704b6c50de16b4be65be1202891d17788..c000e0310e5f705c65263bb0e5b2ea1d999d8a92 100644 (file)
@@ -298,7 +298,7 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   case SLARP_REQUEST:
   case SLARP_REPLY:
     if (check_col(pinfo->cinfo, COL_INFO)) {
-      tvb_memcpy(tvb, (guint8 *)&address, 4, 4);
+      address = tvb_get_ipv4(tvb, 4);
       col_add_fstr(pinfo->cinfo, COL_INFO, "%s, from %s, mask %s",
         match_strval(code, slarp_ptype_vals),
         get_hostname(address),
index 0c9402692cc2d1d0fcda11bb0eaf5192f234dea1..ad115dd4023f77f1bca0d092648083287ed8b247 100644 (file)
@@ -1096,7 +1096,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
   case COPS_OBJ_IN_INT:
   case COPS_OBJ_OUT_INT:
     if (c_type == 1) {          /* IPv4 */
-      tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+      ipv4addr = tvb_get_ipv4(tvb, offset);
       ifindex = tvb_get_ntohl(tvb, offset + 4);
       ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, ifIndex: %u",
                                ip_to_str((guint8 *)&ipv4addr), ifindex);
@@ -1106,7 +1106,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
                           tvb, offset, 4, ipv4addr);
       offset += 4;
     } else if (c_type == 2) {   /* IPv6 */
-      tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+      tvb_get_ipv6(tvb, offset, &ipv6addr);
       ifindex = tvb_get_ntohl(tvb, offset + sizeof ipv6addr);
       ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u",
                                ip6_to_str(&ipv6addr), ifindex);
@@ -1232,7 +1232,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
   case COPS_OBJ_PDPREDIRADDR:
   case COPS_OBJ_LASTPDPADDR:
     if (c_type == 1) {          /* IPv4 */
-      tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+      ipv4addr = tvb_get_ipv4(tvb, offset);
       tcp_port = tvb_get_ntohs(tvb, offset + 4 + 2);
       ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, TCP Port Number: %u",
                                ip_to_str((guint8 *)&ipv4addr), tcp_port);
@@ -1242,7 +1242,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
                           tvb, offset, 4, ipv4addr);
       offset += 4;
     } else if (c_type == 2) {   /* IPv6 */
-      tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+      tvb_get_ipv6(tvb, offset, &ipv6addr);
       tcp_port = tvb_get_ntohs(tvb, offset + sizeof ipv6addr + 2);
       ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u",
                                ip6_to_str(&ipv6addr), tcp_port);
@@ -2493,6 +2493,7 @@ info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const ch
      proto_item *pi = NULL;
      guint8   code8  = 0;
      guint16  code16 = 0;
+     guint32  codeipv4 = 0;
      guint32  code32 = 0;
      float    codefl = 0.0;
 
@@ -2558,7 +2559,7 @@ info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const ch
              switch (mode) {
                case FMT_FLT:  codefl  = tvb_get_ntohieee_float(tvb,offset);
                               break;
-               case FMT_IPv4: tvb_memcpy(tvb, (guint8 *)&code32, offset, 4);
+               case FMT_IPv4: codeipv4 = tvb_get_ipv4(tvb, offset);
                               break;
                default:       code32  = tvb_get_ntohl(tvb,offset);
             }
@@ -2572,7 +2573,7 @@ info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const ch
                 }
                 /* Ip address format*/
                 if (mode==FMT_IPv4) {
-                   pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, code32);
+                   pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, codeipv4);
                    break;
                 }
                 /* Ieee float format */
index f969cd14f933f6cba5851250b33422d7b81eb37a..589bf78b3ad8009370822cb431d736bb5002b623 100644 (file)
@@ -47,7 +47,6 @@
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 #include "packet-arp.h"
 
 static int proto_dhcpv6 = -1;
@@ -461,7 +460,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                                   optlen, "IAADDR: malformed option");
               break;
            }
-           tvb_memcpy(tvb, (guint8 *)&in6, off, sizeof(in6));
+           tvb_get_ipv6(tvb, off, &in6);
            proto_tree_add_text(subtree, tvb, off,
                                sizeof(in6), "IPv6 address: %s",
                                ip6_to_str(&in6));
@@ -563,7 +562,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                                optlen, "UNICAST: malformed option");
            break;
          }
-         tvb_memcpy(tvb, (guint8 *)&in6, off, sizeof(in6));
+         tvb_get_ipv6(tvb, off, &in6);
          proto_tree_add_text(subtree, tvb, off,
                              sizeof(in6), "IPv6 address: %s",
                                ip6_to_str(&in6));
@@ -649,7 +648,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
                for (i = 0; i < optlen; i += 16) {
-                       tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+                       tvb_get_ipv6(tvb, off + i, &in6);
                        proto_tree_add_text(subtree, tvb, off + i,
                                sizeof(in6), "SIP servers address: %s",
                                ip6_to_str(&in6));
@@ -662,7 +661,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
                for (i = 0; i < optlen; i += 16) {
-                       tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+                       tvb_get_ipv6(tvb, off + i, &in6);
                        proto_tree_add_text(subtree, tvb, off + i,
                                sizeof(in6), "DNS servers address: %s",
                                ip6_to_str(&in6));
@@ -681,7 +680,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
                for (i = 0; i < optlen; i += 16) {
-                       tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+                       tvb_get_ipv6(tvb, off + i, &in6);
                        proto_tree_add_text(subtree, tvb, off + i,
                                sizeof(in6), "NIS servers address: %s",
                                ip6_to_str(&in6));
@@ -694,7 +693,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
                for (i = 0; i < optlen; i += 16) {
-                       tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+                       tvb_get_ipv6(tvb, off + i, &in6);
                        proto_tree_add_text(subtree, tvb, off + i,
                                sizeof(in6), "NISP servers address: %s",
                                ip6_to_str(&in6));
@@ -719,7 +718,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
                for (i = 0; i < optlen; i += 16) {
-                       tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+                       tvb_get_ipv6(tvb, off + i, &in6);
                        proto_tree_add_text(subtree, tvb, off + i,
                                sizeof(in6), "SNTP servers address: %s",
                                ip6_to_str(&in6));
@@ -793,7 +792,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                }
                proto_tree_add_text(subtree, tvb, off + 8, 1,
                                    "Prefix length: %d", prefix_length);
-               tvb_memcpy(tvb, (guint8 *)&in6, off + 9 , sizeof(in6));
+               tvb_get_ipv6(tvb, off + 9, &in6);
                proto_tree_add_text(subtree, tvb, off + 9,
                                    16, "Prefix address: %s",
                                    ip6_to_str(&in6));
@@ -816,7 +815,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
 
-               tvb_memcpy(tvb, (guint8 *)&in6, off , sizeof(in6));
+               tvb_get_ipv6(tvb, off, &in6);
                proto_tree_add_text(subtree, tvb, off,
                        16, "Home Agent: %s", ip6_to_str(&in6));
                break;
@@ -827,7 +826,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
                        break;
                }
 
-               tvb_memcpy(tvb, (guint8 *)&in6, off , sizeof(in6));
+               tvb_get_ipv6(tvb, off, &in6);
                proto_tree_add_text(subtree, tvb, off,
                        16, "Home Address: %s", ip6_to_str(&in6));
                break;
@@ -882,11 +881,11 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
            hop_count = tvb_get_guint8(tvb, off+1);
            proto_tree_add_text(bp_tree, tvb, off+1, 1, "Hop count: %d", hop_count);
 
-           tvb_memcpy(tvb, (guint8 *)&in6, off+2, sizeof(in6));
+           tvb_get_ipv6(tvb, off+2, &in6);
            proto_tree_add_text(bp_tree, tvb, off+2, sizeof(in6), 
                                "Link-address: %s",ip6_to_str(&in6));
 
-           tvb_memcpy(tvb, (guint8 *)&in6, off+18, sizeof(in6));
+           tvb_get_ipv6(tvb, off+18, &in6);
            proto_tree_add_text(bp_tree, tvb, off+18, sizeof(in6), 
                                "Peer-address: %s",ip6_to_str(&in6));
 
@@ -909,7 +908,7 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                           msgtype);
                   proto_tree_add_text(bp_tree, tvb, off+1, 3, "Transaction-ID: 0x%08x", xid);
 #if 0
-                  tvb_memcpy(tvb, (guint8 *)&in6, 4, sizeof(in6));
+                  tvb_get_ipv6(tvb, 4, &in6);
                   proto_tree_add_text(bp_tree, tvb, 4, sizeof(in6),
                           "Server address: %s", ip6_to_str(&in6));
 #endif
index 3f6b2af0892e925f32a07838ffe291ee761af77f..0fa5ce15e8e8a113c7cb496d412dbe60da384e4e 100644 (file)
@@ -35,7 +35,6 @@
 #include <memory.h>
 
 #include <glib.h>
-#include <epan/ipv6-utils.h>
 #include <epan/packet.h>
 #include <epan/ipproto.h>
 #include <epan/addr_resolv.h>
index a2a6e21b700efe4d46b7a47d0ec1eb2424a496a3..70419b8aa32d30cbaad37f37504e6788f935d0d4 100644 (file)
@@ -94,7 +94,6 @@
 
 #include <epan/packet.h>
 #include <epan/prefs.h>
-#include <epan/ipv6-utils.h>
 #include <epan/tap.h>
 #include <epan/emem.h>
 
@@ -11098,7 +11097,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add
                    proto_tree_add_text(tree,tvb, curr_offset-3, 2, "Parameter: (%u) P-CSCF Address" , prot );
                    proto_tree_add_text(tree,tvb, curr_offset-1, 1, "Length: 0x%02x (%u)", e_len , e_len);
 
-                   tvb_memcpy(tvb, (guint8 *)&ipv6_addr, curr_offset, 16);
+                   tvb_get_ipv6(tvb, curr_offset, &ipv6_addr);
                    proto_tree_add_text(tree,
                        tvb, curr_offset, 16,
                        "IPv6: %s", ip6_to_str(&ipv6_addr));
@@ -11113,7 +11112,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add
                    proto_tree_add_text(tree,tvb, curr_offset-3, 2, "Parameter: (%u) DNS Server Address" , prot );
                    proto_tree_add_text(tree,tvb, curr_offset-1, 1, "Length: 0x%02x (%u)", e_len , e_len);
 
-                   tvb_memcpy(tvb, (guint8 *)&ipv6_addr, curr_offset, 16);
+                   tvb_get_ipv6(tvb, curr_offset, &ipv6_addr);
                    proto_tree_add_text(tree,
                        tvb, curr_offset, 16,
                        "IPv6: %s", ip6_to_str(&ipv6_addr));
@@ -11285,7 +11284,7 @@ de_sm_pdp_addr(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar
                    tvb, curr_offset+2, 0,
                    "IPv6: length is wrong");
            } else {
-               tvb_memcpy(tvb, (guint8 *)&ipv6_addr, curr_offset+2, 16);
+               tvb_get_ipv6(tvb, curr_offset+2, &ipv6_addr);
                 proto_tree_add_text(tree,
                     tvb, curr_offset+2, len-2,
                    "IPv6: %s", ip6_to_str(&ipv6_addr));
@@ -12203,7 +12202,7 @@ de_sm_tflow_temp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gch
                {
                        struct e_in6_addr ipv6_addr;
 
-                       tvb_memcpy(tvb, (guint8 *)&ipv6_addr, curr_offset, 16);
+                       tvb_get_ipv6(tvb, curr_offset, &ipv6_addr);
                        proto_tree_add_text(tree,
                                tvb, curr_offset+2, len-2,
                                "Packet filter content: IPv6 %s", ip6_to_str(&ipv6_addr));
index 1be50796167d464984f95b2dba52b2567b15bb19..a39481be25e8099adc3e64decc0f407023db0a48 100644 (file)
@@ -2667,12 +2667,12 @@ decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
        } else if (length > 2) {
                switch (pdp_typ) {
                        case 0x21:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+5, sizeof addr_ipv4);
+                               addr_ipv4 = tvb_get_ipv4(tvb, offset+5);
                                proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset+5, 4, addr_ipv4);
                                proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
                                break;
                        case 0x57:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+5, sizeof addr_ipv6);
+                               tvb_get_ipv6(tvb, offset+5, &addr_ipv6);
                                proto_tree_add_ipv6 (ext_tree_user, hf_gtp_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
                                proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                                break;
@@ -3245,11 +3245,11 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
        if (pdp_addr_len > 0) {
                switch (pdp_type_num) {
                        case 0x21:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
+                               addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
                                proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
                                break;
                        case 0x57:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
+                               tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
                                proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                                break;
                        default:
@@ -3264,11 +3264,11 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
 
        switch (ggsn_addr_len) {
                case 4:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
+                       addr_ipv4 = tvb_get_ipv4(tvb, offset+1);
                        proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
                        break;
                case 16:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
+                       tvb_get_ipv6(tvb, offset+1, &addr_ipv6);
                        proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        break;
                default:
@@ -3284,11 +3284,11 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
 
                switch (ggsn_addr_len) {
                        case 4:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
+                               addr_ipv4 = tvb_get_ipv4(tvb, offset+1);
                                proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
                                break;
                        case 16:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
+                               tvb_get_ipv6(tvb, offset+1, &addr_ipv6);
                                proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                                break;
                        default:
@@ -3427,7 +3427,7 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
        switch (length) {
                case 4:
                        proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
+                       addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
                        break;
@@ -3437,13 +3437,13 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
                        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
                        addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
                        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+4, sizeof addr_ipv4);
+                       addr_ipv4 = tvb_get_ipv4(tvb, offset+4);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
                        break;
                case 16:
                        proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
+                       tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
                        break;
@@ -3453,7 +3453,7 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
                        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
                        addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
                        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+4, sizeof addr_ipv6);
+                       tvb_get_ipv6(tvb, offset+4, &addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+4, 16, (guint8*)&addr_ipv6);
                        break;
@@ -3604,15 +3604,15 @@ decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tr
                                switch (pf_content_id) {
                                        /* address IPv4 and mask = 8 bytes*/
                                        case 0x10:
-                                               tvb_memcpy (tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
-                                               tvb_memcpy (tvb, (guint8 *)&mask_ipv4, offset + pf_offset + 5, sizeof mask_ipv4);
+                                               addr_ipv4 = tvb_get_ipv4 (tvb, offset + pf_offset + 1);
+                                               mask_ipv4 = tvb_get_ipv4 (tvb, offset + pf_offset + 5);
                                                proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 9, "ID 0x10: IPv4/mask: %s/%s", ip_to_str ((guint8 *)&addr_ipv4), ip_to_str ((guint8 *)&mask_ipv4));
                                                pf_offset = pf_offset + 9;
                                                break;
                                        /* address IPv6 and mask = 32 bytes*/
                                        case 0x20:
-                                               tvb_memcpy (tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
-                                               tvb_memcpy (tvb, (guint8 *)&mask_ipv6, offset+pf_offset+17, sizeof mask_ipv6);
+                                               tvb_get_ipv6 (tvb, offset+pf_offset+1, &addr_ipv6);
+                                               tvb_get_ipv6 (tvb, offset+pf_offset+17, &mask_ipv6);
                                                proto_tree_add_text (ext_tree_tft_pf, tvb, offset+pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s", ip6_to_str ((struct e_in6_addr*)&addr_ipv6), ip6_to_str ((struct e_in6_addr*)&mask_ipv6));
                                                pf_offset = pf_offset + 33;
                                                break;
@@ -3745,11 +3745,11 @@ decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
 
                switch (length) {
                        case 12:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
+                               addr_ipv4 = tvb_get_ipv4(tvb, offset+8);
                                proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
                                break;
                        case 24:
-                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
+                               tvb_get_ipv6(tvb, offset+8, &addr_ipv6);
                                proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
                                break;
                        default:
@@ -3843,12 +3843,12 @@ decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
 
        switch (length) {
                case 4:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
+                       addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4 (ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
                        break;
                case 16:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
+                       tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6 (ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
                        break;
@@ -3998,12 +3998,12 @@ decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
 
        switch (length) {
                case 4:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
+                       addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4 (ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset+3, 4, addr_ipv4);
                        break;
                case 16:
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
+                       tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6 (ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
                        break;
index 44f189f62867dddfa74412230cfb012d121ecf8d..edd7ae8134e6d2b671ab66039a530332427df475 100644 (file)
@@ -1219,7 +1219,7 @@ dissect_h225_T_h245ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
                                        4, 4, &value_tvb);
 
   if (value_tvb)
-    tvb_memcpy(value_tvb, (guint8*)&ipv4_address, 0, 4);
+    ipv4_address = tvb_get_ipv4(value_tvb, 0);
 
   return offset;
 }
index 748b175f6547dfafd096608ba63aedf5b0e8fa7b..f868b88ea2eb03f3d1485ccb2953c340693e2dc2 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
-/* .\packet-h245.c                                                            */
+/* ./packet-h245.c                                                            */
 /* ../../tools/asn2eth.py -X -e -p h245 -c h245.cnf -s packet-h245-template h245.asn */
 
 /* Input file: packet-h245-template.c */
@@ -9593,10 +9593,10 @@ dissect_h245_Ipv4_network(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pro
                                        4, 4, &value_tvb);
 
   if ( media_channel )
-    tvb_memcpy(value_tvb, (guint8*)&ipv4_address, 0, 4);
+    ipv4_address = tvb_get_ipv4(value_tvb, 0);
 
   if ( media_control_channel )
-    tvb_memcpy(value_tvb, (guint8*)&rtcp_ipv4_address, 0, 4);
+    rtcp_ipv4_address = tvb_get_ipv4(value_tvb, 0);
 
 
   return offset;
index 96951d500c8ed9f54462995d6ff80cf97b0b56c6..3b425f0062a288be82c8300b23862cf5940851ab 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
-/* .\packet-h245.h                                                            */
+/* ./packet-h245.h                                                            */
 /* ../../tools/asn2eth.py -X -e -p h245 -c h245.cnf -s packet-h245-template h245.asn */
 
 /* Input file: packet-h245-template.h */
index 2dc960112001b18e2fd588f1f6c28079bbaa8d00..b68a747dcb6691ab228f2b33ee22db641a7a7682 100644 (file)
@@ -613,7 +613,7 @@ dissect_nodeinfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
            p = offset + sizeof *ni;
            for (i = 0; i < n; i++) {
                struct e_in6_addr e_in6_addr;
-               tvb_memcpy(tvb, (guint8 *)&e_in6_addr, p, sizeof e_in6_addr);
+               tvb_get_ipv6(tvb, p, &e_in6_addr);
                proto_tree_add_text(field_tree, tvb,
                    p, sizeof(struct e_in6_addr),
                    "%s", ip6_to_str(&e_in6_addr));
@@ -728,7 +728,7 @@ dissect_nodeinfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
                struct e_in6_addr e_in6_addr;
                gint32 ttl;
                ttl = (gint32)tvb_get_ntohl(tvb, p);
-               tvb_memcpy(tvb, (guint8 *)&e_in6_addr, p + sizeof ttl, sizeof e_in6_addr);
+               tvb_get_ipv6(tvb, p + sizeof ttl, &e_in6_addr);
                proto_tree_add_text(field_tree, tvb,
                    p, sizeof(struct e_in6_addr) + sizeof(gint32),
                    "%s (TTL %d)", ip6_to_str(&e_in6_addr), ttl);
@@ -955,7 +955,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree )
     localOffset += 2;
     recordSize = 4 + 16 + (16 * sourceNb) + (auxDataLen * 4);
 
-    tvb_memcpy(tvb, (guint8 *)&addr, localOffset, sizeof(addr) );
+    tvb_get_ipv6(tvb, localOffset, &addr);
     tf = proto_tree_add_text( tree, tvb, offset, recordSize, 
 #ifdef INET6
                              "%s: %s (%s)", val_to_str(recordType, mldrv2ModesNames,"Unknown mode"),
@@ -974,7 +974,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree )
     localOffset += 16;
 
     for( ; sourceNb; sourceNb--, localOffset += 16 ) {
-      tvb_memcpy(tvb, (guint8 *)&addr, localOffset, sizeof(addr) );
+      tvb_get_ipv6(tvb, localOffset, &addr);
       proto_tree_add_text( sub_tree, tvb, localOffset, 16, 
 #ifdef INET6
                           "Source Address: %s (%s)", get_hostname6(&addr), ip6_to_str(&addr) );
@@ -991,7 +991,7 @@ dissect_mldqv2(tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree)
   struct e_in6_addr addr;
 
   for ( ; count; count--, offset += 16) {
-      tvb_memcpy(tvb, (guint8 *)&addr, offset, sizeof(addr));
+      tvb_get_ipv6(tvb, offset, &addr);
       proto_tree_add_text(tree, tvb, offset, 16, 
                          "Source Address: %s (%s)", get_hostname6(&addr), ip6_to_str(&addr));
   }
index 0a06e89a3f7450c6cae9187467f433dcd0a3826a..dcc31cfdd0fb03a3ac18e2baf720260e8bf67eaa 100644 (file)
@@ -446,7 +446,7 @@ dissect_v3_group_record(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
        guint16 num;
        guint32 ip;
 
-       tvb_memcpy(tvb, (guint8 *)&ip, offset+4, 4);
+       ip = tvb_get_ipv4(tvb, offset+4);
        item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                "Group Record : %s  %s",
                        ip_to_str((guint8*)&ip),
index f40e0af37cc25a7f7913b82e09c6a395afb88782..a9af75f16ad6c2e83d775f2470409dfe9ba913ae 100644 (file)
@@ -489,9 +489,7 @@ dissect_ipopt_route(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
       break;
     }
 
-    /* Avoids alignment problems on many architectures. */
-    tvb_memcpy(tvb, (guint8 *)&addr, offset + optoffset, sizeof(addr));
-
+    addr = tvb_get_ipv4(tvb, offset + optoffset);
     proto_tree_add_text(field_tree, tvb, offset + optoffset, 4,
               "%s%s",
               ((addr == 0) ? "-" : (char *)get_hostname(addr)),
@@ -559,7 +557,7 @@ dissect_ipopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
           "(suboption would go past end of option)");
         break;
       }
-      tvb_memcpy(tvb, (guint8 *)&addr, offset + optoffset, sizeof(addr));
+      addr = tvb_get_ipv4(tvb, offset + optoffset);
       ts = tvb_get_ntohl(tvb, offset + optoffset + 4);
       optlen -= 8;
       proto_tree_add_text(field_tree, tvb, offset + optoffset,      8,
index eb5ce61fedfd53d0e61cb723c0adcb86d2e4095b..bac3a7bb6c5fc5a609c75117d219b5cc4f1e1c42 100644 (file)
@@ -39,7 +39,6 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 #include <epan/ipproto.h>
 #include <epan/dissectors/packet-x509if.h>
 #include <epan/dissectors/packet-isakmp.h>
@@ -1671,7 +1670,7 @@ dissect_nat_original_address(tvbuff_t *tvb, int offset, int length, proto_tree *
 
   case 1:      /* ID_IPV4_ADDR */
     if (length == 4) {
-      tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset, length);
+      addr_ipv4 = tvb_get_ipv4(tvb, offset);
       proto_tree_add_text(tree, tvb, offset, length,
                          "Original address: %s",
                          ip_to_str((guint8 *)&addr_ipv4));
@@ -1684,7 +1683,7 @@ dissect_nat_original_address(tvbuff_t *tvb, int offset, int length, proto_tree *
 
   case 5:      /* ID_IPV6_ADDR */
     if (length == 16) {
-      tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset, length);
+      tvb_get_ipv6(tvb, offset, &addr_ipv6);
       proto_tree_add_text(tree, tvb, offset, length,
                          "Original address: %s",
                          ip6_to_str(&addr_ipv6));
index 27b90968dfda3634809648f3ab360f675634f5d2..a88d6d8b01aba45f724ea441ef4478ba2002ccd4 100644 (file)
@@ -542,7 +542,7 @@ dissect_lsp_ip_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
                 * Gotta build a sub-tree for all our pieces
                 */
                if ( tree ) {
-                       tvb_memcpy(tvb, (guint8 *)&src, offset+4, 4);
+                       src = tvb_get_ipv4(tvb, offset+4);
                        mask = tvb_get_ntohl(tvb, offset+8);
 
                        /* find out if the mask matches one of 33 possible prefix lengths */
index a83f58b88b43c890bb09dca258b17d29247fc3e8..8e8e20ca14b23b7eb624c273ca50f0e137b32125 100644 (file)
@@ -47,7 +47,6 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 #include <epan/stats_tree.h>
 #include <prefs.h>
 #include "packet-q931.h"
@@ -1970,7 +1969,7 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
                        icp = tvb_get_ntohs(parameter_tvb, offset);
                        proto_tree_add_uint(parameter_tree, hf_iana_icp, parameter_tvb, offset, 1, icp );
                        if ( icp == 0 ){ /* IPv6 addr */
-                               tvb_memcpy(parameter_tvb, (guint8 *)&ipv6_addr,( offset + 2 ), 16);
+                               tvb_get_ipv6(parameter_tvb, ( offset + 2 ), &ipv6_addr);
                                proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 3,
                                    "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
                                            proto_tree_add_ipv6(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset,
@@ -1978,7 +1977,7 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
 
                        }
                        else { /* IPv4 addr */
-                               tvb_memcpy(parameter_tvb,(guint8 *) &addr, ( offset + 2 ), 4);
+                               addr = tvb_get_ipv4(parameter_tvb, ( offset + 2 ));
                                proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 3,
                                    "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
                                proto_tree_add_ipv4(parameter_tree, hf_nsap_ipv4_addr, parameter_tvb, offset + 2, 4, addr);
index cef613ad3243596f0c74c7eafbbdd14b9035cf6e..bb3ec4ae2e2416c9a37f28cf42dc951fa95fab3e 100644 (file)
@@ -1126,7 +1126,7 @@ dissect_tlv_path_vector(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
                if(val_tree == NULL) return;
 
                for(ix=1; rem >= 4; ix++, offset += 4, rem -= 4) {
-                       tvb_memcpy(tvb, (guint8 *)&addr, offset, 4);
+                       addr = tvb_get_ipv4(tvb, offset);
                        proto_tree_add_ipv4_format(val_tree,
                            hf_ldp_tlv_pv_lsrid, tvb, offset, 4,
                            addr, "LSR Id %u: %s", ix,
index 96e6927237ceaca4b47c6e27b777fdfb62fdacef..86212bcc42418a68d36954eec1fa3b980adf3d0f 100644 (file)
@@ -80,8 +80,8 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        /* MANOLITO packet header (network byte order) */
        header.checksum = tvb_get_ntohl(tvb, 0);
        header.seqno = tvb_get_ntohl(tvb, 4);
-       tvb_memcpy(tvb, (guint8 *)&header.src, 8, 4);
-       tvb_memcpy(tvb, (guint8 *)&header.dest, 12, 4);
+       header.src = tvb_get_ipv4(tvb, 8);
+       header.dest = tvb_get_ipv4(tvb, 12);
        if (tvb_reported_length(tvb) == 19)
        {
                header.options = (tvb_get_ntohs(tvb, 16) << 8) +
index dc0234356b3e055bdc98cedf39b2cf6e801e19e3..88838ca09e77b90b6392edf404737fdd8d3cd865 100644 (file)
@@ -246,7 +246,6 @@ static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo,
     proto_tree *tree, int *offset, int length)
 {
         guint8 entries;
-        guint32 rp_addr;
 
         if (length < 1)
                 return;
@@ -260,7 +259,6 @@ static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo,
                 length = 0;
                 return;
         }
-        tvb_memcpy(tvb, (guint8 *)&rp_addr, *offset, 4);
         proto_tree_add_item(tree, hf_msdp_sa_rp_addr, tvb, *offset, 4, FALSE);
         *offset += 4;
         length -= 4;
@@ -343,7 +341,7 @@ static void add_notification_data_ipv4addr(tvbuff_t *tvb, proto_tree *tree, int
 
         proto_tree_add_item(tree, hf_msdp_not_res, tvb, *offset, 3, FALSE);
         *offset += 3;
-        tvb_memcpy(tvb, (guint8 *)&ipaddr, *offset, 4);
+        ipaddr = tvb_get_ipv4(tvb, *offset);
         proto_tree_add_ipv4_format(tree, hf_msdp_not_ipv4, tvb, *offset, 4, ipaddr,
                                    "%s: %s", addrtype, ip_to_str((guint8 *)&ipaddr));
         *offset += 4;
index e0ec3f0c856fffe9c83de8e738604ae263ff1f0e..dd00fc5f708b1d122e8d7952b958ad052a9b8ce5 100644 (file)
@@ -117,7 +117,7 @@ dissect_msnip_rmr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, in
                offset += 3;
 
                /* multicast group */
-               tvb_memcpy(tvb, (guint8 *)&maddr, offset, 4);
+               maddr = tvb_get_ipv4(tvb, offset);
                proto_tree_add_ipv4(tree, hf_maddr, tvb, offset, 4,
                        maddr);
                offset += 4;
@@ -188,7 +188,7 @@ dissect_msnip_gm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int
                tree = proto_item_add_subtree(item, ett_groups);
 
                /* multicast group */
-               tvb_memcpy(tvb, (guint8 *)&maddr, offset, 4);
+               maddr = tvb_get_ipv4(tvb, offset);
                proto_tree_add_ipv4(tree, hf_maddr, tvb, offset, 4,
                        maddr);
                offset += 4;
index c843fbf486bdb2be0e03a47d2bfde677a47b06e7..6522592ae93adda70069b441baa3a5862dcb6c02 100644 (file)
@@ -503,7 +503,7 @@ static void dissect_request_connect(tvbuff_t *tvb, int offset,
                proto_tree_add_item( tree, hf_msproxy_dstaddr, tvb, offset, 4,
                        FALSE);
 
-       tvb_memcpy( tvb, (guint8 *)&conv_info->dst_addr, offset, sizeof( guint32));
+       conv_info->dst_addr = tvb_get_ipv4( tvb, offset);
 
        offset += 12;
 
@@ -908,7 +908,7 @@ static void dissect_bind_info( tvbuff_t *tvb, int offset, packet_info *pinfo,
                        conv_info->dst_port);
        offset += 2;
 
-       tvb_memcpy( tvb, (guint8 *)&conv_info->dst_addr, offset, sizeof( guint32));
+       conv_info->dst_addr = tvb_get_ipv4( tvb, offset);
        if ( tree)
                proto_tree_add_item( tree, hf_msproxy_dstaddr, tvb, offset, 4,
                        FALSE);
index 39c7ac922d990e40ffb336310587021f5ad7a6db..146320d4446150ab6a9e144b1d9ca44942fd6da0 100644 (file)
@@ -1225,7 +1225,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        header.flags.node_type = (flags & 12) >> 2;
 
        header.dgm_id = tvb_get_ntohs(tvb, offset+2);
-       tvb_memcpy(tvb, (guint8 *)&header.src_ip, offset+4, 4);
+       header.src_ip = tvb_get_ipv4(tvb, offset+4);
        header.src_port = tvb_get_ntohs(tvb, offset+8);
 
        switch (header.msg_type) {
index 0d961a1462296918768327176c778d5bf814c4e5..f9fd5a95fa4ed280a6a02d6d7191495b81b8b6c6 100644 (file)
@@ -923,8 +923,6 @@ dissect_v9_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset,
        int i;
 
        for (i = 0; i < template->count; i++) {
-               guint32 ipv4addr;
-               guint8  ipv6addr[16];
                guint16 type, length;
                nstime_t ts;
 
@@ -993,15 +991,11 @@ dissect_v9_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset,
 
                case 8: /* source IP */
                        if (length == 4) {
-                               tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset,
-                                   sizeof(ipv4addr));
-                               proto_tree_add_ipv4(pdutree, hf_cflow_srcaddr,
-                                   tvb, offset, length, ipv4addr);
+                               proto_tree_add_item(pdutree, hf_cflow_srcaddr,
+                                   tvb, offset, length, FALSE);
                        } else if (length == 16) {
-                               tvb_memcpy(tvb, ipv6addr, offset,
-                                   sizeof(ipv6addr));
-                               proto_tree_add_ipv6(pdutree, hf_cflow_srcaddr_v6,
-                                   tvb, offset, length, ipv6addr);
+                               proto_tree_add_item(pdutree, hf_cflow_srcaddr_v6,
+                                   tvb, offset, length, FALSE);
                        } else {
                                proto_tree_add_text(pdutree,
                                    tvb, offset, length,
@@ -1026,15 +1020,11 @@ dissect_v9_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset,
 
                case 12: /* dest IP */
                        if (length == 4) {
-                               tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset,
-                                   sizeof(ipv4addr));
-                               proto_tree_add_ipv4(pdutree, hf_cflow_dstaddr,
-                                   tvb, offset, length, ipv4addr);
+                               proto_tree_add_item(pdutree, hf_cflow_dstaddr,
+                                   tvb, offset, length, FALSE);
                        } else if (length == 16) {
-                               tvb_memcpy(tvb, ipv6addr, offset,
-                                   sizeof(ipv6addr));
-                               proto_tree_add_ipv6(pdutree, hf_cflow_dstaddr_v6,
-                                   tvb, offset, length, ipv6addr);
+                               proto_tree_add_item(pdutree, hf_cflow_dstaddr_v6,
+                                   tvb, offset, length, FALSE);
                        } else {
                                proto_tree_add_text(pdutree,
                                    tvb, offset, length,
@@ -1054,15 +1044,11 @@ dissect_v9_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset,
 
                case 15: /* nexthop IP */
                        if (length == 4) {
-                               tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset,
-                                   sizeof(ipv4addr));
-                               proto_tree_add_ipv4(pdutree, hf_cflow_nexthop,
-                                   tvb, offset, length, ipv4addr);
+                               proto_tree_add_item(pdutree, hf_cflow_nexthop,
+                                   tvb, offset, length, FALSE);
                        } else if (length == 16) {
-                               tvb_memcpy(tvb, ipv6addr, offset,
-                                   sizeof(ipv6addr));
-                               proto_tree_add_ipv6(pdutree, hf_cflow_nexthop_v6,
-                                   tvb, offset, length, ipv6addr);
+                               proto_tree_add_item(pdutree, hf_cflow_nexthop_v6,
+                                   tvb, offset, length, FALSE);
                        } else {
                                proto_tree_add_text(pdutree,
                                    tvb, offset, length,
@@ -1082,15 +1068,11 @@ dissect_v9_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset,
 
                case 18: /* BGP nexthop IP */
                        if (length == 4) {
-                               tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset,
-                                   sizeof(ipv4addr));
-                               proto_tree_add_ipv4(pdutree, hf_cflow_bgpnexthop,
-                                   tvb, offset, length, ipv4addr);
+                               proto_tree_add_item(pdutree, hf_cflow_bgpnexthop,
+                                   tvb, offset, length, FALSE);
                        } else if (length == 16) {
-                               tvb_memcpy(tvb, ipv6addr, offset,
-                                   sizeof(ipv6addr));
-                               proto_tree_add_ipv6(pdutree, hf_cflow_bgpnexthop_v6,
-                                   tvb, offset, length, ipv6addr);
+                               proto_tree_add_item(pdutree, hf_cflow_bgpnexthop_v6,
+                                   tvb, offset, length, FALSE);
                        } else {
                                proto_tree_add_text(pdutree,
                                    tvb, offset, length,
@@ -1407,12 +1389,12 @@ dissect_pdu(proto_tree * pdutree, tvbuff_t * tvb, int offset, int ver)
        /*
         * memcpy so we can use the values later to calculate a prefix 
         */
-       tvb_memcpy(tvb, (guint8 *) & srcaddr, offset, 4);
+       srcaddr = tvb_get_ipv4(tvb, offset);
        proto_tree_add_ipv4(pdutree, hf_cflow_srcaddr, tvb, offset, 4,
                            srcaddr);
        offset += 4;
 
-       tvb_memcpy(tvb, (guint8 *) & dstaddr, offset, 4);
+       dstaddr = tvb_get_ipv4(tvb, offset);
        proto_tree_add_ipv4(pdutree, hf_cflow_dstaddr, tvb, offset, 4,
                            dstaddr);
        offset += 4;
index 526a985a2f3d19ebd230f09b61f9c90b401411b0..d7bb036d56597594ad1ac32a95e40417e41d043a 100644 (file)
@@ -36,7 +36,6 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 #include <prefs.h>
 
 #define NSIP_DEBUG 0
@@ -393,8 +392,7 @@ decode_ip_element(nsip_ip_element_info_t *element, build_info_t *bi, proto_tree
     /* IP address */
     switch (element->version) {
     case NSIP_IP_VERSION_4:
-      tvb_memcpy(bi->tvb, (guint8 *)&ip4_addr, bi->offset, 
-                element->address_length);
+      ip4_addr = tvb_get_ipv4(bi->tvb, bi->offset);
       proto_tree_add_item(field_tree, hf_nsip_ip_address_ipv4, 
                          bi->tvb, bi->offset, element->address_length, 
                          NSIP_LITTLE_ENDIAN); 
@@ -403,8 +401,7 @@ decode_ip_element(nsip_ip_element_info_t *element, build_info_t *bi, proto_tree
 
       break;
     case NSIP_IP_VERSION_6:
-      tvb_memcpy(bi->tvb, (guint8 *)&ip6_addr, bi->offset, 
-                sizeof(struct e_in6_addr));
+      tvb_get_ipv6(bi->tvb, bi->offset, &ip6_addr);
       proto_tree_add_item(field_tree, hf_nsip_ip_address_ipv6, bi->tvb, 
                          bi->offset, element->address_length, 
                          NSIP_LITTLE_ENDIAN); 
@@ -530,8 +527,7 @@ decode_iei_ip_address(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) {
   switch (address_type) {
   case NSIP_IP_ADDRESS_TYPE_IPV4:
     ie->total_length = 2 + ipv4_element.address_length;
-    tvb_memcpy(bi->tvb, (guint8 *)&ip4_addr, bi->offset, 
-              ipv4_element.address_length);
+    ip4_addr = tvb_get_ipv4(bi->tvb, bi->offset);
     if (bi->nsip_tree) {
       proto_tree_add_ipv4(bi->nsip_tree, hf_nsip_ip_address_ipv4, 
                          bi->tvb, ie_start_offset, ie->total_length, 
@@ -540,8 +536,7 @@ decode_iei_ip_address(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) {
     break;
   case NSIP_IP_ADDRESS_TYPE_IPV6:
     ie->total_length = 2 + ipv6_element.address_length;
-    tvb_memcpy(bi->tvb, (guint8 *)&ip6_addr, bi->offset, 
-              sizeof(struct e_in6_addr));
+    tvb_get_ipv6(bi->tvb, bi->offset, &ip6_addr);
     if (bi->nsip_tree) {
       proto_tree_add_ipv6(bi->nsip_tree, hf_nsip_ip_address_ipv4, 
                          bi->tvb, ie_start_offset, ie->total_length, 
index aa13cfc9de744f8ca925c79875260071879ddcf0..9430099d33e7c7e9273bcce1889bbd449601e33e 100644 (file)
@@ -558,7 +558,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
                }
        } else {
                buff[sizeof(buff) - 1] = '\0';
-               tvb_memcpy(tvb, (guint8 *)&refid_addr, 12, 4);
+               refid_addr = tvb_get_ipv4(tvb, 12);
                strncpy (buff, get_hostname (refid_addr),
                    sizeof(buff));
                if (buff[sizeof(buff) - 1] != '\0')
index 7d28d341385802f4927d2bfab9a5d6c71e03df28..74ee3c7933e31164b614a25c65dfa530935a3e4c 100644 (file)
@@ -48,7 +48,6 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 
 #define UDP_PORT_OLSR  698
 #define HELLO  1
@@ -111,18 +110,6 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        
        guint16 packet_len;
        
-       guint32 origin_addr;
-       guint32 neighbor_addr;
-       guint32 interface_addr;
-       guint32 network_addr;
-       guint32 netmask;
-       struct e_in6_addr origin6_addr, *origin=&origin6_addr;
-       struct e_in6_addr neighbor6_addr, *neighbor=&neighbor6_addr;
-       struct e_in6_addr interface6_addr, *theinterface=&interface6_addr;
-       struct e_in6_addr network6_addr, *network=&network6_addr;
-       struct e_in6_addr netmask6, *netmask_v6=&netmask6;
-       
-
        /* Does this packet have a valid message type at the beginning? */
        if (!tvb_bytes_exist(tvb, 0, 2))
                return 0;       /* not enough bytes for the packet length */
@@ -202,8 +189,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        
                        /*-----------------Dissecting: Origin Addr, TTL, Hop Count, and Message Seq Number*/
                        if(message_size > 0)    {
-                               tvb_memcpy(tvb, (guint8*)&origin_addr, offset, 4);
-                               proto_tree_add_ipv4(olsr_tree, hf_olsr_origin_addr, tvb, offset, 4, origin_addr);
+                               proto_tree_add_item(olsr_tree, hf_olsr_origin_addr, tvb, offset, 4, FALSE);
                                message_size--;
                                packet_size--;
                                offset+=4;
@@ -228,8 +214,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                packet_size--;
 
                                while(message_size>0)  {
-                                       tvb_memcpy(tvb, (guint8*)&neighbor_addr, offset, 4);
-                                       proto_tree_add_ipv4(olsr_tree, hf_olsr_neighbor_addr, tvb, offset, 4, neighbor_addr);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_neighbor_addr, tvb, offset, 4, FALSE);
                                        message_size--;
                                        offset+=4;
                                        packet_size--;
@@ -308,8 +293,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                                                                        
                                        /*-------------------Dissect Neighbor Addresses--------------------*/
                                        while(link_message_size>0)   {
-                                               tvb_memcpy(tvb, (guint8*)&neighbor_addr, offset, 4);
-                                               proto_tree_add_ipv4(olsr_tree, hf_olsr_neighbor_addr, tvb, offset, 4, neighbor_addr);
+                                               proto_tree_add_item(olsr_tree, hf_olsr_neighbor_addr, tvb, offset, 4, FALSE);
                                                offset+=4;
                                                message_size--;
                                                packet_size--;
@@ -321,8 +305,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        /*---------------------------------Dissect MID Message----------------------------------*/
                        else if(message_size>0 && message_type==MID)    {
                                while(message_size>0)   {
-                                       tvb_memcpy(tvb, (guint8*)&interface_addr, offset, 4);
-                                       proto_tree_add_ipv4(olsr_tree, hf_olsr_interface_addr, tvb, offset, 4, interface_addr);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_interface_addr, tvb, offset, 4, FALSE);
                                        message_size--;
                                        offset+=4;
                                        packet_size--;
@@ -332,13 +315,11 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        /*-----------------------------Dissect HNA Message--------------------------------*/
                        else if(message_size>0 && message_type==HNA)    {
                                while(message_size>0)   {
-                                       tvb_memcpy(tvb, (guint8*)&network_addr, offset, 4);
-                                       proto_tree_add_ipv4(olsr_tree, hf_olsr_network_addr, tvb, offset, 4, network_addr);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_network_addr, tvb, offset, 4, FALSE);
                                        message_size--;
                                        packet_size--;
                                        offset+=4;
-                                       tvb_memcpy(tvb, (guint8*)&netmask, offset, 4);
-                                       proto_tree_add_ipv4(olsr_tree, hf_olsr_netmask, tvb, offset, 4, netmask);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_netmask, tvb, offset, 4, FALSE);
                                        message_size--;
                                        packet_size--;
                                        offset+=4;
@@ -401,8 +382,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
                        /*-----------------Dissecting: Origin Addr, TTL, Hop Count, and Message Seq Number */
                        if(message_size > 0)    {
-                               tvb_memcpy(tvb, (guint8*)&origin6_addr, offset, 16);
-                               proto_tree_add_ipv6(olsr_tree, hf_olsr_origin6_addr, tvb, offset, 16, (guint8*)origin);
+                               proto_tree_add_item(olsr_tree, hf_olsr_origin6_addr, tvb, offset, 16, FALSE);
                                offset+=16;
                                message_size-=4;
                                packet_size-=4;
@@ -427,8 +407,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                packet_size--;
 
                                while(message_size>0)  {
-                                       tvb_memcpy(tvb, (guint8*)&neighbor6_addr, offset, 16);
-                                       proto_tree_add_ipv6(olsr_tree, hf_olsr_neighbor6_addr, tvb, offset, 16, (guint8*)neighbor);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_neighbor6_addr, tvb, offset, 16, FALSE);
                                        message_size-=4;
                                        offset+=16;
                                        packet_size-=4;
@@ -507,8 +486,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                                                                        
                                        /*--------------------------Dissect Neighbor Addresses---------------------------*/
                                        while(link_message_size>0)   {
-                                               tvb_memcpy(tvb, (guint8*)&neighbor6_addr, offset, 16);
-                                               proto_tree_add_ipv6(olsr_tree, hf_olsr_neighbor6_addr, tvb, offset, 16, (guint8*)neighbor);
+                                               proto_tree_add_item(olsr_tree, hf_olsr_neighbor6_addr, tvb, offset, 16, FALSE);
                                                offset+=16;
                                                message_size-=4;
                                                packet_size-=4;
@@ -520,8 +498,7 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        /*---------------------------------Dissect MID Message----------------------------------*/
                        else if(message_size>0 && message_type==MID)    {
                                while(message_size>0)   {
-                                       tvb_memcpy(tvb, (guint8*)&interface6_addr, offset, 16);
-                                       proto_tree_add_ipv6(olsr_tree, hf_olsr_interface6_addr, tvb, offset, 16, (guint8*)theinterface);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_interface6_addr, tvb, offset, 16, FALSE);
                                        message_size-=4;
                                        offset+=16;
                                        packet_size-=4;
@@ -531,13 +508,11 @@ dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        /*-----------------------------Dissect HNA Message--------------------------------*/
                        else if(message_size>0 && message_type==HNA)    {
                                while(message_size>0)   {
-                                       tvb_memcpy(tvb, (guint8*)&network6_addr, offset, 16);
-                                       proto_tree_add_ipv6(olsr_tree, hf_olsr_network6_addr, tvb, offset, 16, (guint8*)network);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_network6_addr, tvb, offset, 16, FALSE);
                                        offset+=16;
                                        message_size-=4;
                                        packet_size-=4;
-                                       tvb_memcpy(tvb, (guint8*)&netmask6, offset, 16);
-                                       proto_tree_add_ipv6(olsr_tree, hf_olsr_netmask6, tvb, offset, 16, (guint8*)netmask_v6);
+                                       proto_tree_add_item(olsr_tree, hf_olsr_netmask6, tvb, offset, 16, FALSE);
                                        message_size-=4;
                                        packet_size-=4;
                                        offset+=16;
index 85ae3aeee6964903be011433ab54cfd4ac662bc8..34e34f34cb32474e7262f7afc5fc6abf078d0664 100644 (file)
@@ -277,7 +277,7 @@ dissect_quake3_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo _U_,
                        proto_item      *server_item = NULL;
                        proto_tree      *server_tree = NULL;
 
-                       tvb_memcpy(tvb, (guint8 *)&ip_addr, base + 1, 4);
+                       ip_addr = tvb_get_ipv4(tvb, base + 1);
                        udp_port = tvb_get_ntohs(tvb, base + 5);
 
                        /* It may be a good idea to create a conversation for
index fca4ccbc0702a9abff128a6cf199e52743a8996c..ee7bb6c5ae271433c4f5762c9cdc57a6c4090fd4 100644 (file)
@@ -1393,7 +1393,7 @@ static void dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
            src_addr.type=AT_IPv4;
            src_addr.len=4;
            src_addr.data=(guint8 *)&ipv4_address;
-           tvb_memcpy(tvb, (guint8 *)&ipv4_address, offset+16, 4);
+           ipv4_address = tvb_get_ipv4(tvb, offset+16);
            rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+20), 0, "Skinny", pinfo->fd->num, NULL);
       }
       break;
@@ -1774,7 +1774,7 @@ static void dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
            src_addr.type=AT_IPv4;
            src_addr.len=4;
            src_addr.data=(char *)&ipv4_address;
-           tvb_memcpy(tvb, (char *)&ipv4_address, offset+20, 4);
+           ipv4_address = tvb_get_ipv4(tvb, offset+20);
            rtp_add_address(pinfo, &src_addr, tvb_get_letohl(tvb, offset+24), 0, "Skinny", pinfo->fd->num, NULL);
       }
       break;
index 77c12a727c7dbcebe3d2e657188f00dea9d256ee..eeba019bd4453afc4d940fb441b2ae0f0adec2d3 100644 (file)
@@ -342,8 +342,7 @@ static int get_address_v5(tvbuff_t *tvb, int offset,
        if ( a_type == 1){              /* IPv4 address */
 
                if ( hash_info)
-                       tvb_memcpy(tvb, (guint8 *)&hash_info->dst_addr,
-                           offset, 4);
+                       hash_info->dst_addr = tvb_get_ipv4(tvb, offset);
                offset += 4;
        }
 
@@ -672,7 +671,7 @@ state_machine_v4( socks_hash_entry_t *hash_info, tvbuff_t *tvb,
                        hash_info->port =  tvb_get_ntohs(tvb, offset + 2);
                                                /* get remote address   */
 
-               tvb_memcpy(tvb, (guint8 *)&hash_info->dst_addr, offset + 4, 4);
+               hash_info->dst_addr = tvb_get_ipv4(tvb, offset + 4);
 
                                                /* save the packet pointer */
                hash_info->connect_row = get_packet_ptr;
index 36b0935849d32314fc4416bd5b6d32aaeb548283..174fbaff6aec525b1b619a759b04a99afb4e10b8 100644 (file)
@@ -153,35 +153,45 @@ static int
 parse_teredo_orig(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                        int offset, e_teredohdr *teredoh)
 {
+       proto_item *ti = NULL;
+
        if (check_col(pinfo->cinfo, COL_INFO))
                col_append_sep_str (pinfo->cinfo, COL_INFO, ", ",
                                        "Origin indication");
 
        if (tree) {
-               proto_item *ti;
-               guint16 port;
-               guint32 addr;
-
                ti = proto_tree_add_item(tree, hf_teredo_orig, tvb, offset,
                                                8, FALSE);
                tree = proto_item_add_subtree(ti, ett_teredo_orig);
-               offset += 2;
+       }
+       offset += 2;
 
-               port = ~tvb_get_ntohs(tvb, offset);
+       teredoh->th_orgport = tvb_get_ntohs(tvb, offset);
+       if (tree) {
+               /*
+                * The "usual arithmetic conversions" will convert
+                * "teredoh->th_orgport" to an "int" (because all
+                * "unsigned short" values will fit in an "int"),
+                * which will zero-extend it.  This means that
+                * complementing it will turn all the zeroes in
+                * the upper 16 bits into ones; we just want the
+                * lower 16 bits (containing the port number)
+                * complemented, with the result zero-extended.
+                *
+                * That's what the cast is for.
+                */
                proto_tree_add_uint(tree, hf_teredo_orig_port, tvb,
-                                       offset, 2, port);
-               offset += 2;
+                                       offset, 2,
+                                       (guint16)~teredoh->th_orgport);
+       }
+       offset += 2;
 
-               tvb_memcpy(tvb, (guint8 *)&addr, offset, 4);
+       teredoh->th_iporgaddr = tvb_get_ipv4(tvb, offset);
+       if (tree) {
                proto_tree_add_ipv4(tree, hf_teredo_orig_addr, tvb,
-                                       offset, 4, ~addr);
-               offset += 4;
+                                       offset, 4, ~teredoh->th_iporgaddr);
        }
-       else
-               offset += 8;
-
-       teredoh->th_orgport = tvb_get_ntohs(tvb, offset - 6);
-       tvb_memcpy(tvb, (guint8 *)&teredoh->th_iporgaddr, offset-4, 4);
+       offset += 4;
 
        return offset;
 }
index d7e012322ca2a555c4a601aa2ea8463c977d6de9..c0dbe5344a5ee4f20b26d9bd34caf14b465e497a 100644 (file)
@@ -938,7 +938,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
                if ( octet == 0x57 ){ /* IPv6 */
 
                }else{ /* All other values shall be interpreted as Ipv4 address in this version of the protocol.*/
-                       tvb_memcpy(tvb, (guint8 *)&sgw_ipv4_address, ie_offset, 4);
+                       sgw_ipv4_address = tvb_get_ipv4(tvb, ie_offset);
                        proto_tree_add_ipv4(urr_ie_tree, hf_uma_urr_sgw_ipv4, tvb, ie_offset, 4, sgw_ipv4_address);
 
                }
@@ -1339,7 +1339,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
                if ( octet == 0x57 ){ /* IPv6 */
 
                }else{ /* All other values shall be interpreted as Ipv4 address in this version of the protocol.*/
-                       tvb_memcpy(tvb, (guint8 *)&unc_ipv4_address, ie_offset, 4);
+                       unc_ipv4_address = tvb_get_ipv4(tvb, ie_offset);
                        proto_tree_add_ipv4(urr_ie_tree, hf_uma_urr_unc_ipv4, tvb, ie_offset, 4, unc_ipv4_address);
                        rtp_ipv4_address = unc_ipv4_address;
 
@@ -1363,7 +1363,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
                if ( octet == 0x57 ){ /* IPv6 */
 
                }else{ /* All other values shall be interpreted as Ipv4 address in this version of the protocol.*/
-                       tvb_memcpy(tvb, (guint8 *)&GPRS_user_data_ipv4_address, ie_offset, 4);
+                       GPRS_user_data_ipv4_address = tvb_get_ipv4(tvb, ie_offset);
                        proto_tree_add_ipv4(urr_ie_tree, hf_uma_urr_GPRS_user_data_transport_ipv4, tvb, ie_offset, 4, GPRS_user_data_ipv4_address);
 
                }
index 9c8adfa2fd4c09d9e671299603e72951de470965..bdae4572e62af1822aef146913c8ad79f6fcbf68 100644 (file)
@@ -270,7 +270,7 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                            "Number of Web Caches: %u", cache_count);
                        offset += 4;
                        for (i = 0; i < cache_count; i++) {
-                               tvb_memcpy(tvb, (guint8 *)&ipaddr, offset, 4);
+                               ipaddr = tvb_get_ipv4(tvb, offset);
                                proto_tree_add_ipv4_format(wccp_tree,
                                    hf_cache_ip, tvb, offset, 4,
                                    ipaddr,
index e644e5bf04656a25c0507b0594adc89eeb4b6908..6cd52b9a1d065b54f8582acd6f1f015cae57b049 100644 (file)
@@ -54,7 +54,6 @@
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
-#include <epan/ipv6-utils.h>
 #include <epan/conversation.h>
 
 #include "packet-wap.h"
@@ -4606,7 +4605,7 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                 */
                                goto unknown_address_type;
                        }
-                       tvb_memcpy(tvb, (guint8 *)&address_ipv4, offset, 4);
+                       address_ipv4 = tvb_get_ipv4(tvb, offset);
                        if (tree) {
                                proto_tree_add_ipv4 (addr_tree,
                                    hf_address_ipv4_addr,
@@ -4642,7 +4641,7 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                 */
                                goto unknown_address_type;
                        }
-                       tvb_memcpy(tvb, (guint8 *)&address_ipv6, offset, 16);
+                       tvb_get_ipv6(tvb, offset, &address_ipv6);
                        if (tree) {
                                proto_tree_add_ipv6 (addr_tree,
                                    hf_address_ipv6_addr,
@@ -4796,7 +4795,7 @@ add_addresses(proto_tree *tree, tvbuff_t *tvb, int hf)
                                 */
                                goto unknown_address_type;
                        }
-                       tvb_memcpy(tvb, (guint8 *)&address_ipv4, offset, 4);
+                       address_ipv4 = tvb_get_ipv4(tvb, offset);
                        proto_tree_add_ipv4 (addr_tree, hf_address_ipv4_addr,
                                        tvb, offset, 4, address_ipv4);
                        break;
@@ -4811,7 +4810,7 @@ add_addresses(proto_tree *tree, tvbuff_t *tvb, int hf)
                                 */
                                goto unknown_address_type;
                        }
-                       tvb_memcpy(tvb, (guint8 *)&address_ipv6, offset, 16);
+                       tvb_get_ipv6(tvb, offset, &address_ipv6);
                        proto_tree_add_ipv6 (addr_tree, hf_address_ipv6_addr,
                                        tvb, offset, 16, (guint8 *)&address_ipv6);
                        break;
index c68c1d04cfdd72fa18f9b2cfa86fa941e3ffb8f9..45b073f1fb5d6b579186dc0db897d9b02fe567e6 100644 (file)
@@ -43,7 +43,6 @@
 #include "timestamp.h"
 
 #include "atalk-utils.h"
-#include "ipv6-utils.h"
 #include "sna-utils.h"
 #include "osi-utils.h"
 #include "to_str.h"
index a7996f4276743b4e7f6ca32639707d0ea73ccc8d..b6c9fcf2701aa92e6e95de3c516d13ea03836caf 100644 (file)
@@ -36,7 +36,6 @@
 #include "strutil.h"
 #include "addr_resolv.h"
 #include "plugins.h"
-#include "ipv6-utils.h"
 #include "proto.h"
 #include "epan_dissect.h"
 #include "slab.h"
index ae767e519cd570a4edc87c19cc7d4fb8d94ccbba..fd3ee2c45df89cfa681c248577d960fa719adb58 100644 (file)
@@ -46,7 +46,6 @@
 #endif
 
 #include "pint.h"
-#include "ipv6-utils.h"
 #include "tvbuff.h"
 #include "strutil.h"
 #include "emem.h"
index f13a39ccd9053d1fc6fd1a3ff67592b5ef82db4a..01648b0979be5550017002976c56d25921a4e987 100644 (file)
@@ -36,6 +36,7 @@
 #define __TVBUFF_H__
 
 #include <glib.h>
+#include <epan/ipv6-utils.h>
 #include "exceptions.h"
 
 /** @file
index c18d368879ba564914e087ca8deb0dd9f58bcf4d..ef36a040e4050d8f287b867402739d443288d0eb 100644 (file)
@@ -359,7 +359,7 @@ void decode_ipv4_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int of
                proto_tree_add_text(tree, tvb, offset, length, "Too short attribute!");
                return;
        }
-       tvb_memcpy(tvb, (guint8 *)&ip_address, offset+4, 4);
+       ip_address = tvb_get_ipv4(tvb, offset+4);
        proto_tree_add_ipv4(tree, *hfValue, tvb, offset+4, 4, ip_address);
 }
 
index 9fc5d39682ee7d5ed59492bf02496858695f3686..1cbb23f0cbc607caafe2c467b54cadd7575ec956 100644 (file)
@@ -306,7 +306,7 @@ dissect_pn_ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
 {
     guint32 data;
 
-    tvb_memcpy(tvb, (guint8 *)&data, offset, 4);
+    data = tvb_get_ipv4(tvb, offset);
     if(tree)
         proto_tree_add_ipv4(tree, hfindex, tvb, offset, 4, data);