+ /* Arranges for the poll loop to wake up when 'vconn' is ready to take an
+ * action of the given 'type'. */
+ void (*wait)(struct vconn *vconn, enum vconn_wait_type type);
+};
+\f
+/* Passive virtual connection to an OpenFlow device.
+ *
+ * This structure should be treated as opaque by vconn implementations. */
+struct pvconn {
+ struct pvconn_class *class;
+ char *name;
+};
+
+void pvconn_init(struct pvconn *, struct pvconn_class *, const char *name);
+static inline void pvconn_assert_class(const struct pvconn *pvconn,
+ const struct pvconn_class *class)
+{
+ assert(pvconn->class == class);
+}
+
+struct pvconn_class {
+ /* Prefix for connection names, e.g. "ptcp", "pssl". */
+ const char *name;
+
+ /* Attempts to start listening for OpenFlow connections. 'name' is the
+ * full connection name provided by the user, e.g. "nl:0", "tcp:1.2.3.4".
+ * This name is useful for error messages but must not be modified.
+ *
+ * 'suffix' is a copy of 'name' following the colon and may be modified.
+ *
+ * Returns 0 if successful, otherwise a positive errno value. If
+ * successful, stores a pointer to the new connection in '*pvconnp'.
+ *
+ * The listen function must not block. If the connection cannot be
+ * completed immediately, it should return EAGAIN (not EINPROGRESS, as
+ * returned by the connect system call) and continue the connection in the
+ * background. */
+ int (*listen)(const char *name, char *suffix, struct pvconn **pvconnp);
+
+ /* Closes 'pvconn' and frees associated memory. */
+ void (*close)(struct pvconn *pvconn);
+
+ /* Tries to accept a new connection on 'pvconn'. If successful, stores the
+ * new connection in '*new_vconnp' and returns 0. Otherwise, returns a
+ * positive errno value.
+ *
+ * The accept function must not block waiting for a connection. If no
+ * connection is ready to be accepted, it should return EAGAIN. */
+ int (*accept)(struct pvconn *pvconn, struct vconn **new_vconnp);
+
+ /* Arranges for the poll loop to wake up when a connection is ready to be
+ * accepted on 'pvconn'. */
+ void (*wait)(struct pvconn *pvconn);