ofp-util: Work on decoding OF1.1 flow_mods.
[openvswitch] / lib / hmap.c
index 9f2774465c3c357b81b4a0086594966e1a72cd11..19710295da2c0fe0785c76ff345ef9ae8d2c7a23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -261,3 +261,18 @@ hmap_at_position(const struct hmap *hmap,
     *offsetp = 0;
     return NULL;
 }
+
+/* Returns true if 'node' is in 'hmap', false otherwise. */
+bool
+hmap_contains(const struct hmap *hmap, const struct hmap_node *node)
+{
+    struct hmap_node *p;
+
+    for (p = hmap_first_in_bucket(hmap, node->hash); p; p = p->next) {
+        if (p == node) {
+            return true;
+        }
+    }
+
+    return false;
+}