1 /* GNIO - GLib Network Layer of GIO
3 * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Authors: Christian Kellner <gicmo@gnome.org>
21 * Samuel Cormier-Iijima <sciyoshi@gmail.com>
31 #include "gtcpserver.h"
33 G_DEFINE_TYPE (GTcpServer, g_tcp_server, G_TYPE_OBJECT);
40 struct _GTcpServerPrivate
46 g_tcp_server_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
48 GTcpServer *server = G_TCP_SERVER (object);
53 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
58 g_tcp_server_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
60 GTcpServer *server = G_TCP_SERVER (object);
65 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
70 g_tcp_server_finalize (GObject *object)
72 GTcpServer *server = G_TCP_SERVER (object);
74 if (G_OBJECT_CLASS (g_tcp_server_parent_class)->finalize)
75 (*G_OBJECT_CLASS (g_tcp_server_parent_class)->finalize) (object);
79 g_tcp_server_dispose (GObject *object)
81 GTcpServer *server = G_TCP_SERVER (object);
83 if (G_OBJECT_CLASS (g_tcp_server_parent_class)->dispose)
84 (*G_OBJECT_CLASS (g_tcp_server_parent_class)->dispose) (object);
88 g_tcp_server_class_init (GTcpServerClass *klass)
90 GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
92 g_type_class_add_private (klass, sizeof (GTcpServerPrivate));
94 gobject_class->finalize = g_tcp_server_finalize;
95 gobject_class->dispose = g_tcp_server_dispose;
96 gobject_class->set_property = g_tcp_server_set_property;
97 gobject_class->get_property = g_tcp_server_get_property;
101 g_tcp_server_init (GTcpServer *server)
103 server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, G_TYPE_TCP_SERVER, GTcpServerPrivate);
107 g_tcp_server_new (GInetSocketAddress *address,
114 g_tcp_server_accept (GTcpServer *tcp_server,
115 GCancellable *cancellable,
122 g_tcp_server_close (GTcpServer *tcp_server)
124 g_return_if_fail (G_IS_TCP_SERVER (tcp_server));