aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ipv4.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-10-26 00:03:09 -0700
committerGuy Harris <guy@alum.mit.edu>2017-10-26 07:03:43 +0000
commit859405fd2dd7b76e00d650e1674db2378e05beff (patch)
tree5398bf88a4ae3290d5412bdb352ccf42da57f8e5 /epan/ipv4.h
parente7abfc397bfa8981b3813c19a64c36cfb275f21d (diff)
Swallow up the stuff from epan/ipv4.c into epan/ftypes/ftype-ipv4.c and epan/ipv4.h.
Most of it doesn't need to be public; pull it into epan/ipv4.c. Pull the two routines that *are* used outside epan/ftypes/ftype-ipv4.c into epan/ipv4.h as static inline functions. This allows some optimization, and makes epan/ipv4.h more like epan/ipv6.h. Change-Id: I80229acde559d810aecec2acd5c995076440c181 Reviewed-on: https://code.wireshark.org/review/24071 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/ipv4.h')
-rw-r--r--epan/ipv4.h42
1 files changed, 11 insertions, 31 deletions
diff --git a/epan/ipv4.h b/epan/ipv4.h
index fce104aedb..3adbbed8c3 100644
--- a/epan/ipv4.h
+++ b/epan/ipv4.h
@@ -30,41 +30,21 @@
#include <glib.h>
#include "ws_symbol_export.h"
-
typedef struct {
guint32 addr; /* stored in host order */
guint32 nmask; /* stored in host order */
} ipv4_addr_and_mask;
-/* Allocate a new ipv4_addr_and_mask struct, initialize it,
- * and return pointer
- */
-ipv4_addr_and_mask* ipv4_addr_and_mask_new(void);
-
-/* Frees an ipv4_addr_and_mask struct */
-void ipv4_addr_and_mask_free(ipv4_addr_and_mask *ipv4);
-
-void ipv4_addr_and_mask_set_host_order_addr(ipv4_addr_and_mask *ipv4, const guint32 new_addr);
-void ipv4_addr_and_mask_set_net_order_addr(ipv4_addr_and_mask *ipv4, const guint32 new_addr);
-void ipv4_addr_and_mask_set_netmask_bits(ipv4_addr_and_mask *ipv4, const guint new_nmask_bits);
-
-WS_DLL_PUBLIC
-guint32 ipv4_get_net_order_addr(ipv4_addr_and_mask *ipv4);
-guint32 ipv4_get_host_order_addr(ipv4_addr_and_mask *ipv4);
-
-/* Fills in a buffer with a dotted-decimal notation representation of an IPv4
- * address. */
-void ipv4_addr_and_mask_str_buf(const ipv4_addr_and_mask *ipv4, gchar *buf);
-
-/* Compares two ipv4_addr_and_masks, taking into account the less restrictive of the
- * two netmasks, applying that netmask to both addrs.
- */
-gboolean ipv4_addr_and_mask_eq(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b);
-gboolean ipv4_addr_and_mask_gt(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b);
-gboolean ipv4_addr_and_mask_ge(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b);
-gboolean ipv4_addr_and_mask_lt(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b);
-gboolean ipv4_addr_and_mask_le(const ipv4_addr_and_mask *a, const ipv4_addr_and_mask *b);
-
-#define ipv4_addr_and_mask_ne(a,b) !ipv4_addr_and_mask_eq((a),(b))
+static inline guint32
+ipv4_get_net_order_addr(ipv4_addr_and_mask *ipv4)
+{
+ return g_htonl(ipv4->addr);
+}
+
+static inline guint32
+ipv4_get_host_order_addr(ipv4_addr_and_mask *ipv4)
+{
+ return ipv4->addr;
+}
#endif