+ guint64 (* get_bytes_read) (Device * self);
+ guint64 (* get_bytes_written) (Device * self);
+
+ gboolean (* listen)(Device *self, gboolean for_writing, DirectTCPAddr **addrs);
+ /* The MainLoop must be running, but the following 4 methods must not be
+ * called from an event. they must be called from a different thread.
+ * They return:
+ * 0 - success
+ * 1 - failed
+ * 2 - interupted
+ */
+ int (* accept)(Device *self, DirectTCPConnection **conn,
+ int *cancelled, GMutex *abort_mutex, GCond *abort_cond);
+ int (* connect)(Device *self, gboolean for_writing,
+ DirectTCPAddr *addrs, DirectTCPConnection **conn,
+ int *cancelled,
+ GMutex *abort_mutex, GCond *abort_cond);
+ int (* write_from_connection)(Device *self, guint64 size,
+ guint64 *actual_size, int *cancelled,
+ GMutex *abort_mutex, GCond *abort_cond);
+ int (* read_to_connection)(Device *self, guint64 size,
+ guint64 *actual_size, int *cancelled,
+ GMutex *abort_mutex, GCond *abort_cond);
+
+ gboolean (* use_connection)(Device *self, DirectTCPConnection *conn);