rubyfb 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Manifest +0 -1
- data/Rakefile +1 -1
- data/ext/AddUser.c +217 -248
- data/ext/AddUser.h +3 -3
- data/ext/Backup.c +337 -404
- data/ext/Backup.h +3 -3
- data/ext/Blob.c +197 -248
- data/ext/Blob.h +30 -31
- data/ext/Common.c +17 -18
- data/ext/Common.h +10 -10
- data/ext/Connection.c +413 -487
- data/ext/Connection.h +18 -19
- data/ext/DataArea.c +172 -189
- data/ext/DataArea.h +11 -11
- data/ext/Database.c +198 -238
- data/ext/Database.h +16 -17
- data/ext/FireRuby.c +118 -142
- data/ext/FireRuby.h +17 -17
- data/ext/FireRubyException.c +68 -138
- data/ext/FireRubyException.h +14 -21
- data/ext/Generator.c +296 -377
- data/ext/Generator.h +17 -18
- data/ext/RemoveUser.c +91 -102
- data/ext/RemoveUser.h +3 -3
- data/ext/Restore.c +353 -423
- data/ext/Restore.h +3 -3
- data/ext/ResultSet.c +423 -456
- data/ext/ResultSet.h +26 -27
- data/ext/Row.c +505 -568
- data/ext/Row.h +27 -28
- data/ext/ServiceManager.c +143 -164
- data/ext/ServiceManager.h +17 -18
- data/ext/Services.c +58 -67
- data/ext/Services.h +3 -3
- data/ext/Statement.c +388 -449
- data/ext/Statement.h +30 -31
- data/ext/Transaction.c +374 -448
- data/ext/Transaction.h +17 -18
- data/ext/TypeMap.c +654 -774
- data/ext/TypeMap.h +17 -17
- data/ext/rfbint.h +3 -3
- data/lib/active_record/connection_adapters/rubyfb_adapter.rb +1 -1
- data/lib/rubyfb_lib.so +0 -0
- data/lib/src.rb +33 -0
- data/rubyfb.gemspec +3 -3
- data/test/ResultSetTest.rb +13 -0
- data/test/RowTest.rb +16 -0
- metadata +4 -5
- data/test/UnitTest.rb +0 -65
data/ext/Row.h
CHANGED
@@ -3,20 +3,20 @@
|
|
3
3
|
*----------------------------------------------------------------------------*/
|
4
4
|
/**
|
5
5
|
* Copyright � Peter Wood, 2005
|
6
|
-
*
|
6
|
+
*
|
7
7
|
* The contents of this file are subject to the Mozilla Public License Version
|
8
8
|
* 1.1 (the "License"); you may not use this file except in compliance with the
|
9
|
-
* License. You may obtain a copy of the License at
|
9
|
+
* License. You may obtain a copy of the License at
|
10
10
|
*
|
11
11
|
* http://www.mozilla.org/MPL/
|
12
|
-
*
|
12
|
+
*
|
13
13
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
14
14
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
15
15
|
* the specificlanguage governing rights and limitations under the License.
|
16
|
-
*
|
16
|
+
*
|
17
17
|
* The Original Code is the FireRuby extension for the Ruby language.
|
18
|
-
*
|
19
|
-
* The Initial Developer of the Original Code is Peter Wood. All Rights
|
18
|
+
*
|
19
|
+
* The Initial Developer of the Original Code is Peter Wood. All Rights
|
20
20
|
* Reserved.
|
21
21
|
*
|
22
22
|
* @author Peter Wood
|
@@ -25,31 +25,30 @@
|
|
25
25
|
#ifndef FIRERUBY_ROW_H
|
26
26
|
#define FIRERUBY_ROW_H
|
27
27
|
|
28
|
-
|
28
|
+
/* Includes. */
|
29
29
|
#ifndef RUBY_H_INCLUDED
|
30
30
|
#include "ruby.h"
|
31
31
|
#define RUBY_H_INCLUDED
|
32
32
|
#endif
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
VALUE rb_row_new(VALUE, VALUE, VALUE);
|
33
|
+
|
34
|
+
/* Type definitions. */
|
35
|
+
typedef struct {
|
36
|
+
char name[32],
|
37
|
+
alias[32];
|
38
|
+
VALUE value,
|
39
|
+
type,
|
40
|
+
scale;
|
41
|
+
} ColumnHandle;
|
42
|
+
|
43
|
+
typedef struct {
|
44
|
+
unsigned int size,
|
45
|
+
number;
|
46
|
+
ColumnHandle *columns;
|
47
|
+
} RowHandle;
|
48
|
+
|
49
|
+
/* Function prototypes. */
|
50
|
+
void Init_Row(VALUE);
|
51
|
+
void freeRow(void *);
|
52
|
+
VALUE rb_row_new(VALUE, VALUE, VALUE);
|
54
53
|
|
55
54
|
#endif // FIRERUBY_ROW_H
|
data/ext/ServiceManager.c
CHANGED
@@ -48,20 +48,18 @@ VALUE cServiceManager;
|
|
48
48
|
* @return A reference to the newly allocated ServiceManager object.
|
49
49
|
*
|
50
50
|
*/
|
51
|
-
VALUE allocateServiceManager(VALUE klass)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
return(instance);
|
51
|
+
VALUE allocateServiceManager(VALUE klass) {
|
52
|
+
VALUE instance = Qnil;
|
53
|
+
ManagerHandle *manager = ALLOC(ManagerHandle);
|
54
|
+
|
55
|
+
if(manager == NULL) {
|
56
|
+
rb_raise(rb_eNoMemError,
|
57
|
+
"Memory allocation failure creating a service manager.");
|
58
|
+
}
|
59
|
+
manager->handle = NULL;
|
60
|
+
instance = Data_Wrap_Struct(klass, NULL, serviceManagerFree, manager);
|
61
|
+
|
62
|
+
return(instance);
|
65
63
|
}
|
66
64
|
|
67
65
|
|
@@ -72,13 +70,12 @@ VALUE allocateServiceManager(VALUE klass)
|
|
72
70
|
* @param host The name of the database host for the service manager.
|
73
71
|
*
|
74
72
|
*/
|
75
|
-
VALUE initializeServiceManager(VALUE self, VALUE host)
|
76
|
-
|
77
|
-
VALUE text = rb_funcall(host, rb_intern("to_s"), 0);
|
73
|
+
VALUE initializeServiceManager(VALUE self, VALUE host) {
|
74
|
+
VALUE text = rb_funcall(host, rb_intern("to_s"), 0);
|
78
75
|
|
79
|
-
|
76
|
+
rb_iv_set(self, "@host", text);
|
80
77
|
|
81
|
-
|
78
|
+
return(self);
|
82
79
|
}
|
83
80
|
|
84
81
|
|
@@ -94,80 +91,75 @@ VALUE initializeServiceManager(VALUE self, VALUE host)
|
|
94
91
|
* @return A reference to the newly connected ServiceManager object.
|
95
92
|
*
|
96
93
|
*/
|
97
|
-
VALUE connectServiceManager(VALUE self, VALUE user, VALUE password)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
/* Clean up. */
|
167
|
-
free(buffer);
|
168
|
-
free(service);
|
169
|
-
|
170
|
-
return(self);
|
94
|
+
VALUE connectServiceManager(VALUE self, VALUE user, VALUE password) {
|
95
|
+
ManagerHandle *manager = NULL;
|
96
|
+
char *buffer = NULL,
|
97
|
+
*position = NULL,
|
98
|
+
*text = NULL,
|
99
|
+
*service = NULL;
|
100
|
+
short length = 2,
|
101
|
+
size = 0;
|
102
|
+
VALUE host = rb_iv_get(self, "@host");
|
103
|
+
ISC_STATUS status[ISC_STATUS_LENGTH];
|
104
|
+
|
105
|
+
Data_Get_Struct(self, ManagerHandle, manager);
|
106
|
+
if(manager->handle != 0) {
|
107
|
+
rb_fireruby_raise(NULL, "Service manager already connected.");
|
108
|
+
}
|
109
|
+
|
110
|
+
/* Calculate the size of the service parameter buffer. */
|
111
|
+
length += strlen(StringValuePtr(user)) + 2;
|
112
|
+
length += strlen(StringValuePtr(password)) + 2;
|
113
|
+
|
114
|
+
/* Create the service parameter buffer. */
|
115
|
+
position = buffer = ALLOC_N(char, length);
|
116
|
+
if(position == NULL) {
|
117
|
+
rb_raise(rb_eNoMemError,
|
118
|
+
"Memory allocation failure creating service parameter buffer.");
|
119
|
+
}
|
120
|
+
memset(buffer, 0, length);
|
121
|
+
|
122
|
+
/* Populate the service parameter buffer. */
|
123
|
+
*position++ = isc_spb_version;
|
124
|
+
*position++ = isc_spb_current_version;
|
125
|
+
|
126
|
+
text = StringValuePtr(user);
|
127
|
+
size = strlen(text);
|
128
|
+
*position++ = isc_spb_user_name;
|
129
|
+
*position++ = size;
|
130
|
+
strncpy(position, text, size);
|
131
|
+
position += size;
|
132
|
+
|
133
|
+
text = StringValuePtr(password);
|
134
|
+
size = strlen(text);
|
135
|
+
*position++ = isc_spb_password;
|
136
|
+
*position++ = size;
|
137
|
+
strncpy(position, text, size);
|
138
|
+
|
139
|
+
/* Create the service name. */
|
140
|
+
size = strlen(StringValuePtr(host)) + 13;
|
141
|
+
service = ALLOC_N(char, size);
|
142
|
+
if(service == NULL) {
|
143
|
+
free(buffer);
|
144
|
+
rb_raise(rb_eNoMemError,
|
145
|
+
"Memory allocation failure service manager service name.");
|
146
|
+
}
|
147
|
+
memset(service, 0, size);
|
148
|
+
sprintf(service, "%s:service_mgr", StringValuePtr(host));
|
149
|
+
|
150
|
+
/* Make the attachment call. */
|
151
|
+
if(isc_service_attach(status, 0, service, &manager->handle, length,
|
152
|
+
buffer)) {
|
153
|
+
free(buffer);
|
154
|
+
free(service);
|
155
|
+
rb_fireruby_raise(status, "Error connecting service manager.");
|
156
|
+
}
|
157
|
+
|
158
|
+
/* Clean up. */
|
159
|
+
free(buffer);
|
160
|
+
free(service);
|
161
|
+
|
162
|
+
return(self);
|
171
163
|
}
|
172
164
|
|
173
165
|
|
@@ -179,23 +171,20 @@ VALUE connectServiceManager(VALUE self, VALUE user, VALUE password)
|
|
179
171
|
* @return A reference to the disconnected ServiceManager object.
|
180
172
|
*
|
181
173
|
*/
|
182
|
-
VALUE disconnectServiceManager(VALUE self)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
}
|
197
|
-
|
198
|
-
return(self);
|
174
|
+
VALUE disconnectServiceManager(VALUE self) {
|
175
|
+
ManagerHandle *manager = NULL;
|
176
|
+
|
177
|
+
Data_Get_Struct(self, ManagerHandle, manager);
|
178
|
+
if(manager->handle != 0) {
|
179
|
+
ISC_STATUS status[ISC_STATUS_LENGTH];
|
180
|
+
|
181
|
+
if(isc_service_detach(status, &manager->handle)) {
|
182
|
+
rb_fireruby_raise(status, "Error disconnecting service manager.");
|
183
|
+
}
|
184
|
+
manager->handle = 0;
|
185
|
+
}
|
186
|
+
|
187
|
+
return(self);
|
199
188
|
}
|
200
189
|
|
201
190
|
|
@@ -207,18 +196,16 @@ VALUE disconnectServiceManager(VALUE self)
|
|
207
196
|
* @return True if the manager is connected, false otherwise.
|
208
197
|
*
|
209
198
|
*/
|
210
|
-
VALUE isServiceManagerConnected(VALUE self)
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
return(result);
|
199
|
+
VALUE isServiceManagerConnected(VALUE self) {
|
200
|
+
VALUE result = Qfalse;
|
201
|
+
ManagerHandle *manager = NULL;
|
202
|
+
|
203
|
+
Data_Get_Struct(self, ManagerHandle, manager);
|
204
|
+
if(manager->handle != 0) {
|
205
|
+
result = Qtrue;
|
206
|
+
}
|
207
|
+
|
208
|
+
return(result);
|
222
209
|
}
|
223
210
|
|
224
211
|
|
@@ -235,19 +222,16 @@ VALUE isServiceManagerConnected(VALUE self)
|
|
235
222
|
* @return A reference to the ServiceManager class.
|
236
223
|
*
|
237
224
|
*/
|
238
|
-
VALUE executeServiceTasks(int argc, VALUE *argv, VALUE self)
|
239
|
-
{
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
}
|
249
|
-
|
250
|
-
return(self);
|
225
|
+
VALUE executeServiceTasks(int argc, VALUE *argv, VALUE self) {
|
226
|
+
if(argc > 0) {
|
227
|
+
int i;
|
228
|
+
|
229
|
+
for(i = 0; i < argc; i++) {
|
230
|
+
rb_funcall(argv[i], rb_intern("execute"), 1, self);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
return(self);
|
251
235
|
}
|
252
236
|
|
253
237
|
|
@@ -260,20 +244,17 @@ VALUE executeServiceTasks(int argc, VALUE *argv, VALUE self)
|
|
260
244
|
* ServiceManager being collected.
|
261
245
|
*
|
262
246
|
*/
|
263
|
-
void serviceManagerFree(void *manager)
|
264
|
-
{
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
}
|
275
|
-
free(handle);
|
276
|
-
}
|
247
|
+
void serviceManagerFree(void *manager) {
|
248
|
+
if(manager != NULL) {
|
249
|
+
ManagerHandle *handle = (ManagerHandle *)manager;
|
250
|
+
|
251
|
+
if(handle->handle != 0) {
|
252
|
+
ISC_STATUS status[ISC_STATUS_LENGTH];
|
253
|
+
|
254
|
+
isc_service_detach(status, &handle->handle);
|
255
|
+
}
|
256
|
+
free(handle);
|
257
|
+
}
|
277
258
|
}
|
278
259
|
|
279
260
|
|
@@ -287,13 +268,12 @@ void serviceManagerFree(void *manager)
|
|
287
268
|
* @return A reference to the newly created ServiceManager object.
|
288
269
|
*
|
289
270
|
*/
|
290
|
-
VALUE rb_service_manager_new(VALUE host)
|
291
|
-
|
292
|
-
VALUE manager = allocateServiceManager(cServiceManager);
|
271
|
+
VALUE rb_service_manager_new(VALUE host) {
|
272
|
+
VALUE manager = allocateServiceManager(cServiceManager);
|
293
273
|
|
294
|
-
|
274
|
+
initializeServiceManager(manager, host);
|
295
275
|
|
296
|
-
|
276
|
+
return(manager);
|
297
277
|
}
|
298
278
|
|
299
279
|
|
@@ -303,14 +283,13 @@ VALUE rb_service_manager_new(VALUE host)
|
|
303
283
|
* @param module The module to create the new class definition under.
|
304
284
|
*
|
305
285
|
*/
|
306
|
-
void Init_ServiceManager(VALUE module)
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
rb_define_method(cServiceManager, "execute", executeServiceTasks, -1);
|
286
|
+
void Init_ServiceManager(VALUE module) {
|
287
|
+
cServiceManager = rb_define_class_under(module, "ServiceManager", rb_cObject);
|
288
|
+
rb_define_alloc_func(cServiceManager, allocateServiceManager);
|
289
|
+
rb_define_method(cServiceManager, "initialize", initializeServiceManager, 1);
|
290
|
+
rb_define_method(cServiceManager, "initialize_copy", forbidObjectCopy, 1);
|
291
|
+
rb_define_method(cServiceManager, "connect", connectServiceManager, 2);
|
292
|
+
rb_define_method(cServiceManager, "disconnect", disconnectServiceManager, 0);
|
293
|
+
rb_define_method(cServiceManager, "connected?", isServiceManagerConnected, 0);
|
294
|
+
rb_define_method(cServiceManager, "execute", executeServiceTasks, -1);
|
316
295
|
}
|
data/ext/ServiceManager.h
CHANGED
@@ -3,20 +3,20 @@
|
|
3
3
|
*----------------------------------------------------------------------------*/
|
4
4
|
/**
|
5
5
|
* Copyright � Peter Wood, 2005
|
6
|
-
*
|
6
|
+
*
|
7
7
|
* The contents of this file are subject to the Mozilla Public License Version
|
8
8
|
* 1.1 (the "License"); you may not use this file except in compliance with the
|
9
|
-
* License. You may obtain a copy of the License at
|
9
|
+
* License. You may obtain a copy of the License at
|
10
10
|
*
|
11
11
|
* http://www.mozilla.org/MPL/
|
12
|
-
*
|
12
|
+
*
|
13
13
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
14
14
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
15
15
|
* the specificlanguage governing rights and limitations under the License.
|
16
|
-
*
|
16
|
+
*
|
17
17
|
* The Original Code is the FireRuby extension for the Ruby language.
|
18
|
-
*
|
19
|
-
* The Initial Developer of the Original Code is Peter Wood. All Rights
|
18
|
+
*
|
19
|
+
* The Initial Developer of the Original Code is Peter Wood. All Rights
|
20
20
|
* Reserved.
|
21
21
|
*
|
22
22
|
* @author Peter Wood
|
@@ -25,7 +25,7 @@
|
|
25
25
|
#ifndef FIRERUBY_SERVICE_MANAGER_H
|
26
26
|
#define FIRERUBY_SERVICE_MANAGER_H
|
27
27
|
|
28
|
-
|
28
|
+
/* Includes. */
|
29
29
|
#ifndef FIRERUBY_FIRE_RUBY_H
|
30
30
|
#include "FireRuby.h"
|
31
31
|
#endif
|
@@ -33,16 +33,15 @@
|
|
33
33
|
#ifndef FIRERUBY_FIRE_RUBY_EXCEPTION_H
|
34
34
|
#include "FireRubyException.h"
|
35
35
|
#endif
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
VALUE rb_service_manager_new(VALUE);
|
36
|
+
|
37
|
+
/* Type definitions. */
|
38
|
+
typedef struct {
|
39
|
+
isc_svc_handle handle;
|
40
|
+
} ManagerHandle;
|
41
|
+
|
42
|
+
/* Function prototypes. */
|
43
|
+
void Init_ServiceManager(VALUE);
|
44
|
+
void serviceManagerFree(void *);
|
45
|
+
VALUE rb_service_manager_new(VALUE);
|
47
46
|
|
48
47
|
#endif /* FIRERUBY_SERVICE_MANAGER_H */
|
data/ext/Services.c
CHANGED
@@ -45,81 +45,72 @@
|
|
45
45
|
* or nil if there is no output.
|
46
46
|
*
|
47
47
|
*/
|
48
|
-
VALUE queryService(isc_svc_handle *handle)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
short done = 0;
|
48
|
+
VALUE queryService(isc_svc_handle *handle) {
|
49
|
+
VALUE result = Qnil;
|
50
|
+
int size = START_BUFFER_SIZE;
|
51
|
+
short done = 0;
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
short len = 0;
|
53
|
+
/* Query the service until it has completed. */
|
54
|
+
while(!done) {
|
55
|
+
ISC_STATUS status[ISC_STATUS_LENGTH];
|
56
|
+
char *output = NULL,
|
57
|
+
*offset = NULL,
|
58
|
+
*log = NULL,
|
59
|
+
request[] = {isc_info_svc_to_eof};
|
60
|
+
short len = 0;
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
memset(output, 0, size);
|
62
|
+
/* Allocate the output buffer. */
|
63
|
+
offset = output = ALLOC_N(char, size);
|
64
|
+
if(output == NULL) {
|
65
|
+
rb_raise(rb_eNoMemError,
|
66
|
+
"Memory allocation failure querying service status.");
|
67
|
+
}
|
68
|
+
memset(output, 0, size);
|
72
69
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}
|
70
|
+
/* Make the service info request. */
|
71
|
+
done = 1;
|
72
|
+
if(isc_service_query(status, handle, NULL, 0, NULL, sizeof(request),
|
73
|
+
request, size, output)) {
|
74
|
+
free(output);
|
75
|
+
rb_fireruby_raise(status, "Error querying service status.");
|
76
|
+
}
|
81
77
|
|
82
|
-
|
83
|
-
{
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
free(output);
|
95
|
-
rb_raise(rb_eNoMemError,
|
96
|
-
"Memory allocation failure querying service status.");
|
97
|
-
}
|
78
|
+
do {
|
79
|
+
switch(*offset++) {
|
80
|
+
case isc_info_svc_to_eof:
|
81
|
+
len = isc_vax_integer(offset, 2);
|
82
|
+
offset += 2;
|
83
|
+
if(len > 0) {
|
84
|
+
log = ALLOC_N(char, len + 1);
|
85
|
+
if(log == NULL) {
|
86
|
+
free(output);
|
87
|
+
rb_raise(rb_eNoMemError,
|
88
|
+
"Memory allocation failure querying service status.");
|
89
|
+
}
|
98
90
|
|
99
|
-
|
100
|
-
|
91
|
+
memset(log, 0, len + 1);
|
92
|
+
memcpy(log, offset, len);
|
101
93
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
94
|
+
result = rb_str_new2(log);
|
95
|
+
free(log);
|
96
|
+
}
|
97
|
+
break;
|
106
98
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
99
|
+
case isc_info_truncated:
|
100
|
+
done = 0;
|
101
|
+
size = size * 2;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
} while(*offset);
|
113
105
|
|
114
|
-
|
115
|
-
|
106
|
+
/* Clean up. */
|
107
|
+
free(output);
|
116
108
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
}
|
109
|
+
/* Snooze if we're not done. */
|
110
|
+
if(!done) {
|
111
|
+
rfb_sleep(1);
|
112
|
+
}
|
113
|
+
}
|
123
114
|
|
124
|
-
|
115
|
+
return(result);
|
125
116
|
}
|
data/ext/Services.h
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
#ifndef FIRERUBY_SERVICES_H
|
26
26
|
#define FIRERUBY_SERVICES_H
|
27
27
|
|
28
|
-
|
28
|
+
/* Includes. */
|
29
29
|
#ifndef IBASE_H_INCLUDED
|
30
30
|
#include "ibase.h"
|
31
31
|
#define IBASE_H_INCLUDED
|
@@ -36,7 +36,7 @@
|
|
36
36
|
#define RUBY_H_INCLUDED
|
37
37
|
#endif
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
/* Function prototypes. */
|
40
|
+
VALUE queryService(isc_svc_handle *);
|
41
41
|
|
42
42
|
#endif /* FIRERUBY_SERVICES_H */
|