broccoli 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples/broping.rb +1 -1
- data/ext/broccoli/Makefile +2 -2
- data/ext/broccoli/broccoli.bundle +0 -0
- data/ext/broccoli/broccoli.i +16 -16
- data/ext/broccoli/broccoli_wrap.c +50 -16
- data/ext/broccoli/broccoli_wrap.o +0 -0
- metadata +5 -3
data/examples/broping.rb
CHANGED
data/ext/broccoli/Makefile
CHANGED
|
@@ -3,7 +3,7 @@ SHELL = /bin/sh
|
|
|
3
3
|
|
|
4
4
|
#### Start of system configuration section. ####
|
|
5
5
|
|
|
6
|
-
srcdir =
|
|
6
|
+
srcdir = /Users/seth/Dev/rbroccoli/trunk/ext/broccoli
|
|
7
7
|
topdir = /opt/local/lib/ruby/1.8/i686-darwin8.10.1
|
|
8
8
|
hdrdir = $(topdir)
|
|
9
9
|
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
|
@@ -45,7 +45,7 @@ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
|
|
45
45
|
|
|
46
46
|
RUBY_EXTCONF_H =
|
|
47
47
|
CFLAGS = -fno-common -O2 -fno-common -pipe -fno-common -I/usr/local/bro/include -I/usr/local/bro/include -DBROCCOLI
|
|
48
|
-
INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I
|
|
48
|
+
INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I/Users/seth/Dev/rbroccoli/trunk/ext/broccoli
|
|
49
49
|
CPPFLAGS = -DHAVE_BROCCOLI_H -I/opt/local/include
|
|
50
50
|
CXXFLAGS = $(CFLAGS)
|
|
51
51
|
DLDFLAGS = -L. -L/opt/local/lib -L/usr/local/bro/lib -lbroccoli
|
|
Binary file
|
data/ext/broccoli/broccoli.i
CHANGED
|
@@ -21,62 +21,62 @@ BroString to_brostring(VALUE obj){
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
static void
|
|
24
|
-
wrap_BroCompactEventFunc(BroConn *bc, void *
|
|
24
|
+
wrap_BroCompactEventFunc(BroConn *bc, void *user_data, BroEvMeta *meta)
|
|
25
25
|
{
|
|
26
26
|
int i;
|
|
27
27
|
int callback_arity = 0;
|
|
28
|
-
VALUE proc = (VALUE)
|
|
28
|
+
VALUE proc = (VALUE)user_data;
|
|
29
29
|
VALUE out[15] = {Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,
|
|
30
30
|
Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil};
|
|
31
31
|
|
|
32
32
|
callback_arity = NUM2INT(rb_funcall(proc, rb_intern("arity"), 0));
|
|
33
|
-
if ( callback_arity !=
|
|
33
|
+
if ( callback_arity != meta->ev_numargs )
|
|
34
34
|
{
|
|
35
35
|
printf("ERROR: callback has %d arguments when it should have %d arguments.\n",
|
|
36
36
|
callback_arity,
|
|
37
|
-
|
|
37
|
+
meta->ev_numargs);
|
|
38
38
|
}
|
|
39
|
-
for(i=0 ; i <
|
|
39
|
+
for(i=0 ; i < meta->ev_numargs ; i++)
|
|
40
40
|
{
|
|
41
41
|
//printf("Loop #%i\n", i);
|
|
42
|
-
switch (
|
|
42
|
+
switch (meta->ev_args[i].arg_type)
|
|
43
43
|
{
|
|
44
44
|
case BRO_TYPE_RECORD:
|
|
45
45
|
//printf("Found a BroRecord in the callback wrapper\n");
|
|
46
|
-
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(
|
|
46
|
+
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(meta->ev_args[i].arg_data), SWIGTYPE_p_bro_record, 0 | 0 );
|
|
47
47
|
break;
|
|
48
48
|
case BRO_TYPE_PORT:
|
|
49
|
-
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(
|
|
49
|
+
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(meta->ev_args[i].arg_data), SWIGTYPE_p_bro_port, 0 | 0 );
|
|
50
50
|
break;
|
|
51
51
|
case BRO_TYPE_INT:
|
|
52
52
|
case BRO_TYPE_ENUM:
|
|
53
53
|
//printf("Found an integer in the callback wrapper\n");
|
|
54
|
-
out[i] = INT2NUM( *((int *)
|
|
54
|
+
out[i] = INT2NUM( *((int *) meta->ev_args[i].arg_data) );
|
|
55
55
|
break;
|
|
56
56
|
case BRO_TYPE_BOOL:
|
|
57
57
|
//printf("Found a boolean in the callback wrapper\n");
|
|
58
|
-
out[i] = *((int *)
|
|
58
|
+
out[i] = *((int *) meta->ev_args[i].arg_data) ? Qtrue : Qfalse;
|
|
59
59
|
break;
|
|
60
60
|
case BRO_TYPE_STRING:
|
|
61
61
|
//printf("Found a BroString in the callback wrapper\n");
|
|
62
|
-
out[i] = rb_str_new( (char*) bro_string_get_data( (BroString*)
|
|
63
|
-
bro_string_get_length( (BroString*)
|
|
62
|
+
out[i] = rb_str_new( (char*) bro_string_get_data( (BroString*) meta->ev_args[i].arg_data ),
|
|
63
|
+
bro_string_get_length( (BroString*) meta->ev_args[i].arg_data ) );
|
|
64
64
|
break;
|
|
65
65
|
case BRO_TYPE_TIME:
|
|
66
66
|
case BRO_TYPE_DOUBLE:
|
|
67
67
|
case BRO_TYPE_INTERVAL:
|
|
68
68
|
//printf("Found a double in the callback wrapper\n");
|
|
69
|
-
out[i] = rb_float_new( *((double *)
|
|
69
|
+
out[i] = rb_float_new( *((double *) meta->ev_args[i].arg_data) );
|
|
70
70
|
break;
|
|
71
71
|
case BRO_TYPE_COUNT:
|
|
72
72
|
case BRO_TYPE_NET:
|
|
73
73
|
//printf("Found a 32bit unsigned integer in the callback wrapper\n");
|
|
74
|
-
out[i] = UINT2NUM( *((uint32 *)
|
|
74
|
+
out[i] = UINT2NUM( *((uint32 *) meta->ev_args[i].arg_data) );
|
|
75
75
|
break;
|
|
76
76
|
case BRO_TYPE_IPADDR:
|
|
77
77
|
//printf("Found an ip address... making it a string\n");
|
|
78
78
|
//output ip addresses as strings that can be unpacked from ruby.
|
|
79
|
-
out[i] = rb_str_new2((char *)
|
|
79
|
+
out[i] = rb_str_new2((char *) meta->ev_args[i].arg_data);
|
|
80
80
|
break;
|
|
81
81
|
case BRO_TYPE_COUNTER:
|
|
82
82
|
case BRO_TYPE_TIMER:
|
|
@@ -103,7 +103,7 @@ wrap_BroCompactEventFunc(BroConn *bc, void *data, int num_args, BroEvArg *args)
|
|
|
103
103
|
rb_funcall2(proc, rb_intern("call"), callback_arity, out);
|
|
104
104
|
|
|
105
105
|
bc = NULL;
|
|
106
|
-
|
|
106
|
+
user_data = NULL;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
%}
|
|
@@ -1608,62 +1608,62 @@ BroString to_brostring(VALUE obj){
|
|
|
1608
1608
|
}
|
|
1609
1609
|
|
|
1610
1610
|
static void
|
|
1611
|
-
wrap_BroCompactEventFunc(BroConn *bc, void *
|
|
1611
|
+
wrap_BroCompactEventFunc(BroConn *bc, void *user_data, BroEvMeta *meta)
|
|
1612
1612
|
{
|
|
1613
1613
|
int i;
|
|
1614
1614
|
int callback_arity = 0;
|
|
1615
|
-
VALUE proc = (VALUE)
|
|
1615
|
+
VALUE proc = (VALUE)user_data;
|
|
1616
1616
|
VALUE out[15] = {Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,
|
|
1617
1617
|
Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil};
|
|
1618
1618
|
|
|
1619
1619
|
callback_arity = NUM2INT(rb_funcall(proc, rb_intern("arity"), 0));
|
|
1620
|
-
if ( callback_arity !=
|
|
1620
|
+
if ( callback_arity != meta->ev_numargs )
|
|
1621
1621
|
{
|
|
1622
1622
|
printf("ERROR: callback has %d arguments when it should have %d arguments.\n",
|
|
1623
1623
|
callback_arity,
|
|
1624
|
-
|
|
1624
|
+
meta->ev_numargs);
|
|
1625
1625
|
}
|
|
1626
|
-
for(i=0 ; i <
|
|
1626
|
+
for(i=0 ; i < meta->ev_numargs ; i++)
|
|
1627
1627
|
{
|
|
1628
1628
|
//printf("Loop #%i\n", i);
|
|
1629
|
-
switch (
|
|
1629
|
+
switch (meta->ev_args[i].arg_type)
|
|
1630
1630
|
{
|
|
1631
1631
|
case BRO_TYPE_RECORD:
|
|
1632
1632
|
//printf("Found a BroRecord in the callback wrapper\n");
|
|
1633
|
-
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(
|
|
1633
|
+
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(meta->ev_args[i].arg_data), SWIGTYPE_p_bro_record, 0 | 0 );
|
|
1634
1634
|
break;
|
|
1635
1635
|
case BRO_TYPE_PORT:
|
|
1636
|
-
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(
|
|
1636
|
+
out[i] = SWIG_NewPointerObj(SWIG_as_voidptr(meta->ev_args[i].arg_data), SWIGTYPE_p_bro_port, 0 | 0 );
|
|
1637
1637
|
break;
|
|
1638
1638
|
case BRO_TYPE_INT:
|
|
1639
1639
|
case BRO_TYPE_ENUM:
|
|
1640
1640
|
//printf("Found an integer in the callback wrapper\n");
|
|
1641
|
-
out[i] = INT2NUM( *((int *)
|
|
1641
|
+
out[i] = INT2NUM( *((int *) meta->ev_args[i].arg_data) );
|
|
1642
1642
|
break;
|
|
1643
1643
|
case BRO_TYPE_BOOL:
|
|
1644
1644
|
//printf("Found a boolean in the callback wrapper\n");
|
|
1645
|
-
out[i] = *((int *)
|
|
1645
|
+
out[i] = *((int *) meta->ev_args[i].arg_data) ? Qtrue : Qfalse;
|
|
1646
1646
|
break;
|
|
1647
1647
|
case BRO_TYPE_STRING:
|
|
1648
1648
|
//printf("Found a BroString in the callback wrapper\n");
|
|
1649
|
-
out[i] = rb_str_new( (char*) bro_string_get_data( (BroString*)
|
|
1650
|
-
bro_string_get_length( (BroString*)
|
|
1649
|
+
out[i] = rb_str_new( (char*) bro_string_get_data( (BroString*) meta->ev_args[i].arg_data ),
|
|
1650
|
+
bro_string_get_length( (BroString*) meta->ev_args[i].arg_data ) );
|
|
1651
1651
|
break;
|
|
1652
1652
|
case BRO_TYPE_TIME:
|
|
1653
1653
|
case BRO_TYPE_DOUBLE:
|
|
1654
1654
|
case BRO_TYPE_INTERVAL:
|
|
1655
1655
|
//printf("Found a double in the callback wrapper\n");
|
|
1656
|
-
out[i] = rb_float_new( *((double *)
|
|
1656
|
+
out[i] = rb_float_new( *((double *) meta->ev_args[i].arg_data) );
|
|
1657
1657
|
break;
|
|
1658
1658
|
case BRO_TYPE_COUNT:
|
|
1659
1659
|
case BRO_TYPE_NET:
|
|
1660
1660
|
//printf("Found a 32bit unsigned integer in the callback wrapper\n");
|
|
1661
|
-
out[i] = UINT2NUM( *((uint32 *)
|
|
1661
|
+
out[i] = UINT2NUM( *((uint32 *) meta->ev_args[i].arg_data) );
|
|
1662
1662
|
break;
|
|
1663
1663
|
case BRO_TYPE_IPADDR:
|
|
1664
1664
|
//printf("Found an ip address... making it a string\n");
|
|
1665
1665
|
//output ip addresses as strings that can be unpacked from ruby.
|
|
1666
|
-
out[i] = rb_str_new2((char *)
|
|
1666
|
+
out[i] = rb_str_new2((char *) meta->ev_args[i].arg_data);
|
|
1667
1667
|
break;
|
|
1668
1668
|
case BRO_TYPE_COUNTER:
|
|
1669
1669
|
case BRO_TYPE_TIMER:
|
|
@@ -1690,7 +1690,7 @@ wrap_BroCompactEventFunc(BroConn *bc, void *data, int num_args, BroEvArg *args)
|
|
|
1690
1690
|
rb_funcall2(proc, rb_intern("call"), callback_arity, out);
|
|
1691
1691
|
|
|
1692
1692
|
bc = NULL;
|
|
1693
|
-
|
|
1693
|
+
user_data = NULL;
|
|
1694
1694
|
}
|
|
1695
1695
|
|
|
1696
1696
|
|
|
@@ -5285,6 +5285,38 @@ fail:
|
|
|
5285
5285
|
}
|
|
5286
5286
|
|
|
5287
5287
|
|
|
5288
|
+
SWIGINTERN VALUE
|
|
5289
|
+
_wrap_bro_record_get_nth_name(int argc, VALUE *argv, VALUE self) {
|
|
5290
|
+
BroRecord *arg1 = (BroRecord *) 0 ;
|
|
5291
|
+
int arg2 ;
|
|
5292
|
+
char *result = 0 ;
|
|
5293
|
+
void *argp1 = 0 ;
|
|
5294
|
+
int res1 = 0 ;
|
|
5295
|
+
int val2 ;
|
|
5296
|
+
int ecode2 = 0 ;
|
|
5297
|
+
VALUE vresult = Qnil;
|
|
5298
|
+
|
|
5299
|
+
if ((argc < 2) || (argc > 2)) {
|
|
5300
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
|
5301
|
+
}
|
|
5302
|
+
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_bro_record, 0 | 0 );
|
|
5303
|
+
if (!SWIG_IsOK(res1)) {
|
|
5304
|
+
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bro_record_get_nth_name" "', argument " "1"" of type '" "BroRecord *""'");
|
|
5305
|
+
}
|
|
5306
|
+
arg1 = (BroRecord *)(argp1);
|
|
5307
|
+
ecode2 = SWIG_AsVal_int(argv[1], &val2);
|
|
5308
|
+
if (!SWIG_IsOK(ecode2)) {
|
|
5309
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bro_record_get_nth_name" "', argument " "2"" of type '" "int""'");
|
|
5310
|
+
}
|
|
5311
|
+
arg2 = (int)(val2);
|
|
5312
|
+
result = (char *)bro_record_get_nth_name(arg1,arg2);
|
|
5313
|
+
vresult = SWIG_FromCharPtr((const char *)result);
|
|
5314
|
+
return vresult;
|
|
5315
|
+
fail:
|
|
5316
|
+
return Qnil;
|
|
5317
|
+
}
|
|
5318
|
+
|
|
5319
|
+
|
|
5288
5320
|
SWIGINTERN VALUE
|
|
5289
5321
|
_wrap_bro_record_get_named_val(int argc, VALUE *argv, VALUE self) {
|
|
5290
5322
|
BroRecord *arg1 = (BroRecord *) 0 ;
|
|
@@ -6665,6 +6697,7 @@ SWIGEXPORT void Init_broccoli(void) {
|
|
|
6665
6697
|
rb_define_const(mBroccoli, "BRO_CFLAG_SHAREABLE", SWIG_From_int((int)((1 << 2))));
|
|
6666
6698
|
rb_define_const(mBroccoli, "BRO_CFLAG_DONTCACHE", SWIG_From_int((int)((1 << 3))));
|
|
6667
6699
|
rb_define_const(mBroccoli, "BRO_CFLAG_YIELD", SWIG_From_int((int)((1 << 4))));
|
|
6700
|
+
rb_define_const(mBroccoli, "BRO_CFLAG_CACHE", SWIG_From_int((int)((1 << 5))));
|
|
6668
6701
|
|
|
6669
6702
|
cBroString.klass = rb_define_class_under(mBroccoli, "BroString", rb_cObject);
|
|
6670
6703
|
SWIG_TypeClientData(SWIGTYPE_p_bro_string, (void *) &cBroString);
|
|
@@ -6810,6 +6843,7 @@ SWIGEXPORT void Init_broccoli(void) {
|
|
|
6810
6843
|
rb_define_module_function(mBroccoli, "bro_record_get_length", _wrap_bro_record_get_length, -1);
|
|
6811
6844
|
rb_define_module_function(mBroccoli, "bro_record_add_val", _wrap_bro_record_add_val, -1);
|
|
6812
6845
|
rb_define_module_function(mBroccoli, "bro_record_get_nth_val", _wrap_bro_record_get_nth_val, -1);
|
|
6846
|
+
rb_define_module_function(mBroccoli, "bro_record_get_nth_name", _wrap_bro_record_get_nth_name, -1);
|
|
6813
6847
|
rb_define_module_function(mBroccoli, "bro_record_get_named_val", _wrap_bro_record_get_named_val, -1);
|
|
6814
6848
|
rb_define_module_function(mBroccoli, "bro_record_set_nth_val", _wrap_bro_record_set_nth_val, -1);
|
|
6815
6849
|
rb_define_module_function(mBroccoli, "bro_record_set_named_val", _wrap_bro_record_set_named_val, -1);
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: broccoli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Seth Hall
|
|
@@ -9,7 +9,7 @@ autorequire: bro
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-06-20 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -29,8 +29,10 @@ files:
|
|
|
29
29
|
- README
|
|
30
30
|
- ext/broccoli
|
|
31
31
|
- ext/broccoli/autogen.sh
|
|
32
|
+
- ext/broccoli/broccoli.bundle
|
|
32
33
|
- ext/broccoli/broccoli.i
|
|
33
34
|
- ext/broccoli/broccoli_wrap.c
|
|
35
|
+
- ext/broccoli/broccoli_wrap.o
|
|
34
36
|
- ext/broccoli/extconf.rb
|
|
35
37
|
- ext/broccoli/Makefile
|
|
36
38
|
- ext/broccoli/post-clean.rb
|
|
@@ -71,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
73
|
requirements: []
|
|
72
74
|
|
|
73
75
|
rubyforge_project: rbroccoli
|
|
74
|
-
rubygems_version: 1.
|
|
76
|
+
rubygems_version: 1.3.1
|
|
75
77
|
signing_key:
|
|
76
78
|
specification_version: 2
|
|
77
79
|
summary: Interface for the Bro Intrusion Detection System.
|