gio2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gio2/extconf.rb +4 -42
- data/ext/gio2/gio2.c +18 -117
- data/ext/gio2/gio2.h +20 -339
- data/ext/gio2/rbgio.c +132 -0
- data/ext/gio2/rbgio2.h +156 -0
- data/ext/gio2/rbgio2conversions.h +154 -0
- data/ext/gio2/rbgio2private.h +147 -0
- data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
- data/ext/gio2/rbgioapplaunchcontext.c +81 -0
- data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
- data/ext/gio2/rbgioasyncresult.c +41 -0
- data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
- data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
- data/ext/gio2/rbgiocancellable.c +180 -0
- data/ext/gio2/rbgiocharsetconverter.c +57 -0
- data/ext/gio2/rbgiocontenttype.c +131 -0
- data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
- data/ext/gio2/rbgioconverterinputstream.c +43 -0
- data/ext/gio2/rbgioconverteroutputstream.c +43 -0
- data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
- data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
- data/ext/gio2/rbgiodesktopappinfo.c +87 -0
- data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
- data/ext/gio2/rbgioemblem.c +52 -0
- data/ext/gio2/rbgioemblemedicon.c +65 -0
- data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
- data/ext/gio2/rbgiofileattribute.c +114 -0
- data/ext/gio2/rbgiofileattributeinfo.c +86 -0
- data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
- data/ext/gio2/rbgiofileattributematcher.c +93 -0
- data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
- data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
- data/ext/gio2/rbgiofileicon.c +41 -0
- data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
- data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
- data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
- data/ext/gio2/rbgiofilemonitor.c +46 -0
- data/ext/gio2/rbgiofilenamecompleter.c +74 -0
- data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
- data/ext/gio2/rbgiofilterinputstream.c +28 -0
- data/ext/gio2/rbgiofilteroutputstream.c +28 -0
- data/ext/gio2/rbgioicon.c +69 -0
- data/ext/gio2/rbgioinetaddress.c +118 -0
- data/ext/gio2/rbgioinetsocketaddress.c +41 -0
- data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
- data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
- data/ext/gio2/rbgioio.c +73 -0
- data/ext/gio2/rbgioiomodule.c +45 -0
- data/ext/gio2/rbgioiomodules.c +47 -0
- data/ext/gio2/rbgioioscheduler.c +102 -0
- data/ext/gio2/rbgioioschedulerjob.c +121 -0
- data/ext/gio2/rbgioiostream.c +108 -0
- data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
- data/ext/gio2/rbgiomemoryinputstream.c +67 -0
- data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
- data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
- data/ext/gio2/rbgiomountoperation.c +53 -0
- data/ext/gio2/rbgionetworkaddress.c +59 -0
- data/ext/gio2/rbgionetworkservice.c +45 -0
- data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
- data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
- data/ext/gio2/rbgioseekable.c +91 -0
- data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
- data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
- data/ext/gio2/rbgiosocketaddress.c +34 -0
- data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
- data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
- data/ext/gio2/rbgiosocketconnectable.c +41 -0
- data/ext/gio2/rbgiosocketconnection.c +66 -0
- data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
- data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
- data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
- data/ext/gio2/rbgiosocketservice.c +66 -0
- data/ext/gio2/rbgiosrvtarget.c +76 -0
- data/ext/gio2/rbgiotcpconnection.c +28 -0
- data/ext/gio2/rbgiothemedicon.c +83 -0
- data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
- data/ext/gio2/rbgiounixconnection.c +71 -0
- data/ext/gio2/rbgiounixfdlist.c +115 -0
- data/ext/gio2/rbgiounixfdmessage.c +74 -0
- data/ext/gio2/rbgiounixinputstream.c +51 -0
- data/ext/gio2/rbgiounixmount.c +164 -0
- data/ext/gio2/rbgiounixmountmonitor.c +66 -0
- data/ext/gio2/rbgiounixmountpoint.c +136 -0
- data/ext/gio2/rbgiounixmountpoints.c +58 -0
- data/ext/gio2/rbgiounixmounts.c +58 -0
- data/ext/gio2/rbgiounixoutputstream.c +51 -0
- data/ext/gio2/rbgiounixsocketaddress.c +69 -0
- data/ext/gio2/rbgiovfs.c +84 -0
- data/ext/gio2/rbgiovolume.c +193 -0
- data/ext/gio2/rbgiovolumemonitor.c +77 -0
- data/ext/gio2/rbgiozlibcompressor.c +52 -0
- data/ext/gio2/rbgiozlibdecompressor.c +45 -0
- data/ext/gio2/util.c +57 -60
- data/lib/gio2/deprecated.rb +102 -0
- data/lib/gio2.rb +14 -12
- metadata +100 -88
- data/ChangeLog +0 -129
- data/ext/gio2/gapplaunchcontext.c +0 -79
- data/ext/gio2/gasyncresult.c +0 -39
- data/ext/gio2/gbufferedoutputstream.c +0 -48
- data/ext/gio2/gcancellable.c +0 -177
- data/ext/gio2/gcharsetconverter.c +0 -55
- data/ext/gio2/gcontenttype.c +0 -128
- data/ext/gio2/gconverterinputstream.c +0 -41
- data/ext/gio2/gconverteroutputstream.c +0 -41
- data/ext/gio2/gdesktopappinfo.c +0 -88
- data/ext/gio2/gemblem.c +0 -52
- data/ext/gio2/gemblemedicon.c +0 -63
- data/ext/gio2/gfileattribute.c +0 -111
- data/ext/gio2/gfileattributeinfo.c +0 -89
- data/ext/gio2/gfileattributeinfolist.c +0 -109
- data/ext/gio2/gfileattributematcher.c +0 -90
- data/ext/gio2/gfiledescriptorbased.c +0 -42
- data/ext/gio2/gfileicon.c +0 -39
- data/ext/gio2/gfilemonitor.c +0 -44
- data/ext/gio2/gfilenamecompleter.c +0 -72
- data/ext/gio2/gfilterinputstream.c +0 -27
- data/ext/gio2/gfilteroutputstream.c +0 -27
- data/ext/gio2/gicon.c +0 -67
- data/ext/gio2/ginetaddress.c +0 -116
- data/ext/gio2/ginetsocketaddress.c +0 -38
- data/ext/gio2/gioerror.c +0 -70
- data/ext/gio2/giomodule.c +0 -63
- data/ext/gio2/gioscheduler.c +0 -193
- data/ext/gio2/giostream.c +0 -106
- data/ext/gio2/gmemoryinputstream.c +0 -65
- data/ext/gio2/gmemoryoutputstream.c +0 -41
- data/ext/gio2/gmountoperation.c +0 -66
- data/ext/gio2/gnetworkaddress.c +0 -57
- data/ext/gio2/gnetworkservice.c +0 -43
- data/ext/gio2/gseekable.c +0 -89
- data/ext/gio2/gsimpleasyncresult.c +0 -153
- data/ext/gio2/gsocketaddress.c +0 -33
- data/ext/gio2/gsocketconnectable.c +0 -97
- data/ext/gio2/gsocketconnection.c +0 -75
- data/ext/gio2/gsocketcontrolmessage.c +0 -80
- data/ext/gio2/gsocketservice.c +0 -64
- data/ext/gio2/gsrvtarget.c +0 -77
- data/ext/gio2/gtcpconnection.c +0 -27
- data/ext/gio2/gthemedicon.c +0 -81
- data/ext/gio2/gthreadedsocketservice.c +0 -40
- data/ext/gio2/gunixconnection.c +0 -69
- data/ext/gio2/gunixfdlist.c +0 -112
- data/ext/gio2/gunixfdmessage.c +0 -72
- data/ext/gio2/gunixinputstream.c +0 -49
- data/ext/gio2/gunixmounts.c +0 -343
- data/ext/gio2/gunixoutputstream.c +0 -49
- data/ext/gio2/gunixsocketaddress.c +0 -67
- data/ext/gio2/gvfs.c +0 -82
- data/ext/gio2/gvolume.c +0 -191
- data/ext/gio2/gvolumemonitor.c +0 -75
- data/ext/gio2/gzlibcompressor.c +0 -50
- data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,33 +1,31 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
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
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
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
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
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
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
24
|
+
#define RG_TARGET_NAMESPACE cSocket
|
23
25
|
#define _SELF(value) RVAL2GSOCKET(value)
|
24
26
|
|
25
|
-
#define RVAL2GIOCONDITION(value) RVAL2GFLAGS((value), G_TYPE_IO_CONDITION)
|
26
|
-
|
27
|
-
#define GIOCONDITION2RVAL(value) GENUM2RVAL((value), G_TYPE_IO_CONDITION)
|
28
|
-
|
29
27
|
static VALUE
|
30
|
-
|
28
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
31
29
|
{
|
32
30
|
VALUE family, type, protocol;
|
33
31
|
GError *error = NULL;
|
@@ -47,7 +45,7 @@ socket_initialize(int argc, VALUE *argv, VALUE self)
|
|
47
45
|
}
|
48
46
|
|
49
47
|
static VALUE
|
50
|
-
|
48
|
+
rg_s_new_from_fd(G_GNUC_UNUSED VALUE self, VALUE id)
|
51
49
|
{
|
52
50
|
GError *error = NULL;
|
53
51
|
GSocket *socket;
|
@@ -60,7 +58,7 @@ socket_new_from_fd(G_GNUC_UNUSED VALUE self, VALUE id)
|
|
60
58
|
}
|
61
59
|
|
62
60
|
static VALUE
|
63
|
-
|
61
|
+
rg_bind(VALUE self, VALUE address, VALUE allow_reuse)
|
64
62
|
{
|
65
63
|
GError *error = NULL;
|
66
64
|
|
@@ -74,7 +72,7 @@ socket_bind(VALUE self, VALUE address, VALUE allow_reuse)
|
|
74
72
|
}
|
75
73
|
|
76
74
|
static VALUE
|
77
|
-
|
75
|
+
rg_listen(VALUE self)
|
78
76
|
{
|
79
77
|
GError *error = NULL;
|
80
78
|
|
@@ -85,7 +83,7 @@ socket_listen(VALUE self)
|
|
85
83
|
}
|
86
84
|
|
87
85
|
static VALUE
|
88
|
-
|
86
|
+
rg_accept(int argc, VALUE *argv, VALUE self)
|
89
87
|
{
|
90
88
|
VALUE cancellable;
|
91
89
|
GError *error = NULL;
|
@@ -102,7 +100,7 @@ socket_accept(int argc, VALUE *argv, VALUE self)
|
|
102
100
|
}
|
103
101
|
|
104
102
|
static VALUE
|
105
|
-
|
103
|
+
rg_connect(int argc, VALUE *argv, VALUE self)
|
106
104
|
{
|
107
105
|
VALUE address, cancellable;
|
108
106
|
GError *error = NULL;
|
@@ -119,7 +117,7 @@ socket_connect(int argc, VALUE *argv, VALUE self)
|
|
119
117
|
|
120
118
|
/* TODO: This makes very little sense in Ruby. How do we deal with it? */
|
121
119
|
static VALUE
|
122
|
-
|
120
|
+
rg_check_connect_result(VALUE self)
|
123
121
|
{
|
124
122
|
GError *error = NULL;
|
125
123
|
|
@@ -130,7 +128,7 @@ socket_check_connect_result(VALUE self)
|
|
130
128
|
}
|
131
129
|
|
132
130
|
static VALUE
|
133
|
-
|
131
|
+
rg_receive(int argc, VALUE *argv, VALUE self)
|
134
132
|
{
|
135
133
|
VALUE rbbytes, cancellable, result;
|
136
134
|
GError *error = NULL;
|
@@ -148,7 +146,7 @@ socket_receive(int argc, VALUE *argv, VALUE self)
|
|
148
146
|
if (read == -1)
|
149
147
|
rbgio_raise_error(error);
|
150
148
|
|
151
|
-
/* TODO: This is what Ruby does, but I can
|
149
|
+
/* TODO: This is what Ruby does, but I can't figure out why one needs
|
152
150
|
* both. */
|
153
151
|
rb_str_set_len(result, read);
|
154
152
|
rb_str_resize(result, read);
|
@@ -158,7 +156,7 @@ socket_receive(int argc, VALUE *argv, VALUE self)
|
|
158
156
|
}
|
159
157
|
|
160
158
|
static VALUE
|
161
|
-
|
159
|
+
rg_receive_from(int argc, VALUE *argv, VALUE self)
|
162
160
|
{
|
163
161
|
VALUE rbbytes, cancellable, result;
|
164
162
|
GSocketAddress *address;
|
@@ -186,7 +184,7 @@ socket_receive_from(int argc, VALUE *argv, VALUE self)
|
|
186
184
|
}
|
187
185
|
|
188
186
|
static VALUE
|
189
|
-
|
187
|
+
rg_send(int argc, VALUE *argv, VALUE self)
|
190
188
|
{
|
191
189
|
VALUE buffer, cancellable;
|
192
190
|
GError *error = NULL;
|
@@ -206,7 +204,7 @@ socket_send(int argc, VALUE *argv, VALUE self)
|
|
206
204
|
}
|
207
205
|
|
208
206
|
static VALUE
|
209
|
-
|
207
|
+
rg_send_to(int argc, VALUE *argv, VALUE self)
|
210
208
|
{
|
211
209
|
VALUE address, buffer, cancellable;
|
212
210
|
GError *error = NULL;
|
@@ -227,7 +225,7 @@ socket_send_to(int argc, VALUE *argv, VALUE self)
|
|
227
225
|
}
|
228
226
|
|
229
227
|
static VALUE
|
230
|
-
|
228
|
+
rg_close(VALUE self)
|
231
229
|
{
|
232
230
|
GError *error = NULL;
|
233
231
|
|
@@ -238,13 +236,13 @@ socket_close(VALUE self)
|
|
238
236
|
}
|
239
237
|
|
240
238
|
static VALUE
|
241
|
-
|
239
|
+
rg_closed_p(VALUE self)
|
242
240
|
{
|
243
241
|
return CBOOL2RVAL(g_socket_is_closed(_SELF(self)));
|
244
242
|
}
|
245
243
|
|
246
244
|
static VALUE
|
247
|
-
|
245
|
+
rg_shutdown(VALUE self, VALUE shutdown_read, VALUE shutdown_write)
|
248
246
|
{
|
249
247
|
GError *error = NULL;
|
250
248
|
|
@@ -258,13 +256,13 @@ socket_shutdown(VALUE self, VALUE shutdown_read, VALUE shutdown_write)
|
|
258
256
|
}
|
259
257
|
|
260
258
|
static VALUE
|
261
|
-
|
259
|
+
rg_connected_p(VALUE self)
|
262
260
|
{
|
263
261
|
return (g_socket_is_connected(_SELF(self)));
|
264
262
|
}
|
265
263
|
|
266
264
|
static VALUE
|
267
|
-
|
265
|
+
rg_create_source(int argc, VALUE *argv, VALUE self)
|
268
266
|
{
|
269
267
|
VALUE condition, cancellable;
|
270
268
|
|
@@ -276,14 +274,14 @@ socket_create_source(int argc, VALUE *argv, VALUE self)
|
|
276
274
|
}
|
277
275
|
|
278
276
|
static VALUE
|
279
|
-
|
277
|
+
rg_condition_check(VALUE self, VALUE condition)
|
280
278
|
{
|
281
279
|
return GIOCONDITION2RVAL(g_socket_condition_check(_SELF(self),
|
282
280
|
RVAL2GIOCONDITION(condition)));
|
283
281
|
}
|
284
282
|
|
285
283
|
static VALUE
|
286
|
-
|
284
|
+
rg_condition_wait(int argc, VALUE *argv, VALUE self)
|
287
285
|
{
|
288
286
|
VALUE condition, cancellable;
|
289
287
|
GError *error = NULL;
|
@@ -325,48 +323,48 @@ socket_get_remote_address(VALUE self)
|
|
325
323
|
}
|
326
324
|
|
327
325
|
static VALUE
|
328
|
-
|
326
|
+
rg_speaks_ipv4_p(VALUE self)
|
329
327
|
{
|
330
328
|
return CBOOL2RVAL(g_socket_speaks_ipv4(_SELF(self)));
|
331
329
|
}
|
332
330
|
|
333
331
|
void
|
334
|
-
Init_gsocket(VALUE
|
332
|
+
Init_gsocket(VALUE mGio)
|
335
333
|
{
|
336
|
-
VALUE
|
337
|
-
|
338
|
-
G_DEF_CLASS(G_TYPE_SOCKET_FAMILY, "Family",
|
339
|
-
G_DEF_CONSTANTS(
|
340
|
-
|
341
|
-
G_DEF_CLASS(G_TYPE_SOCKET_TYPE, "Type",
|
342
|
-
G_DEF_CONSTANTS(
|
343
|
-
|
344
|
-
G_DEF_CLASS(G_TYPE_SOCKET_PROTOCOL, "Protocol",
|
345
|
-
G_DEF_CONSTANTS(
|
346
|
-
|
347
|
-
G_DEF_CLASS(G_TYPE_SOCKET_MSG_FLAGS, "MsgFlags",
|
348
|
-
G_DEF_CONSTANTS(
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
G_REPLACE_GET_PROPERTY(
|
370
|
-
G_REPLACE_GET_PROPERTY(
|
371
|
-
|
334
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET, "Socket", mGio);
|
335
|
+
|
336
|
+
G_DEF_CLASS(G_TYPE_SOCKET_FAMILY, "Family", RG_TARGET_NAMESPACE);
|
337
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SOCKET_FAMILY, "G_SOCKET_");
|
338
|
+
|
339
|
+
G_DEF_CLASS(G_TYPE_SOCKET_TYPE, "Type", RG_TARGET_NAMESPACE);
|
340
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SOCKET_TYPE, "G_SOCKET_");
|
341
|
+
|
342
|
+
G_DEF_CLASS(G_TYPE_SOCKET_PROTOCOL, "Protocol", RG_TARGET_NAMESPACE);
|
343
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SOCKET_PROTOCOL, "G_SOCKET_");
|
344
|
+
|
345
|
+
G_DEF_CLASS(G_TYPE_SOCKET_MSG_FLAGS, "MsgFlags", RG_TARGET_NAMESPACE);
|
346
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SOCKET_MSG_FLAGS, "G_SOCKET_");
|
347
|
+
|
348
|
+
RG_DEF_SMETHOD(new_from_fd, 1);
|
349
|
+
|
350
|
+
RG_DEF_METHOD(initialize, -1);
|
351
|
+
RG_DEF_METHOD(bind, 2);
|
352
|
+
RG_DEF_METHOD(listen, 0);
|
353
|
+
RG_DEF_METHOD(accept, -1);
|
354
|
+
RG_DEF_METHOD(connect, -1);
|
355
|
+
RG_DEF_METHOD(check_connect_result, 0);
|
356
|
+
RG_DEF_METHOD(receive, -1);
|
357
|
+
RG_DEF_METHOD(receive_from, -1);
|
358
|
+
RG_DEF_METHOD(send, -1);
|
359
|
+
RG_DEF_METHOD(send_to, -1);
|
360
|
+
RG_DEF_METHOD(close, -1);
|
361
|
+
RG_DEF_METHOD_P(closed, 0);
|
362
|
+
RG_DEF_METHOD(shutdown, 2);
|
363
|
+
RG_DEF_METHOD_P(connected, 0);
|
364
|
+
RG_DEF_METHOD(create_source, -1);
|
365
|
+
RG_DEF_METHOD(condition_check, 1);
|
366
|
+
RG_DEF_METHOD(condition_wait, -1);
|
367
|
+
G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "local_address", socket_get_local_address, 0);
|
368
|
+
G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "remote_address", socket_get_remote_address, 0);
|
369
|
+
RG_DEF_METHOD_P(speaks_ipv4, 0);
|
372
370
|
}
|
@@ -0,0 +1,34 @@
|
|
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
|
+
/* TODO: new_from_native? */
|
25
|
+
|
26
|
+
/* TODO: to_native? */
|
27
|
+
|
28
|
+
/* TODO: get_native_size? */
|
29
|
+
|
30
|
+
void
|
31
|
+
Init_gsocketaddress(VALUE mGio)
|
32
|
+
{
|
33
|
+
(void)G_DEF_CLASS(G_TYPE_SOCKET_ADDRESS, "SocketAddress", mGio);
|
34
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
4
|
+
*
|
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.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
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.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rbgio2private.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE cSocketAddressEnumerator
|
24
|
+
#define _SELF(value) RVAL2GSOCKETADDRESSENUMERATOR(value)
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_next(int argc, VALUE *argv, VALUE self)
|
28
|
+
{
|
29
|
+
VALUE cancellable;
|
30
|
+
GError *error = NULL;
|
31
|
+
GSocketAddress *address;
|
32
|
+
|
33
|
+
rb_scan_args(argc, argv, "01", &cancellable);
|
34
|
+
address = g_socket_address_enumerator_next(_SELF(self),
|
35
|
+
RVAL2GCANCELLABLE(cancellable),
|
36
|
+
&error);
|
37
|
+
if (error != NULL)
|
38
|
+
rbgio_raise_error(error);
|
39
|
+
|
40
|
+
return GOBJ2RVAL(address);
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
rg_next_async(int argc, VALUE *argv, VALUE self)
|
45
|
+
{
|
46
|
+
VALUE rbcancellable, block;
|
47
|
+
GCancellable *cancellable;
|
48
|
+
|
49
|
+
rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
|
50
|
+
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
51
|
+
SAVE_BLOCK(block);
|
52
|
+
g_socket_address_enumerator_next_async(_SELF(self),
|
53
|
+
cancellable,
|
54
|
+
rbgio_async_ready_callback,
|
55
|
+
(gpointer)block);
|
56
|
+
|
57
|
+
return self;
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
rg_next_finish(VALUE self, VALUE result)
|
62
|
+
{
|
63
|
+
GError *error = NULL;
|
64
|
+
GSocketAddress *address;
|
65
|
+
|
66
|
+
address = g_socket_address_enumerator_next_finish(_SELF(self),
|
67
|
+
RVAL2GASYNCRESULT(result),
|
68
|
+
&error);
|
69
|
+
if (address == NULL)
|
70
|
+
rbgio_raise_error(error);
|
71
|
+
|
72
|
+
return GOBJ2RVAL(address);
|
73
|
+
}
|
74
|
+
|
75
|
+
void
|
76
|
+
Init_gsocketaddressenumerator(VALUE mGio)
|
77
|
+
{
|
78
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET_ADDRESS_ENUMERATOR, "SocketAddressEnumerator", mGio);
|
79
|
+
|
80
|
+
RG_DEF_METHOD(next, -1);
|
81
|
+
RG_DEF_METHOD(next_async, -1);
|
82
|
+
RG_DEF_METHOD(next_finish, 1);
|
83
|
+
}
|
@@ -1,29 +1,31 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
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
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
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
15
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
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
|
19
20
|
*/
|
20
21
|
|
21
|
-
#include "
|
22
|
+
#include "rbgio2private.h"
|
22
23
|
|
23
|
-
#define
|
24
|
+
#define RG_TARGET_NAMESPACE cSocketClient
|
25
|
+
#define _SELF(value) RVAL2GSOCKETCLIENT(value)
|
24
26
|
|
25
27
|
static VALUE
|
26
|
-
|
28
|
+
rg_initialize(VALUE self)
|
27
29
|
{
|
28
30
|
G_INITIALIZE(self, g_socket_client_new());
|
29
31
|
|
@@ -31,7 +33,7 @@ socketclient_initialize(VALUE self)
|
|
31
33
|
}
|
32
34
|
|
33
35
|
static VALUE
|
34
|
-
|
36
|
+
rg_connect(int argc, VALUE *argv, VALUE self)
|
35
37
|
{
|
36
38
|
VALUE connectable, cancellable;
|
37
39
|
GError *error = NULL;
|
@@ -49,7 +51,7 @@ socketclient_connect(int argc, VALUE *argv, VALUE self)
|
|
49
51
|
}
|
50
52
|
|
51
53
|
static VALUE
|
52
|
-
|
54
|
+
rg_connect_async(int argc, VALUE *argv, VALUE self)
|
53
55
|
{
|
54
56
|
VALUE rbconnectable, rbcancellable, block;
|
55
57
|
GCancellable *cancellable;
|
@@ -86,13 +88,13 @@ connection_finish_method(ConnectionFinishMethod method, VALUE self, VALUE result
|
|
86
88
|
}
|
87
89
|
|
88
90
|
static VALUE
|
89
|
-
|
91
|
+
rg_connect_finish(VALUE self, VALUE result)
|
90
92
|
{
|
91
93
|
return connection_finish_method(g_socket_client_connect_finish, self, result);
|
92
94
|
}
|
93
95
|
|
94
96
|
static VALUE
|
95
|
-
|
97
|
+
rg_connect_to_host(int argc, VALUE *argv, VALUE self)
|
96
98
|
{
|
97
99
|
VALUE host_and_port, default_port, cancellable;
|
98
100
|
GError *error = NULL;
|
@@ -111,7 +113,7 @@ socketclient_connect_to_host(int argc, VALUE *argv, VALUE self)
|
|
111
113
|
}
|
112
114
|
|
113
115
|
static VALUE
|
114
|
-
|
116
|
+
rg_connect_to_host_async(int argc, VALUE *argv, VALUE self)
|
115
117
|
{
|
116
118
|
VALUE rbhost_and_port, rbdefault_port, rbcancellable, block;
|
117
119
|
GCancellable *cancellable;
|
@@ -134,13 +136,13 @@ socketclient_connect_to_host_async(int argc, VALUE *argv, VALUE self)
|
|
134
136
|
}
|
135
137
|
|
136
138
|
static VALUE
|
137
|
-
|
139
|
+
rg_connect_to_host_finish(VALUE self, VALUE result)
|
138
140
|
{
|
139
141
|
return connection_finish_method(g_socket_client_connect_to_host_finish, self, result);
|
140
142
|
}
|
141
143
|
|
142
144
|
static VALUE
|
143
|
-
|
145
|
+
rg_connect_to_service(int argc, VALUE *argv, VALUE self)
|
144
146
|
{
|
145
147
|
VALUE domain, service, cancellable;
|
146
148
|
GError *error = NULL;
|
@@ -159,7 +161,7 @@ socketclient_connect_to_service(int argc, VALUE *argv, VALUE self)
|
|
159
161
|
}
|
160
162
|
|
161
163
|
static VALUE
|
162
|
-
|
164
|
+
rg_connect_to_service_async(int argc, VALUE *argv, VALUE self)
|
163
165
|
{
|
164
166
|
VALUE rbdomain, rbservice, rbcancellable, block;
|
165
167
|
GCancellable *cancellable;
|
@@ -182,24 +184,24 @@ socketclient_connect_to_service_async(int argc, VALUE *argv, VALUE self)
|
|
182
184
|
}
|
183
185
|
|
184
186
|
static VALUE
|
185
|
-
|
187
|
+
rg_connect_to_service_finish(VALUE self, VALUE result)
|
186
188
|
{
|
187
189
|
return connection_finish_method(g_socket_client_connect_to_service_finish, self, result);
|
188
190
|
}
|
189
191
|
|
190
192
|
void
|
191
|
-
Init_gsocketclient(VALUE
|
193
|
+
Init_gsocketclient(VALUE mGio)
|
192
194
|
{
|
193
|
-
VALUE
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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);
|
205
207
|
}
|
@@ -0,0 +1,41 @@
|
|
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
|
+
}
|
@@ -0,0 +1,66 @@
|
|
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
|
+
}
|