rubyipq 0.1.0-i686-linux

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.
data/Rubyipq.so ADDED
Binary file
data/extconf.rb ADDED
@@ -0,0 +1,12 @@
1
+ require "mkmf"
2
+
3
+ have_library("ipq", "ipq_errstr")
4
+
5
+ have_header("libipq.h")
6
+ have_header("linux/netfilter.h")
7
+
8
+ find_header("rubyipq.h", ".")
9
+ find_header("rubyipq_proto.h", ".")
10
+
11
+ create_makefile("Rubyipq")
12
+
data/rubyipq.c ADDED
@@ -0,0 +1,400 @@
1
+ /*
2
+ * rubyipq v0.1.0
3
+ * Ruby bindings for Netfilter's libipq.
4
+ *
5
+ * Copyright (c) 2005 Leonardo Eloy
6
+ * Author: Leonardo Eloy <l.eloy@terra.com.br/leonardo.eloy@gmail.com>
7
+ * Project Homepage: http://rubyipq.rubyforge.org
8
+ *
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation; either version 2 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; if not, write to the Free Software
22
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
+ */
24
+ #include "rubyipq.h"
25
+ #include "rubyipq_defs.h"
26
+
27
+ static void rubyipq_free() {
28
+ ipq_destroy_handle(handle);
29
+ rubyipq_open = 0;
30
+ }
31
+
32
+ VALUE rubyipq_new(VALUE class, VALUE protocol) {
33
+ VALUE argv[1], struct_data;
34
+
35
+ handle = ipq_create_handle(0, NUM2INT(protocol));
36
+ if (!handle)
37
+ rb_raise(rb_eRuntimeError, "%s", ipq_errstr());
38
+
39
+ rubyipq_open = 1;
40
+
41
+ struct_data = Data_Wrap_Struct(class, 0, rubyipq_free, NULL);
42
+ argv[0] = protocol;
43
+
44
+ rb_obj_call_init(struct_data, 1, argv);
45
+
46
+ return struct_data;
47
+ }
48
+
49
+ VALUE rubyipq_destroy(VALUE class) {
50
+ if (!rubyipq_open) {
51
+ rb_raise(rb_eRuntimeError, "rubyipq not properly instantiated");
52
+ }
53
+
54
+ rubyipq_free();
55
+
56
+ return Qnil;
57
+ }
58
+
59
+ VALUE rubyipq_initialize(VALUE class, VALUE protocol) {
60
+ /* Store the protocol to be used (PF_INET or PF_INET6) */
61
+ rb_iv_set(class, "@protocol", protocol);
62
+
63
+ return class;
64
+ }
65
+
66
+ VALUE rubyipq_set_mode(VALUE class, VALUE mode) {
67
+ int ret;
68
+
69
+ ret = ipq_set_mode(handle, NUM2INT(mode), buffer_size);
70
+ if (ret < 0)
71
+ rb_raise(rb_eRuntimeError, "%s", ipq_errstr());
72
+
73
+ return Qnil;
74
+ }
75
+
76
+
77
+ VALUE rubyipq_is_open(VALUE class) {
78
+ return (rubyipq_open ? Qtrue : Qfalse);
79
+ }
80
+
81
+ VALUE rubyipq_set_buffer_size(VALUE class, VALUE bufsize) {
82
+ int i_bufsize = NUM2INT(bufsize);
83
+
84
+ if (i_bufsize <= 0 || i_bufsize > 65535)
85
+ rb_raise(rb_eArgError, "invalid buffer size '%d', should be between 1 and 65535", i_bufsize);
86
+
87
+ buffer_size = i_bufsize;
88
+
89
+ return bufsize;
90
+ }
91
+
92
+ VALUE rubyipq_get_buffer_size(VALUE class) {
93
+ return INT2NUM(buffer_size);
94
+ }
95
+
96
+ VALUE rubyipq_read(VALUE class, VALUE timeout) {
97
+ int ret;
98
+ unsigned char buf[buffer_size];
99
+
100
+ ret = ipq_read(handle, buf, buffer_size, NUM2INT(timeout));
101
+ if (ret < 0)
102
+ rb_raise(rb_eRuntimeError, "%s", ipq_errstr());
103
+
104
+ /* Clean up "last" variables... */
105
+ static_cleanup();
106
+
107
+ last_packet = buf;
108
+
109
+ if (last_packet == NULL)
110
+ rb_raise(rb_eRuntimeError, "could not load last_packet");
111
+
112
+ return Qtrue;
113
+ }
114
+
115
+ VALUE rubyipq_get_message_type(VALUE class) {
116
+ return INT2NUM(ipq_message_type(get_last_packet()));
117
+ }
118
+
119
+ VALUE rubyipq_set_verdict(VALUE class, VALUE verdict) {
120
+ int ret, i_verdict = NUM2INT(verdict);
121
+
122
+ /* TODO: fix this argument checking condition
123
+ if (NF_ACCEPT != i_verdict || NF_DROP != i_verdict) {
124
+ rb_raise(rb_eArgError, "unknown verdict type '%d' '%d'", i_verdict, NF_ACCEPT);
125
+ }*/
126
+
127
+
128
+ ret = ipq_set_verdict(handle, get_last_packet_msg()->packet_id, i_verdict, 0, NULL);
129
+ if (ret < 0)
130
+ rb_raise(rb_eRuntimeError, "%s", ipq_errstr());
131
+
132
+ return Qnil;
133
+ }
134
+
135
+ VALUE rubyipq_set_verdict_inject(VALUE class, VALUE verdict, VALUE payload) {
136
+ return Qnil;
137
+ }
138
+
139
+ VALUE rubyipq_get_indev(VALUE class) {
140
+ return rb_str_new2(get_last_packet_msg()->indev_name);
141
+ }
142
+
143
+ VALUE rubyipq_get_outdev(VALUE class) {
144
+ return rb_str_new2(get_last_packet_msg()->outdev_name);
145
+ }
146
+
147
+ VALUE rubyipq_get_timestamp_sec(VALUE class) {
148
+ return INT2NUM(get_last_packet_msg()->timestamp_sec);
149
+ }
150
+
151
+ VALUE rubyipq_get_timestamp_usec(VALUE class) {
152
+ return INT2NUM(get_last_packet_msg()->timestamp_usec);
153
+ }
154
+
155
+ VALUE rubyipq_is_incoming_packet(VALUE class) {
156
+ return (get_last_packet_msg()->indev_name[0] != '\0' ? Qtrue : Qfalse);
157
+ }
158
+
159
+ VALUE rubyipq_is_outgoing_packet(VALUE class) {
160
+ return (get_last_packet_msg()->outdev_name[0] != '\0' ? Qtrue : Qfalse);
161
+ }
162
+
163
+ VALUE rubyipq_get_hw_addr(VALUE class) {
164
+ VALUE hw_ary;
165
+ ipq_packet_msg_t *m = get_last_packet_msg();
166
+
167
+ hw_ary = rb_ary_new();
168
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[0]));
169
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[1]));
170
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[2]));
171
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[3]));
172
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[4]));
173
+ rb_ary_push(hw_ary, CHR2FIX(m->hw_addr[5]));
174
+
175
+ return hw_ary;
176
+ }
177
+
178
+
179
+
180
+ /* Rubyipq class */
181
+ static VALUE cRubyipq, cIPHeader, cTCPHeader, cUDPHeader, cICMPHeader;
182
+
183
+ void Init_Rubyipq() {
184
+ rubyipq_open = 0;
185
+ buffer_size = DEFAULT_BUFFER_SIZE;
186
+
187
+ cRubyipq = rb_define_class("Rubyipq", rb_cObject);
188
+
189
+ cIPHeader = rb_define_class_under(cRubyipq, "IPHeader", rb_cObject);
190
+ cTCPHeader = rb_define_class_under(cRubyipq, "TCPHeader", rb_cObject);
191
+ cUDPHeader = rb_define_class_under(cRubyipq, "UDPHeader", rb_cObject);
192
+
193
+ /* cRubyipq definitions */
194
+ rb_define_singleton_method(cRubyipq, "new", rubyipq_new, 1);
195
+ rb_define_method(cRubyipq, "initialize", rubyipq_initialize, 1);
196
+ rb_define_method(cRubyipq, "destroy", rubyipq_destroy, 0);
197
+ rb_define_method(cRubyipq, "opened?", rubyipq_is_open, 0);
198
+ rb_define_method(cRubyipq, "is_open?", rubyipq_is_open, 0);
199
+ rb_define_method(cRubyipq, "set_mode", rubyipq_set_mode, 1);
200
+ rb_define_method(cRubyipq, "set_verdict", rubyipq_set_verdict, 1);
201
+ rb_define_method(cRubyipq, "set_verdict_inject", rubyipq_set_verdict, 2);
202
+ rb_define_method(cRubyipq, "read", rubyipq_read, 1);
203
+ rb_define_method(cRubyipq, "get_message_type", rubyipq_get_message_type, 0);
204
+ rb_define_method(cRubyipq, "set_buffer_size", rubyipq_set_buffer_size, 1);
205
+ rb_define_method(cRubyipq, "get_buffer_size", rubyipq_get_buffer_size, 0);
206
+ rb_define_method(cRubyipq, "get_indev", rubyipq_get_indev, 0);
207
+ rb_define_method(cRubyipq, "get_outdev", rubyipq_get_outdev, 0);
208
+ rb_define_method(cRubyipq, "get_timestamp_sec", rubyipq_get_timestamp_sec, 0);
209
+ rb_define_method(cRubyipq, "get_timestamp_usec", rubyipq_get_timestamp_usec, 0);
210
+ rb_define_method(cRubyipq, "get_hw_addr", rubyipq_get_hw_addr, 0);
211
+ rb_define_method(cRubyipq, "is_incoming_packet?", rubyipq_is_incoming_packet, 0);
212
+ rb_define_method(cRubyipq, "is_outgoing_packet?", rubyipq_is_outgoing_packet, 0);
213
+
214
+
215
+
216
+ #define rb_define_rubyipq_const(var) \
217
+ rb_define_const(cRubyipq, #var, INT2NUM(var))
218
+
219
+ rb_define_rubyipq_const(PF_INET);
220
+ rb_define_rubyipq_const(PF_INET6);
221
+ rb_define_rubyipq_const(IPQ_COPY_META);
222
+ rb_define_rubyipq_const(IPQ_COPY_PACKET);
223
+ rb_define_rubyipq_const(NF_ACCEPT);
224
+ rb_define_rubyipq_const(NF_DROP);
225
+ rb_define_rubyipq_const(NLMSG_ERROR);
226
+ rb_define_rubyipq_const(IPQM_PACKET);
227
+
228
+ rb_define_rubyipq_const(PROTO_HOPOPT);
229
+ rb_define_rubyipq_const(PROTO_ICMP);
230
+ rb_define_rubyipq_const(PROTO_IGMP);
231
+ rb_define_rubyipq_const(PROTO_GGP);
232
+ rb_define_rubyipq_const(PROTO_IP);
233
+ rb_define_rubyipq_const(PROTO_ST);
234
+ rb_define_rubyipq_const(PROTO_TCP);
235
+ rb_define_rubyipq_const(PROTO_CBT);
236
+ rb_define_rubyipq_const(PROTO_EGP);
237
+ rb_define_rubyipq_const(PROTO_IGP);
238
+ rb_define_rubyipq_const(PROTO_BBN_RCC_MON);
239
+ rb_define_rubyipq_const(PROTO_NVP_II);
240
+ rb_define_rubyipq_const(PROTO_PUP);
241
+ rb_define_rubyipq_const(PROTO_ARGUS);
242
+ rb_define_rubyipq_const(PROTO_EMCON);
243
+ rb_define_rubyipq_const(PROTO_XNET);
244
+ rb_define_rubyipq_const(PROTO_CHAOS);
245
+ rb_define_rubyipq_const(PROTO_UDP);
246
+ rb_define_rubyipq_const(PROTO_MUX);
247
+ rb_define_rubyipq_const(PROTO_DCN_MEAS);
248
+ rb_define_rubyipq_const(PROTO_HMP);
249
+ rb_define_rubyipq_const(PROTO_PRM);
250
+ rb_define_rubyipq_const(PROTO_XNS_IDP);
251
+ rb_define_rubyipq_const(PROTO_TRUNK_1);
252
+ rb_define_rubyipq_const(PROTO_TRUNK_2);
253
+ rb_define_rubyipq_const(PROTO_LEAF_1);
254
+ rb_define_rubyipq_const(PROTO_LEAF_2);
255
+ rb_define_rubyipq_const(PROTO_RDP);
256
+ rb_define_rubyipq_const(PROTO_IRTP);
257
+ rb_define_rubyipq_const(PROTO_ISO_TP4);
258
+ rb_define_rubyipq_const(PROTO_NETBLT);
259
+ rb_define_rubyipq_const(PROTO_MFE_NSP);
260
+ rb_define_rubyipq_const(PROTO_MERIT_INP);
261
+ rb_define_rubyipq_const(PROTO_DCCP);
262
+ rb_define_rubyipq_const(PROTO_3PC);
263
+ rb_define_rubyipq_const(PROTO_IDPR);
264
+ rb_define_rubyipq_const(PROTO_XTP);
265
+ rb_define_rubyipq_const(PROTO_DDP);
266
+ rb_define_rubyipq_const(PROTO_IDPR_CMTP);
267
+ rb_define_rubyipq_const(PROTO_TPpp);
268
+ rb_define_rubyipq_const(PROTO_IL);
269
+ rb_define_rubyipq_const(PROTO_IPV6);
270
+ rb_define_rubyipq_const(PROTO_SDRP);
271
+ rb_define_rubyipq_const(PROTO_IPV6_ROUTE);
272
+ rb_define_rubyipq_const(PROTO_IPV6_FRAG);
273
+ rb_define_rubyipq_const(PROTO_IDRP);
274
+ rb_define_rubyipq_const(PROTO_RSVP);
275
+ rb_define_rubyipq_const(PROTO_GRE);
276
+ rb_define_rubyipq_const(PROTO_MHRP);
277
+ rb_define_rubyipq_const(PROTO_BNA);
278
+ rb_define_rubyipq_const(PROTO_ESP);
279
+ rb_define_rubyipq_const(PROTO_AH);
280
+ rb_define_rubyipq_const(PROTO_I_NLSP);
281
+ rb_define_rubyipq_const(PROTO_SWIPE);
282
+ rb_define_rubyipq_const(PROTO_NARP);
283
+ rb_define_rubyipq_const(PROTO_MOBILE);
284
+ rb_define_rubyipq_const(PROTO_TLSP);
285
+ rb_define_rubyipq_const(PROTO_SKIP);
286
+ rb_define_rubyipq_const(PROTO_IPV6_ICMP);
287
+ rb_define_rubyipq_const(PROTO_IPV6_NONXT);
288
+ rb_define_rubyipq_const(PROTO_IPV6_OPTS);
289
+ rb_define_rubyipq_const(PROTO_ANY_HOST_INTERNAL_PROTOCOL);
290
+ rb_define_rubyipq_const(PROTO_CFTP);
291
+ rb_define_rubyipq_const(PROTO_ANY_LOCAL_NETWORK);
292
+ rb_define_rubyipq_const(PROTO_SAT_EXPAK);
293
+ rb_define_rubyipq_const(PROTO_KRYPTOLAN);
294
+ rb_define_rubyipq_const(PROTO_RVD);
295
+ rb_define_rubyipq_const(PROTO_IPPC);
296
+ rb_define_rubyipq_const(PROTO_ANY_DISTRIBUTED_FILE_SYSTEM);
297
+ rb_define_rubyipq_const(PROTO_SAT_MON);
298
+ rb_define_rubyipq_const(PROTO_VISA);
299
+ rb_define_rubyipq_const(PROTO_IPCV);
300
+ rb_define_rubyipq_const(PROTO_CPNX);
301
+ rb_define_rubyipq_const(PROTO_CPHB);
302
+ rb_define_rubyipq_const(PROTO_WSN);
303
+ rb_define_rubyipq_const(PROTO_PVP);
304
+ rb_define_rubyipq_const(PROTO_BR_SAT_MON);
305
+ rb_define_rubyipq_const(PROTO_SUN_ND);
306
+ rb_define_rubyipq_const(PROTO_WB_MON);
307
+ rb_define_rubyipq_const(PROTO_WB_EXPAK);
308
+ rb_define_rubyipq_const(PROTO_ISO_IP);
309
+ rb_define_rubyipq_const(PROTO_VMTP);
310
+ rb_define_rubyipq_const(PROTO_SECURE_VMTP);
311
+ rb_define_rubyipq_const(PROTO_VINES);
312
+ rb_define_rubyipq_const(PROTO_TTP);
313
+ rb_define_rubyipq_const(PROTO_NSFNET_IGP);
314
+ rb_define_rubyipq_const(PROTO_DGP);
315
+ rb_define_rubyipq_const(PROTO_TCF);
316
+ rb_define_rubyipq_const(PROTO_EIGRP);
317
+ rb_define_rubyipq_const(PROTO_OSPFIGP);
318
+ rb_define_rubyipq_const(PROTO_SPRITE_RPC);
319
+ rb_define_rubyipq_const(PROTO_LARP);
320
+ rb_define_rubyipq_const(PROTO_MTP);
321
+ rb_define_rubyipq_const(PROTO_AX_25);
322
+ rb_define_rubyipq_const(PROTO_IPIP);
323
+ rb_define_rubyipq_const(PROTO_MICP);
324
+ rb_define_rubyipq_const(PROTO_SCC_SP);
325
+ rb_define_rubyipq_const(PROTO_ETHERIP);
326
+ rb_define_rubyipq_const(PROTO_ENCAP);
327
+ rb_define_rubyipq_const(PROTO_ANY_PRIVATE_ENCRYPTION_SCHEME);
328
+ rb_define_rubyipq_const(PROTO_GMTP);
329
+ rb_define_rubyipq_const(PROTO_IFMP);
330
+ rb_define_rubyipq_const(PROTO_PNNI);
331
+ rb_define_rubyipq_const(PROTO_PIM);
332
+ rb_define_rubyipq_const(PROTO_ARIS);
333
+ rb_define_rubyipq_const(PROTO_SCPS);
334
+ rb_define_rubyipq_const(PROTO_QNX);
335
+ rb_define_rubyipq_const(PROTO_A_N);
336
+ rb_define_rubyipq_const(PROTO_IPCOMP);
337
+ rb_define_rubyipq_const(PROTO_SNP);
338
+ rb_define_rubyipq_const(PROTO_COMPAQ_PEER);
339
+ rb_define_rubyipq_const(PROTO_IPX_IN_IP);
340
+ rb_define_rubyipq_const(PROTO_VRRP);
341
+ rb_define_rubyipq_const(PROTO_PGM);
342
+ rb_define_rubyipq_const(PROTO_ANY_0_HOP_PROTOCOL);
343
+ rb_define_rubyipq_const(PROTO_L2TP);
344
+ rb_define_rubyipq_const(PROTO_DDX);
345
+ rb_define_rubyipq_const(PROTO_IATP);
346
+ rb_define_rubyipq_const(PROTO_STP);
347
+ rb_define_rubyipq_const(PROTO_SRP);
348
+ rb_define_rubyipq_const(PROTO_UTI);
349
+ rb_define_rubyipq_const(PROTO_SMP);
350
+ rb_define_rubyipq_const(PROTO_SM);
351
+ rb_define_rubyipq_const(PROTO_PTP);
352
+ rb_define_rubyipq_const(PROTO_ISIS_OVER_IPV4);
353
+ rb_define_rubyipq_const(PROTO_FIRE);
354
+ rb_define_rubyipq_const(PROTO_CRTP);
355
+ rb_define_rubyipq_const(PROTO_CRUDP);
356
+ rb_define_rubyipq_const(PROTO_SSCOPMCE);
357
+ rb_define_rubyipq_const(PROTO_IPLT);
358
+ rb_define_rubyipq_const(PROTO_SPS);
359
+ rb_define_rubyipq_const(PROTO_PIPE);
360
+ rb_define_rubyipq_const(PROTO_SCTP);
361
+ rb_define_rubyipq_const(PROTO_FC);
362
+ rb_define_rubyipq_const(PROTO_RSVP_E2E_IGNORE);
363
+ rb_define_rubyipq_const(PROTO_MOBILITY);
364
+ rb_define_rubyipq_const(PROTO_UDPLITE);
365
+ rb_define_rubyipq_const(PROTO_MPLS_IN_IP);
366
+
367
+
368
+ /* cIPHeader definitions */
369
+ rb_define_singleton_method(cIPHeader, "new", ipheader_new, 0);
370
+ rb_define_singleton_method(cIPHeader, "initialize", ipheader_init, 0);
371
+ rb_define_singleton_method(cIPHeader, "tos", ipheader_tos, 0);
372
+ rb_define_singleton_method(cIPHeader, "tot_len", ipheader_tot_len, 0);
373
+ rb_define_singleton_method(cIPHeader, "id", ipheader_id, 0);
374
+ rb_define_singleton_method(cIPHeader, "frag_off", ipheader_frag_off, 0);
375
+ rb_define_singleton_method(cIPHeader, "ttl", ipheader_ttl, 0);
376
+ rb_define_singleton_method(cIPHeader, "protocol", ipheader_protocol, 0);
377
+ rb_define_singleton_method(cIPHeader, "check", ipheader_check, 0);
378
+ rb_define_singleton_method(cIPHeader, "saddr", ipheader_saddr, 0);
379
+ rb_define_singleton_method(cIPHeader, "daddr", ipheader_daddr, 0);
380
+
381
+ /* cTCPHeader definitions */
382
+ rb_define_singleton_method(cTCPHeader, "new", tcpheader_new, 0);
383
+ rb_define_singleton_method(cTCPHeader, "initialize", tcpheader_init, 0);
384
+ rb_define_singleton_method(cTCPHeader, "source", tcpheader_source, 0);
385
+ rb_define_singleton_method(cTCPHeader, "dest", tcpheader_dest, 0);
386
+ rb_define_singleton_method(cTCPHeader, "seq", tcpheader_seq, 0);
387
+ rb_define_singleton_method(cTCPHeader, "ack_seq", tcpheader_ack_seq, 0);
388
+ rb_define_singleton_method(cTCPHeader, "window", tcpheader_window, 0);
389
+ rb_define_singleton_method(cTCPHeader, "check", tcpheader_check, 0);
390
+ rb_define_singleton_method(cTCPHeader, "get_data", tcpheader_get_data, 0);
391
+
392
+ /* cUDPHeader definitions */
393
+ rb_define_singleton_method(cUDPHeader, "new", udpheader_new, 0);
394
+ rb_define_singleton_method(cUDPHeader, "initialize", udpheader_init, 0);
395
+ rb_define_singleton_method(cUDPHeader, "source", udpheader_source, 0);
396
+ rb_define_singleton_method(cUDPHeader, "dest", udpheader_dest, 0);
397
+ rb_define_singleton_method(cUDPHeader, "len", udpheader_len, 0);
398
+ rb_define_singleton_method(cUDPHeader, "check", udpheader_check, 0);
399
+ rb_define_singleton_method(cUDPHeader, "get_data", udpheader_get_data, 0);
400
+ }
data/rubyipq.h ADDED
@@ -0,0 +1,36 @@
1
+ /*
2
+ * rubyipq v0.1.0
3
+ * Ruby bindings for Netfilter's libipq.
4
+ *
5
+ * Copyright (c) 2005 Leonardo Eloy
6
+ * Author: Leonardo Eloy <l.eloy@terra.com.br/leonardo.eloy@gmail.com>
7
+ * Project Homepage: http://rubyipq.rubyforge.org
8
+ *
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation; either version 2 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; if not, write to the Free Software
22
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
+ */
24
+
25
+ #include "ruby.h"
26
+ #include "util.h"
27
+
28
+ #include "rubyipq_proto.h"
29
+ #include "rubyipq_defs.h"
30
+
31
+ #include <stdio.h>
32
+
33
+ /* Needed for __u32_to_str() */
34
+ #define DECIMAL_BYTE_VALUE 255
35
+
36
+ #define DEFAULT_BUFFER_SIZE 2048