src/lib/tcp.h
branchnew-lib-errors
changeset 219 cefec18b8268
parent 177 a74b55104fb9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/tcp.h	Thu May 28 01:17:36 2009 +0300
@@ -0,0 +1,35 @@
+#ifndef LIBQMSK_TCP_H
+#define LIBQMSK_TCP_H
+
+/**
+ * @file
+ *
+ * TCP transport/service implementation.
+ *
+ * XXX: provide some TCP-specific type/functions?
+ */
+#include "transport.h"
+#include "service.h"
+
+/**
+ * Connect the given transport via TCP to the given host/service. The transport will not be ready for use until the
+ * transport_callbacks::on_connect callback has been invoked.
+ *
+ * XXX: blocking DNS resolution
+ *
+ * @param info the transport setup info
+ * @param transport_ptr returned transport
+ * @param host the hostname to connect to
+ * @param service the service name (i.e. port) to connect to
+ * @param err returned error info
+ */
+err_t tcp_connect (const struct transport_info *info, transport_t **transport_ptr, 
+        const char *host, const char *service, error_t *err);
+
+/**
+ * Create a passive/listening TCP socket on the given interface/port (NULL to pick automatically).
+ */
+err_t tcp_listen (const struct service_info *info, service_t **service_ptr, 
+        const char *interface, const char *service, error_t *err);
+
+#endif