+int dpif_get_max_ports(const struct dpif *);
+
+struct dpif_port_dump {
+ const struct dpif *dpif;
+ int error;
+ void *state;
+};
+void dpif_port_dump_start(struct dpif_port_dump *, const struct dpif *);
+bool dpif_port_dump_next(struct dpif_port_dump *, struct dpif_port *);
+int dpif_port_dump_done(struct dpif_port_dump *);
+
+/* Iterates through each DPIF_PORT in DPIF, using DUMP as state.
+ *
+ * Arguments all have pointer type.
+ *
+ * If you break out of the loop, then you need to free the dump structure by
+ * hand using dpif_port_dump_done(). */
+#define DPIF_PORT_FOR_EACH(DPIF_PORT, DUMP, DPIF) \
+ for (dpif_port_dump_start(DUMP, DPIF); \
+ (dpif_port_dump_next(DUMP, DPIF_PORT) \
+ ? true \
+ : (dpif_port_dump_done(DUMP), false)); \
+ )