*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
void
ipv4_addr_free(ipv4_addr *ipv4)
{
- if (ipv4)
- g_free(ipv4);
+ g_free(ipv4);
}
void
-ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, guint32 new_addr)
+ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, const guint32 new_addr)
{
ipv4->addr = new_addr;
}
void
-ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, guint32 new_addr)
+ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, const guint32 new_addr)
{
ipv4->addr = g_ntohl(new_addr);
}
void
-ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, guint new_nmask_bits)
+ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, const guint new_nmask_bits)
{
static guint32 bitmasks[33] = {
0x00000000,
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)
{
guint32 ipv4_host_order = g_htonl(ipv4->addr);
- ip_to_str_buf((guint8*)&ipv4_host_order, buf);
+ ip_to_str_buf((guint8*)&ipv4_host_order, buf, MAX_IP_STR_LEN);
}