gio2 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +26 -9
- data/ext/gio2/extconf.rb +38 -28
- data/ext/gio2/rb-gio2-pollable-source.c +59 -0
- data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
- data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
- data/extconf.rb +22 -6
- data/lib/1.9/gio2.so +0 -0
- data/lib/2.0/gio2.so +0 -0
- data/lib/2.1/gio2.so +0 -0
- data/lib/gio2/deprecated.rb +16 -0
- data/lib/gio2/inet-address.rb +33 -0
- data/lib/gio2/input-stream.rb +39 -0
- data/lib/gio2/loader.rb +244 -0
- data/lib/gio2/output-stream.rb +24 -0
- data/lib/gio2/pollable-input-stream.rb +51 -0
- data/lib/gio2/pollable-output-stream.rb +32 -0
- data/lib/gio2/resources.rb +62 -0
- data/lib/gio2.rb +38 -143
- data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
- data/test/fixture/resource/Rakefile +32 -0
- data/test/fixture/resource/logo.png +0 -0
- data/test/fixture/resource/ruby-gio2.gresource +0 -0
- data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
- data/test/gio2-test-utils/fixture.rb +24 -0
- data/test/gio2-test-utils/socket-client.rb +59 -0
- data/test/gio2-test-utils.rb +21 -0
- data/test/run-test.rb +45 -9
- data/test/test-buffered-input-stream.rb +23 -0
- data/test/test-charset-converter.rb +23 -0
- data/test/test-content-type.rb +31 -0
- data/test/test-data-input-stream.rb +21 -0
- data/test/test-file-enumerator.rb +26 -0
- data/test/test-file-monitor.rb +33 -0
- data/test/test-file.rb +28 -0
- data/test/test-inet-address.rb +34 -0
- data/test/test-input-stream.rb +36 -0
- data/test/test-output-stream.rb +39 -0
- data/test/test-pollable-input-stream.rb +54 -0
- data/test/test-pollable-output-stream.rb +53 -0
- data/test/test-resources.rb +58 -0
- metadata +49 -107
- data/README +0 -34
- data/ext/gio2/depend +0 -11
- data/ext/gio2/gio2.def +0 -2
- data/ext/gio2/gio2.h +0 -30
- data/ext/gio2/rbgio.c +0 -133
- data/ext/gio2/rbgio2.h +0 -158
- data/ext/gio2/rbgio2conversions.h +0 -154
- data/ext/gio2/rbgio2private.h +0 -148
- data/ext/gio2/rbgioappinfo.c +0 -317
- data/ext/gio2/rbgioapplaunchcontext.c +0 -81
- data/ext/gio2/rbgioasyncinitable.c +0 -246
- data/ext/gio2/rbgioasyncresult.c +0 -41
- data/ext/gio2/rbgiobufferedinputstream.c +0 -167
- data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
- data/ext/gio2/rbgiocancellable.c +0 -180
- data/ext/gio2/rbgiocharsetconverter.c +0 -57
- data/ext/gio2/rbgiocontenttype.c +0 -131
- data/ext/gio2/rbgioconverter.c +0 -113
- data/ext/gio2/rbgioconverterinputstream.c +0 -43
- data/ext/gio2/rbgioconverteroutputstream.c +0 -43
- data/ext/gio2/rbgiodatainputstream.c +0 -309
- data/ext/gio2/rbgiodataoutputstream.c +0 -186
- data/ext/gio2/rbgiodesktopappinfo.c +0 -87
- data/ext/gio2/rbgiodrive.c +0 -266
- data/ext/gio2/rbgioemblem.c +0 -52
- data/ext/gio2/rbgioemblemedicon.c +0 -65
- data/ext/gio2/rbgiofile.c +0 -2045
- data/ext/gio2/rbgiofileattribute.c +0 -114
- data/ext/gio2/rbgiofileattributeinfo.c +0 -86
- data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
- data/ext/gio2/rbgiofileattributematcher.c +0 -95
- data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
- data/ext/gio2/rbgiofileenumerator.c +0 -166
- data/ext/gio2/rbgiofileicon.c +0 -41
- data/ext/gio2/rbgiofileinfo.c +0 -617
- data/ext/gio2/rbgiofileinputstream.c +0 -91
- data/ext/gio2/rbgiofileiostream.c +0 -98
- data/ext/gio2/rbgiofilemonitor.c +0 -46
- data/ext/gio2/rbgiofilenamecompleter.c +0 -73
- data/ext/gio2/rbgiofileoutputstream.c +0 -98
- data/ext/gio2/rbgiofilterinputstream.c +0 -28
- data/ext/gio2/rbgioicon.c +0 -69
- data/ext/gio2/rbgioinetaddress.c +0 -118
- data/ext/gio2/rbgioinetsocketaddress.c +0 -41
- data/ext/gio2/rbgioinitable.c +0 -199
- data/ext/gio2/rbgioinputstream.c +0 -341
- data/ext/gio2/rbgioio.c +0 -73
- data/ext/gio2/rbgioiomodule.c +0 -45
- data/ext/gio2/rbgioiomodules.c +0 -47
- data/ext/gio2/rbgioioscheduler.c +0 -102
- data/ext/gio2/rbgioioschedulerjob.c +0 -121
- data/ext/gio2/rbgioiostream.c +0 -107
- data/ext/gio2/rbgioloadableicon.c +0 -92
- data/ext/gio2/rbgiomemoryinputstream.c +0 -67
- data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
- data/ext/gio2/rbgiomount.c +0 -286
- data/ext/gio2/rbgiomountoperation.c +0 -53
- data/ext/gio2/rbgionetworkaddress.c +0 -59
- data/ext/gio2/rbgionetworkservice.c +0 -45
- data/ext/gio2/rbgiooutputstream.c +0 -331
- data/ext/gio2/rbgioresolver.c +0 -230
- data/ext/gio2/rbgioseekable.c +0 -91
- data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
- data/ext/gio2/rbgiosocket.c +0 -390
- data/ext/gio2/rbgiosocketaddress.c +0 -34
- data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
- data/ext/gio2/rbgiosocketclient.c +0 -207
- data/ext/gio2/rbgiosocketconnectable.c +0 -41
- data/ext/gio2/rbgiosocketconnection.c +0 -66
- data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
- data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
- data/ext/gio2/rbgiosocketlistener.c +0 -246
- data/ext/gio2/rbgiosocketservice.c +0 -66
- data/ext/gio2/rbgiosrvtarget.c +0 -76
- data/ext/gio2/rbgiotcpconnection.c +0 -28
- data/ext/gio2/rbgiothemedicon.c +0 -83
- data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
- data/ext/gio2/rbgiotlscertificate.c +0 -89
- data/ext/gio2/rbgiounixconnection.c +0 -71
- data/ext/gio2/rbgiounixfdlist.c +0 -115
- data/ext/gio2/rbgiounixfdmessage.c +0 -74
- data/ext/gio2/rbgiounixinputstream.c +0 -51
- data/ext/gio2/rbgiounixmount.c +0 -164
- data/ext/gio2/rbgiounixmountmonitor.c +0 -65
- data/ext/gio2/rbgiounixmountpoint.c +0 -136
- data/ext/gio2/rbgiounixmountpoints.c +0 -58
- data/ext/gio2/rbgiounixmounts.c +0 -58
- data/ext/gio2/rbgiounixoutputstream.c +0 -51
- data/ext/gio2/rbgiounixsocketaddress.c +0 -69
- data/ext/gio2/rbgiovfs.c +0 -84
- data/ext/gio2/rbgiovolume.c +0 -193
- data/ext/gio2/rbgiovolumemonitor.c +0 -77
- data/ext/gio2/rbgiozlibcompressor.c +0 -52
- data/ext/gio2/rbgiozlibdecompressor.c +0 -45
- data/ext/gio2/util.c +0 -303
- data/test/test_bufferedinputstream.rb +0 -9
- data/test/test_charsetconverter.rb +0 -9
- data/test/test_datainputstream.rb +0 -7
- data/test/test_fileenumerator.rb +0 -8
- data/test/test_filemonitor.rb +0 -17
- data/test/test_inetaddress.rb +0 -8
@@ -1,207 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cSocketClient
|
25
|
-
#define _SELF(value) RVAL2GSOCKETCLIENT(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self)
|
29
|
-
{
|
30
|
-
G_INITIALIZE(self, g_socket_client_new());
|
31
|
-
|
32
|
-
return Qnil;
|
33
|
-
}
|
34
|
-
|
35
|
-
static VALUE
|
36
|
-
rg_connect(int argc, VALUE *argv, VALUE self)
|
37
|
-
{
|
38
|
-
VALUE connectable, cancellable;
|
39
|
-
GError *error = NULL;
|
40
|
-
GSocketConnection *connection;
|
41
|
-
|
42
|
-
rb_scan_args(argc, argv, "11", &connectable, &cancellable);
|
43
|
-
connection = g_socket_client_connect(_SELF(self),
|
44
|
-
RVAL2GSOCKETCONNECTABLE(connectable),
|
45
|
-
RVAL2GCANCELLABLE(cancellable),
|
46
|
-
&error);
|
47
|
-
if (connection == NULL)
|
48
|
-
rbgio_raise_error(error);
|
49
|
-
|
50
|
-
return GOBJ2RVAL_UNREF(connection);
|
51
|
-
}
|
52
|
-
|
53
|
-
static VALUE
|
54
|
-
rg_connect_async(int argc, VALUE *argv, VALUE self)
|
55
|
-
{
|
56
|
-
VALUE rbconnectable, rbcancellable, block;
|
57
|
-
GCancellable *cancellable;
|
58
|
-
GSocketConnectable *connectable;
|
59
|
-
|
60
|
-
rb_scan_args(argc, argv, "11&", &rbconnectable, &rbcancellable, &block);
|
61
|
-
connectable = RVAL2GSOCKETCONNECTABLE(rbconnectable);
|
62
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
63
|
-
SAVE_BLOCK(block);
|
64
|
-
g_socket_client_connect_async(_SELF(self),
|
65
|
-
connectable,
|
66
|
-
cancellable,
|
67
|
-
rbgio_async_ready_callback,
|
68
|
-
(gpointer)block);
|
69
|
-
|
70
|
-
return self;
|
71
|
-
}
|
72
|
-
|
73
|
-
typedef GSocketConnection *(*ConnectionFinishMethod)(GSocketClient *,
|
74
|
-
GAsyncResult *,
|
75
|
-
GError **);
|
76
|
-
|
77
|
-
static VALUE
|
78
|
-
connection_finish_method(ConnectionFinishMethod method, VALUE self, VALUE result)
|
79
|
-
{
|
80
|
-
GError *error = NULL;
|
81
|
-
GSocketConnection *connection;
|
82
|
-
|
83
|
-
connection = method(_SELF(self), RVAL2GASYNCRESULT(result), &error);
|
84
|
-
if (connection == NULL)
|
85
|
-
rbgio_raise_error(error);
|
86
|
-
|
87
|
-
return GOBJ2RVAL_UNREF(connection);
|
88
|
-
}
|
89
|
-
|
90
|
-
static VALUE
|
91
|
-
rg_connect_finish(VALUE self, VALUE result)
|
92
|
-
{
|
93
|
-
return connection_finish_method(g_socket_client_connect_finish, self, result);
|
94
|
-
}
|
95
|
-
|
96
|
-
static VALUE
|
97
|
-
rg_connect_to_host(int argc, VALUE *argv, VALUE self)
|
98
|
-
{
|
99
|
-
VALUE host_and_port, default_port, cancellable;
|
100
|
-
GError *error = NULL;
|
101
|
-
GSocketConnection *connection;
|
102
|
-
|
103
|
-
rb_scan_args(argc, argv, "21", &host_and_port, &default_port, &cancellable);
|
104
|
-
connection = g_socket_client_connect_to_host(_SELF(self),
|
105
|
-
RVAL2CSTR(host_and_port),
|
106
|
-
RVAL2GUINT16(default_port),
|
107
|
-
RVAL2GCANCELLABLE(cancellable),
|
108
|
-
&error);
|
109
|
-
if (connection == NULL)
|
110
|
-
rbgio_raise_error(error);
|
111
|
-
|
112
|
-
return GOBJ2RVAL_UNREF(connection);
|
113
|
-
}
|
114
|
-
|
115
|
-
static VALUE
|
116
|
-
rg_connect_to_host_async(int argc, VALUE *argv, VALUE self)
|
117
|
-
{
|
118
|
-
VALUE rbhost_and_port, rbdefault_port, rbcancellable, block;
|
119
|
-
GCancellable *cancellable;
|
120
|
-
const gchar *host_and_port;
|
121
|
-
guint16 default_port;
|
122
|
-
|
123
|
-
rb_scan_args(argc, argv, "21&", &rbhost_and_port, &rbdefault_port, &rbcancellable, &block);
|
124
|
-
host_and_port = RVAL2CSTR(rbhost_and_port);
|
125
|
-
default_port = RVAL2GUINT16(rbdefault_port);
|
126
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
127
|
-
SAVE_BLOCK(block);
|
128
|
-
g_socket_client_connect_to_host_async(_SELF(self),
|
129
|
-
host_and_port,
|
130
|
-
default_port,
|
131
|
-
cancellable,
|
132
|
-
rbgio_async_ready_callback,
|
133
|
-
(gpointer)block);
|
134
|
-
|
135
|
-
return self;
|
136
|
-
}
|
137
|
-
|
138
|
-
static VALUE
|
139
|
-
rg_connect_to_host_finish(VALUE self, VALUE result)
|
140
|
-
{
|
141
|
-
return connection_finish_method(g_socket_client_connect_to_host_finish, self, result);
|
142
|
-
}
|
143
|
-
|
144
|
-
static VALUE
|
145
|
-
rg_connect_to_service(int argc, VALUE *argv, VALUE self)
|
146
|
-
{
|
147
|
-
VALUE domain, service, cancellable;
|
148
|
-
GError *error = NULL;
|
149
|
-
GSocketConnection *connection;
|
150
|
-
|
151
|
-
rb_scan_args(argc, argv, "21", &domain, &service, &cancellable);
|
152
|
-
connection = g_socket_client_connect_to_service(_SELF(self),
|
153
|
-
RVAL2CSTR(domain),
|
154
|
-
RVAL2CSTR(service),
|
155
|
-
RVAL2GCANCELLABLE(cancellable),
|
156
|
-
&error);
|
157
|
-
if (connection == NULL)
|
158
|
-
rbgio_raise_error(error);
|
159
|
-
|
160
|
-
return GOBJ2RVAL_UNREF(connection);
|
161
|
-
}
|
162
|
-
|
163
|
-
static VALUE
|
164
|
-
rg_connect_to_service_async(int argc, VALUE *argv, VALUE self)
|
165
|
-
{
|
166
|
-
VALUE rbdomain, rbservice, rbcancellable, block;
|
167
|
-
GCancellable *cancellable;
|
168
|
-
const gchar *domain;
|
169
|
-
const gchar *service;
|
170
|
-
|
171
|
-
rb_scan_args(argc, argv, "21&", &domain, &service, &rbcancellable, &block);
|
172
|
-
domain = RVAL2CSTR(rbdomain);
|
173
|
-
service = RVAL2CSTR(rbservice);
|
174
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
175
|
-
SAVE_BLOCK(block);
|
176
|
-
g_socket_client_connect_to_service_async(_SELF(self),
|
177
|
-
domain,
|
178
|
-
service,
|
179
|
-
cancellable,
|
180
|
-
rbgio_async_ready_callback,
|
181
|
-
(gpointer)block);
|
182
|
-
|
183
|
-
return self;
|
184
|
-
}
|
185
|
-
|
186
|
-
static VALUE
|
187
|
-
rg_connect_to_service_finish(VALUE self, VALUE result)
|
188
|
-
{
|
189
|
-
return connection_finish_method(g_socket_client_connect_to_service_finish, self, result);
|
190
|
-
}
|
191
|
-
|
192
|
-
void
|
193
|
-
Init_gsocketclient(VALUE mGio)
|
194
|
-
{
|
195
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_CLIENT, "SocketClient", mGio);
|
196
|
-
|
197
|
-
RG_DEF_METHOD(initialize, 0);
|
198
|
-
RG_DEF_METHOD(connect, -1);
|
199
|
-
RG_DEF_METHOD(connect_async, -1);
|
200
|
-
RG_DEF_METHOD(connect_finish, 1);
|
201
|
-
RG_DEF_METHOD(connect_to_host, -1);
|
202
|
-
RG_DEF_METHOD(connect_to_host_async, -1);
|
203
|
-
RG_DEF_METHOD(connect_to_host_finish, 1);
|
204
|
-
RG_DEF_METHOD(connect_to_service, -1);
|
205
|
-
RG_DEF_METHOD(connect_to_service_async, -1);
|
206
|
-
RG_DEF_METHOD(connect_to_service_finish, 1);
|
207
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE mSocketConnectable
|
25
|
-
#define _SELF(value) RVAL2GSOCKETCONNECTABLE(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_enumerate(VALUE self)
|
29
|
-
{
|
30
|
-
return GOBJ2RVAL(g_socket_connectable_enumerate(_SELF(self)));
|
31
|
-
}
|
32
|
-
|
33
|
-
void
|
34
|
-
Init_gsocketconnectable(VALUE mGio)
|
35
|
-
{
|
36
|
-
VALUE RG_TARGET_NAMESPACE;
|
37
|
-
|
38
|
-
RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_SOCKET_CONNECTABLE, "SocketConnectable", mGio);
|
39
|
-
|
40
|
-
RG_DEF_METHOD(enumerate, 0);
|
41
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cSocketConnection
|
25
|
-
#define _SELF(value) RVAL2GSOCKETCONNECTION(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_local_address(VALUE self)
|
29
|
-
{
|
30
|
-
GError *error = NULL;
|
31
|
-
GSocketAddress *address;
|
32
|
-
|
33
|
-
address = g_socket_connection_get_local_address(_SELF(self), &error);
|
34
|
-
if (address == NULL)
|
35
|
-
rbgio_raise_error(error);
|
36
|
-
|
37
|
-
return GOBJ2RVAL_UNREF(address);
|
38
|
-
}
|
39
|
-
|
40
|
-
static VALUE
|
41
|
-
rg_remote_address(VALUE self)
|
42
|
-
{
|
43
|
-
GError *error = NULL;
|
44
|
-
GSocketAddress *address;
|
45
|
-
|
46
|
-
address = g_socket_connection_get_remote_address(_SELF(self), &error);
|
47
|
-
if (address == NULL)
|
48
|
-
rbgio_raise_error(error);
|
49
|
-
|
50
|
-
return GOBJ2RVAL_UNREF(address);
|
51
|
-
}
|
52
|
-
|
53
|
-
/* TODO: lookup_type */
|
54
|
-
|
55
|
-
/* TODO: register_type */
|
56
|
-
|
57
|
-
void
|
58
|
-
Init_gsocketconnection(VALUE mGio)
|
59
|
-
{
|
60
|
-
VALUE RG_TARGET_NAMESPACE;
|
61
|
-
|
62
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_CONNECTION, "SocketConnection", mGio);
|
63
|
-
|
64
|
-
RG_DEF_METHOD(local_address, 0);
|
65
|
-
RG_DEF_METHOD(remote_address, 0);
|
66
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE mSocketConnectionFactory
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_s_create_connection(G_GNUC_UNUSED VALUE self, VALUE socket)
|
28
|
-
{
|
29
|
-
return GOBJ2RVAL_UNREF(g_socket_connection_factory_create_connection(RVAL2GSOCKET(socket)));
|
30
|
-
}
|
31
|
-
|
32
|
-
void
|
33
|
-
Init_gsocketconnectionfactory(VALUE mGio)
|
34
|
-
{
|
35
|
-
/* TODO: Perhaps just move this to SocketConnection? */
|
36
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "SocketConnectionFactory");
|
37
|
-
|
38
|
-
RG_DEF_SMETHOD(create_connection, 1);
|
39
|
-
}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cSocketControlMessage
|
25
|
-
#define _SELF(value) RVAL2GSOCKETCONTROLMESSAGE(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_s_deserialize(G_GNUC_UNUSED VALUE self, VALUE level, VALUE type, VALUE data)
|
29
|
-
{
|
30
|
-
StringValue(data);
|
31
|
-
return GOBJ2RVAL(g_socket_control_message_deserialize(FIX2INT(level),
|
32
|
-
FIX2INT(type),
|
33
|
-
RSTRING_LEN(data),
|
34
|
-
RSTRING_PTR(data)));
|
35
|
-
}
|
36
|
-
|
37
|
-
static VALUE
|
38
|
-
rg_level(VALUE self)
|
39
|
-
{
|
40
|
-
return INT2FIX(g_socket_control_message_get_level(_SELF(self)));
|
41
|
-
}
|
42
|
-
|
43
|
-
static VALUE
|
44
|
-
rg_msg_type(VALUE self)
|
45
|
-
{
|
46
|
-
return INT2FIX(g_socket_control_message_get_msg_type(_SELF(self)));
|
47
|
-
}
|
48
|
-
|
49
|
-
static VALUE
|
50
|
-
rg_size(VALUE self)
|
51
|
-
{
|
52
|
-
return GSIZE2RVAL(g_socket_control_message_get_size(_SELF(self)));
|
53
|
-
}
|
54
|
-
|
55
|
-
static VALUE
|
56
|
-
rg_serialize(VALUE self)
|
57
|
-
{
|
58
|
-
gsize size;
|
59
|
-
VALUE result;
|
60
|
-
|
61
|
-
/* TODO: Is tainting really necessary? Where does the message come
|
62
|
-
* from? */
|
63
|
-
size = g_socket_control_message_get_size(_SELF(self));
|
64
|
-
result = rb_str_new(NULL, size);
|
65
|
-
g_socket_control_message_serialize(_SELF(self), RSTRING_PTR(result));
|
66
|
-
OBJ_TAINT(result);
|
67
|
-
|
68
|
-
return result;
|
69
|
-
}
|
70
|
-
|
71
|
-
void
|
72
|
-
Init_gsocketcontrolmessage(VALUE mGio)
|
73
|
-
{
|
74
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_CONTROL_MESSAGE, "SocketControlMessage", mGio);
|
75
|
-
|
76
|
-
RG_DEF_SMETHOD(deserialize, 3);
|
77
|
-
|
78
|
-
RG_DEF_METHOD(level, 0);
|
79
|
-
RG_DEF_METHOD(msg_type, 0);
|
80
|
-
RG_DEF_METHOD(size, 0);
|
81
|
-
RG_DEF_METHOD(serialize, 0);
|
82
|
-
}
|
@@ -1,246 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cSocketListener
|
25
|
-
#define _SELF(value) RVAL2GSOCKETLISTENER(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self)
|
29
|
-
{
|
30
|
-
G_INITIALIZE(self, g_socket_listener_new());
|
31
|
-
|
32
|
-
return Qnil;
|
33
|
-
}
|
34
|
-
|
35
|
-
static VALUE
|
36
|
-
rg_add_socket(int argc, VALUE *argv, VALUE self)
|
37
|
-
{
|
38
|
-
VALUE socket, source_object;
|
39
|
-
GError *error = NULL;
|
40
|
-
|
41
|
-
rb_scan_args(argc, argv, "11", &socket, &source_object);
|
42
|
-
if (!g_socket_listener_add_socket(_SELF(self), RVAL2GSOCKET(socket),
|
43
|
-
RVAL2GOBJ(source_object), &error))
|
44
|
-
rbgio_raise_error(error);
|
45
|
-
|
46
|
-
return self;
|
47
|
-
}
|
48
|
-
|
49
|
-
static VALUE
|
50
|
-
rg_add_address(int argc, VALUE *argv, VALUE self)
|
51
|
-
{
|
52
|
-
VALUE rbaddress, type, protocol, source_object;
|
53
|
-
GError *error = NULL;
|
54
|
-
GSocketAddress *address;
|
55
|
-
|
56
|
-
rb_scan_args(argc, argv, "22", &rbaddress, &type, &protocol, &source_object);
|
57
|
-
if (!g_socket_listener_add_address(_SELF(self),
|
58
|
-
RVAL2GSOCKETADDRESS(rbaddress),
|
59
|
-
RVAL2GSOCKETTYPE(type),
|
60
|
-
RVAL2GSOCKETPROTOCOLDEFAULT(protocol),
|
61
|
-
RVAL2GOBJ(source_object),
|
62
|
-
&address,
|
63
|
-
&error))
|
64
|
-
rbgio_raise_error(error);
|
65
|
-
|
66
|
-
return GOBJ2RVAL_UNREF(address);
|
67
|
-
}
|
68
|
-
|
69
|
-
static VALUE
|
70
|
-
rg_add_inet_port(int argc, VALUE *argv, VALUE self)
|
71
|
-
{
|
72
|
-
VALUE port, source_object;
|
73
|
-
GError *error = NULL;
|
74
|
-
|
75
|
-
rb_scan_args(argc, argv, "11", &port, &source_object);
|
76
|
-
if (!g_socket_listener_add_inet_port(_SELF(self),
|
77
|
-
RVAL2GUINT16(port),
|
78
|
-
RVAL2GOBJ(source_object),
|
79
|
-
&error))
|
80
|
-
rbgio_raise_error(error);
|
81
|
-
|
82
|
-
return self;
|
83
|
-
}
|
84
|
-
|
85
|
-
static VALUE
|
86
|
-
rg_add_any_inet_port(int argc, VALUE *argv, VALUE self)
|
87
|
-
{
|
88
|
-
VALUE source_object;
|
89
|
-
GError *error = NULL;
|
90
|
-
guint16 port;
|
91
|
-
|
92
|
-
rb_scan_args(argc, argv, "01", &source_object);
|
93
|
-
port = g_socket_listener_add_any_inet_port(_SELF(self),
|
94
|
-
RVAL2GOBJ(source_object),
|
95
|
-
&error);
|
96
|
-
if (port == 0)
|
97
|
-
rbgio_raise_error(error);
|
98
|
-
|
99
|
-
return self;
|
100
|
-
}
|
101
|
-
|
102
|
-
static VALUE
|
103
|
-
rg_accept(int argc, VALUE *argv, VALUE self)
|
104
|
-
{
|
105
|
-
VALUE cancellable;
|
106
|
-
GObject *source_object;
|
107
|
-
GError *error = NULL;
|
108
|
-
GSocketConnection *connection;
|
109
|
-
|
110
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
111
|
-
connection = g_socket_listener_accept(_SELF(self),
|
112
|
-
&source_object,
|
113
|
-
RVAL2GCANCELLABLE(cancellable),
|
114
|
-
&error);
|
115
|
-
if (connection == NULL)
|
116
|
-
rbgio_raise_error(error);
|
117
|
-
|
118
|
-
return rb_assoc_new(GOBJ2RVAL_UNREF(connection),
|
119
|
-
GOBJ2RVAL(source_object));
|
120
|
-
}
|
121
|
-
|
122
|
-
static VALUE
|
123
|
-
rg_accept_async(int argc, VALUE *argv, VALUE self)
|
124
|
-
{
|
125
|
-
VALUE rbcancellable, block;
|
126
|
-
GCancellable *cancellable;
|
127
|
-
|
128
|
-
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
129
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
130
|
-
SAVE_BLOCK(block);
|
131
|
-
g_socket_listener_accept_async(_SELF(self),
|
132
|
-
cancellable,
|
133
|
-
rbgio_async_ready_callback,
|
134
|
-
(gpointer)block);
|
135
|
-
|
136
|
-
return self;
|
137
|
-
}
|
138
|
-
|
139
|
-
static VALUE
|
140
|
-
rg_accept_finish(VALUE self, VALUE result)
|
141
|
-
{
|
142
|
-
GObject *source_object;
|
143
|
-
GError *error = NULL;
|
144
|
-
GSocketConnection *connection;
|
145
|
-
|
146
|
-
connection = g_socket_listener_accept_finish(_SELF(self),
|
147
|
-
RVAL2GASYNCRESULT(result),
|
148
|
-
&source_object,
|
149
|
-
&error);
|
150
|
-
if (connection == NULL)
|
151
|
-
rbgio_raise_error(error);
|
152
|
-
|
153
|
-
return rb_assoc_new(GOBJ2RVAL_UNREF(connection),
|
154
|
-
GOBJ2RVAL(source_object));
|
155
|
-
}
|
156
|
-
|
157
|
-
static VALUE
|
158
|
-
rg_accept_socket(int argc, VALUE *argv, VALUE self)
|
159
|
-
{
|
160
|
-
VALUE cancellable;
|
161
|
-
GObject *source_object;
|
162
|
-
GError *error = NULL;
|
163
|
-
GSocket *socket;
|
164
|
-
|
165
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
166
|
-
socket = g_socket_listener_accept_socket(_SELF(self),
|
167
|
-
&source_object,
|
168
|
-
RVAL2GCANCELLABLE(cancellable),
|
169
|
-
&error);
|
170
|
-
if (socket == NULL)
|
171
|
-
rbgio_raise_error(error);
|
172
|
-
|
173
|
-
return rb_assoc_new(GOBJ2RVAL_UNREF(socket),
|
174
|
-
GOBJ2RVAL(source_object));
|
175
|
-
}
|
176
|
-
|
177
|
-
static VALUE
|
178
|
-
rg_accept_socket_async(int argc, VALUE *argv, VALUE self)
|
179
|
-
{
|
180
|
-
VALUE rbcancellable, block;
|
181
|
-
GCancellable *cancellable;
|
182
|
-
|
183
|
-
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
184
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
185
|
-
SAVE_BLOCK(block);
|
186
|
-
g_socket_listener_accept_socket_async(_SELF(self),
|
187
|
-
cancellable,
|
188
|
-
rbgio_async_ready_callback,
|
189
|
-
(gpointer)block);
|
190
|
-
|
191
|
-
return self;
|
192
|
-
}
|
193
|
-
|
194
|
-
static VALUE
|
195
|
-
rg_accept_socket_finish(VALUE self, VALUE result)
|
196
|
-
{
|
197
|
-
GObject *source_object;
|
198
|
-
GError *error = NULL;
|
199
|
-
GSocket *socket;
|
200
|
-
|
201
|
-
socket = g_socket_listener_accept_socket_finish(_SELF(self),
|
202
|
-
RVAL2GASYNCRESULT(result),
|
203
|
-
&source_object,
|
204
|
-
&error);
|
205
|
-
if (socket == NULL)
|
206
|
-
rbgio_raise_error(error);
|
207
|
-
|
208
|
-
return rb_assoc_new(GOBJ2RVAL_UNREF(socket),
|
209
|
-
GOBJ2RVAL(source_object));
|
210
|
-
}
|
211
|
-
|
212
|
-
static VALUE
|
213
|
-
rg_close(VALUE self)
|
214
|
-
{
|
215
|
-
g_socket_listener_close(_SELF(self));
|
216
|
-
|
217
|
-
return self;
|
218
|
-
}
|
219
|
-
|
220
|
-
static VALUE
|
221
|
-
rg_set_backlog(VALUE self, VALUE listen_backlog)
|
222
|
-
{
|
223
|
-
g_socket_listener_set_backlog(_SELF(self), FIX2INT(listen_backlog));
|
224
|
-
|
225
|
-
return self;
|
226
|
-
}
|
227
|
-
|
228
|
-
void
|
229
|
-
Init_gsocketlistener(VALUE mGio)
|
230
|
-
{
|
231
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_LISTENER, "SocketListener", mGio);
|
232
|
-
|
233
|
-
RG_DEF_METHOD(initialize, 0);
|
234
|
-
RG_DEF_METHOD(add_socket, -1);
|
235
|
-
RG_DEF_METHOD(add_address, -1);
|
236
|
-
RG_DEF_METHOD(add_inet_port, -1);
|
237
|
-
RG_DEF_METHOD(add_any_inet_port, -1);
|
238
|
-
RG_DEF_METHOD(accept, -1);
|
239
|
-
RG_DEF_METHOD(accept_async, -1);
|
240
|
-
RG_DEF_METHOD(accept_finish, 1);
|
241
|
-
RG_DEF_METHOD(accept_socket, -1);
|
242
|
-
RG_DEF_METHOD(accept_socket_async, -1);
|
243
|
-
RG_DEF_METHOD(accept_socket_finish, 1);
|
244
|
-
RG_DEF_METHOD(close, 0);
|
245
|
-
RG_DEF_METHOD(set_backlog, 1);
|
246
|
-
}
|