diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-01-03 15:05:13 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-01-04 00:03:34 +0000 |
commit | 32f9f92487f797bcaef6d3cbf92b7fb802a6079e (patch) | |
tree | bf558a353d296a429f8bfa50db4d653c40e4bf0b /epan/ipv4.c | |
parent | fa7cf8737cd913a3217971d7fa8008efb4f0dd87 (diff) | |
download | wireshark-32f9f92487f797bcaef6d3cbf92b7fb802a6079e.tar.gz |
Rename ipv4_addr and ipv6_addr to indicate their full contents.
They're not just addresses, they also include a mask length for IPv4 and
a prefix length for IPv6. Rename them appropriately.
Rename the old ipv4_addr_and_mask() and ipv6_addr_and_mask() to reflect
that 1) they fetch data from a tvbuff and 2) *don't* fetch the mask
length or prefix length, those lengths are passed as arguments to
indicate how many bytes worth of address to fetch.
Change-Id: I4cad5a186ad7bfcb60022a91dbe8bc8479e6471f
Reviewed-on: https://code.wireshark.org/review/13035
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/ipv4.c')
-rw-r--r-- | epan/ipv4.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/epan/ipv4.c b/epan/ipv4.c index 3957941eb0..103e7b47d4 100644 --- a/epan/ipv4.c +++ b/epan/ipv4.c @@ -34,54 +34,54 @@ #include "addr_and_mask.h" -ipv4_addr* -ipv4_addr_new(void) +ipv4_addr_and_mask* +ipv4_addr_and_mask_new(void) { - ipv4_addr *ipv4; + ipv4_addr_and_mask *ipv4; - ipv4 = g_new(ipv4_addr, 1); + ipv4 = g_new(ipv4_addr_and_mask, 1); return ipv4; } void -ipv4_addr_free(ipv4_addr *ipv4) +ipv4_addr_and_mask_free(ipv4_addr_and_mask *ipv4) { g_free(ipv4); } void -ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, const guint32 new_addr) +ipv4_addr_and_mask_set_host_order_addr(ipv4_addr_and_mask *ipv4, const guint32 new_addr) { ipv4->addr = new_addr; } void -ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, const guint32 new_addr) +ipv4_addr_and_mask_set_net_order_addr(ipv4_addr_and_mask *ipv4, const guint32 new_addr) { ipv4->addr = g_ntohl(new_addr); } void -ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, const guint new_nmask_bits) +ipv4_addr_and_mask_set_netmask_bits(ipv4_addr_and_mask *ipv4, const guint new_nmask_bits) { ipv4->nmask = ip_get_subnet_mask(new_nmask_bits); } guint32 -ipv4_get_net_order_addr(ipv4_addr *ipv4) +ipv4_get_net_order_addr(ipv4_addr_and_mask *ipv4) { return g_htonl(ipv4->addr); } guint32 -ipv4_get_host_order_addr(ipv4_addr *ipv4) +ipv4_get_host_order_addr(ipv4_addr_and_mask *ipv4) { return ipv4->addr; } /* We're assuming the buffer is at least MAX_IP_STR_LEN (16 bytes) */ void -ipv4_addr_str_buf(const ipv4_addr *ipv4, gchar *buf) +ipv4_addr_and_mask_str_buf(const ipv4_addr_and_mask *ipv4, gchar *buf) { guint32 ipv4_host_order = g_htonl(ipv4->addr); ip_to_str_buf((guint8*)&ipv4_host_order, buf, MAX_IP_STR_LEN); @@ -95,7 +95,7 @@ ipv4_addr_str_buf(const ipv4_addr *ipv4, gchar *buf) /* Returns TRUE if equal, FALSE if not */ gboolean -ipv4_addr_eq(const ipv4_addr *a, const ipv4_addr *b) +ipv4_addr_and_mask_eq(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b) { guint32 val_a, val_b, nmask; @@ -106,7 +106,7 @@ ipv4_addr_eq(const ipv4_addr *a, const ipv4_addr *b) } gboolean -ipv4_addr_gt(const ipv4_addr *a, const ipv4_addr *b) +ipv4_addr_and_mask_gt(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b) { guint32 val_a, val_b, nmask; @@ -118,7 +118,7 @@ ipv4_addr_gt(const ipv4_addr *a, const ipv4_addr *b) } gboolean -ipv4_addr_ge(const ipv4_addr *a, const ipv4_addr *b) +ipv4_addr_and_mask_ge(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b) { guint32 val_a, val_b, nmask; @@ -130,7 +130,7 @@ ipv4_addr_ge(const ipv4_addr *a, const ipv4_addr *b) } gboolean -ipv4_addr_lt(const ipv4_addr *a, const ipv4_addr *b) +ipv4_addr_and_mask_lt(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b) { guint32 val_a, val_b, nmask; @@ -142,7 +142,7 @@ ipv4_addr_lt(const ipv4_addr *a, const ipv4_addr *b) } gboolean -ipv4_addr_le(const ipv4_addr *a, const ipv4_addr *b) +ipv4_addr_and_mask_le(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b) { guint32 val_a, val_b, nmask; |