rbroccoli 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4213 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 1.3.29
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #define SWIGRUBY
12
+ /* -----------------------------------------------------------------------------
13
+ * This section contains generic SWIG labels for method/variable
14
+ * declarations/attributes, and other compiler dependent labels.
15
+ * ----------------------------------------------------------------------------- */
16
+
17
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
18
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
19
+ # if defined(__SUNPRO_CC)
20
+ # if (__SUNPRO_CC <= 0x560)
21
+ # define SWIGTEMPLATEDISAMBIGUATOR template
22
+ # else
23
+ # define SWIGTEMPLATEDISAMBIGUATOR
24
+ # endif
25
+ # else
26
+ # define SWIGTEMPLATEDISAMBIGUATOR
27
+ # endif
28
+ #endif
29
+
30
+ /* inline attribute */
31
+ #ifndef SWIGINLINE
32
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
33
+ # define SWIGINLINE inline
34
+ # else
35
+ # define SWIGINLINE
36
+ # endif
37
+ #endif
38
+
39
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
40
+ #ifndef SWIGUNUSED
41
+ # if defined(__GNUC__)
42
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
43
+ # define SWIGUNUSED __attribute__ ((__unused__))
44
+ # else
45
+ # define SWIGUNUSED
46
+ # endif
47
+ # elif defined(__ICC)
48
+ # define SWIGUNUSED __attribute__ ((__unused__))
49
+ # else
50
+ # define SWIGUNUSED
51
+ # endif
52
+ #endif
53
+
54
+ #ifndef SWIGUNUSEDPARM
55
+ # ifdef __cplusplus
56
+ # define SWIGUNUSEDPARM(p)
57
+ # else
58
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
59
+ # endif
60
+ #endif
61
+
62
+ /* internal SWIG method */
63
+ #ifndef SWIGINTERN
64
+ # define SWIGINTERN static SWIGUNUSED
65
+ #endif
66
+
67
+ /* internal inline SWIG method */
68
+ #ifndef SWIGINTERNINLINE
69
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
70
+ #endif
71
+
72
+ /* exporting methods */
73
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
74
+ # ifndef GCC_HASCLASSVISIBILITY
75
+ # define GCC_HASCLASSVISIBILITY
76
+ # endif
77
+ #endif
78
+
79
+ #ifndef SWIGEXPORT
80
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
81
+ # if defined(STATIC_LINKED)
82
+ # define SWIGEXPORT
83
+ # else
84
+ # define SWIGEXPORT __declspec(dllexport)
85
+ # endif
86
+ # else
87
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
88
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
89
+ # else
90
+ # define SWIGEXPORT
91
+ # endif
92
+ # endif
93
+ #endif
94
+
95
+ /* calling conventions for Windows */
96
+ #ifndef SWIGSTDCALL
97
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
98
+ # define SWIGSTDCALL __stdcall
99
+ # else
100
+ # define SWIGSTDCALL
101
+ # endif
102
+ #endif
103
+
104
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
105
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
106
+ # define _CRT_SECURE_NO_DEPRECATE
107
+ #endif
108
+
109
+ /* -----------------------------------------------------------------------------
110
+ * This section contains generic SWIG labels for method/variable
111
+ * declarations/attributes, and other compiler dependent labels.
112
+ * ----------------------------------------------------------------------------- */
113
+
114
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
115
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
116
+ # if defined(__SUNPRO_CC)
117
+ # if (__SUNPRO_CC <= 0x560)
118
+ # define SWIGTEMPLATEDISAMBIGUATOR template
119
+ # else
120
+ # define SWIGTEMPLATEDISAMBIGUATOR
121
+ # endif
122
+ # else
123
+ # define SWIGTEMPLATEDISAMBIGUATOR
124
+ # endif
125
+ #endif
126
+
127
+ /* inline attribute */
128
+ #ifndef SWIGINLINE
129
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
130
+ # define SWIGINLINE inline
131
+ # else
132
+ # define SWIGINLINE
133
+ # endif
134
+ #endif
135
+
136
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
137
+ #ifndef SWIGUNUSED
138
+ # if defined(__GNUC__)
139
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
140
+ # define SWIGUNUSED __attribute__ ((__unused__))
141
+ # else
142
+ # define SWIGUNUSED
143
+ # endif
144
+ # elif defined(__ICC)
145
+ # define SWIGUNUSED __attribute__ ((__unused__))
146
+ # else
147
+ # define SWIGUNUSED
148
+ # endif
149
+ #endif
150
+
151
+ #ifndef SWIGUNUSEDPARM
152
+ # ifdef __cplusplus
153
+ # define SWIGUNUSEDPARM(p)
154
+ # else
155
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
156
+ # endif
157
+ #endif
158
+
159
+ /* internal SWIG method */
160
+ #ifndef SWIGINTERN
161
+ # define SWIGINTERN static SWIGUNUSED
162
+ #endif
163
+
164
+ /* internal inline SWIG method */
165
+ #ifndef SWIGINTERNINLINE
166
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
167
+ #endif
168
+
169
+ /* exporting methods */
170
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
171
+ # ifndef GCC_HASCLASSVISIBILITY
172
+ # define GCC_HASCLASSVISIBILITY
173
+ # endif
174
+ #endif
175
+
176
+ #ifndef SWIGEXPORT
177
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
178
+ # if defined(STATIC_LINKED)
179
+ # define SWIGEXPORT
180
+ # else
181
+ # define SWIGEXPORT __declspec(dllexport)
182
+ # endif
183
+ # else
184
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
185
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
186
+ # else
187
+ # define SWIGEXPORT
188
+ # endif
189
+ # endif
190
+ #endif
191
+
192
+ /* calling conventions for Windows */
193
+ #ifndef SWIGSTDCALL
194
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
195
+ # define SWIGSTDCALL __stdcall
196
+ # else
197
+ # define SWIGSTDCALL
198
+ # endif
199
+ #endif
200
+
201
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
202
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
203
+ # define _CRT_SECURE_NO_DEPRECATE
204
+ #endif
205
+
206
+ /* -----------------------------------------------------------------------------
207
+ * swigrun.swg
208
+ *
209
+ * This file contains generic CAPI SWIG runtime support for pointer
210
+ * type checking.
211
+ * ----------------------------------------------------------------------------- */
212
+
213
+ /* This should only be incremented when either the layout of swig_type_info changes,
214
+ or for whatever reason, the runtime changes incompatibly */
215
+ #define SWIG_RUNTIME_VERSION "2"
216
+
217
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
218
+ #ifdef SWIG_TYPE_TABLE
219
+ # define SWIG_QUOTE_STRING(x) #x
220
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
221
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
222
+ #else
223
+ # define SWIG_TYPE_TABLE_NAME
224
+ #endif
225
+
226
+ /*
227
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
228
+ creating a static or dynamic library from the swig runtime code.
229
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
230
+
231
+ But only do this if is strictly necessary, ie, if you have problems
232
+ with your compiler or so.
233
+ */
234
+
235
+ #ifndef SWIGRUNTIME
236
+ # define SWIGRUNTIME SWIGINTERN
237
+ #endif
238
+
239
+ #ifndef SWIGRUNTIMEINLINE
240
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
241
+ #endif
242
+
243
+ /* Generic buffer size */
244
+ #ifndef SWIG_BUFFER_SIZE
245
+ # define SWIG_BUFFER_SIZE 1024
246
+ #endif
247
+
248
+ /* Flags for pointer conversions */
249
+ #define SWIG_POINTER_DISOWN 0x1
250
+
251
+ /* Flags for new pointer objects */
252
+ #define SWIG_POINTER_OWN 0x1
253
+
254
+
255
+ /*
256
+ Flags/methods for returning states.
257
+
258
+ The swig conversion methods, as ConvertPtr, return and integer
259
+ that tells if the conversion was successful or not. And if not,
260
+ an error code can be returned (see swigerrors.swg for the codes).
261
+
262
+ Use the following macros/flags to set or process the returning
263
+ states.
264
+
265
+ In old swig versions, you usually write code as:
266
+
267
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
268
+ // success code
269
+ } else {
270
+ //fail code
271
+ }
272
+
273
+ Now you can be more explicit as:
274
+
275
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
276
+ if (SWIG_IsOK(res)) {
277
+ // success code
278
+ } else {
279
+ // fail code
280
+ }
281
+
282
+ that seems to be the same, but now you can also do
283
+
284
+ Type *ptr;
285
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
286
+ if (SWIG_IsOK(res)) {
287
+ // success code
288
+ if (SWIG_IsNewObj(res) {
289
+ ...
290
+ delete *ptr;
291
+ } else {
292
+ ...
293
+ }
294
+ } else {
295
+ // fail code
296
+ }
297
+
298
+ I.e., now SWIG_ConvertPtr can return new objects and you can
299
+ identify the case and take care of the deallocation. Of course that
300
+ requires also to SWIG_ConvertPtr to return new result values, as
301
+
302
+ int SWIG_ConvertPtr(obj, ptr,...) {
303
+ if (<obj is ok>) {
304
+ if (<need new object>) {
305
+ *ptr = <ptr to new allocated object>;
306
+ return SWIG_NEWOBJ;
307
+ } else {
308
+ *ptr = <ptr to old object>;
309
+ return SWIG_OLDOBJ;
310
+ }
311
+ } else {
312
+ return SWIG_BADOBJ;
313
+ }
314
+ }
315
+
316
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
317
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
318
+ swig errors code.
319
+
320
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
321
+ allows to return the 'cast rank', for example, if you have this
322
+
323
+ int food(double)
324
+ int fooi(int);
325
+
326
+ and you call
327
+
328
+ food(1) // cast rank '1' (1 -> 1.0)
329
+ fooi(1) // cast rank '0'
330
+
331
+ just use the SWIG_AddCast()/SWIG_CheckState()
332
+
333
+
334
+ */
335
+ #define SWIG_OK (0)
336
+ #define SWIG_ERROR (-1)
337
+ #define SWIG_IsOK(r) (r >= 0)
338
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
339
+
340
+ /* The CastRankLimit says how many bits are used for the cast rank */
341
+ #define SWIG_CASTRANKLIMIT (1 << 8)
342
+ /* The NewMask denotes the object was created (using new/malloc) */
343
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
344
+ /* The TmpMask is for in/out typemaps that use temporal objects */
345
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
346
+ /* Simple returning values */
347
+ #define SWIG_BADOBJ (SWIG_ERROR)
348
+ #define SWIG_OLDOBJ (SWIG_OK)
349
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
350
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
351
+ /* Check, add and del mask methods */
352
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
353
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
354
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
355
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
356
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
357
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
358
+
359
+
360
+ /* Cast-Rank Mode */
361
+ #if defined(SWIG_CASTRANK_MODE)
362
+ # ifndef SWIG_TypeRank
363
+ # define SWIG_TypeRank unsigned long
364
+ # endif
365
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
366
+ # define SWIG_MAXCASTRANK (2)
367
+ # endif
368
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
369
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
370
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
371
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
372
+ }
373
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
374
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
375
+ }
376
+ #else /* no cast-rank mode */
377
+ # define SWIG_AddCast
378
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
379
+ #endif
380
+
381
+
382
+
383
+
384
+ #include <string.h>
385
+
386
+ #ifdef __cplusplus
387
+ extern "C" {
388
+ #endif
389
+
390
+ typedef void *(*swig_converter_func)(void *);
391
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
392
+
393
+ /* Structure to store inforomation on one type */
394
+ typedef struct swig_type_info {
395
+ const char *name; /* mangled name of this type */
396
+ const char *str; /* human readable name of this type */
397
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
398
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
399
+ void *clientdata; /* language specific type data */
400
+ int owndata; /* flag if the structure owns the clientdata */
401
+ } swig_type_info;
402
+
403
+ /* Structure to store a type and conversion function used for casting */
404
+ typedef struct swig_cast_info {
405
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
406
+ swig_converter_func converter; /* function to cast the void pointers */
407
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
408
+ struct swig_cast_info *prev; /* pointer to the previous cast */
409
+ } swig_cast_info;
410
+
411
+ /* Structure used to store module information
412
+ * Each module generates one structure like this, and the runtime collects
413
+ * all of these structures and stores them in a circularly linked list.*/
414
+ typedef struct swig_module_info {
415
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
416
+ size_t size; /* Number of types in this module */
417
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
418
+ swig_type_info **type_initial; /* Array of initially generated type structures */
419
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
420
+ void *clientdata; /* Language specific module data */
421
+ } swig_module_info;
422
+
423
+ /*
424
+ Compare two type names skipping the space characters, therefore
425
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
426
+
427
+ Return 0 when the two name types are equivalent, as in
428
+ strncmp, but skipping ' '.
429
+ */
430
+ SWIGRUNTIME int
431
+ SWIG_TypeNameComp(const char *f1, const char *l1,
432
+ const char *f2, const char *l2) {
433
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
434
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
435
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
436
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
437
+ }
438
+ return (l1 - f1) - (l2 - f2);
439
+ }
440
+
441
+ /*
442
+ Check type equivalence in a name list like <name1>|<name2>|...
443
+ Return 0 if not equal, 1 if equal
444
+ */
445
+ SWIGRUNTIME int
446
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
447
+ int equiv = 0;
448
+ const char* te = tb + strlen(tb);
449
+ const char* ne = nb;
450
+ while (!equiv && *ne) {
451
+ for (nb = ne; *ne; ++ne) {
452
+ if (*ne == '|') break;
453
+ }
454
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
455
+ if (*ne) ++ne;
456
+ }
457
+ return equiv;
458
+ }
459
+
460
+ /*
461
+ Check type equivalence in a name list like <name1>|<name2>|...
462
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
463
+ */
464
+ SWIGRUNTIME int
465
+ SWIG_TypeCompare(const char *nb, const char *tb) {
466
+ int equiv = 0;
467
+ const char* te = tb + strlen(tb);
468
+ const char* ne = nb;
469
+ while (!equiv && *ne) {
470
+ for (nb = ne; *ne; ++ne) {
471
+ if (*ne == '|') break;
472
+ }
473
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
474
+ if (*ne) ++ne;
475
+ }
476
+ return equiv;
477
+ }
478
+
479
+
480
+ /* think of this as a c++ template<> or a scheme macro */
481
+ #define SWIG_TypeCheck_Template(comparison, ty) \
482
+ if (ty) { \
483
+ swig_cast_info *iter = ty->cast; \
484
+ while (iter) { \
485
+ if (comparison) { \
486
+ if (iter == ty->cast) return iter; \
487
+ /* Move iter to the top of the linked list */ \
488
+ iter->prev->next = iter->next; \
489
+ if (iter->next) \
490
+ iter->next->prev = iter->prev; \
491
+ iter->next = ty->cast; \
492
+ iter->prev = 0; \
493
+ if (ty->cast) ty->cast->prev = iter; \
494
+ ty->cast = iter; \
495
+ return iter; \
496
+ } \
497
+ iter = iter->next; \
498
+ } \
499
+ } \
500
+ return 0
501
+
502
+ /*
503
+ Check the typename
504
+ */
505
+ SWIGRUNTIME swig_cast_info *
506
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
507
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
508
+ }
509
+
510
+ /* Same as previous function, except strcmp is replaced with a pointer comparison */
511
+ SWIGRUNTIME swig_cast_info *
512
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
513
+ SWIG_TypeCheck_Template(iter->type == from, into);
514
+ }
515
+
516
+ /*
517
+ Cast a pointer up an inheritance hierarchy
518
+ */
519
+ SWIGRUNTIMEINLINE void *
520
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
521
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
522
+ }
523
+
524
+ /*
525
+ Dynamic pointer casting. Down an inheritance hierarchy
526
+ */
527
+ SWIGRUNTIME swig_type_info *
528
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
529
+ swig_type_info *lastty = ty;
530
+ if (!ty || !ty->dcast) return ty;
531
+ while (ty && (ty->dcast)) {
532
+ ty = (*ty->dcast)(ptr);
533
+ if (ty) lastty = ty;
534
+ }
535
+ return lastty;
536
+ }
537
+
538
+ /*
539
+ Return the name associated with this type
540
+ */
541
+ SWIGRUNTIMEINLINE const char *
542
+ SWIG_TypeName(const swig_type_info *ty) {
543
+ return ty->name;
544
+ }
545
+
546
+ /*
547
+ Return the pretty name associated with this type,
548
+ that is an unmangled type name in a form presentable to the user.
549
+ */
550
+ SWIGRUNTIME const char *
551
+ SWIG_TypePrettyName(const swig_type_info *type) {
552
+ /* The "str" field contains the equivalent pretty names of the
553
+ type, separated by vertical-bar characters. We choose
554
+ to print the last name, as it is often (?) the most
555
+ specific. */
556
+ if (!type) return NULL;
557
+ if (type->str != NULL) {
558
+ const char *last_name = type->str;
559
+ const char *s;
560
+ for (s = type->str; *s; s++)
561
+ if (*s == '|') last_name = s+1;
562
+ return last_name;
563
+ }
564
+ else
565
+ return type->name;
566
+ }
567
+
568
+ /*
569
+ Set the clientdata field for a type
570
+ */
571
+ SWIGRUNTIME void
572
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
573
+ swig_cast_info *cast = ti->cast;
574
+ /* if (ti->clientdata == clientdata) return; */
575
+ ti->clientdata = clientdata;
576
+
577
+ while (cast) {
578
+ if (!cast->converter) {
579
+ swig_type_info *tc = cast->type;
580
+ if (!tc->clientdata) {
581
+ SWIG_TypeClientData(tc, clientdata);
582
+ }
583
+ }
584
+ cast = cast->next;
585
+ }
586
+ }
587
+ SWIGRUNTIME void
588
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
589
+ SWIG_TypeClientData(ti, clientdata);
590
+ ti->owndata = 1;
591
+ }
592
+
593
+ /*
594
+ Search for a swig_type_info structure only by mangled name
595
+ Search is a O(log #types)
596
+
597
+ We start searching at module start, and finish searching when start == end.
598
+ Note: if start == end at the beginning of the function, we go all the way around
599
+ the circular list.
600
+ */
601
+ SWIGRUNTIME swig_type_info *
602
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
603
+ swig_module_info *end,
604
+ const char *name) {
605
+ swig_module_info *iter = start;
606
+ do {
607
+ if (iter->size) {
608
+ register size_t l = 0;
609
+ register size_t r = iter->size - 1;
610
+ do {
611
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
612
+ register size_t i = (l + r) >> 1;
613
+ const char *iname = iter->types[i]->name;
614
+ if (iname) {
615
+ register int compare = strcmp(name, iname);
616
+ if (compare == 0) {
617
+ return iter->types[i];
618
+ } else if (compare < 0) {
619
+ if (i) {
620
+ r = i - 1;
621
+ } else {
622
+ break;
623
+ }
624
+ } else if (compare > 0) {
625
+ l = i + 1;
626
+ }
627
+ } else {
628
+ break; /* should never happen */
629
+ }
630
+ } while (l <= r);
631
+ }
632
+ iter = iter->next;
633
+ } while (iter != end);
634
+ return 0;
635
+ }
636
+
637
+ /*
638
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
639
+ It first searches the mangled names of the types, which is a O(log #types)
640
+ If a type is not found it then searches the human readable names, which is O(#types).
641
+
642
+ We start searching at module start, and finish searching when start == end.
643
+ Note: if start == end at the beginning of the function, we go all the way around
644
+ the circular list.
645
+ */
646
+ SWIGRUNTIME swig_type_info *
647
+ SWIG_TypeQueryModule(swig_module_info *start,
648
+ swig_module_info *end,
649
+ const char *name) {
650
+ /* STEP 1: Search the name field using binary search */
651
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
652
+ if (ret) {
653
+ return ret;
654
+ } else {
655
+ /* STEP 2: If the type hasn't been found, do a complete search
656
+ of the str field (the human readable name) */
657
+ swig_module_info *iter = start;
658
+ do {
659
+ register size_t i = 0;
660
+ for (; i < iter->size; ++i) {
661
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
662
+ return iter->types[i];
663
+ }
664
+ iter = iter->next;
665
+ } while (iter != end);
666
+ }
667
+
668
+ /* neither found a match */
669
+ return 0;
670
+ }
671
+
672
+ /*
673
+ Pack binary data into a string
674
+ */
675
+ SWIGRUNTIME char *
676
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
677
+ static const char hex[17] = "0123456789abcdef";
678
+ register const unsigned char *u = (unsigned char *) ptr;
679
+ register const unsigned char *eu = u + sz;
680
+ for (; u != eu; ++u) {
681
+ register unsigned char uu = *u;
682
+ *(c++) = hex[(uu & 0xf0) >> 4];
683
+ *(c++) = hex[uu & 0xf];
684
+ }
685
+ return c;
686
+ }
687
+
688
+ /*
689
+ Unpack binary data from a string
690
+ */
691
+ SWIGRUNTIME const char *
692
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
693
+ register unsigned char *u = (unsigned char *) ptr;
694
+ register const unsigned char *eu = u + sz;
695
+ for (; u != eu; ++u) {
696
+ register char d = *(c++);
697
+ register unsigned char uu;
698
+ if ((d >= '0') && (d <= '9'))
699
+ uu = ((d - '0') << 4);
700
+ else if ((d >= 'a') && (d <= 'f'))
701
+ uu = ((d - ('a'-10)) << 4);
702
+ else
703
+ return (char *) 0;
704
+ d = *(c++);
705
+ if ((d >= '0') && (d <= '9'))
706
+ uu |= (d - '0');
707
+ else if ((d >= 'a') && (d <= 'f'))
708
+ uu |= (d - ('a'-10));
709
+ else
710
+ return (char *) 0;
711
+ *u = uu;
712
+ }
713
+ return c;
714
+ }
715
+
716
+ /*
717
+ Pack 'void *' into a string buffer.
718
+ */
719
+ SWIGRUNTIME char *
720
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
721
+ char *r = buff;
722
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
723
+ *(r++) = '_';
724
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
725
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
726
+ strcpy(r,name);
727
+ return buff;
728
+ }
729
+
730
+ SWIGRUNTIME const char *
731
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
732
+ if (*c != '_') {
733
+ if (strcmp(c,"NULL") == 0) {
734
+ *ptr = (void *) 0;
735
+ return name;
736
+ } else {
737
+ return 0;
738
+ }
739
+ }
740
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
741
+ }
742
+
743
+ SWIGRUNTIME char *
744
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
745
+ char *r = buff;
746
+ size_t lname = (name ? strlen(name) : 0);
747
+ if ((2*sz + 2 + lname) > bsz) return 0;
748
+ *(r++) = '_';
749
+ r = SWIG_PackData(r,ptr,sz);
750
+ if (lname) {
751
+ strncpy(r,name,lname+1);
752
+ } else {
753
+ *r = 0;
754
+ }
755
+ return buff;
756
+ }
757
+
758
+ SWIGRUNTIME const char *
759
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
760
+ if (*c != '_') {
761
+ if (strcmp(c,"NULL") == 0) {
762
+ memset(ptr,0,sz);
763
+ return name;
764
+ } else {
765
+ return 0;
766
+ }
767
+ }
768
+ return SWIG_UnpackData(++c,ptr,sz);
769
+ }
770
+
771
+ #ifdef __cplusplus
772
+ }
773
+ #endif
774
+
775
+ /* Errors in SWIG */
776
+ #define SWIG_UnknownError -1
777
+ #define SWIG_IOError -2
778
+ #define SWIG_RuntimeError -3
779
+ #define SWIG_IndexError -4
780
+ #define SWIG_TypeError -5
781
+ #define SWIG_DivisionByZero -6
782
+ #define SWIG_OverflowError -7
783
+ #define SWIG_SyntaxError -8
784
+ #define SWIG_ValueError -9
785
+ #define SWIG_SystemError -10
786
+ #define SWIG_AttributeError -11
787
+ #define SWIG_MemoryError -12
788
+ #define SWIG_NullReferenceError -13
789
+
790
+
791
+
792
+ #include <ruby.h>
793
+
794
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
795
+ #ifndef NUM2LL
796
+ #define NUM2LL(x) NUM2LONG((x))
797
+ #endif
798
+ #ifndef LL2NUM
799
+ #define LL2NUM(x) INT2NUM((long) (x))
800
+ #endif
801
+ #ifndef ULL2NUM
802
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
803
+ #endif
804
+
805
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
806
+ #ifndef NUM2ULL
807
+ #ifdef HAVE_LONG_LONG
808
+ #define NUM2ULL(x) rb_num2ull((x))
809
+ #else
810
+ #define NUM2ULL(x) NUM2ULONG(x)
811
+ #endif
812
+ #endif
813
+
814
+ /*
815
+ * Need to be very careful about how these macros are defined, especially
816
+ * when compiling C++ code or C code with an ANSI C compiler.
817
+ *
818
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
819
+ * a Ruby method so that it can be passed as an argument to API functions
820
+ * like rb_define_method() and rb_define_singleton_method().
821
+ *
822
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
823
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
824
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
825
+ * and Data_Make_Struct().
826
+ */
827
+
828
+ #ifdef __cplusplus
829
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
830
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
831
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
832
+ # define VOIDFUNC(f) ((void (*)()) f)
833
+ # else
834
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
835
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
836
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
837
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
838
+ # else /* These definitions should work for Ruby 1.7+ */
839
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
840
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
841
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
842
+ # endif
843
+ # endif
844
+ #else
845
+ # define VALUEFUNC(f) (f)
846
+ # define VOIDFUNC(f) (f)
847
+ #endif
848
+
849
+ /* Don't use for expressions have side effect */
850
+ #ifndef RB_STRING_VALUE
851
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
852
+ #endif
853
+ #ifndef StringValue
854
+ #define StringValue(s) RB_STRING_VALUE(s)
855
+ #endif
856
+ #ifndef StringValuePtr
857
+ #define StringValuePtr(s) RSTRING(RB_STRING_VALUE(s))->ptr
858
+ #endif
859
+ #ifndef StringValueLen
860
+ #define StringValueLen(s) RSTRING(RB_STRING_VALUE(s))->len
861
+ #endif
862
+ #ifndef SafeStringValue
863
+ #define SafeStringValue(v) do {\
864
+ StringValue(v);\
865
+ rb_check_safe_str(v);\
866
+ } while (0)
867
+ #endif
868
+
869
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
870
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
871
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
872
+ #endif
873
+
874
+
875
+ /* -----------------------------------------------------------------------------
876
+ * error manipulation
877
+ * ----------------------------------------------------------------------------- */
878
+
879
+
880
+ /* Define some additional error types */
881
+ #define SWIG_ObjectPreviouslyDeletedError -100
882
+
883
+
884
+ /* Define custom exceptions for errors that do not map to existing Ruby
885
+ exceptions. Note this only works for C++ since a global cannot be
886
+ initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/
887
+
888
+ SWIGINTERN VALUE
889
+ getNullReferenceError(void) {
890
+ static int init = 0;
891
+ static VALUE rb_eNullReferenceError ;
892
+ if (!init) {
893
+ init = 1;
894
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
895
+ }
896
+ return rb_eNullReferenceError;
897
+ }
898
+
899
+ SWIGINTERN VALUE
900
+ getObjectPreviouslyDeletedError(void) {
901
+ static int init = 0;
902
+ static VALUE rb_eObjectPreviouslyDeleted ;
903
+ if (!init) {
904
+ init = 1;
905
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
906
+ }
907
+ return rb_eObjectPreviouslyDeleted;
908
+ }
909
+
910
+
911
+ SWIGINTERN VALUE
912
+ SWIG_Ruby_ErrorType(int SWIG_code) {
913
+ VALUE type;
914
+ switch (SWIG_code) {
915
+ case SWIG_MemoryError:
916
+ type = rb_eNoMemError;
917
+ break;
918
+ case SWIG_IOError:
919
+ type = rb_eIOError;
920
+ break;
921
+ case SWIG_RuntimeError:
922
+ type = rb_eRuntimeError;
923
+ break;
924
+ case SWIG_IndexError:
925
+ type = rb_eIndexError;
926
+ break;
927
+ case SWIG_TypeError:
928
+ type = rb_eTypeError;
929
+ break;
930
+ case SWIG_DivisionByZero:
931
+ type = rb_eZeroDivError;
932
+ break;
933
+ case SWIG_OverflowError:
934
+ type = rb_eRangeError;
935
+ break;
936
+ case SWIG_SyntaxError:
937
+ type = rb_eSyntaxError;
938
+ break;
939
+ case SWIG_ValueError:
940
+ type = rb_eArgError;
941
+ break;
942
+ case SWIG_SystemError:
943
+ type = rb_eFatal;
944
+ break;
945
+ case SWIG_AttributeError:
946
+ type = rb_eRuntimeError;
947
+ break;
948
+ case SWIG_NullReferenceError:
949
+ type = getNullReferenceError();
950
+ break;
951
+ case SWIG_ObjectPreviouslyDeletedError:
952
+ type = getObjectPreviouslyDeletedError();
953
+ break;
954
+ case SWIG_UnknownError:
955
+ type = rb_eRuntimeError;
956
+ break;
957
+ default:
958
+ type = rb_eRuntimeError;
959
+ }
960
+ return type;
961
+ }
962
+
963
+
964
+
965
+
966
+ /* -----------------------------------------------------------------------------
967
+ * See the LICENSE file for information on copyright, usage and redistribution
968
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
969
+ *
970
+ * rubytracking.swg
971
+ *
972
+ * This file contains support for tracking mappings from
973
+ * Ruby objects to C++ objects. This functionality is needed
974
+ * to implement mark functions for Ruby's mark and sweep
975
+ * garbage collector.
976
+ * ----------------------------------------------------------------------------- */
977
+
978
+ #ifdef __cplusplus
979
+ extern "C" {
980
+ #endif
981
+
982
+
983
+ /* Global Ruby hash table to store Trackings from C/C++
984
+ structs to Ruby Objects. */
985
+ static VALUE swig_ruby_trackings;
986
+
987
+ /* Global variable that stores a reference to the ruby
988
+ hash table delete function. */
989
+ static ID swig_ruby_hash_delete = 0;
990
+
991
+ /* Setup a Ruby hash table to store Trackings */
992
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
993
+ /* Create a ruby hash table to store Trackings from C++
994
+ objects to Ruby objects. Also make sure to tell
995
+ the garabage collector about the hash table. */
996
+ swig_ruby_trackings = rb_hash_new();
997
+ rb_gc_register_address(&swig_ruby_trackings);
998
+
999
+ /* Now store a reference to the hash table delete function
1000
+ so that we only have to look it up once.*/
1001
+ swig_ruby_hash_delete = rb_intern("delete");
1002
+ }
1003
+
1004
+ /* Get a Ruby number to reference a pointer */
1005
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1006
+ /* We cast the pointer to an unsigned long
1007
+ and then store a reference to it using
1008
+ a Ruby number object. */
1009
+
1010
+ /* Convert the pointer to a Ruby number */
1011
+ unsigned long value = (unsigned long) ptr;
1012
+ return LONG2NUM(value);
1013
+ }
1014
+
1015
+ /* Get a Ruby number to reference an object */
1016
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1017
+ /* We cast the object to an unsigned long
1018
+ and then store a reference to it using
1019
+ a Ruby number object. */
1020
+
1021
+ /* Convert the Object to a Ruby number */
1022
+ unsigned long value = (unsigned long) object;
1023
+ return LONG2NUM(value);
1024
+ }
1025
+
1026
+ /* Get a Ruby object from a previously stored reference */
1027
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1028
+ /* The provided Ruby number object is a reference
1029
+ to the Ruby object we want.*/
1030
+
1031
+ /* First convert the Ruby number to a C number */
1032
+ unsigned long value = NUM2LONG(reference);
1033
+ return (VALUE) value;
1034
+ }
1035
+
1036
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1037
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1038
+ /* In a Ruby hash table we store the pointer and
1039
+ the associated Ruby object. The trick here is
1040
+ that we cannot store the Ruby object directly - if
1041
+ we do then it cannot be garbage collected. So
1042
+ instead we typecast it as a unsigned long and
1043
+ convert it to a Ruby number object.*/
1044
+
1045
+ /* Get a reference to the pointer as a Ruby number */
1046
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1047
+
1048
+ /* Get a reference to the Ruby object as a Ruby number */
1049
+ VALUE value = SWIG_RubyObjectToReference(object);
1050
+
1051
+ /* Store the mapping to the global hash table. */
1052
+ rb_hash_aset(swig_ruby_trackings, key, value);
1053
+ }
1054
+
1055
+ /* Get the Ruby object that owns the specified C/C++ struct */
1056
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1057
+ /* Get a reference to the pointer as a Ruby number */
1058
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1059
+
1060
+ /* Now lookup the value stored in the global hash table */
1061
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1062
+
1063
+ if (value == Qnil) {
1064
+ /* No object exists - return nil. */
1065
+ return Qnil;
1066
+ }
1067
+ else {
1068
+ /* Convert this value to Ruby object */
1069
+ return SWIG_RubyReferenceToObject(value);
1070
+ }
1071
+ }
1072
+
1073
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1074
+ is very important to remove objects once they are destroyed
1075
+ since the same memory address may be reused later to create
1076
+ a new object. */
1077
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1078
+ /* Get a reference to the pointer as a Ruby number */
1079
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1080
+
1081
+ /* Delete the object from the hash table by calling Ruby's
1082
+ do this we need to call the Hash.delete method.*/
1083
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1084
+ }
1085
+
1086
+ /* This is a helper method that unlinks a Ruby object from its
1087
+ underlying C++ object. This is needed if the lifetime of the
1088
+ Ruby object is longer than the C++ object */
1089
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1090
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1091
+
1092
+ if (object != Qnil) {
1093
+ DATA_PTR(object) = 0;
1094
+ }
1095
+ }
1096
+
1097
+
1098
+ #ifdef __cplusplus
1099
+ }
1100
+ #endif
1101
+
1102
+ /* -----------------------------------------------------------------------------
1103
+ * Ruby API portion that goes into the runtime
1104
+ * ----------------------------------------------------------------------------- */
1105
+
1106
+ #ifdef __cplusplus
1107
+ extern "C" {
1108
+ #endif
1109
+
1110
+ SWIGINTERN VALUE
1111
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1112
+ if (NIL_P(target)) {
1113
+ target = o;
1114
+ } else {
1115
+ if (TYPE(target) != T_ARRAY) {
1116
+ VALUE o2 = target;
1117
+ target = rb_ary_new();
1118
+ rb_ary_push(target, o2);
1119
+ }
1120
+ rb_ary_push(target, o);
1121
+ }
1122
+ return target;
1123
+ }
1124
+
1125
+ #ifdef __cplusplus
1126
+ }
1127
+ #endif
1128
+
1129
+
1130
+ /* -----------------------------------------------------------------------------
1131
+ * See the LICENSE file for information on copyright, usage and redistribution
1132
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1133
+ *
1134
+ * rubyrun.swg
1135
+ *
1136
+ * This file contains the runtime support for Ruby modules
1137
+ * and includes code for managing global variables and pointer
1138
+ * type checking.
1139
+ * ----------------------------------------------------------------------------- */
1140
+
1141
+ /* For backward compatibility only */
1142
+ #define SWIG_POINTER_EXCEPTION 0
1143
+
1144
+ /* for raw pointers */
1145
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1146
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1147
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1148
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1149
+ #define swig_owntype ruby_owntype
1150
+
1151
+ /* for raw packed data */
1152
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1153
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1154
+
1155
+ /* for class or struct pointers */
1156
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1157
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1158
+
1159
+ /* for C or C++ function pointers */
1160
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1161
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1162
+
1163
+ /* for C++ member pointers, ie, member methods */
1164
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1165
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1166
+
1167
+
1168
+ /* Runtime API */
1169
+
1170
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1171
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1172
+
1173
+
1174
+ /* Error manipulation */
1175
+
1176
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1177
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
1178
+ #define SWIG_fail goto fail
1179
+
1180
+
1181
+ /* Ruby-specific SWIG API */
1182
+
1183
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1184
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1185
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1186
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1187
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1188
+
1189
+
1190
+ /* -----------------------------------------------------------------------------
1191
+ * pointers/data manipulation
1192
+ * ----------------------------------------------------------------------------- */
1193
+
1194
+ #ifdef __cplusplus
1195
+ extern "C" {
1196
+ #if 0
1197
+ } /* cc-mode */
1198
+ #endif
1199
+ #endif
1200
+
1201
+ typedef struct {
1202
+ VALUE klass;
1203
+ VALUE mImpl;
1204
+ void (*mark)(void *);
1205
+ void (*destroy)(void *);
1206
+ int trackObjects;
1207
+ } swig_class;
1208
+
1209
+
1210
+ static VALUE _mSWIG = Qnil;
1211
+ static VALUE _cSWIG_Pointer = Qnil;
1212
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1213
+
1214
+ SWIGRUNTIME VALUE
1215
+ getExceptionClass(void) {
1216
+ static int init = 0;
1217
+ static VALUE rubyExceptionClass ;
1218
+ if (!init) {
1219
+ init = 1;
1220
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1221
+ }
1222
+ return rubyExceptionClass;
1223
+ }
1224
+
1225
+ /* This code checks to see if the Ruby object being raised as part
1226
+ of an exception inherits from the Ruby class Exception. If so,
1227
+ the object is simply returned. If not, then a new Ruby exception
1228
+ object is created and that will be returned to Ruby.*/
1229
+ SWIGRUNTIME VALUE
1230
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1231
+ VALUE exceptionClass = getExceptionClass();
1232
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1233
+ return obj;
1234
+ } else {
1235
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1236
+ }
1237
+ }
1238
+
1239
+ /* Initialize Ruby runtime support */
1240
+ SWIGRUNTIME void
1241
+ SWIG_Ruby_InitRuntime(void)
1242
+ {
1243
+ if (_mSWIG == Qnil) {
1244
+ _mSWIG = rb_define_module("SWIG");
1245
+ }
1246
+ }
1247
+
1248
+ /* Define Ruby class for C type */
1249
+ SWIGRUNTIME void
1250
+ SWIG_Ruby_define_class(swig_type_info *type)
1251
+ {
1252
+ VALUE klass;
1253
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1254
+ sprintf(klass_name, "TYPE%s", type->name);
1255
+ if (NIL_P(_cSWIG_Pointer)) {
1256
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1257
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1258
+ }
1259
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1260
+ free((void *) klass_name);
1261
+ }
1262
+
1263
+ /* Create a new pointer object */
1264
+ SWIGRUNTIME VALUE
1265
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1266
+ {
1267
+ int own = flags & SWIG_POINTER_OWN;
1268
+
1269
+ char *klass_name;
1270
+ swig_class *sklass;
1271
+ VALUE klass;
1272
+ VALUE obj;
1273
+
1274
+ if (!ptr)
1275
+ return Qnil;
1276
+
1277
+ if (type->clientdata) {
1278
+ sklass = (swig_class *) type->clientdata;
1279
+
1280
+ /* Are we tracking this class and have we already returned this Ruby object? */
1281
+ if (sklass->trackObjects) {
1282
+ obj = SWIG_RubyInstanceFor(ptr);
1283
+
1284
+ /* Check the object's type and make sure it has the correct type.
1285
+ It might not in cases where methods do things like
1286
+ downcast methods. */
1287
+ if (obj != Qnil) {
1288
+ VALUE value = rb_iv_get(obj, "__swigtype__");
1289
+ char* type_name = RSTRING(value)->ptr;
1290
+
1291
+ if (strcmp(type->name, type_name) == 0) {
1292
+ return obj;
1293
+ }
1294
+ }
1295
+ }
1296
+
1297
+ /* Create a new Ruby object */
1298
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);
1299
+
1300
+ /* If tracking is on for this class then track this object. */
1301
+ if (sklass->trackObjects) {
1302
+ SWIG_RubyAddTracking(ptr, obj);
1303
+ }
1304
+ } else {
1305
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1306
+ sprintf(klass_name, "TYPE%s", type->name);
1307
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1308
+ free((void *) klass_name);
1309
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1310
+ }
1311
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
1312
+
1313
+ return obj;
1314
+ }
1315
+
1316
+ /* Create a new class instance (always owned) */
1317
+ SWIGRUNTIME VALUE
1318
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1319
+ {
1320
+ VALUE obj;
1321
+ swig_class *sklass = (swig_class *) type->clientdata;
1322
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1323
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
1324
+ return obj;
1325
+ }
1326
+
1327
+ /* Get type mangle from class name */
1328
+ SWIGRUNTIMEINLINE char *
1329
+ SWIG_Ruby_MangleStr(VALUE obj)
1330
+ {
1331
+ VALUE stype = rb_iv_get(obj, "__swigtype__");
1332
+ return StringValuePtr(stype);
1333
+ }
1334
+
1335
+ /* Acquire a pointer value */
1336
+ typedef void (*ruby_owntype)(void*);
1337
+
1338
+ SWIGRUNTIME ruby_owntype
1339
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1340
+ if (obj) {
1341
+ ruby_owntype oldown = RDATA(obj)->dfree;
1342
+ RDATA(obj)->dfree = own;
1343
+ return oldown;
1344
+ } else {
1345
+ return 0;
1346
+ }
1347
+ }
1348
+
1349
+ /* Convert a pointer value */
1350
+ SWIGRUNTIME int
1351
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1352
+ {
1353
+ char *c;
1354
+ swig_cast_info *tc;
1355
+ void *vptr = 0;
1356
+
1357
+ /* Grab the pointer */
1358
+ if (NIL_P(obj)) {
1359
+ *ptr = 0;
1360
+ return SWIG_OK;
1361
+ } else {
1362
+ if (TYPE(obj) != T_DATA) {
1363
+ return SWIG_ERROR;
1364
+ }
1365
+ Data_Get_Struct(obj, void, vptr);
1366
+ }
1367
+
1368
+ if (own) *own = RDATA(obj)->dfree;
1369
+
1370
+ /* Check to see if the input object is giving up ownership
1371
+ of the underlying C struct or C++ object. If so then we
1372
+ need to reset the destructor since the Ruby object no
1373
+ longer owns the underlying C++ object.*/
1374
+ if (flags & SWIG_POINTER_DISOWN) {
1375
+ /* Is tracking on for this class? */
1376
+ int track = 0;
1377
+ if (ty && ty->clientdata) {
1378
+ swig_class *sklass = (swig_class *) ty->clientdata;
1379
+ track = sklass->trackObjects;
1380
+ }
1381
+
1382
+ if (track) {
1383
+ /* We are tracking objects for this class. Thus we change the destructor
1384
+ * to SWIG_RubyRemoveTracking. This allows us to
1385
+ * remove the mapping from the C++ to Ruby object
1386
+ * when the Ruby object is garbage collected. If we don't
1387
+ * do this, then it is possible we will return a reference
1388
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1389
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1390
+ } else {
1391
+ RDATA(obj)->dfree = 0;
1392
+ }
1393
+ }
1394
+
1395
+ /* Do type-checking if type info was provided */
1396
+ if (ty) {
1397
+ if (ty->clientdata) {
1398
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1399
+ if (vptr == 0) {
1400
+ /* The object has already been deleted */
1401
+ return SWIG_ObjectPreviouslyDeletedError;
1402
+ }
1403
+ *ptr = vptr;
1404
+ return SWIG_OK;
1405
+ }
1406
+ }
1407
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1408
+ return SWIG_ERROR;
1409
+ }
1410
+ tc = SWIG_TypeCheck(c, ty);
1411
+ if (!tc) {
1412
+ return SWIG_ERROR;
1413
+ }
1414
+ *ptr = SWIG_TypeCast(tc, vptr);
1415
+ } else {
1416
+ *ptr = vptr;
1417
+ }
1418
+
1419
+ return SWIG_OK;
1420
+ }
1421
+
1422
+ /* Check convert */
1423
+ SWIGRUNTIMEINLINE int
1424
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1425
+ {
1426
+ char *c = SWIG_MangleStr(obj);
1427
+ if (!c) return 0;
1428
+ return SWIG_TypeCheck(c,ty) != 0;
1429
+ }
1430
+
1431
+ SWIGRUNTIME VALUE
1432
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1433
+ char result[1024];
1434
+ char *r = result;
1435
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1436
+ *(r++) = '_';
1437
+ r = SWIG_PackData(r, ptr, sz);
1438
+ strcpy(r, type->name);
1439
+ return rb_str_new2(result);
1440
+ }
1441
+
1442
+ /* Convert a packed value value */
1443
+ SWIGRUNTIME int
1444
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1445
+ swig_cast_info *tc;
1446
+ const char *c;
1447
+
1448
+ if (TYPE(obj) != T_STRING) goto type_error;
1449
+ c = StringValuePtr(obj);
1450
+ /* Pointer values must start with leading underscore */
1451
+ if (*c != '_') goto type_error;
1452
+ c++;
1453
+ c = SWIG_UnpackData(c, ptr, sz);
1454
+ if (ty) {
1455
+ tc = SWIG_TypeCheck(c, ty);
1456
+ if (!tc) goto type_error;
1457
+ }
1458
+ return SWIG_OK;
1459
+
1460
+ type_error:
1461
+ return SWIG_ERROR;
1462
+ }
1463
+
1464
+ SWIGRUNTIME swig_module_info *
1465
+ SWIG_Ruby_GetModule(void)
1466
+ {
1467
+ VALUE pointer;
1468
+ swig_module_info *ret = 0;
1469
+ VALUE verbose = rb_gv_get("VERBOSE");
1470
+
1471
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1472
+ rb_gv_set("VERBOSE", Qfalse);
1473
+
1474
+ /* first check if pointer already created */
1475
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1476
+ if (pointer != Qnil) {
1477
+ Data_Get_Struct(pointer, swig_module_info, ret);
1478
+ }
1479
+
1480
+ /* reinstate warnings */
1481
+ rb_gv_set("VERBOSE", verbose);
1482
+ return ret;
1483
+ }
1484
+
1485
+ SWIGRUNTIME void
1486
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1487
+ {
1488
+ /* register a new class */
1489
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1490
+ /* create and store the structure pointer to a global variable */
1491
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1492
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1493
+ }
1494
+
1495
+ #ifdef __cplusplus
1496
+ #if 0
1497
+ { /* cc-mode */
1498
+ #endif
1499
+ }
1500
+ #endif
1501
+
1502
+
1503
+
1504
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1505
+
1506
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1507
+
1508
+
1509
+
1510
+ /* -------- TYPES TABLE (BEGIN) -------- */
1511
+
1512
+ #define SWIGTYPE_p_bro_buf swig_types[0]
1513
+ #define SWIGTYPE_p_bro_conn swig_types[1]
1514
+ #define SWIGTYPE_p_bro_event swig_types[2]
1515
+ #define SWIGTYPE_p_bro_port swig_types[3]
1516
+ #define SWIGTYPE_p_bro_record swig_types[4]
1517
+ #define SWIGTYPE_p_bro_string swig_types[5]
1518
+ #define SWIGTYPE_p_bro_subnet swig_types[6]
1519
+ #define SWIGTYPE_p_char swig_types[7]
1520
+ #define SWIGTYPE_p_double swig_types[8]
1521
+ #define SWIGTYPE_p_f_p_struct_bro_conn_v_______void swig_types[9]
1522
+ #define SWIGTYPE_p_int swig_types[10]
1523
+ #define SWIGTYPE_p_unsigned_char swig_types[11]
1524
+ #define SWIGTYPE_p_unsigned_int swig_types[12]
1525
+ #define SWIGTYPE_p_unsigned_short swig_types[13]
1526
+ static swig_type_info *swig_types[15];
1527
+ static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
1528
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1529
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1530
+
1531
+ /* -------- TYPES TABLE (END) -------- */
1532
+
1533
+ #define SWIG_init Init_broccoli_ext
1534
+ #define SWIG_name "Broccoli_ext"
1535
+
1536
+ static VALUE mBroccoli_ext;
1537
+
1538
+ #define SWIGVERSION 0x010329
1539
+
1540
+
1541
+ #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1542
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1543
+
1544
+
1545
+ #ifdef __cplusplus
1546
+ extern "C" {
1547
+ #endif
1548
+ #include "rubyio.h"
1549
+ #ifdef __cplusplus
1550
+ }
1551
+ #endif
1552
+
1553
+
1554
+ #ifdef __cplusplus
1555
+ extern "C" {
1556
+ #endif
1557
+ #ifdef HAVE_SYS_TIME_H
1558
+ # include <sys/time.h>
1559
+ struct timeval rb_time_timeval(VALUE);
1560
+ #endif
1561
+ #ifdef __cplusplus
1562
+ }
1563
+ #endif
1564
+
1565
+
1566
+ /* Includes the header in the wrapper code */
1567
+ #include "broccoli.h"
1568
+ #include "stdarg.h"
1569
+
1570
+
1571
+
1572
+ /* Convert Ruby String to BroString */
1573
+ BroString to_brostring(VALUE obj){
1574
+ if(!NIL_P(obj)){
1575
+ Check_Type(obj, T_STRING);
1576
+ BroString bs;
1577
+ bro_string_set(&bs, STR2CSTR(obj));
1578
+ return bs;
1579
+ }
1580
+ }
1581
+
1582
+ //VALUE
1583
+ //from_brostring(BroString *bs) {
1584
+ // printf("Converting a brostring to char*\n");
1585
+ // return rb_str_new( (uchar *) (bs->str_val), bs->str_len );
1586
+ //}
1587
+
1588
+
1589
+
1590
+ void
1591
+ wrap_BroEventFunc(BroConn *bc, void *data, ...)
1592
+ {
1593
+ va_list argp;
1594
+ int i = 0;
1595
+ int callback_arity = 0;
1596
+ int typemap_arity = 0;
1597
+ VALUE proc;
1598
+ VALUE event_name;
1599
+ VALUE typemap;
1600
+ VALUE input = (VALUE)data;
1601
+ VALUE class_name;
1602
+ VALUE out[15] = {Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,
1603
+ Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil};
1604
+
1605
+ if (strcmp("Array",
1606
+ STR2CSTR(rb_funcall(rb_funcall(input, rb_intern("class"), 0), rb_intern("to_s"), 0))) != 0)
1607
+ {
1608
+ printf("There is a problem!\n");
1609
+ return;
1610
+ }
1611
+
1612
+ event_name = rb_funcall(input, rb_intern("at"), 1, INT2NUM(0));
1613
+ typemap = rb_funcall(input, rb_intern("at"), 1, INT2NUM(1));
1614
+ proc = rb_funcall(input, rb_intern("at"), 1, INT2NUM(2));
1615
+
1616
+ callback_arity = NUM2INT(rb_funcall(proc, rb_intern("arity"), 0));
1617
+ typemap_arity = NUM2INT(rb_funcall(typemap, rb_intern("size"), 0));
1618
+ if( callback_arity != typemap_arity ) {
1619
+ printf("There is a problem with the argument definition for either the typemap "
1620
+ "or the callback for the %s event handler\n", STR2CSTR(event_name));
1621
+ }
1622
+ va_start(argp, data);
1623
+ for(i=0 ; i < callback_arity ; i++) {
1624
+ //printf("Loop #%i\n", i);
1625
+ switch (NUM2INT(rb_funcall(typemap, rb_intern("at"), 1, INT2NUM(i))))
1626
+ {
1627
+ case BRO_TYPE_RECORD:
1628
+ //printf("Found a BroRecord in the callback wrapper\n");
1629
+ out[i] = SWIG_NewPointerObj(SWIG_as_voidptr( va_arg(argp, BroRecord *) ), SWIGTYPE_p_bro_record, 0 | 0 );
1630
+ rb_funcall(out[i], rb_intern("from_callback="), 1, event_name);
1631
+ rb_funcall(out[i], rb_intern("arg_num="), 1, INT2NUM(i));
1632
+ break;
1633
+ case BRO_TYPE_PORT:
1634
+ out[i] = SWIG_NewPointerObj(SWIG_as_voidptr( va_arg(argp, BroPort *) ), SWIGTYPE_p_bro_port, 0 | 0 );
1635
+ break;
1636
+ case BRO_TYPE_INT:
1637
+ case BRO_TYPE_ENUM:
1638
+ //printf("Found an integer in the callback wrapper\n");
1639
+ out[i] = INT2NUM( *((int *)(va_arg(argp, int*))) );
1640
+ break;
1641
+ case BRO_TYPE_BOOL:
1642
+ //printf("Found a boolean in the callback wrapper\n");
1643
+ out[i] = *((int *)(va_arg(argp, int*))) ? Qtrue : Qfalse;
1644
+ break;
1645
+ case BRO_TYPE_STRING:
1646
+ 1; //for some reason the compiler doesn't like variable defs in the first line
1647
+ //printf("Found a BroString in the callback wrapper\n");
1648
+ BroString *foo_string = va_arg(argp, BroString *);
1649
+ out[i] = rb_str_new( (char*) bro_string_get_data(foo_string), bro_string_get_length(foo_string) );
1650
+ //out[i] = rb_str_new2(foo_string->str_val);
1651
+ break;
1652
+ case BRO_TYPE_TIME:
1653
+ case BRO_TYPE_DOUBLE:
1654
+ case BRO_TYPE_INTERVAL:
1655
+ //printf("Found a double in the callback wrapper\n");
1656
+ out[i] = rb_float_new( *((double *)(va_arg(argp, double *))) );
1657
+ break;
1658
+ case BRO_TYPE_COUNT:
1659
+ case BRO_TYPE_NET:
1660
+ //printf("Found a 32bit unsigned integer in the callback wrapper\n");
1661
+ //uint32 *int_tt_foo = va_arg(argp, uint32 *);
1662
+ //out[i] = UINT2NUM( *int_tt_foo );
1663
+ out[i] = UINT2NUM( *((uint32 *)(va_arg(argp, uint32 *))) );
1664
+ break;
1665
+ case BRO_TYPE_IPADDR:
1666
+ //printf("I found an ip addres... making it a string\n");
1667
+ //output ip addresses as strings that can be unpacked from ruby.
1668
+ out[i] = rb_str_new2( (char *) (va_arg(argp, char *)) );
1669
+ break;
1670
+ default:
1671
+ printf("Invalid type was registered for callback!\n");
1672
+ va_arg(argp, void*); // do this to throw out an item and keep 'i' correct
1673
+ break;
1674
+ }
1675
+ }
1676
+ va_end(argp);
1677
+
1678
+ // Call the ruby proc object finally!
1679
+ rb_funcall2(proc, rb_intern("call"), callback_arity, out);
1680
+
1681
+ bc = NULL;
1682
+ data = NULL;
1683
+ }
1684
+
1685
+
1686
+
1687
+ #include <limits.h>
1688
+ #ifndef LLONG_MIN
1689
+ # define LLONG_MIN LONG_LONG_MIN
1690
+ #endif
1691
+ #ifndef LLONG_MAX
1692
+ # define LLONG_MAX LONG_LONG_MAX
1693
+ #endif
1694
+ #ifndef ULLONG_MAX
1695
+ # define ULLONG_MAX ULONG_LONG_MAX
1696
+ #endif
1697
+
1698
+
1699
+ #define SWIG_From_long LONG2NUM
1700
+
1701
+
1702
+ SWIGINTERNINLINE VALUE
1703
+ SWIG_From_int (int value)
1704
+ {
1705
+ return SWIG_From_long (value);
1706
+ }
1707
+
1708
+
1709
+ SWIGINTERN VALUE
1710
+ SWIG_ruby_failed(void)
1711
+ {
1712
+ return Qnil;
1713
+ }
1714
+
1715
+
1716
+ /*@SWIG:%ruby_aux_method@*/
1717
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1718
+ {
1719
+ VALUE obj = args[0];
1720
+ VALUE type = TYPE(obj);
1721
+ unsigned long *res = (unsigned long *)(args[1]);
1722
+ *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
1723
+ return obj;
1724
+ }
1725
+ /*@SWIG@*/
1726
+
1727
+ SWIGINTERN int
1728
+ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
1729
+ {
1730
+ VALUE type = TYPE(obj);
1731
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1732
+ unsigned long v;
1733
+ VALUE a[2];
1734
+ a[0] = obj;
1735
+ a[1] = (VALUE)(&v);
1736
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1737
+ if (val) *val = v;
1738
+ return SWIG_OK;
1739
+ }
1740
+ }
1741
+ return SWIG_TypeError;
1742
+ }
1743
+
1744
+
1745
+ SWIGINTERN int
1746
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
1747
+ {
1748
+ unsigned long v;
1749
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1750
+ if (SWIG_IsOK(res)) {
1751
+ if ((v > UINT_MAX)) {
1752
+ return SWIG_OverflowError;
1753
+ } else {
1754
+ if (val) *val = (unsigned int)(v);
1755
+ }
1756
+ }
1757
+ return res;
1758
+ }
1759
+
1760
+
1761
+ SWIGINTERNINLINE VALUE
1762
+ SWIG_From_unsigned_SS_long (unsigned long value)
1763
+ {
1764
+ return ULONG2NUM(value);
1765
+ }
1766
+
1767
+
1768
+ SWIGINTERNINLINE VALUE
1769
+ SWIG_From_unsigned_SS_int (unsigned int value)
1770
+ {
1771
+ return SWIG_From_unsigned_SS_long (value);
1772
+ }
1773
+
1774
+
1775
+ SWIGINTERN int
1776
+ SWIG_AsVal_unsigned_SS_short (VALUE obj, unsigned short *val)
1777
+ {
1778
+ unsigned long v;
1779
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1780
+ if (SWIG_IsOK(res)) {
1781
+ if ((v > USHRT_MAX)) {
1782
+ return SWIG_OverflowError;
1783
+ } else {
1784
+ if (val) *val = (unsigned short)(v);
1785
+ }
1786
+ }
1787
+ return res;
1788
+ }
1789
+
1790
+
1791
+ SWIGINTERNINLINE VALUE
1792
+ SWIG_From_unsigned_SS_short (unsigned short value)
1793
+ {
1794
+ return SWIG_From_unsigned_SS_long (value);
1795
+ }
1796
+
1797
+
1798
+ /*@SWIG:%ruby_aux_method@*/
1799
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1800
+ {
1801
+ VALUE obj = args[0];
1802
+ VALUE type = TYPE(obj);
1803
+ long *res = (long *)(args[1]);
1804
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1805
+ return obj;
1806
+ }
1807
+ /*@SWIG@*/
1808
+
1809
+ SWIGINTERN int
1810
+ SWIG_AsVal_long (VALUE obj, long* val)
1811
+ {
1812
+ VALUE type = TYPE(obj);
1813
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1814
+ long v;
1815
+ VALUE a[2];
1816
+ a[0] = obj;
1817
+ a[1] = (VALUE)(&v);
1818
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1819
+ if (val) *val = v;
1820
+ return SWIG_OK;
1821
+ }
1822
+ }
1823
+ return SWIG_TypeError;
1824
+ }
1825
+
1826
+
1827
+ SWIGINTERN int
1828
+ SWIG_AsVal_int (VALUE obj, int *val)
1829
+ {
1830
+ long v;
1831
+ int res = SWIG_AsVal_long (obj, &v);
1832
+ if (SWIG_IsOK(res)) {
1833
+ if ((v < INT_MIN || v > INT_MAX)) {
1834
+ return SWIG_OverflowError;
1835
+ } else {
1836
+ if (val) *val = (int)(v);
1837
+ }
1838
+ }
1839
+ return res;
1840
+ }
1841
+
1842
+
1843
+ SWIGINTERN swig_type_info*
1844
+ SWIG_pchar_descriptor()
1845
+ {
1846
+ static int init = 0;
1847
+ static swig_type_info* info = 0;
1848
+ if (!init) {
1849
+ info = SWIG_TypeQuery("_p_char");
1850
+ init = 1;
1851
+ }
1852
+ return info;
1853
+ }
1854
+
1855
+
1856
+ SWIGINTERN int
1857
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1858
+ {
1859
+ if (TYPE(obj) == T_STRING) {
1860
+
1861
+
1862
+
1863
+ char *cstr = STR2CSTR(obj);
1864
+
1865
+ size_t size = RSTRING(obj)->len + 1;
1866
+ if (cptr) {
1867
+ if (alloc) {
1868
+ if (*alloc == SWIG_NEWOBJ) {
1869
+ *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1870
+ } else {
1871
+ *cptr = cstr;
1872
+ *alloc = SWIG_OLDOBJ;
1873
+ }
1874
+ }
1875
+ }
1876
+ if (psize) *psize = size;
1877
+ return SWIG_OK;
1878
+ } else {
1879
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1880
+ if (pchar_descriptor) {
1881
+ void* vptr = 0;
1882
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1883
+ if (cptr) *cptr = (char *)vptr;
1884
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1885
+ if (alloc) *alloc = SWIG_OLDOBJ;
1886
+ return SWIG_OK;
1887
+ }
1888
+ }
1889
+ }
1890
+ return SWIG_TypeError;
1891
+ }
1892
+
1893
+
1894
+
1895
+
1896
+
1897
+ #define SWIG_From_double rb_float_new
1898
+
1899
+
1900
+ SWIGINTERNINLINE VALUE
1901
+ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1902
+ {
1903
+ if (carray) {
1904
+ if (size > LONG_MAX) {
1905
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1906
+ return pchar_descriptor ?
1907
+ SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : Qnil;
1908
+ } else {
1909
+ return rb_str_new(carray, (long)(size));
1910
+ }
1911
+ } else {
1912
+ return Qnil;
1913
+ }
1914
+ }
1915
+
1916
+
1917
+ SWIGINTERNINLINE VALUE
1918
+ SWIG_FromCharPtr(const char *cptr)
1919
+ {
1920
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1921
+ }
1922
+
1923
+ SWIGINTERN VALUE
1924
+ _wrap_to_brostring(int argc, VALUE *argv, VALUE self) {
1925
+ VALUE arg1 = (VALUE) 0 ;
1926
+ BroString result;
1927
+ VALUE vresult = Qnil;
1928
+
1929
+ if ((argc < 1) || (argc > 1)) {
1930
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1931
+ }
1932
+ arg1 = argv[0];
1933
+ result = to_brostring(arg1);
1934
+ vresult = SWIG_NewPointerObj((BroString *)memcpy((BroString *)malloc(sizeof(BroString)),&result,sizeof(BroString)), SWIGTYPE_p_bro_string, SWIG_POINTER_OWN | 0 );
1935
+ return vresult;
1936
+ fail:
1937
+ return Qnil;
1938
+ }
1939
+
1940
+
1941
+ SWIGINTERN VALUE
1942
+ bro_debug_calltrace_get(VALUE self) {
1943
+ VALUE _val;
1944
+
1945
+ _val = SWIG_From_int((int)(bro_debug_calltrace));
1946
+ return _val;
1947
+ }
1948
+
1949
+
1950
+ SWIGINTERN VALUE
1951
+ bro_debug_calltrace_set(VALUE self, VALUE _val) {
1952
+ bro_debug_calltrace = _val ? 1:0;
1953
+ return _val;
1954
+ fail:
1955
+ return Qnil;
1956
+ }
1957
+
1958
+
1959
+ SWIGINTERN VALUE
1960
+ bro_debug_messages_get(VALUE self) {
1961
+ VALUE _val;
1962
+
1963
+ _val = SWIG_From_int((int)(bro_debug_messages));
1964
+ return _val;
1965
+ }
1966
+
1967
+
1968
+ SWIGINTERN VALUE
1969
+ bro_debug_messages_set(VALUE self, VALUE _val) {
1970
+ bro_debug_messages = _val ? 1:0;
1971
+ return _val;
1972
+ fail:
1973
+ return Qnil;
1974
+ }
1975
+
1976
+
1977
+ swig_class cBroString;
1978
+
1979
+ SWIGINTERN VALUE
1980
+ _wrap_BroString_str_len_set(int argc, VALUE *argv, VALUE self) {
1981
+ BroString *arg1 = (BroString *) 0 ;
1982
+ uint32 arg2 ;
1983
+ void *argp1 = 0 ;
1984
+ int res1 = 0 ;
1985
+ unsigned int val2 ;
1986
+ int ecode2 = 0 ;
1987
+
1988
+ if ((argc < 1) || (argc > 1)) {
1989
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1990
+ }
1991
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
1992
+ if (!SWIG_IsOK(res1)) {
1993
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "str_len" "', argument " "1"" of type '" "BroString *""'");
1994
+ }
1995
+ arg1 = (BroString *)(argp1);
1996
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
1997
+ if (!SWIG_IsOK(ecode2)) {
1998
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "str_len" "', argument " "2"" of type '" "uint32""'");
1999
+ }
2000
+ arg2 = (uint32)(val2);
2001
+ if (arg1) (arg1)->str_len = arg2;
2002
+
2003
+ return Qnil;
2004
+ fail:
2005
+ return Qnil;
2006
+ }
2007
+
2008
+
2009
+ SWIGINTERN VALUE
2010
+ _wrap_BroString_str_len_get(int argc, VALUE *argv, VALUE self) {
2011
+ BroString *arg1 = (BroString *) 0 ;
2012
+ uint32 result;
2013
+ void *argp1 = 0 ;
2014
+ int res1 = 0 ;
2015
+ VALUE vresult = Qnil;
2016
+
2017
+ if ((argc < 0) || (argc > 0)) {
2018
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2019
+ }
2020
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2021
+ if (!SWIG_IsOK(res1)) {
2022
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "str_len" "', argument " "1"" of type '" "BroString *""'");
2023
+ }
2024
+ arg1 = (BroString *)(argp1);
2025
+ result = (uint32) ((arg1)->str_len);
2026
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2027
+ return vresult;
2028
+ fail:
2029
+ return Qnil;
2030
+ }
2031
+
2032
+
2033
+ SWIGINTERN VALUE
2034
+ _wrap_BroString_str_val_set(int argc, VALUE *argv, VALUE self) {
2035
+ BroString *arg1 = (BroString *) 0 ;
2036
+ uchar *arg2 = (uchar *) 0 ;
2037
+ void *argp1 = 0 ;
2038
+ int res1 = 0 ;
2039
+
2040
+ if ((argc < 1) || (argc > 1)) {
2041
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2042
+ }
2043
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2044
+ if (!SWIG_IsOK(res1)) {
2045
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "str_val" "', argument " "1"" of type '" "BroString *""'");
2046
+ }
2047
+ arg1 = (BroString *)(argp1);
2048
+ arg2 = (uchar*)STR2CSTR(argv[0]);
2049
+ if (arg1) (arg1)->str_val = arg2;
2050
+
2051
+ return Qnil;
2052
+ fail:
2053
+ return Qnil;
2054
+ }
2055
+
2056
+
2057
+ SWIGINTERN VALUE
2058
+ _wrap_BroString_str_val_get(int argc, VALUE *argv, VALUE self) {
2059
+ BroString *arg1 = (BroString *) 0 ;
2060
+ uchar *result = 0 ;
2061
+ void *argp1 = 0 ;
2062
+ int res1 = 0 ;
2063
+ VALUE vresult = Qnil;
2064
+
2065
+ if ((argc < 0) || (argc > 0)) {
2066
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2067
+ }
2068
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2069
+ if (!SWIG_IsOK(res1)) {
2070
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "str_val" "', argument " "1"" of type '" "BroString *""'");
2071
+ }
2072
+ arg1 = (BroString *)(argp1);
2073
+ result = (uchar *) ((arg1)->str_val);
2074
+ vresult = rb_str_new2((char*)result);
2075
+ return vresult;
2076
+ fail:
2077
+ return Qnil;
2078
+ }
2079
+
2080
+
2081
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2082
+ SWIGINTERN VALUE
2083
+ _wrap_BroString_allocate(VALUE self) {
2084
+ #else
2085
+ SWIGINTERN VALUE
2086
+ _wrap_BroString_allocate(int argc, VALUE *argv, VALUE self) {
2087
+ #endif
2088
+
2089
+
2090
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_bro_string);
2091
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2092
+ rb_obj_call_init(vresult, argc, argv);
2093
+ #endif
2094
+ return vresult;
2095
+ }
2096
+
2097
+
2098
+ SWIGINTERN VALUE
2099
+ _wrap_new_BroString(int argc, VALUE *argv, VALUE self) {
2100
+ BroString *result = 0 ;
2101
+
2102
+ if ((argc < 0) || (argc > 0)) {
2103
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2104
+ }
2105
+ result = (BroString *)(BroString *) calloc(1, sizeof(BroString));DATA_PTR(self) = result;
2106
+
2107
+ return self;
2108
+ fail:
2109
+ return Qnil;
2110
+ }
2111
+
2112
+
2113
+ SWIGINTERN void
2114
+ free_BroString(BroString *arg1) {
2115
+ free((char *) arg1);
2116
+ }
2117
+
2118
+ swig_class cBroPort;
2119
+
2120
+ SWIGINTERN VALUE
2121
+ _wrap_BroPort_port_num_set(int argc, VALUE *argv, VALUE self) {
2122
+ BroPort *arg1 = (BroPort *) 0 ;
2123
+ uint16 arg2 ;
2124
+ void *argp1 = 0 ;
2125
+ int res1 = 0 ;
2126
+ unsigned short val2 ;
2127
+ int ecode2 = 0 ;
2128
+
2129
+ if ((argc < 1) || (argc > 1)) {
2130
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2131
+ }
2132
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_port, 0 | 0 );
2133
+ if (!SWIG_IsOK(res1)) {
2134
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "port_num" "', argument " "1"" of type '" "BroPort *""'");
2135
+ }
2136
+ arg1 = (BroPort *)(argp1);
2137
+ ecode2 = SWIG_AsVal_unsigned_SS_short(argv[0], &val2);
2138
+ if (!SWIG_IsOK(ecode2)) {
2139
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "port_num" "', argument " "2"" of type '" "uint16""'");
2140
+ }
2141
+ arg2 = (uint16)(val2);
2142
+ if (arg1) (arg1)->port_num = arg2;
2143
+
2144
+ return Qnil;
2145
+ fail:
2146
+ return Qnil;
2147
+ }
2148
+
2149
+
2150
+ SWIGINTERN VALUE
2151
+ _wrap_BroPort_port_num_get(int argc, VALUE *argv, VALUE self) {
2152
+ BroPort *arg1 = (BroPort *) 0 ;
2153
+ uint16 result;
2154
+ void *argp1 = 0 ;
2155
+ int res1 = 0 ;
2156
+ VALUE vresult = Qnil;
2157
+
2158
+ if ((argc < 0) || (argc > 0)) {
2159
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2160
+ }
2161
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_port, 0 | 0 );
2162
+ if (!SWIG_IsOK(res1)) {
2163
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "port_num" "', argument " "1"" of type '" "BroPort *""'");
2164
+ }
2165
+ arg1 = (BroPort *)(argp1);
2166
+ result = (uint16) ((arg1)->port_num);
2167
+ vresult = SWIG_From_unsigned_SS_short((unsigned short)(result));
2168
+ return vresult;
2169
+ fail:
2170
+ return Qnil;
2171
+ }
2172
+
2173
+
2174
+ SWIGINTERN VALUE
2175
+ _wrap_BroPort_port_proto_set(int argc, VALUE *argv, VALUE self) {
2176
+ BroPort *arg1 = (BroPort *) 0 ;
2177
+ int arg2 ;
2178
+ void *argp1 = 0 ;
2179
+ int res1 = 0 ;
2180
+ int val2 ;
2181
+ int ecode2 = 0 ;
2182
+
2183
+ if ((argc < 1) || (argc > 1)) {
2184
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2185
+ }
2186
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_port, 0 | 0 );
2187
+ if (!SWIG_IsOK(res1)) {
2188
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "port_proto" "', argument " "1"" of type '" "BroPort *""'");
2189
+ }
2190
+ arg1 = (BroPort *)(argp1);
2191
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2192
+ if (!SWIG_IsOK(ecode2)) {
2193
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "port_proto" "', argument " "2"" of type '" "int""'");
2194
+ }
2195
+ arg2 = (int)(val2);
2196
+ if (arg1) (arg1)->port_proto = arg2;
2197
+
2198
+ return Qnil;
2199
+ fail:
2200
+ return Qnil;
2201
+ }
2202
+
2203
+
2204
+ SWIGINTERN VALUE
2205
+ _wrap_BroPort_port_proto_get(int argc, VALUE *argv, VALUE self) {
2206
+ BroPort *arg1 = (BroPort *) 0 ;
2207
+ int result;
2208
+ void *argp1 = 0 ;
2209
+ int res1 = 0 ;
2210
+ VALUE vresult = Qnil;
2211
+
2212
+ if ((argc < 0) || (argc > 0)) {
2213
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2214
+ }
2215
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_port, 0 | 0 );
2216
+ if (!SWIG_IsOK(res1)) {
2217
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "port_proto" "', argument " "1"" of type '" "BroPort *""'");
2218
+ }
2219
+ arg1 = (BroPort *)(argp1);
2220
+ result = (int) ((arg1)->port_proto);
2221
+ vresult = SWIG_From_int((int)(result));
2222
+ return vresult;
2223
+ fail:
2224
+ return Qnil;
2225
+ }
2226
+
2227
+
2228
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2229
+ SWIGINTERN VALUE
2230
+ _wrap_BroPort_allocate(VALUE self) {
2231
+ #else
2232
+ SWIGINTERN VALUE
2233
+ _wrap_BroPort_allocate(int argc, VALUE *argv, VALUE self) {
2234
+ #endif
2235
+
2236
+
2237
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_bro_port);
2238
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2239
+ rb_obj_call_init(vresult, argc, argv);
2240
+ #endif
2241
+ return vresult;
2242
+ }
2243
+
2244
+
2245
+ SWIGINTERN VALUE
2246
+ _wrap_new_BroPort(int argc, VALUE *argv, VALUE self) {
2247
+ BroPort *result = 0 ;
2248
+
2249
+ if ((argc < 0) || (argc > 0)) {
2250
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2251
+ }
2252
+ result = (BroPort *)(BroPort *) calloc(1, sizeof(BroPort));DATA_PTR(self) = result;
2253
+
2254
+ return self;
2255
+ fail:
2256
+ return Qnil;
2257
+ }
2258
+
2259
+
2260
+ SWIGINTERN void
2261
+ free_BroPort(BroPort *arg1) {
2262
+ free((char *) arg1);
2263
+ }
2264
+
2265
+ swig_class cBroSubnet;
2266
+
2267
+ SWIGINTERN VALUE
2268
+ _wrap_BroSubnet_sn_net_set(int argc, VALUE *argv, VALUE self) {
2269
+ BroSubnet *arg1 = (BroSubnet *) 0 ;
2270
+ uint32 arg2 ;
2271
+ void *argp1 = 0 ;
2272
+ int res1 = 0 ;
2273
+ unsigned int val2 ;
2274
+ int ecode2 = 0 ;
2275
+
2276
+ if ((argc < 1) || (argc > 1)) {
2277
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2278
+ }
2279
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_subnet, 0 | 0 );
2280
+ if (!SWIG_IsOK(res1)) {
2281
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sn_net" "', argument " "1"" of type '" "BroSubnet *""'");
2282
+ }
2283
+ arg1 = (BroSubnet *)(argp1);
2284
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2285
+ if (!SWIG_IsOK(ecode2)) {
2286
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sn_net" "', argument " "2"" of type '" "uint32""'");
2287
+ }
2288
+ arg2 = (uint32)(val2);
2289
+ if (arg1) (arg1)->sn_net = arg2;
2290
+
2291
+ return Qnil;
2292
+ fail:
2293
+ return Qnil;
2294
+ }
2295
+
2296
+
2297
+ SWIGINTERN VALUE
2298
+ _wrap_BroSubnet_sn_net_get(int argc, VALUE *argv, VALUE self) {
2299
+ BroSubnet *arg1 = (BroSubnet *) 0 ;
2300
+ uint32 result;
2301
+ void *argp1 = 0 ;
2302
+ int res1 = 0 ;
2303
+ VALUE vresult = Qnil;
2304
+
2305
+ if ((argc < 0) || (argc > 0)) {
2306
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2307
+ }
2308
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_subnet, 0 | 0 );
2309
+ if (!SWIG_IsOK(res1)) {
2310
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sn_net" "', argument " "1"" of type '" "BroSubnet *""'");
2311
+ }
2312
+ arg1 = (BroSubnet *)(argp1);
2313
+ result = (uint32) ((arg1)->sn_net);
2314
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2315
+ return vresult;
2316
+ fail:
2317
+ return Qnil;
2318
+ }
2319
+
2320
+
2321
+ SWIGINTERN VALUE
2322
+ _wrap_BroSubnet_sn_width_set(int argc, VALUE *argv, VALUE self) {
2323
+ BroSubnet *arg1 = (BroSubnet *) 0 ;
2324
+ uint32 arg2 ;
2325
+ void *argp1 = 0 ;
2326
+ int res1 = 0 ;
2327
+ unsigned int val2 ;
2328
+ int ecode2 = 0 ;
2329
+
2330
+ if ((argc < 1) || (argc > 1)) {
2331
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2332
+ }
2333
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_subnet, 0 | 0 );
2334
+ if (!SWIG_IsOK(res1)) {
2335
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sn_width" "', argument " "1"" of type '" "BroSubnet *""'");
2336
+ }
2337
+ arg1 = (BroSubnet *)(argp1);
2338
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2339
+ if (!SWIG_IsOK(ecode2)) {
2340
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sn_width" "', argument " "2"" of type '" "uint32""'");
2341
+ }
2342
+ arg2 = (uint32)(val2);
2343
+ if (arg1) (arg1)->sn_width = arg2;
2344
+
2345
+ return Qnil;
2346
+ fail:
2347
+ return Qnil;
2348
+ }
2349
+
2350
+
2351
+ SWIGINTERN VALUE
2352
+ _wrap_BroSubnet_sn_width_get(int argc, VALUE *argv, VALUE self) {
2353
+ BroSubnet *arg1 = (BroSubnet *) 0 ;
2354
+ uint32 result;
2355
+ void *argp1 = 0 ;
2356
+ int res1 = 0 ;
2357
+ VALUE vresult = Qnil;
2358
+
2359
+ if ((argc < 0) || (argc > 0)) {
2360
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2361
+ }
2362
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bro_subnet, 0 | 0 );
2363
+ if (!SWIG_IsOK(res1)) {
2364
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sn_width" "', argument " "1"" of type '" "BroSubnet *""'");
2365
+ }
2366
+ arg1 = (BroSubnet *)(argp1);
2367
+ result = (uint32) ((arg1)->sn_width);
2368
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2369
+ return vresult;
2370
+ fail:
2371
+ return Qnil;
2372
+ }
2373
+
2374
+
2375
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2376
+ SWIGINTERN VALUE
2377
+ _wrap_BroSubnet_allocate(VALUE self) {
2378
+ #else
2379
+ SWIGINTERN VALUE
2380
+ _wrap_BroSubnet_allocate(int argc, VALUE *argv, VALUE self) {
2381
+ #endif
2382
+
2383
+
2384
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_bro_subnet);
2385
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2386
+ rb_obj_call_init(vresult, argc, argv);
2387
+ #endif
2388
+ return vresult;
2389
+ }
2390
+
2391
+
2392
+ SWIGINTERN VALUE
2393
+ _wrap_new_BroSubnet(int argc, VALUE *argv, VALUE self) {
2394
+ BroSubnet *result = 0 ;
2395
+
2396
+ if ((argc < 0) || (argc > 0)) {
2397
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2398
+ }
2399
+ result = (BroSubnet *)(BroSubnet *) calloc(1, sizeof(BroSubnet));DATA_PTR(self) = result;
2400
+
2401
+ return self;
2402
+ fail:
2403
+ return Qnil;
2404
+ }
2405
+
2406
+
2407
+ SWIGINTERN void
2408
+ free_BroSubnet(BroSubnet *arg1) {
2409
+ free((char *) arg1);
2410
+ }
2411
+
2412
+ SWIGINTERN VALUE
2413
+ _wrap_bro_conn_new_str(int argc, VALUE *argv, VALUE self) {
2414
+ char *arg1 = (char *) 0 ;
2415
+ int arg2 ;
2416
+ BroConn *result = 0 ;
2417
+ int res1 ;
2418
+ char *buf1 = 0 ;
2419
+ int alloc1 = 0 ;
2420
+ int val2 ;
2421
+ int ecode2 = 0 ;
2422
+ VALUE vresult = Qnil;
2423
+
2424
+ if ((argc < 2) || (argc > 2)) {
2425
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2426
+ }
2427
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2428
+ if (!SWIG_IsOK(res1)) {
2429
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_new_str" "', argument " "1"" of type '" "char const *""'");
2430
+ }
2431
+ arg1 = buf1;
2432
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2433
+ if (!SWIG_IsOK(ecode2)) {
2434
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bro_conn_new_str" "', argument " "2"" of type '" "int""'");
2435
+ }
2436
+ arg2 = (int)(val2);
2437
+ result = (BroConn *)bro_conn_new_str((char const *)arg1,arg2);
2438
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_bro_conn, 0 | 0 );
2439
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2440
+ return vresult;
2441
+ fail:
2442
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2443
+ return Qnil;
2444
+ }
2445
+
2446
+
2447
+ SWIGINTERN VALUE
2448
+ _wrap_bro_conn_connect(int argc, VALUE *argv, VALUE self) {
2449
+ BroConn *arg1 = (BroConn *) 0 ;
2450
+ int result;
2451
+ void *argp1 = 0 ;
2452
+ int res1 = 0 ;
2453
+ VALUE vresult = Qnil;
2454
+
2455
+ if ((argc < 1) || (argc > 1)) {
2456
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2457
+ }
2458
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2459
+ if (!SWIG_IsOK(res1)) {
2460
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_connect" "', argument " "1"" of type '" "BroConn *""'");
2461
+ }
2462
+ arg1 = (BroConn *)(argp1);
2463
+ result = (int)bro_conn_connect(arg1);
2464
+ vresult = result ? Qtrue:Qfalse;
2465
+ return vresult;
2466
+ fail:
2467
+ return Qnil;
2468
+ }
2469
+
2470
+
2471
+ SWIGINTERN VALUE
2472
+ _wrap_bro_conn_process_input(int argc, VALUE *argv, VALUE self) {
2473
+ BroConn *arg1 = (BroConn *) 0 ;
2474
+ int result;
2475
+ void *argp1 = 0 ;
2476
+ int res1 = 0 ;
2477
+ VALUE vresult = Qnil;
2478
+
2479
+ if ((argc < 1) || (argc > 1)) {
2480
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2481
+ }
2482
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2483
+ if (!SWIG_IsOK(res1)) {
2484
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_process_input" "', argument " "1"" of type '" "BroConn *""'");
2485
+ }
2486
+ arg1 = (BroConn *)(argp1);
2487
+ result = (int)bro_conn_process_input(arg1);
2488
+ vresult = result ? Qtrue:Qfalse;
2489
+ return vresult;
2490
+ fail:
2491
+ return Qnil;
2492
+ }
2493
+
2494
+
2495
+ SWIGINTERN VALUE
2496
+ _wrap_bro_conn_delete(int argc, VALUE *argv, VALUE self) {
2497
+ BroConn *arg1 = (BroConn *) 0 ;
2498
+ int result;
2499
+ void *argp1 = 0 ;
2500
+ int res1 = 0 ;
2501
+ VALUE vresult = Qnil;
2502
+
2503
+ if ((argc < 1) || (argc > 1)) {
2504
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2505
+ }
2506
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2507
+ if (!SWIG_IsOK(res1)) {
2508
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_delete" "', argument " "1"" of type '" "BroConn *""'");
2509
+ }
2510
+ arg1 = (BroConn *)(argp1);
2511
+ result = (int)bro_conn_delete(arg1);
2512
+ vresult = result ? Qtrue:Qfalse;
2513
+ return vresult;
2514
+ fail:
2515
+ return Qnil;
2516
+ }
2517
+
2518
+
2519
+ SWIGINTERN VALUE
2520
+ _wrap_bro_conn_aliveq___(int argc, VALUE *argv, VALUE self) {
2521
+ BroConn *arg1 = (BroConn *) 0 ;
2522
+ int result;
2523
+ void *argp1 = 0 ;
2524
+ int res1 = 0 ;
2525
+ VALUE vresult = Qnil;
2526
+
2527
+ if ((argc < 1) || (argc > 1)) {
2528
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2529
+ }
2530
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2531
+ if (!SWIG_IsOK(res1)) {
2532
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_alive" "', argument " "1"" of type '" "BroConn const *""'");
2533
+ }
2534
+ arg1 = (BroConn *)(argp1);
2535
+ result = (int)bro_conn_alive((struct bro_conn const *)arg1);
2536
+ vresult = (result ? Qtrue : Qfalse);
2537
+ return vresult;
2538
+ fail:
2539
+ return Qnil;
2540
+ }
2541
+
2542
+
2543
+ SWIGINTERN VALUE
2544
+ _wrap_bro_conn_data_get(int argc, VALUE *argv, VALUE self) {
2545
+ BroConn *arg1 = (BroConn *) 0 ;
2546
+ char *arg2 = (char *) 0 ;
2547
+ void *result = 0 ;
2548
+ void *argp1 = 0 ;
2549
+ int res1 = 0 ;
2550
+ int res2 ;
2551
+ char *buf2 = 0 ;
2552
+ int alloc2 = 0 ;
2553
+ VALUE vresult = Qnil;
2554
+
2555
+ if ((argc < 2) || (argc > 2)) {
2556
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2557
+ }
2558
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2559
+ if (!SWIG_IsOK(res1)) {
2560
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_data_get" "', argument " "1"" of type '" "BroConn *""'");
2561
+ }
2562
+ arg1 = (BroConn *)(argp1);
2563
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2564
+ if (!SWIG_IsOK(res2)) {
2565
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_conn_data_get" "', argument " "2"" of type '" "char const *""'");
2566
+ }
2567
+ arg2 = buf2;
2568
+ result = (void *)bro_conn_data_get(arg1,(char const *)arg2);
2569
+ {
2570
+ if( strcmp(arg2, "service") == 0 ||
2571
+ strcmp(arg2, "addl") == 0 ||
2572
+ strcmp(arg2, "history") == 0) {
2573
+ //printf("converting to a ruby string...\n");
2574
+ vresult = rb_str_new( (char*)bro_string_get_data((BroString*) result), bro_string_get_length((BroString*) result) );
2575
+ }
2576
+ else if( strcmp(arg2, "") == 0 ) {
2577
+
2578
+ }
2579
+ else
2580
+ {
2581
+ printf("Couldn't find the correct data type to convert to...\n");
2582
+ vresult = Qnil;
2583
+ }
2584
+ }
2585
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2586
+ return vresult;
2587
+ fail:
2588
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2589
+ return Qnil;
2590
+ }
2591
+
2592
+
2593
+ SWIGINTERN VALUE
2594
+ _wrap_bro_conn_get_fd(int argc, VALUE *argv, VALUE self) {
2595
+ BroConn *arg1 = (BroConn *) 0 ;
2596
+ int result;
2597
+ void *argp1 = 0 ;
2598
+ int res1 = 0 ;
2599
+ VALUE vresult = Qnil;
2600
+
2601
+ if ((argc < 1) || (argc > 1)) {
2602
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2603
+ }
2604
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
2605
+ if (!SWIG_IsOK(res1)) {
2606
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conn_get_fd" "', argument " "1"" of type '" "BroConn *""'");
2607
+ }
2608
+ arg1 = (BroConn *)(argp1);
2609
+ result = (int)bro_conn_get_fd(arg1);
2610
+ vresult = SWIG_From_int((int)(result));
2611
+ return vresult;
2612
+ fail:
2613
+ return Qnil;
2614
+ }
2615
+
2616
+
2617
+ SWIGINTERN VALUE
2618
+ _wrap_bro_conf_get_int(int argc, VALUE *argv, VALUE self) {
2619
+ char *arg1 = (char *) 0 ;
2620
+ int *arg2 = (int *) 0 ;
2621
+ int result;
2622
+ int res1 ;
2623
+ char *buf1 = 0 ;
2624
+ int alloc1 = 0 ;
2625
+ int temp2 ;
2626
+ int res2 = SWIG_TMPOBJ ;
2627
+ VALUE vresult = Qnil;
2628
+
2629
+ arg2 = &temp2;
2630
+ if ((argc < 1) || (argc > 1)) {
2631
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2632
+ }
2633
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2634
+ if (!SWIG_IsOK(res1)) {
2635
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conf_get_int" "', argument " "1"" of type '" "char const *""'");
2636
+ }
2637
+ arg1 = buf1;
2638
+ result = (int)bro_conf_get_int((char const *)arg1,arg2);
2639
+ vresult = SWIG_From_int((int)(result));
2640
+ if (SWIG_IsTmpObj(res2)) {
2641
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg2)));
2642
+ } else {
2643
+ int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
2644
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags));
2645
+ }
2646
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2647
+ return vresult;
2648
+ fail:
2649
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2650
+ return Qnil;
2651
+ }
2652
+
2653
+
2654
+ SWIGINTERN VALUE
2655
+ _wrap_bro_conf_get_dbl(int argc, VALUE *argv, VALUE self) {
2656
+ char *arg1 = (char *) 0 ;
2657
+ double *arg2 = (double *) 0 ;
2658
+ int result;
2659
+ int res1 ;
2660
+ char *buf1 = 0 ;
2661
+ int alloc1 = 0 ;
2662
+ double temp2 ;
2663
+ int res2 = SWIG_TMPOBJ ;
2664
+ VALUE vresult = Qnil;
2665
+
2666
+ arg2 = &temp2;
2667
+ if ((argc < 1) || (argc > 1)) {
2668
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2669
+ }
2670
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2671
+ if (!SWIG_IsOK(res1)) {
2672
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conf_get_dbl" "', argument " "1"" of type '" "char const *""'");
2673
+ }
2674
+ arg1 = buf1;
2675
+ result = (int)bro_conf_get_dbl((char const *)arg1,arg2);
2676
+ vresult = SWIG_From_int((int)(result));
2677
+ if (SWIG_IsTmpObj(res2)) {
2678
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg2)));
2679
+ } else {
2680
+ int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
2681
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_double, new_flags));
2682
+ }
2683
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2684
+ return vresult;
2685
+ fail:
2686
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2687
+ return Qnil;
2688
+ }
2689
+
2690
+
2691
+ SWIGINTERN VALUE
2692
+ _wrap_bro_conf_get_str(int argc, VALUE *argv, VALUE self) {
2693
+ char *arg1 = (char *) 0 ;
2694
+ char *result = 0 ;
2695
+ int res1 ;
2696
+ char *buf1 = 0 ;
2697
+ int alloc1 = 0 ;
2698
+ VALUE vresult = Qnil;
2699
+
2700
+ if ((argc < 1) || (argc > 1)) {
2701
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2702
+ }
2703
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2704
+ if (!SWIG_IsOK(res1)) {
2705
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_conf_get_str" "', argument " "1"" of type '" "char const *""'");
2706
+ }
2707
+ arg1 = buf1;
2708
+ result = (char *)bro_conf_get_str((char const *)arg1);
2709
+ vresult = SWIG_FromCharPtr(result);
2710
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2711
+ return vresult;
2712
+ fail:
2713
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2714
+ return Qnil;
2715
+ }
2716
+
2717
+
2718
+ SWIGINTERN VALUE
2719
+ _wrap_bro_string_init(int argc, VALUE *argv, VALUE self) {
2720
+ BroString *arg1 = (BroString *) 0 ;
2721
+ void *argp1 = 0 ;
2722
+ int res1 = 0 ;
2723
+
2724
+ if ((argc < 1) || (argc > 1)) {
2725
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2726
+ }
2727
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2728
+ if (!SWIG_IsOK(res1)) {
2729
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_init" "', argument " "1"" of type '" "BroString *""'");
2730
+ }
2731
+ arg1 = (BroString *)(argp1);
2732
+ bro_string_init(arg1);
2733
+ return Qnil;
2734
+ fail:
2735
+ return Qnil;
2736
+ }
2737
+
2738
+
2739
+ SWIGINTERN VALUE
2740
+ _wrap_bro_string_set(int argc, VALUE *argv, VALUE self) {
2741
+ BroString *arg1 = (BroString *) 0 ;
2742
+ char *arg2 = (char *) 0 ;
2743
+ int result;
2744
+ void *argp1 = 0 ;
2745
+ int res1 = 0 ;
2746
+ int res2 ;
2747
+ char *buf2 = 0 ;
2748
+ int alloc2 = 0 ;
2749
+ VALUE vresult = Qnil;
2750
+
2751
+ if ((argc < 2) || (argc > 2)) {
2752
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2753
+ }
2754
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2755
+ if (!SWIG_IsOK(res1)) {
2756
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_set" "', argument " "1"" of type '" "BroString *""'");
2757
+ }
2758
+ arg1 = (BroString *)(argp1);
2759
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2760
+ if (!SWIG_IsOK(res2)) {
2761
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_string_set" "', argument " "2"" of type '" "char const *""'");
2762
+ }
2763
+ arg2 = buf2;
2764
+ result = (int)bro_string_set(arg1,(char const *)arg2);
2765
+ vresult = SWIG_From_int((int)(result));
2766
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2767
+ return vresult;
2768
+ fail:
2769
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2770
+ return Qnil;
2771
+ }
2772
+
2773
+
2774
+ SWIGINTERN VALUE
2775
+ _wrap_bro_string_set_data(int argc, VALUE *argv, VALUE self) {
2776
+ BroString *arg1 = (BroString *) 0 ;
2777
+ uchar *arg2 = (uchar *) 0 ;
2778
+ int arg3 ;
2779
+ int result;
2780
+ void *argp1 = 0 ;
2781
+ int res1 = 0 ;
2782
+ int val3 ;
2783
+ int ecode3 = 0 ;
2784
+ VALUE vresult = Qnil;
2785
+
2786
+ if ((argc < 3) || (argc > 3)) {
2787
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2788
+ }
2789
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2790
+ if (!SWIG_IsOK(res1)) {
2791
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_set_data" "', argument " "1"" of type '" "BroString *""'");
2792
+ }
2793
+ arg1 = (BroString *)(argp1);
2794
+ arg2 = (uchar*)STR2CSTR(argv[1]);
2795
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
2796
+ if (!SWIG_IsOK(ecode3)) {
2797
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_string_set_data" "', argument " "3"" of type '" "int""'");
2798
+ }
2799
+ arg3 = (int)(val3);
2800
+ result = (int)bro_string_set_data(arg1,(unsigned char const *)arg2,arg3);
2801
+ vresult = SWIG_From_int((int)(result));
2802
+ return vresult;
2803
+ fail:
2804
+ return Qnil;
2805
+ }
2806
+
2807
+
2808
+ SWIGINTERN VALUE
2809
+ _wrap_bro_string_get_data(int argc, VALUE *argv, VALUE self) {
2810
+ BroString *arg1 = (BroString *) 0 ;
2811
+ uchar *result = 0 ;
2812
+ void *argp1 = 0 ;
2813
+ int res1 = 0 ;
2814
+ VALUE vresult = Qnil;
2815
+
2816
+ if ((argc < 1) || (argc > 1)) {
2817
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2818
+ }
2819
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2820
+ if (!SWIG_IsOK(res1)) {
2821
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_get_data" "', argument " "1"" of type '" "BroString const *""'");
2822
+ }
2823
+ arg1 = (BroString *)(argp1);
2824
+ result = (uchar *)bro_string_get_data((struct bro_string const *)arg1);
2825
+ vresult = rb_str_new2((char*)result);
2826
+ return vresult;
2827
+ fail:
2828
+ return Qnil;
2829
+ }
2830
+
2831
+
2832
+ SWIGINTERN VALUE
2833
+ _wrap_bro_string_get_length(int argc, VALUE *argv, VALUE self) {
2834
+ BroString *arg1 = (BroString *) 0 ;
2835
+ uint32 result;
2836
+ void *argp1 = 0 ;
2837
+ int res1 = 0 ;
2838
+ VALUE vresult = Qnil;
2839
+
2840
+ if ((argc < 1) || (argc > 1)) {
2841
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2842
+ }
2843
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2844
+ if (!SWIG_IsOK(res1)) {
2845
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_get_length" "', argument " "1"" of type '" "BroString const *""'");
2846
+ }
2847
+ arg1 = (BroString *)(argp1);
2848
+ result = (uint32)bro_string_get_length((struct bro_string const *)arg1);
2849
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2850
+ return vresult;
2851
+ fail:
2852
+ return Qnil;
2853
+ }
2854
+
2855
+
2856
+ SWIGINTERN VALUE
2857
+ _wrap_bro_string_copy(int argc, VALUE *argv, VALUE self) {
2858
+ BroString *arg1 = (BroString *) 0 ;
2859
+ BroString *result = 0 ;
2860
+ void *argp1 = 0 ;
2861
+ int res1 = 0 ;
2862
+ VALUE vresult = Qnil;
2863
+
2864
+ if ((argc < 1) || (argc > 1)) {
2865
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2866
+ }
2867
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2868
+ if (!SWIG_IsOK(res1)) {
2869
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_copy" "', argument " "1"" of type '" "BroString *""'");
2870
+ }
2871
+ arg1 = (BroString *)(argp1);
2872
+ result = (BroString *)bro_string_copy(arg1);
2873
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_bro_string, 0 | 0 );
2874
+ return vresult;
2875
+ fail:
2876
+ return Qnil;
2877
+ }
2878
+
2879
+
2880
+ SWIGINTERN VALUE
2881
+ _wrap_bro_string_cleanup(int argc, VALUE *argv, VALUE self) {
2882
+ BroString *arg1 = (BroString *) 0 ;
2883
+ void *argp1 = 0 ;
2884
+ int res1 = 0 ;
2885
+
2886
+ if ((argc < 1) || (argc > 1)) {
2887
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2888
+ }
2889
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2890
+ if (!SWIG_IsOK(res1)) {
2891
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_cleanup" "', argument " "1"" of type '" "BroString *""'");
2892
+ }
2893
+ arg1 = (BroString *)(argp1);
2894
+ bro_string_cleanup(arg1);
2895
+ return Qnil;
2896
+ fail:
2897
+ return Qnil;
2898
+ }
2899
+
2900
+
2901
+ SWIGINTERN VALUE
2902
+ _wrap_bro_string_free(int argc, VALUE *argv, VALUE self) {
2903
+ BroString *arg1 = (BroString *) 0 ;
2904
+ void *argp1 = 0 ;
2905
+ int res1 = 0 ;
2906
+
2907
+ if ((argc < 1) || (argc > 1)) {
2908
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2909
+ }
2910
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_string, 0 | 0 );
2911
+ if (!SWIG_IsOK(res1)) {
2912
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_string_free" "', argument " "1"" of type '" "BroString *""'");
2913
+ }
2914
+ arg1 = (BroString *)(argp1);
2915
+ bro_string_free(arg1);
2916
+ return Qnil;
2917
+ fail:
2918
+ return Qnil;
2919
+ }
2920
+
2921
+
2922
+ SWIGINTERN VALUE
2923
+ _wrap_bro_record_new(int argc, VALUE *argv, VALUE self) {
2924
+ BroRecord *result = 0 ;
2925
+ VALUE vresult = Qnil;
2926
+
2927
+ if ((argc < 0) || (argc > 0)) {
2928
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2929
+ }
2930
+ result = (BroRecord *)bro_record_new();
2931
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_bro_record, 0 | 0 );
2932
+ return vresult;
2933
+ fail:
2934
+ return Qnil;
2935
+ }
2936
+
2937
+
2938
+ SWIGINTERN VALUE
2939
+ _wrap_bro_record_add_val(int argc, VALUE *argv, VALUE self) {
2940
+ BroRecord *arg1 = (BroRecord *) 0 ;
2941
+ char *arg2 = (char *) 0 ;
2942
+ int arg3 ;
2943
+ char *arg4 = (char *) 0 ;
2944
+ void *arg5 = (void *) 0 ;
2945
+ int result;
2946
+ void *argp1 = 0 ;
2947
+ int res1 = 0 ;
2948
+ int res2 ;
2949
+ char *buf2 = 0 ;
2950
+ int alloc2 = 0 ;
2951
+ int val3 ;
2952
+ int ecode3 = 0 ;
2953
+ VALUE vresult = Qnil;
2954
+
2955
+ if ((argc < 4) || (argc > 4)) {
2956
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
2957
+ }
2958
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
2959
+ if (!SWIG_IsOK(res1)) {
2960
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_add_val" "', argument " "1"" of type '" "BroRecord *""'");
2961
+ }
2962
+ arg1 = (BroRecord *)(argp1);
2963
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2964
+ if (!SWIG_IsOK(res2)) {
2965
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_record_add_val" "', argument " "2"" of type '" "char const *""'");
2966
+ }
2967
+ arg2 = buf2;
2968
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
2969
+ if (!SWIG_IsOK(ecode3)) {
2970
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_record_add_val" "', argument " "3"" of type '" "int""'");
2971
+ }
2972
+ arg3 = (int)(val3);
2973
+ {
2974
+ // Get the ruby class of the incoming data
2975
+ char *class = STR2CSTR(rb_funcall(rb_funcall(argv[3], rb_intern("class"), 0), rb_intern("to_s"), 0));
2976
+ //printf("Received type: %s...", class);
2977
+ if(arg3 == BRO_TYPE_INT || arg2 == BRO_TYPE_INT ||
2978
+ arg3 == BRO_TYPE_ENUM || arg2 == BRO_TYPE_ENUM ||
2979
+ arg3 == BRO_TYPE_BOOL || arg2 == BRO_TYPE_BOOL) {
2980
+ int foo;
2981
+ if(strcmp(class, "TrueClass") == 0 || strcmp(class, "FalseClass") == 0) {
2982
+ //printf("Matched on boolean! Storing value as an integer\n");
2983
+ foo = argv[3] ? 1 : 0;
2984
+ } else {
2985
+ //printf("Matched on Fixnum! Storing value as an int (%i)\n", NUM2INT(argv[3]));
2986
+ foo = NUM2INT(argv[3]);
2987
+ }
2988
+ arg5 = &foo;
2989
+ }
2990
+ else if(arg3 == BRO_TYPE_DOUBLE || arg2 == BRO_TYPE_DOUBLE ||
2991
+ arg3 == BRO_TYPE_TIME || arg2 == BRO_TYPE_TIME ||
2992
+ arg3 == BRO_TYPE_INTERVAL || arg2 == BRO_TYPE_INTERVAL) {
2993
+ //printf("Storing value as a double (%f)\n", rb_num2dbl(argv[3]));
2994
+ double foo = rb_num2dbl(argv[3]);
2995
+ arg5 = &foo;
2996
+ }
2997
+ else if(arg3 == BRO_TYPE_COUNT || arg2 == BRO_TYPE_COUNT ||
2998
+ arg3 == BRO_TYPE_IPADDR || arg2 == BRO_TYPE_IPADDR ||
2999
+ arg3 == BRO_TYPE_NET || arg2 == BRO_TYPE_NET) {
3000
+ //printf("Storing value as a uint32\n");
3001
+ uint32 foo = rb_num2ulong(argv[3]);
3002
+ arg5 = &foo;
3003
+ }
3004
+ else if(arg3 == BRO_TYPE_STRING || arg2 == BRO_TYPE_STRING) {
3005
+ //printf("Storing value as a BroString\n");
3006
+ BroString foo = to_brostring(argv[3]);
3007
+ arg5 = &foo;
3008
+ }
3009
+ else if(arg3 == BRO_TYPE_PORT || arg2 == BRO_TYPE_PORT) {
3010
+ //printf("Storing value as a BroPort\n");
3011
+ void *p1 = 0;
3012
+ int res = 0;
3013
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_port, 0 | 0 );
3014
+ if (!SWIG_IsOK(res)) {
3015
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroPort");
3016
+ }
3017
+ BroPort *output;
3018
+ output = (BroPort *)(p1);
3019
+ arg5 = output;
3020
+ }
3021
+ else if(arg3 == BRO_TYPE_SUBNET || arg2 == BRO_TYPE_SUBNET) {
3022
+ //printf("Storing value as a BroSubnet\n");
3023
+ void *p1 = 0;
3024
+ int res = 0;
3025
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_subnet, 0 | 0 );
3026
+ if (!SWIG_IsOK(res)) {
3027
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroSubnet");
3028
+ }
3029
+ BroSubnet *output = (BroSubnet *) 0 ;
3030
+ output = (BroSubnet *)(p1);
3031
+ arg5 = output;
3032
+ }
3033
+ else if(arg3 == BRO_TYPE_RECORD || arg2 == BRO_TYPE_RECORD) {
3034
+ //printf("Storing value as a BroRecord\n");
3035
+ void *p1 = 0;
3036
+ int res = 0;
3037
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_record, 0 | 0 );
3038
+ if (!SWIG_IsOK(res)) {
3039
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroRecord");
3040
+ }
3041
+ BroRecord *output;
3042
+ output = (BroRecord *)(p1);
3043
+ arg5 = output;
3044
+ }
3045
+ else {
3046
+ printf("Couldn't find a type to convert to\n");
3047
+ }
3048
+ // This seems to always be null, so keep it out of the ruby api for now.
3049
+ arg4 = NULL;
3050
+ }
3051
+ result = (int)bro_record_add_val(arg1,(char const *)arg2,arg3,(char const *)arg4,(void const *)arg5);
3052
+ vresult = SWIG_From_int((int)(result));
3053
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3054
+ return vresult;
3055
+ fail:
3056
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3057
+ return Qnil;
3058
+ }
3059
+
3060
+
3061
+ SWIGINTERN VALUE
3062
+ _wrap_bro_record_get_named_val(int argc, VALUE *argv, VALUE self) {
3063
+ BroRecord *arg1 = (BroRecord *) 0 ;
3064
+ char *arg2 = (char *) 0 ;
3065
+ int arg3 ;
3066
+ void *result = 0 ;
3067
+ void *argp1 = 0 ;
3068
+ int res1 = 0 ;
3069
+ int res2 ;
3070
+ char *buf2 = 0 ;
3071
+ int alloc2 = 0 ;
3072
+ int val3 ;
3073
+ int ecode3 = 0 ;
3074
+ VALUE vresult = Qnil;
3075
+
3076
+ if ((argc < 3) || (argc > 3)) {
3077
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3078
+ }
3079
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
3080
+ if (!SWIG_IsOK(res1)) {
3081
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_get_named_val" "', argument " "1"" of type '" "BroRecord *""'");
3082
+ }
3083
+ arg1 = (BroRecord *)(argp1);
3084
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
3085
+ if (!SWIG_IsOK(res2)) {
3086
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_record_get_named_val" "', argument " "2"" of type '" "char const *""'");
3087
+ }
3088
+ arg2 = buf2;
3089
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
3090
+ if (!SWIG_IsOK(ecode3)) {
3091
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_record_get_named_val" "', argument " "3"" of type '" "int""'");
3092
+ }
3093
+ arg3 = (int)(val3);
3094
+ result = (void *)bro_record_get_named_val(arg1,(char const *)arg2,arg3);
3095
+ {
3096
+ if(arg3 == BRO_TYPE_BOOL) {
3097
+ //printf("Ruby: Getting data matched on boolean\n");
3098
+ int *i = result;
3099
+ vresult = (*i ? Qtrue : Qfalse);
3100
+ }
3101
+ else if(arg3 == BRO_TYPE_INT ||
3102
+ arg3 == BRO_TYPE_ENUM) {
3103
+ //printf("Ruby: Getting data matched on int\n");
3104
+ int *i = result;
3105
+ vresult = INT2NUM(*i);
3106
+ }
3107
+ else if(arg3 == BRO_TYPE_TIME ||
3108
+ arg3 == BRO_TYPE_DOUBLE ||
3109
+ arg3 == BRO_TYPE_INTERVAL) {
3110
+ //printf("Ruby: Getting data matched on time\n");
3111
+ double *i = result;
3112
+ vresult = rb_float_new(*i);
3113
+ }
3114
+ else if(arg3 == BRO_TYPE_STRING) {
3115
+ BroString *i = result;
3116
+ vresult = rb_str_new((char*)i->str_val, i->str_len);
3117
+ }
3118
+ else if(arg3 == BRO_TYPE_COUNT) {
3119
+ //printf("Ruby: Getting data matched on uint32\n");
3120
+ uint32 *i = result;
3121
+ vresult = ULONG2NUM(*i);
3122
+ }
3123
+ else if(arg3 == BRO_TYPE_IPADDR ||
3124
+ arg3 == BRO_TYPE_NET) {
3125
+ //printf("I found an ip address... making it a network byte ordered string\n");
3126
+ vresult = rb_str_new2( (char *) result);
3127
+ }
3128
+ else if(arg3 == BRO_TYPE_RECORD) {
3129
+ //printf("Ruby: Getting data matched as a BroRecord\n");
3130
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr( (BroRecord *) result ), SWIGTYPE_p_bro_record, 0);
3131
+ }
3132
+ else if(arg3 == BRO_TYPE_PORT) {
3133
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr( (BroPort *) result ), SWIGTYPE_p_bro_port, 0);
3134
+ }
3135
+ else {
3136
+ printf("No type recognized when getting value\n");
3137
+ }
3138
+ }
3139
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3140
+ return vresult;
3141
+ fail:
3142
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3143
+ return Qnil;
3144
+ }
3145
+
3146
+
3147
+ SWIGINTERN VALUE
3148
+ _wrap_bro_record_get_nth_val(int argc, VALUE *argv, VALUE self) {
3149
+ BroRecord *arg1 = (BroRecord *) 0 ;
3150
+ int arg2 ;
3151
+ int arg3 ;
3152
+ void *result = 0 ;
3153
+ void *argp1 = 0 ;
3154
+ int res1 = 0 ;
3155
+ int val2 ;
3156
+ int ecode2 = 0 ;
3157
+ int val3 ;
3158
+ int ecode3 = 0 ;
3159
+ VALUE vresult = Qnil;
3160
+
3161
+ if ((argc < 3) || (argc > 3)) {
3162
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3163
+ }
3164
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
3165
+ if (!SWIG_IsOK(res1)) {
3166
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_get_nth_val" "', argument " "1"" of type '" "BroRecord *""'");
3167
+ }
3168
+ arg1 = (BroRecord *)(argp1);
3169
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
3170
+ if (!SWIG_IsOK(ecode2)) {
3171
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bro_record_get_nth_val" "', argument " "2"" of type '" "int""'");
3172
+ }
3173
+ arg2 = (int)(val2);
3174
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
3175
+ if (!SWIG_IsOK(ecode3)) {
3176
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_record_get_nth_val" "', argument " "3"" of type '" "int""'");
3177
+ }
3178
+ arg3 = (int)(val3);
3179
+ result = (void *)bro_record_get_nth_val(arg1,arg2,arg3);
3180
+ {
3181
+ if(arg3 == BRO_TYPE_BOOL) {
3182
+ //printf("Ruby: Getting data matched on boolean\n");
3183
+ int *i = result;
3184
+ vresult = (*i ? Qtrue : Qfalse);
3185
+ }
3186
+ else if(arg3 == BRO_TYPE_INT ||
3187
+ arg3 == BRO_TYPE_ENUM) {
3188
+ //printf("Ruby: Getting data matched on int\n");
3189
+ int *i = result;
3190
+ vresult = INT2NUM(*i);
3191
+ }
3192
+ else if(arg3 == BRO_TYPE_TIME ||
3193
+ arg3 == BRO_TYPE_DOUBLE ||
3194
+ arg3 == BRO_TYPE_INTERVAL) {
3195
+ //printf("Ruby: Getting data matched on time\n");
3196
+ double *i = result;
3197
+ vresult = rb_float_new(*i);
3198
+ }
3199
+ else if(arg3 == BRO_TYPE_STRING) {
3200
+ BroString *i = result;
3201
+ vresult = rb_str_new((char*)i->str_val, i->str_len);
3202
+ }
3203
+ else if(arg3 == BRO_TYPE_COUNT) {
3204
+ //printf("Ruby: Getting data matched on uint32\n");
3205
+ uint32 *i = result;
3206
+ vresult = ULONG2NUM(*i);
3207
+ }
3208
+ else if(arg3 == BRO_TYPE_IPADDR ||
3209
+ arg3 == BRO_TYPE_NET) {
3210
+ //printf("I found an ip address... making it a network byte ordered string\n");
3211
+ vresult = rb_str_new2( (char *) result);
3212
+ }
3213
+ else if(arg3 == BRO_TYPE_RECORD) {
3214
+ //printf("Ruby: Getting data matched as a BroRecord\n");
3215
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr( (BroRecord *) result ), SWIGTYPE_p_bro_record, 0);
3216
+ }
3217
+ else if(arg3 == BRO_TYPE_PORT) {
3218
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr( (BroPort *) result ), SWIGTYPE_p_bro_port, 0);
3219
+ }
3220
+ else {
3221
+ printf("No type recognized when getting value\n");
3222
+ }
3223
+ }
3224
+ return vresult;
3225
+ fail:
3226
+ return Qnil;
3227
+ }
3228
+
3229
+
3230
+ SWIGINTERN VALUE
3231
+ _wrap_bro_record_set_nth_val(int argc, VALUE *argv, VALUE self) {
3232
+ BroRecord *arg1 = (BroRecord *) 0 ;
3233
+ int arg2 ;
3234
+ int arg3 ;
3235
+ char *arg4 = (char *) 0 ;
3236
+ void *arg5 = (void *) 0 ;
3237
+ int result;
3238
+ void *argp1 = 0 ;
3239
+ int res1 = 0 ;
3240
+ int val2 ;
3241
+ int ecode2 = 0 ;
3242
+ int val3 ;
3243
+ int ecode3 = 0 ;
3244
+ VALUE vresult = Qnil;
3245
+
3246
+ if ((argc < 4) || (argc > 4)) {
3247
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
3248
+ }
3249
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
3250
+ if (!SWIG_IsOK(res1)) {
3251
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_set_nth_val" "', argument " "1"" of type '" "BroRecord *""'");
3252
+ }
3253
+ arg1 = (BroRecord *)(argp1);
3254
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
3255
+ if (!SWIG_IsOK(ecode2)) {
3256
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bro_record_set_nth_val" "', argument " "2"" of type '" "int""'");
3257
+ }
3258
+ arg2 = (int)(val2);
3259
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
3260
+ if (!SWIG_IsOK(ecode3)) {
3261
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_record_set_nth_val" "', argument " "3"" of type '" "int""'");
3262
+ }
3263
+ arg3 = (int)(val3);
3264
+ {
3265
+ // Get the ruby class of the incoming data
3266
+ char *class = STR2CSTR(rb_funcall(rb_funcall(argv[3], rb_intern("class"), 0), rb_intern("to_s"), 0));
3267
+ //printf("Received type: %s...", class);
3268
+ if(arg3 == BRO_TYPE_INT || arg2 == BRO_TYPE_INT ||
3269
+ arg3 == BRO_TYPE_ENUM || arg2 == BRO_TYPE_ENUM ||
3270
+ arg3 == BRO_TYPE_BOOL || arg2 == BRO_TYPE_BOOL) {
3271
+ int foo;
3272
+ if(strcmp(class, "TrueClass") == 0 || strcmp(class, "FalseClass") == 0) {
3273
+ //printf("Matched on boolean! Storing value as an integer\n");
3274
+ foo = argv[3] ? 1 : 0;
3275
+ } else {
3276
+ //printf("Matched on Fixnum! Storing value as an int (%i)\n", NUM2INT(argv[3]));
3277
+ foo = NUM2INT(argv[3]);
3278
+ }
3279
+ arg5 = &foo;
3280
+ }
3281
+ else if(arg3 == BRO_TYPE_DOUBLE || arg2 == BRO_TYPE_DOUBLE ||
3282
+ arg3 == BRO_TYPE_TIME || arg2 == BRO_TYPE_TIME ||
3283
+ arg3 == BRO_TYPE_INTERVAL || arg2 == BRO_TYPE_INTERVAL) {
3284
+ //printf("Storing value as a double (%f)\n", rb_num2dbl(argv[3]));
3285
+ double foo = rb_num2dbl(argv[3]);
3286
+ arg5 = &foo;
3287
+ }
3288
+ else if(arg3 == BRO_TYPE_COUNT || arg2 == BRO_TYPE_COUNT ||
3289
+ arg3 == BRO_TYPE_IPADDR || arg2 == BRO_TYPE_IPADDR ||
3290
+ arg3 == BRO_TYPE_NET || arg2 == BRO_TYPE_NET) {
3291
+ //printf("Storing value as a uint32\n");
3292
+ uint32 foo = rb_num2ulong(argv[3]);
3293
+ arg5 = &foo;
3294
+ }
3295
+ else if(arg3 == BRO_TYPE_STRING || arg2 == BRO_TYPE_STRING) {
3296
+ //printf("Storing value as a BroString\n");
3297
+ BroString foo = to_brostring(argv[3]);
3298
+ arg5 = &foo;
3299
+ }
3300
+ else if(arg3 == BRO_TYPE_PORT || arg2 == BRO_TYPE_PORT) {
3301
+ //printf("Storing value as a BroPort\n");
3302
+ void *p1 = 0;
3303
+ int res = 0;
3304
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_port, 0 | 0 );
3305
+ if (!SWIG_IsOK(res)) {
3306
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroPort");
3307
+ }
3308
+ BroPort *output;
3309
+ output = (BroPort *)(p1);
3310
+ arg5 = output;
3311
+ }
3312
+ else if(arg3 == BRO_TYPE_SUBNET || arg2 == BRO_TYPE_SUBNET) {
3313
+ //printf("Storing value as a BroSubnet\n");
3314
+ void *p1 = 0;
3315
+ int res = 0;
3316
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_subnet, 0 | 0 );
3317
+ if (!SWIG_IsOK(res)) {
3318
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroSubnet");
3319
+ }
3320
+ BroSubnet *output = (BroSubnet *) 0 ;
3321
+ output = (BroSubnet *)(p1);
3322
+ arg5 = output;
3323
+ }
3324
+ else if(arg3 == BRO_TYPE_RECORD || arg2 == BRO_TYPE_RECORD) {
3325
+ //printf("Storing value as a BroRecord\n");
3326
+ void *p1 = 0;
3327
+ int res = 0;
3328
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_record, 0 | 0 );
3329
+ if (!SWIG_IsOK(res)) {
3330
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroRecord");
3331
+ }
3332
+ BroRecord *output;
3333
+ output = (BroRecord *)(p1);
3334
+ arg5 = output;
3335
+ }
3336
+ else {
3337
+ printf("Couldn't find a type to convert to\n");
3338
+ }
3339
+ // This seems to always be null, so keep it out of the ruby api for now.
3340
+ arg4 = NULL;
3341
+ }
3342
+ result = (int)bro_record_set_nth_val(arg1,arg2,arg3,(char const *)arg4,(void const *)arg5);
3343
+ vresult = result ? Qtrue:Qfalse;
3344
+ return vresult;
3345
+ fail:
3346
+ return Qnil;
3347
+ }
3348
+
3349
+
3350
+ SWIGINTERN VALUE
3351
+ _wrap_bro_record_set_named_val(int argc, VALUE *argv, VALUE self) {
3352
+ BroRecord *arg1 = (BroRecord *) 0 ;
3353
+ char *arg2 = (char *) 0 ;
3354
+ int arg3 ;
3355
+ char *arg4 = (char *) 0 ;
3356
+ void *arg5 = (void *) 0 ;
3357
+ int result;
3358
+ void *argp1 = 0 ;
3359
+ int res1 = 0 ;
3360
+ int res2 ;
3361
+ char *buf2 = 0 ;
3362
+ int alloc2 = 0 ;
3363
+ int val3 ;
3364
+ int ecode3 = 0 ;
3365
+ VALUE vresult = Qnil;
3366
+
3367
+ if ((argc < 4) || (argc > 4)) {
3368
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
3369
+ }
3370
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
3371
+ if (!SWIG_IsOK(res1)) {
3372
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_set_named_val" "', argument " "1"" of type '" "BroRecord *""'");
3373
+ }
3374
+ arg1 = (BroRecord *)(argp1);
3375
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
3376
+ if (!SWIG_IsOK(res2)) {
3377
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_record_set_named_val" "', argument " "2"" of type '" "char const *""'");
3378
+ }
3379
+ arg2 = buf2;
3380
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
3381
+ if (!SWIG_IsOK(ecode3)) {
3382
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bro_record_set_named_val" "', argument " "3"" of type '" "int""'");
3383
+ }
3384
+ arg3 = (int)(val3);
3385
+ {
3386
+ // Get the ruby class of the incoming data
3387
+ char *class = STR2CSTR(rb_funcall(rb_funcall(argv[3], rb_intern("class"), 0), rb_intern("to_s"), 0));
3388
+ //printf("Received type: %s...", class);
3389
+ if(arg3 == BRO_TYPE_INT || arg2 == BRO_TYPE_INT ||
3390
+ arg3 == BRO_TYPE_ENUM || arg2 == BRO_TYPE_ENUM ||
3391
+ arg3 == BRO_TYPE_BOOL || arg2 == BRO_TYPE_BOOL) {
3392
+ int foo;
3393
+ if(strcmp(class, "TrueClass") == 0 || strcmp(class, "FalseClass") == 0) {
3394
+ //printf("Matched on boolean! Storing value as an integer\n");
3395
+ foo = argv[3] ? 1 : 0;
3396
+ } else {
3397
+ //printf("Matched on Fixnum! Storing value as an int (%i)\n", NUM2INT(argv[3]));
3398
+ foo = NUM2INT(argv[3]);
3399
+ }
3400
+ arg5 = &foo;
3401
+ }
3402
+ else if(arg3 == BRO_TYPE_DOUBLE || arg2 == BRO_TYPE_DOUBLE ||
3403
+ arg3 == BRO_TYPE_TIME || arg2 == BRO_TYPE_TIME ||
3404
+ arg3 == BRO_TYPE_INTERVAL || arg2 == BRO_TYPE_INTERVAL) {
3405
+ //printf("Storing value as a double (%f)\n", rb_num2dbl(argv[3]));
3406
+ double foo = rb_num2dbl(argv[3]);
3407
+ arg5 = &foo;
3408
+ }
3409
+ else if(arg3 == BRO_TYPE_COUNT || arg2 == BRO_TYPE_COUNT ||
3410
+ arg3 == BRO_TYPE_IPADDR || arg2 == BRO_TYPE_IPADDR ||
3411
+ arg3 == BRO_TYPE_NET || arg2 == BRO_TYPE_NET) {
3412
+ //printf("Storing value as a uint32\n");
3413
+ uint32 foo = rb_num2ulong(argv[3]);
3414
+ arg5 = &foo;
3415
+ }
3416
+ else if(arg3 == BRO_TYPE_STRING || arg2 == BRO_TYPE_STRING) {
3417
+ //printf("Storing value as a BroString\n");
3418
+ BroString foo = to_brostring(argv[3]);
3419
+ arg5 = &foo;
3420
+ }
3421
+ else if(arg3 == BRO_TYPE_PORT || arg2 == BRO_TYPE_PORT) {
3422
+ //printf("Storing value as a BroPort\n");
3423
+ void *p1 = 0;
3424
+ int res = 0;
3425
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_port, 0 | 0 );
3426
+ if (!SWIG_IsOK(res)) {
3427
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroPort");
3428
+ }
3429
+ BroPort *output;
3430
+ output = (BroPort *)(p1);
3431
+ arg5 = output;
3432
+ }
3433
+ else if(arg3 == BRO_TYPE_SUBNET || arg2 == BRO_TYPE_SUBNET) {
3434
+ //printf("Storing value as a BroSubnet\n");
3435
+ void *p1 = 0;
3436
+ int res = 0;
3437
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_subnet, 0 | 0 );
3438
+ if (!SWIG_IsOK(res)) {
3439
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroSubnet");
3440
+ }
3441
+ BroSubnet *output = (BroSubnet *) 0 ;
3442
+ output = (BroSubnet *)(p1);
3443
+ arg5 = output;
3444
+ }
3445
+ else if(arg3 == BRO_TYPE_RECORD || arg2 == BRO_TYPE_RECORD) {
3446
+ //printf("Storing value as a BroRecord\n");
3447
+ void *p1 = 0;
3448
+ int res = 0;
3449
+ res = SWIG_ConvertPtr(argv[3], &p1, SWIGTYPE_p_bro_record, 0 | 0 );
3450
+ if (!SWIG_IsOK(res)) {
3451
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroRecord");
3452
+ }
3453
+ BroRecord *output;
3454
+ output = (BroRecord *)(p1);
3455
+ arg5 = output;
3456
+ }
3457
+ else {
3458
+ printf("Couldn't find a type to convert to\n");
3459
+ }
3460
+ // This seems to always be null, so keep it out of the ruby api for now.
3461
+ arg4 = NULL;
3462
+ }
3463
+ result = (int)bro_record_set_named_val(arg1,(char const *)arg2,arg3,(char const *)arg4,(void const *)arg5);
3464
+ vresult = result ? Qtrue:Qfalse;
3465
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3466
+ return vresult;
3467
+ fail:
3468
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3469
+ return Qnil;
3470
+ }
3471
+
3472
+
3473
+ SWIGINTERN VALUE
3474
+ _wrap_bro_record_free(int argc, VALUE *argv, VALUE self) {
3475
+ BroRecord *arg1 = (BroRecord *) 0 ;
3476
+ void *argp1 = 0 ;
3477
+ int res1 = 0 ;
3478
+
3479
+ if ((argc < 1) || (argc > 1)) {
3480
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3481
+ }
3482
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
3483
+ if (!SWIG_IsOK(res1)) {
3484
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_free" "', argument " "1"" of type '" "BroRecord *""'");
3485
+ }
3486
+ arg1 = (BroRecord *)(argp1);
3487
+ bro_record_free(arg1);
3488
+ return Qnil;
3489
+ fail:
3490
+ return Qnil;
3491
+ }
3492
+
3493
+
3494
+ SWIGINTERN VALUE
3495
+ _wrap_bro_event_new(int argc, VALUE *argv, VALUE self) {
3496
+ char *arg1 = (char *) 0 ;
3497
+ BroEvent *result = 0 ;
3498
+ int res1 ;
3499
+ char *buf1 = 0 ;
3500
+ int alloc1 = 0 ;
3501
+ VALUE vresult = Qnil;
3502
+
3503
+ if ((argc < 1) || (argc > 1)) {
3504
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3505
+ }
3506
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3507
+ if (!SWIG_IsOK(res1)) {
3508
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_new" "', argument " "1"" of type '" "char const *""'");
3509
+ }
3510
+ arg1 = buf1;
3511
+ result = (BroEvent *)bro_event_new((char const *)arg1);
3512
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_bro_event, 0 | 0 );
3513
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3514
+ return vresult;
3515
+ fail:
3516
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3517
+ return Qnil;
3518
+ }
3519
+
3520
+
3521
+ SWIGINTERN VALUE
3522
+ _wrap_bro_event_add_val(int argc, VALUE *argv, VALUE self) {
3523
+ BroEvent *arg1 = (BroEvent *) 0 ;
3524
+ int arg2 ;
3525
+ char *arg3 = (char *) 0 ;
3526
+ void *arg4 = (void *) 0 ;
3527
+ int result;
3528
+ void *argp1 = 0 ;
3529
+ int res1 = 0 ;
3530
+ int val2 ;
3531
+ int ecode2 = 0 ;
3532
+ VALUE vresult = Qnil;
3533
+
3534
+ if ((argc < 3) || (argc > 3)) {
3535
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3536
+ }
3537
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_event, 0 | 0 );
3538
+ if (!SWIG_IsOK(res1)) {
3539
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_add_val" "', argument " "1"" of type '" "BroEvent *""'");
3540
+ }
3541
+ arg1 = (BroEvent *)(argp1);
3542
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
3543
+ if (!SWIG_IsOK(ecode2)) {
3544
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bro_event_add_val" "', argument " "2"" of type '" "int""'");
3545
+ }
3546
+ arg2 = (int)(val2);
3547
+ {
3548
+ // Get the ruby class of the incoming data
3549
+ char *class = STR2CSTR(rb_funcall(rb_funcall(argv[2], rb_intern("class"), 0), rb_intern("to_s"), 0));
3550
+ //printf("Received type: %s...", class);
3551
+ if(arg3 == BRO_TYPE_INT || arg2 == BRO_TYPE_INT ||
3552
+ arg3 == BRO_TYPE_ENUM || arg2 == BRO_TYPE_ENUM ||
3553
+ arg3 == BRO_TYPE_BOOL || arg2 == BRO_TYPE_BOOL) {
3554
+ int foo;
3555
+ if(strcmp(class, "TrueClass") == 0 || strcmp(class, "FalseClass") == 0) {
3556
+ //printf("Matched on boolean! Storing value as an integer\n");
3557
+ foo = argv[2] ? 1 : 0;
3558
+ } else {
3559
+ //printf("Matched on Fixnum! Storing value as an int (%i)\n", NUM2INT(argv[2]));
3560
+ foo = NUM2INT(argv[2]);
3561
+ }
3562
+ arg4 = &foo;
3563
+ }
3564
+ else if(arg3 == BRO_TYPE_DOUBLE || arg2 == BRO_TYPE_DOUBLE ||
3565
+ arg3 == BRO_TYPE_TIME || arg2 == BRO_TYPE_TIME ||
3566
+ arg3 == BRO_TYPE_INTERVAL || arg2 == BRO_TYPE_INTERVAL) {
3567
+ //printf("Storing value as a double (%f)\n", rb_num2dbl(argv[2]));
3568
+ double foo = rb_num2dbl(argv[2]);
3569
+ arg4 = &foo;
3570
+ }
3571
+ else if(arg3 == BRO_TYPE_COUNT || arg2 == BRO_TYPE_COUNT ||
3572
+ arg3 == BRO_TYPE_IPADDR || arg2 == BRO_TYPE_IPADDR ||
3573
+ arg3 == BRO_TYPE_NET || arg2 == BRO_TYPE_NET) {
3574
+ //printf("Storing value as a uint32\n");
3575
+ uint32 foo = rb_num2ulong(argv[2]);
3576
+ arg4 = &foo;
3577
+ }
3578
+ else if(arg3 == BRO_TYPE_STRING || arg2 == BRO_TYPE_STRING) {
3579
+ //printf("Storing value as a BroString\n");
3580
+ BroString foo = to_brostring(argv[2]);
3581
+ arg4 = &foo;
3582
+ }
3583
+ else if(arg3 == BRO_TYPE_PORT || arg2 == BRO_TYPE_PORT) {
3584
+ //printf("Storing value as a BroPort\n");
3585
+ void *p1 = 0;
3586
+ int res = 0;
3587
+ res = SWIG_ConvertPtr(argv[2], &p1, SWIGTYPE_p_bro_port, 0 | 0 );
3588
+ if (!SWIG_IsOK(res)) {
3589
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroPort");
3590
+ }
3591
+ BroPort *output;
3592
+ output = (BroPort *)(p1);
3593
+ arg4 = output;
3594
+ }
3595
+ else if(arg3 == BRO_TYPE_SUBNET || arg2 == BRO_TYPE_SUBNET) {
3596
+ //printf("Storing value as a BroSubnet\n");
3597
+ void *p1 = 0;
3598
+ int res = 0;
3599
+ res = SWIG_ConvertPtr(argv[2], &p1, SWIGTYPE_p_bro_subnet, 0 | 0 );
3600
+ if (!SWIG_IsOK(res)) {
3601
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroSubnet");
3602
+ }
3603
+ BroSubnet *output = (BroSubnet *) 0 ;
3604
+ output = (BroSubnet *)(p1);
3605
+ arg4 = output;
3606
+ }
3607
+ else if(arg3 == BRO_TYPE_RECORD || arg2 == BRO_TYPE_RECORD) {
3608
+ //printf("Storing value as a BroRecord\n");
3609
+ void *p1 = 0;
3610
+ int res = 0;
3611
+ res = SWIG_ConvertPtr(argv[2], &p1, SWIGTYPE_p_bro_record, 0 | 0 );
3612
+ if (!SWIG_IsOK(res)) {
3613
+ SWIG_exception_fail(SWIG_ArgError(res), "the val was supposed to be a BroRecord");
3614
+ }
3615
+ BroRecord *output;
3616
+ output = (BroRecord *)(p1);
3617
+ arg4 = output;
3618
+ }
3619
+ else {
3620
+ printf("Couldn't find a type to convert to\n");
3621
+ }
3622
+ // This seems to always be null, so keep it out of the ruby api for now.
3623
+ arg3 = NULL;
3624
+ }
3625
+ result = (int)bro_event_add_val(arg1,arg2,(char const *)arg3,(void const *)arg4);
3626
+ vresult = result ? Qtrue:Qfalse;
3627
+ return vresult;
3628
+ fail:
3629
+ return Qnil;
3630
+ }
3631
+
3632
+
3633
+ SWIGINTERN VALUE
3634
+ _wrap_bro_event_registry_add(int argc, VALUE *argv, VALUE self) {
3635
+ BroConn *arg1 = (BroConn *) 0 ;
3636
+ char *arg2 = (char *) 0 ;
3637
+ BroEventFunc arg3 = (BroEventFunc) 0 ;
3638
+ void *arg4 = (void *) 0 ;
3639
+ void *argp1 = 0 ;
3640
+ int res1 = 0 ;
3641
+ int res2 ;
3642
+ char *buf2 = 0 ;
3643
+ int alloc2 = 0 ;
3644
+
3645
+ if ((argc < 3) || (argc > 3)) {
3646
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3647
+ }
3648
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
3649
+ if (!SWIG_IsOK(res1)) {
3650
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_registry_add" "', argument " "1"" of type '" "BroConn *""'");
3651
+ }
3652
+ arg1 = (BroConn *)(argp1);
3653
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
3654
+ if (!SWIG_IsOK(res2)) {
3655
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_event_registry_add" "', argument " "2"" of type '" "char const *""'");
3656
+ }
3657
+ arg2 = buf2;
3658
+ {
3659
+ arg3 = (BroEventFunc) wrap_BroEventFunc;
3660
+ arg4 = (void *)argv[2];
3661
+ }
3662
+ bro_event_registry_add(arg1,(char const *)arg2,arg3,arg4);
3663
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3664
+ return Qnil;
3665
+ fail:
3666
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3667
+ return Qnil;
3668
+ }
3669
+
3670
+
3671
+ SWIGINTERN VALUE
3672
+ _wrap_bro_event_registry_request(int argc, VALUE *argv, VALUE self) {
3673
+ BroConn *arg1 = (BroConn *) 0 ;
3674
+ void *argp1 = 0 ;
3675
+ int res1 = 0 ;
3676
+
3677
+ if ((argc < 1) || (argc > 1)) {
3678
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3679
+ }
3680
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
3681
+ if (!SWIG_IsOK(res1)) {
3682
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_registry_request" "', argument " "1"" of type '" "BroConn *""'");
3683
+ }
3684
+ arg1 = (BroConn *)(argp1);
3685
+ bro_event_registry_request(arg1);
3686
+ return Qnil;
3687
+ fail:
3688
+ return Qnil;
3689
+ }
3690
+
3691
+
3692
+ SWIGINTERN VALUE
3693
+ _wrap_bro_event_queue_length(int argc, VALUE *argv, VALUE self) {
3694
+ BroConn *arg1 = (BroConn *) 0 ;
3695
+ int result;
3696
+ void *argp1 = 0 ;
3697
+ int res1 = 0 ;
3698
+ VALUE vresult = Qnil;
3699
+
3700
+ if ((argc < 1) || (argc > 1)) {
3701
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3702
+ }
3703
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
3704
+ if (!SWIG_IsOK(res1)) {
3705
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_queue_length" "', argument " "1"" of type '" "BroConn *""'");
3706
+ }
3707
+ arg1 = (BroConn *)(argp1);
3708
+ result = (int)bro_event_queue_length(arg1);
3709
+ vresult = SWIG_From_int((int)(result));
3710
+ return vresult;
3711
+ fail:
3712
+ return Qnil;
3713
+ }
3714
+
3715
+
3716
+ SWIGINTERN VALUE
3717
+ _wrap_bro_event_queue_flush(int argc, VALUE *argv, VALUE self) {
3718
+ BroConn *arg1 = (BroConn *) 0 ;
3719
+ int result;
3720
+ void *argp1 = 0 ;
3721
+ int res1 = 0 ;
3722
+ VALUE vresult = Qnil;
3723
+
3724
+ if ((argc < 1) || (argc > 1)) {
3725
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3726
+ }
3727
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
3728
+ if (!SWIG_IsOK(res1)) {
3729
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_queue_flush" "', argument " "1"" of type '" "BroConn *""'");
3730
+ }
3731
+ arg1 = (BroConn *)(argp1);
3732
+ result = (int)bro_event_queue_flush(arg1);
3733
+ vresult = SWIG_From_int((int)(result));
3734
+ return vresult;
3735
+ fail:
3736
+ return Qnil;
3737
+ }
3738
+
3739
+
3740
+ SWIGINTERN VALUE
3741
+ _wrap_bro_event_send(int argc, VALUE *argv, VALUE self) {
3742
+ BroConn *arg1 = (BroConn *) 0 ;
3743
+ BroEvent *arg2 = (BroEvent *) 0 ;
3744
+ int result;
3745
+ void *argp1 = 0 ;
3746
+ int res1 = 0 ;
3747
+ void *argp2 = 0 ;
3748
+ int res2 = 0 ;
3749
+ VALUE vresult = Qnil;
3750
+
3751
+ if ((argc < 2) || (argc > 2)) {
3752
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3753
+ }
3754
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_conn, 0 | 0 );
3755
+ if (!SWIG_IsOK(res1)) {
3756
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_send" "', argument " "1"" of type '" "BroConn *""'");
3757
+ }
3758
+ arg1 = (BroConn *)(argp1);
3759
+ res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_bro_event, 0 | 0 );
3760
+ if (!SWIG_IsOK(res2)) {
3761
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bro_event_send" "', argument " "2"" of type '" "BroEvent *""'");
3762
+ }
3763
+ arg2 = (BroEvent *)(argp2);
3764
+ result = (int)bro_event_send(arg1,arg2);
3765
+ vresult = result ? Qtrue:Qfalse;
3766
+ return vresult;
3767
+ fail:
3768
+ return Qnil;
3769
+ }
3770
+
3771
+
3772
+ SWIGINTERN VALUE
3773
+ _wrap_bro_event_free(int argc, VALUE *argv, VALUE self) {
3774
+ BroEvent *arg1 = (BroEvent *) 0 ;
3775
+ void *argp1 = 0 ;
3776
+ int res1 = 0 ;
3777
+
3778
+ if ((argc < 1) || (argc > 1)) {
3779
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3780
+ }
3781
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_event, 0 | 0 );
3782
+ if (!SWIG_IsOK(res1)) {
3783
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_event_free" "', argument " "1"" of type '" "BroEvent *""'");
3784
+ }
3785
+ arg1 = (BroEvent *)(argp1);
3786
+ bro_event_free(arg1);
3787
+ return Qnil;
3788
+ fail:
3789
+ return Qnil;
3790
+ }
3791
+
3792
+
3793
+ SWIGINTERN VALUE
3794
+ _wrap_bro_util_current_time(int argc, VALUE *argv, VALUE self) {
3795
+ double result;
3796
+ VALUE vresult = Qnil;
3797
+
3798
+ if ((argc < 0) || (argc > 0)) {
3799
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3800
+ }
3801
+ result = (double)bro_util_current_time();
3802
+ vresult = SWIG_From_double((double)(result));
3803
+ return vresult;
3804
+ fail:
3805
+ return Qnil;
3806
+ }
3807
+
3808
+
3809
+
3810
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3811
+
3812
+ static swig_type_info _swigt__p_bro_buf = {"_p_bro_buf", "struct bro_buf *|BroBuf *", 0, 0, (void*)0, 0};
3813
+ static swig_type_info _swigt__p_bro_conn = {"_p_bro_conn", "struct bro_conn *|BroConn *", 0, 0, (void*)0, 0};
3814
+ static swig_type_info _swigt__p_bro_event = {"_p_bro_event", "struct bro_event *|BroEvent *", 0, 0, (void*)0, 0};
3815
+ static swig_type_info _swigt__p_bro_port = {"_p_bro_port", "struct bro_port *|BroPort *", 0, 0, (void*)0, 0};
3816
+ static swig_type_info _swigt__p_bro_record = {"_p_bro_record", "struct bro_record *|BroRecord *", 0, 0, (void*)0, 0};
3817
+ static swig_type_info _swigt__p_bro_string = {"_p_bro_string", "struct bro_string *|BroString *", 0, 0, (void*)0, 0};
3818
+ static swig_type_info _swigt__p_bro_subnet = {"_p_bro_subnet", "struct bro_subnet *|BroSubnet *", 0, 0, (void*)0, 0};
3819
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3820
+ static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
3821
+ static swig_type_info _swigt__p_f_p_struct_bro_conn_v_______void = {"_p_f_p_struct_bro_conn_v_______void", "void (*)(struct bro_conn *,...)|BroEventFunc", 0, 0, (void*)0, 0};
3822
+ static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
3823
+ static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uchar *", 0, 0, (void*)0, 0};
3824
+ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|uint32 *", 0, 0, (void*)0, 0};
3825
+ static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint16 *", 0, 0, (void*)0, 0};
3826
+
3827
+ static swig_type_info *swig_type_initial[] = {
3828
+ &_swigt__p_bro_buf,
3829
+ &_swigt__p_bro_conn,
3830
+ &_swigt__p_bro_event,
3831
+ &_swigt__p_bro_port,
3832
+ &_swigt__p_bro_record,
3833
+ &_swigt__p_bro_string,
3834
+ &_swigt__p_bro_subnet,
3835
+ &_swigt__p_char,
3836
+ &_swigt__p_double,
3837
+ &_swigt__p_f_p_struct_bro_conn_v_______void,
3838
+ &_swigt__p_int,
3839
+ &_swigt__p_unsigned_char,
3840
+ &_swigt__p_unsigned_int,
3841
+ &_swigt__p_unsigned_short,
3842
+ };
3843
+
3844
+ static swig_cast_info _swigc__p_bro_buf[] = { {&_swigt__p_bro_buf, 0, 0, 0},{0, 0, 0, 0}};
3845
+ static swig_cast_info _swigc__p_bro_conn[] = { {&_swigt__p_bro_conn, 0, 0, 0},{0, 0, 0, 0}};
3846
+ static swig_cast_info _swigc__p_bro_event[] = { {&_swigt__p_bro_event, 0, 0, 0},{0, 0, 0, 0}};
3847
+ static swig_cast_info _swigc__p_bro_port[] = { {&_swigt__p_bro_port, 0, 0, 0},{0, 0, 0, 0}};
3848
+ static swig_cast_info _swigc__p_bro_record[] = { {&_swigt__p_bro_record, 0, 0, 0},{0, 0, 0, 0}};
3849
+ static swig_cast_info _swigc__p_bro_string[] = { {&_swigt__p_bro_string, 0, 0, 0},{0, 0, 0, 0}};
3850
+ static swig_cast_info _swigc__p_bro_subnet[] = { {&_swigt__p_bro_subnet, 0, 0, 0},{0, 0, 0, 0}};
3851
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3852
+ static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
3853
+ static swig_cast_info _swigc__p_f_p_struct_bro_conn_v_______void[] = { {&_swigt__p_f_p_struct_bro_conn_v_______void, 0, 0, 0},{0, 0, 0, 0}};
3854
+ static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
3855
+ static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
3856
+ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
3857
+ static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
3858
+
3859
+ static swig_cast_info *swig_cast_initial[] = {
3860
+ _swigc__p_bro_buf,
3861
+ _swigc__p_bro_conn,
3862
+ _swigc__p_bro_event,
3863
+ _swigc__p_bro_port,
3864
+ _swigc__p_bro_record,
3865
+ _swigc__p_bro_string,
3866
+ _swigc__p_bro_subnet,
3867
+ _swigc__p_char,
3868
+ _swigc__p_double,
3869
+ _swigc__p_f_p_struct_bro_conn_v_______void,
3870
+ _swigc__p_int,
3871
+ _swigc__p_unsigned_char,
3872
+ _swigc__p_unsigned_int,
3873
+ _swigc__p_unsigned_short,
3874
+ };
3875
+
3876
+
3877
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3878
+
3879
+ /* -----------------------------------------------------------------------------
3880
+ * Type initialization:
3881
+ * This problem is tough by the requirement that no dynamic
3882
+ * memory is used. Also, since swig_type_info structures store pointers to
3883
+ * swig_cast_info structures and swig_cast_info structures store pointers back
3884
+ * to swig_type_info structures, we need some lookup code at initialization.
3885
+ * The idea is that swig generates all the structures that are needed.
3886
+ * The runtime then collects these partially filled structures.
3887
+ * The SWIG_InitializeModule function takes these initial arrays out of
3888
+ * swig_module, and does all the lookup, filling in the swig_module.types
3889
+ * array with the correct data and linking the correct swig_cast_info
3890
+ * structures together.
3891
+ *
3892
+ * The generated swig_type_info structures are assigned staticly to an initial
3893
+ * array. We just loop though that array, and handle each type individually.
3894
+ * First we lookup if this type has been already loaded, and if so, use the
3895
+ * loaded structure instead of the generated one. Then we have to fill in the
3896
+ * cast linked list. The cast data is initially stored in something like a
3897
+ * two-dimensional array. Each row corresponds to a type (there are the same
3898
+ * number of rows as there are in the swig_type_initial array). Each entry in
3899
+ * a column is one of the swig_cast_info structures for that type.
3900
+ * The cast_initial array is actually an array of arrays, because each row has
3901
+ * a variable number of columns. So to actually build the cast linked list,
3902
+ * we find the array of casts associated with the type, and loop through it
3903
+ * adding the casts to the list. The one last trick we need to do is making
3904
+ * sure the type pointer in the swig_cast_info struct is correct.
3905
+ *
3906
+ * First off, we lookup the cast->type name to see if it is already loaded.
3907
+ * There are three cases to handle:
3908
+ * 1) If the cast->type has already been loaded AND the type we are adding
3909
+ * casting info to has not been loaded (it is in this module), THEN we
3910
+ * replace the cast->type pointer with the type pointer that has already
3911
+ * been loaded.
3912
+ * 2) If BOTH types (the one we are adding casting info to, and the
3913
+ * cast->type) are loaded, THEN the cast info has already been loaded by
3914
+ * the previous module so we just ignore it.
3915
+ * 3) Finally, if cast->type has not already been loaded, then we add that
3916
+ * swig_cast_info to the linked list (because the cast->type) pointer will
3917
+ * be correct.
3918
+ * ----------------------------------------------------------------------------- */
3919
+
3920
+ #ifdef __cplusplus
3921
+ extern "C" {
3922
+ #if 0
3923
+ } /* c-mode */
3924
+ #endif
3925
+ #endif
3926
+
3927
+ #if 0
3928
+ #define SWIGRUNTIME_DEBUG
3929
+ #endif
3930
+
3931
+ SWIGRUNTIME void
3932
+ SWIG_InitializeModule(void *clientdata) {
3933
+ size_t i;
3934
+ swig_module_info *module_head;
3935
+ static int init_run = 0;
3936
+
3937
+ clientdata = clientdata;
3938
+
3939
+ if (init_run) return;
3940
+ init_run = 1;
3941
+
3942
+ /* Initialize the swig_module */
3943
+ swig_module.type_initial = swig_type_initial;
3944
+ swig_module.cast_initial = swig_cast_initial;
3945
+
3946
+ /* Try and load any already created modules */
3947
+ module_head = SWIG_GetModule(clientdata);
3948
+ if (module_head) {
3949
+ swig_module.next = module_head->next;
3950
+ module_head->next = &swig_module;
3951
+ } else {
3952
+ /* This is the first module loaded */
3953
+ swig_module.next = &swig_module;
3954
+ SWIG_SetModule(clientdata, &swig_module);
3955
+ }
3956
+
3957
+ /* Now work on filling in swig_module.types */
3958
+ #ifdef SWIGRUNTIME_DEBUG
3959
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3960
+ #endif
3961
+ for (i = 0; i < swig_module.size; ++i) {
3962
+ swig_type_info *type = 0;
3963
+ swig_type_info *ret;
3964
+ swig_cast_info *cast;
3965
+
3966
+ #ifdef SWIGRUNTIME_DEBUG
3967
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3968
+ #endif
3969
+
3970
+ /* if there is another module already loaded */
3971
+ if (swig_module.next != &swig_module) {
3972
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3973
+ }
3974
+ if (type) {
3975
+ /* Overwrite clientdata field */
3976
+ #ifdef SWIGRUNTIME_DEBUG
3977
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
3978
+ #endif
3979
+ if (swig_module.type_initial[i]->clientdata) {
3980
+ type->clientdata = swig_module.type_initial[i]->clientdata;
3981
+ #ifdef SWIGRUNTIME_DEBUG
3982
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3983
+ #endif
3984
+ }
3985
+ } else {
3986
+ type = swig_module.type_initial[i];
3987
+ }
3988
+
3989
+ /* Insert casting types */
3990
+ cast = swig_module.cast_initial[i];
3991
+ while (cast->type) {
3992
+
3993
+ /* Don't need to add information already in the list */
3994
+ ret = 0;
3995
+ #ifdef SWIGRUNTIME_DEBUG
3996
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3997
+ #endif
3998
+ if (swig_module.next != &swig_module) {
3999
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
4000
+ #ifdef SWIGRUNTIME_DEBUG
4001
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
4002
+ #endif
4003
+ }
4004
+ if (ret) {
4005
+ if (type == swig_module.type_initial[i]) {
4006
+ #ifdef SWIGRUNTIME_DEBUG
4007
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
4008
+ #endif
4009
+ cast->type = ret;
4010
+ ret = 0;
4011
+ } else {
4012
+ /* Check for casting already in the list */
4013
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
4014
+ #ifdef SWIGRUNTIME_DEBUG
4015
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
4016
+ #endif
4017
+ if (!ocast) ret = 0;
4018
+ }
4019
+ }
4020
+
4021
+ if (!ret) {
4022
+ #ifdef SWIGRUNTIME_DEBUG
4023
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
4024
+ #endif
4025
+ if (type->cast) {
4026
+ type->cast->prev = cast;
4027
+ cast->next = type->cast;
4028
+ }
4029
+ type->cast = cast;
4030
+ }
4031
+ cast++;
4032
+ }
4033
+ /* Set entry in modules->types array equal to the type */
4034
+ swig_module.types[i] = type;
4035
+ }
4036
+ swig_module.types[i] = 0;
4037
+
4038
+ #ifdef SWIGRUNTIME_DEBUG
4039
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
4040
+ for (i = 0; i < swig_module.size; ++i) {
4041
+ int j = 0;
4042
+ swig_cast_info *cast = swig_module.cast_initial[i];
4043
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4044
+ while (cast->type) {
4045
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
4046
+ cast++;
4047
+ ++j;
4048
+ }
4049
+ printf("---- Total casts: %d\n",j);
4050
+ }
4051
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
4052
+ #endif
4053
+ }
4054
+
4055
+ /* This function will propagate the clientdata field of type to
4056
+ * any new swig_type_info structures that have been added into the list
4057
+ * of equivalent types. It is like calling
4058
+ * SWIG_TypeClientData(type, clientdata) a second time.
4059
+ */
4060
+ SWIGRUNTIME void
4061
+ SWIG_PropagateClientData(void) {
4062
+ size_t i;
4063
+ swig_cast_info *equiv;
4064
+ static int init_run = 0;
4065
+
4066
+ if (init_run) return;
4067
+ init_run = 1;
4068
+
4069
+ for (i = 0; i < swig_module.size; i++) {
4070
+ if (swig_module.types[i]->clientdata) {
4071
+ equiv = swig_module.types[i]->cast;
4072
+ while (equiv) {
4073
+ if (!equiv->converter) {
4074
+ if (equiv->type && !equiv->type->clientdata)
4075
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
4076
+ }
4077
+ equiv = equiv->next;
4078
+ }
4079
+ }
4080
+ }
4081
+ }
4082
+
4083
+ #ifdef __cplusplus
4084
+ #if 0
4085
+ { /* c-mode */
4086
+ #endif
4087
+ }
4088
+ #endif
4089
+
4090
+
4091
+ #ifdef __cplusplus
4092
+ extern "C"
4093
+ #endif
4094
+ SWIGEXPORT void Init_broccoli_ext(void) {
4095
+ size_t i;
4096
+
4097
+ SWIG_InitRuntime();
4098
+ mBroccoli_ext = rb_define_module("Broccoli_ext");
4099
+
4100
+ SWIG_InitializeModule(0);
4101
+ for (i = 0; i < swig_module.size; i++) {
4102
+ SWIG_define_class(swig_module.types[i]);
4103
+ }
4104
+
4105
+ SWIG_RubyInitializeTrackings();
4106
+ rb_define_module_function(mBroccoli_ext, "to_brostring", _wrap_to_brostring, -1);
4107
+ rb_define_singleton_method(mBroccoli_ext, "bro_debug_calltrace", bro_debug_calltrace_get, 0);
4108
+ rb_define_singleton_method(mBroccoli_ext, "bro_debug_calltrace=", bro_debug_calltrace_set, 1);
4109
+ rb_define_singleton_method(mBroccoli_ext, "bro_debug_messages", bro_debug_messages_get, 0);
4110
+ rb_define_singleton_method(mBroccoli_ext, "bro_debug_messages=", bro_debug_messages_set, 1);
4111
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_BOOL", SWIG_From_int((int)(1)));
4112
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_INT", SWIG_From_int((int)(2)));
4113
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_COUNT", SWIG_From_int((int)(3)));
4114
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_COUNTER", SWIG_From_int((int)(4)));
4115
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_DOUBLE", SWIG_From_int((int)(5)));
4116
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_TIME", SWIG_From_int((int)(6)));
4117
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_INTERVAL", SWIG_From_int((int)(7)));
4118
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_STRING", SWIG_From_int((int)(8)));
4119
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_PATTERN", SWIG_From_int((int)(9)));
4120
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_ENUM", SWIG_From_int((int)(10)));
4121
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_TIMER", SWIG_From_int((int)(11)));
4122
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_PORT", SWIG_From_int((int)(12)));
4123
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_IPADDR", SWIG_From_int((int)(13)));
4124
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_NET", SWIG_From_int((int)(14)));
4125
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_SUBNET", SWIG_From_int((int)(15)));
4126
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_ANY", SWIG_From_int((int)(16)));
4127
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_TABLE", SWIG_From_int((int)(17)));
4128
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_UNION", SWIG_From_int((int)(18)));
4129
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_RECORD", SWIG_From_int((int)(19)));
4130
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_LIST", SWIG_From_int((int)(20)));
4131
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_FUNC", SWIG_From_int((int)(21)));
4132
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_FILE", SWIG_From_int((int)(22)));
4133
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_VECTOR", SWIG_From_int((int)(23)));
4134
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_ERROR", SWIG_From_int((int)(24)));
4135
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_PACKET", SWIG_From_int((int)(25)));
4136
+ rb_define_const(mBroccoli_ext, "BRO_TYPE_MAX", SWIG_From_int((int)(26)));
4137
+ rb_define_const(mBroccoli_ext, "BRO_CFLAG_NONE", SWIG_From_int((int)(0)));
4138
+ rb_define_const(mBroccoli_ext, "BRO_CFLAG_RECONNECT", SWIG_From_int((int)((1 << 0))));
4139
+ rb_define_const(mBroccoli_ext, "BRO_CFLAG_ALWAYS_QUEUE", SWIG_From_int((int)((1 << 1))));
4140
+ rb_define_const(mBroccoli_ext, "BRO_CFLAG_SHAREABLE", SWIG_From_int((int)((1 << 2))));
4141
+ rb_define_const(mBroccoli_ext, "BRO_CFLAG_DONTCACHE", SWIG_From_int((int)((1 << 3))));
4142
+
4143
+ cBroString.klass = rb_define_class_under(mBroccoli_ext, "BroString", rb_cObject);
4144
+ SWIG_TypeClientData(SWIGTYPE_p_bro_string, (void *) &cBroString);
4145
+ rb_define_alloc_func(cBroString.klass, _wrap_BroString_allocate);
4146
+ rb_define_method(cBroString.klass, "initialize", _wrap_new_BroString, -1);
4147
+ rb_define_method(cBroString.klass, "str_len=", _wrap_BroString_str_len_set, -1);
4148
+ rb_define_method(cBroString.klass, "str_len", _wrap_BroString_str_len_get, -1);
4149
+ rb_define_method(cBroString.klass, "str_val=", _wrap_BroString_str_val_set, -1);
4150
+ rb_define_method(cBroString.klass, "str_val", _wrap_BroString_str_val_get, -1);
4151
+ cBroString.mark = 0;
4152
+ cBroString.destroy = (void (*)(void *)) free_BroString;
4153
+ cBroString.trackObjects = 0;
4154
+
4155
+ cBroPort.klass = rb_define_class_under(mBroccoli_ext, "BroPort", rb_cObject);
4156
+ SWIG_TypeClientData(SWIGTYPE_p_bro_port, (void *) &cBroPort);
4157
+ rb_define_alloc_func(cBroPort.klass, _wrap_BroPort_allocate);
4158
+ rb_define_method(cBroPort.klass, "initialize", _wrap_new_BroPort, -1);
4159
+ rb_define_method(cBroPort.klass, "port_num=", _wrap_BroPort_port_num_set, -1);
4160
+ rb_define_method(cBroPort.klass, "port_num", _wrap_BroPort_port_num_get, -1);
4161
+ rb_define_method(cBroPort.klass, "port_proto=", _wrap_BroPort_port_proto_set, -1);
4162
+ rb_define_method(cBroPort.klass, "port_proto", _wrap_BroPort_port_proto_get, -1);
4163
+ cBroPort.mark = 0;
4164
+ cBroPort.destroy = (void (*)(void *)) free_BroPort;
4165
+ cBroPort.trackObjects = 0;
4166
+
4167
+ cBroSubnet.klass = rb_define_class_under(mBroccoli_ext, "BroSubnet", rb_cObject);
4168
+ SWIG_TypeClientData(SWIGTYPE_p_bro_subnet, (void *) &cBroSubnet);
4169
+ rb_define_alloc_func(cBroSubnet.klass, _wrap_BroSubnet_allocate);
4170
+ rb_define_method(cBroSubnet.klass, "initialize", _wrap_new_BroSubnet, -1);
4171
+ rb_define_method(cBroSubnet.klass, "sn_net=", _wrap_BroSubnet_sn_net_set, -1);
4172
+ rb_define_method(cBroSubnet.klass, "sn_net", _wrap_BroSubnet_sn_net_get, -1);
4173
+ rb_define_method(cBroSubnet.klass, "sn_width=", _wrap_BroSubnet_sn_width_set, -1);
4174
+ rb_define_method(cBroSubnet.klass, "sn_width", _wrap_BroSubnet_sn_width_get, -1);
4175
+ cBroSubnet.mark = 0;
4176
+ cBroSubnet.destroy = (void (*)(void *)) free_BroSubnet;
4177
+ cBroSubnet.trackObjects = 0;
4178
+ rb_define_module_function(mBroccoli_ext, "bro_conn_new_str", _wrap_bro_conn_new_str, -1);
4179
+ rb_define_module_function(mBroccoli_ext, "bro_conn_connect", _wrap_bro_conn_connect, -1);
4180
+ rb_define_module_function(mBroccoli_ext, "bro_conn_process_input", _wrap_bro_conn_process_input, -1);
4181
+ rb_define_module_function(mBroccoli_ext, "bro_conn_delete", _wrap_bro_conn_delete, -1);
4182
+ rb_define_module_function(mBroccoli_ext, "bro_conn_alive?", _wrap_bro_conn_aliveq___, -1);
4183
+ rb_define_module_function(mBroccoli_ext, "bro_conn_data_get", _wrap_bro_conn_data_get, -1);
4184
+ rb_define_module_function(mBroccoli_ext, "bro_conn_get_fd", _wrap_bro_conn_get_fd, -1);
4185
+ rb_define_module_function(mBroccoli_ext, "bro_conf_get_int", _wrap_bro_conf_get_int, -1);
4186
+ rb_define_module_function(mBroccoli_ext, "bro_conf_get_dbl", _wrap_bro_conf_get_dbl, -1);
4187
+ rb_define_module_function(mBroccoli_ext, "bro_conf_get_str", _wrap_bro_conf_get_str, -1);
4188
+ rb_define_module_function(mBroccoli_ext, "bro_string_init", _wrap_bro_string_init, -1);
4189
+ rb_define_module_function(mBroccoli_ext, "bro_string_set", _wrap_bro_string_set, -1);
4190
+ rb_define_module_function(mBroccoli_ext, "bro_string_set_data", _wrap_bro_string_set_data, -1);
4191
+ rb_define_module_function(mBroccoli_ext, "bro_string_get_data", _wrap_bro_string_get_data, -1);
4192
+ rb_define_module_function(mBroccoli_ext, "bro_string_get_length", _wrap_bro_string_get_length, -1);
4193
+ rb_define_module_function(mBroccoli_ext, "bro_string_copy", _wrap_bro_string_copy, -1);
4194
+ rb_define_module_function(mBroccoli_ext, "bro_string_cleanup", _wrap_bro_string_cleanup, -1);
4195
+ rb_define_module_function(mBroccoli_ext, "bro_string_free", _wrap_bro_string_free, -1);
4196
+ rb_define_module_function(mBroccoli_ext, "bro_record_new", _wrap_bro_record_new, -1);
4197
+ rb_define_module_function(mBroccoli_ext, "bro_record_add_val", _wrap_bro_record_add_val, -1);
4198
+ rb_define_module_function(mBroccoli_ext, "bro_record_get_named_val", _wrap_bro_record_get_named_val, -1);
4199
+ rb_define_module_function(mBroccoli_ext, "bro_record_get_nth_val", _wrap_bro_record_get_nth_val, -1);
4200
+ rb_define_module_function(mBroccoli_ext, "bro_record_set_nth_val", _wrap_bro_record_set_nth_val, -1);
4201
+ rb_define_module_function(mBroccoli_ext, "bro_record_set_named_val", _wrap_bro_record_set_named_val, -1);
4202
+ rb_define_module_function(mBroccoli_ext, "bro_record_free", _wrap_bro_record_free, -1);
4203
+ rb_define_module_function(mBroccoli_ext, "bro_event_new", _wrap_bro_event_new, -1);
4204
+ rb_define_module_function(mBroccoli_ext, "bro_event_add_val", _wrap_bro_event_add_val, -1);
4205
+ rb_define_module_function(mBroccoli_ext, "bro_event_registry_add", _wrap_bro_event_registry_add, -1);
4206
+ rb_define_module_function(mBroccoli_ext, "bro_event_registry_request", _wrap_bro_event_registry_request, -1);
4207
+ rb_define_module_function(mBroccoli_ext, "bro_event_queue_length", _wrap_bro_event_queue_length, -1);
4208
+ rb_define_module_function(mBroccoli_ext, "bro_event_queue_flush", _wrap_bro_event_queue_flush, -1);
4209
+ rb_define_module_function(mBroccoli_ext, "bro_event_send", _wrap_bro_event_send, -1);
4210
+ rb_define_module_function(mBroccoli_ext, "bro_event_free", _wrap_bro_event_free, -1);
4211
+ rb_define_module_function(mBroccoli_ext, "bro_util_current_time", _wrap_bro_util_current_time, -1);
4212
+ }
4213
+