+/* A port within an OpenFlow switch.
+ *
+ * 'name' and 'type' are suitable for passing to netdev_open(). */
+struct ofproto_port {
+ char *name; /* Network device name, e.g. "eth0". */
+ char *type; /* Network device type, e.g. "system". */
+ uint16_t ofp_port; /* OpenFlow port number. */
+};
+void ofproto_port_clone(struct ofproto_port *, const struct ofproto_port *);
+void ofproto_port_destroy(struct ofproto_port *);
+
+struct ofproto_port_dump {
+ const struct ofproto *ofproto;
+ int error;
+ void *state;
+};
+void ofproto_port_dump_start(struct ofproto_port_dump *,
+ const struct ofproto *);
+bool ofproto_port_dump_next(struct ofproto_port_dump *, struct ofproto_port *);
+int ofproto_port_dump_done(struct ofproto_port_dump *);
+
+/* Iterates through each OFPROTO_PORT in OFPROTO, 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 ofproto_port_dump_done(). */
+#define OFPROTO_PORT_FOR_EACH(OFPROTO_PORT, DUMP, OFPROTO) \
+ for (ofproto_port_dump_start(DUMP, OFPROTO); \
+ (ofproto_port_dump_next(DUMP, OFPROTO_PORT) \
+ ? true \
+ : (ofproto_port_dump_done(DUMP), false)); \
+ )
+
+#define OFPROTO_FLOW_EVICTON_THRESHOLD_DEFAULT 1000
+#define OFPROTO_FLOW_EVICTION_THRESHOLD_MIN 100
+
+int ofproto_port_add(struct ofproto *, struct netdev *, uint16_t *ofp_portp);
+int ofproto_port_del(struct ofproto *, uint16_t ofp_port);
+
+int ofproto_port_query_by_name(const struct ofproto *, const char *devname,
+ struct ofproto_port *);