Add TcpClient and TcpServer
[cascardo/gnio.git] / gnio / gtcpclient.c
diff --git a/gnio/gtcpclient.c b/gnio/gtcpclient.c
new file mode 100644 (file)
index 0000000..599358e
--- /dev/null
@@ -0,0 +1,124 @@
+/* GNIO - GLib Network Layer of GIO
+ *
+ * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ *          Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <gio/gio.h>
+#include <gio/gasynchelper.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include "ginetaddress.h"
+#include "ginet4address.h"
+#include "ginet6address.h"
+#include "gsocket.h"
+#include "gtcpclient.h"
+#include "gnioerror.h"
+#include "ginetsocketaddress.h"
+
+G_DEFINE_TYPE (GTcpClient, g_tcp_client, G_TYPE_OBJECT);
+
+enum
+{
+  PROP_0
+};
+
+struct _GTcpClientPrivate
+{
+
+};
+
+static void
+g_tcp_client_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+  GTcpClient *client = G_TCP_CLIENT (object);
+
+  switch (prop_id)
+    {
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+g_tcp_client_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+  GTcpClient *client = G_TCP_CLIENT (object);
+
+  switch (prop_id)
+    {
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+g_tcp_client_finalize (GObject *object)
+{
+  GTcpClient *client = G_TCP_CLIENT (object);
+
+  if (G_OBJECT_CLASS (g_tcp_client_parent_class)->finalize)
+    (*G_OBJECT_CLASS (g_tcp_client_parent_class)->finalize) (object);
+}
+
+static void
+g_tcp_client_dispose (GObject *object)
+{
+  GTcpClient *client = G_TCP_CLIENT (object);
+
+  if (G_OBJECT_CLASS (g_tcp_client_parent_class)->dispose)
+    (*G_OBJECT_CLASS (g_tcp_client_parent_class)->dispose) (object);
+}
+
+static void
+g_tcp_client_class_init (GTcpClientClass *klass)
+{
+  GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GTcpClientPrivate));
+
+  gobject_class->finalize = g_tcp_client_finalize;
+  gobject_class->dispose = g_tcp_client_dispose;
+  gobject_class->set_property = g_tcp_client_set_property;
+  gobject_class->get_property = g_tcp_client_get_property;
+}
+
+static void
+g_tcp_client_init (GTcpClient *client)
+{
+  client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, G_TYPE_TCP_CLIENT, GTcpClientPrivate);
+}
+
+GTcpClient *
+g_tcp_client_new (GInetSocketAddress *address,
+                  GError **error)
+{
+  return NULL;
+}
+
+void
+g_tcp_client_close (GTcpClient *tcp_client)
+{
+  g_return_if_fail (G_IS_TCP_CLIENT (tcp_client));
+}