summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--epan/guid-utils.c16
-rw-r--r--epan/guid-utils.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/epan/guid-utils.c b/epan/guid-utils.c
index c0a915b31f..8bb95b98b5 100644
--- a/epan/guid-utils.c
+++ b/epan/guid-utils.c
@@ -198,6 +198,22 @@ guids_resolve_guid_to_str(const e_guid_t *guid)
guid->data4[6], guid->data4[7]);
}
+int guid_cmp(const e_guid_t *g1, const e_guid_t *g2)
+{
+ if (g1->data1 != g2->data1) {
+ return (g1->data1 < g2->data1) ? -1 : 1;
+ }
+
+ if (g1->data2 != g2->data2) {
+ return (g1->data2 < g2->data2) ? -1 : 1;
+ }
+
+ if (g1->data3 != g2->data3) {
+ return (g1->data3 < g2->data3) ? -1 : 1;
+ }
+
+ return memcmp(&g1->data4[0], &g2->data4[0], 8);
+}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/epan/guid-utils.h b/epan/guid-utils.h
index bc4f88ada9..6441b361df 100644
--- a/epan/guid-utils.h
+++ b/epan/guid-utils.h
@@ -60,4 +60,6 @@ WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid);
/* (if you need hex string only, use guid_to_str instead) */
#define guids_resolve_uuid_to_str(uuid) guids_resolve_guid_to_str((e_guid_t *) (uuid))
+extern int guid_cmp(const e_guid_t *g1, const e_guid_t *g2);
+
#endif /* __GUID_UTILS_H__ */