blackfoundry-pcap 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,13 +3,15 @@ require 'rake'
3
3
  task :default => [:make]
4
4
 
5
5
  task :make do
6
- puts `ruby extconf.rb`
7
- puts `make`
6
+ Dir.chdir 'ext' do
7
+ puts `ruby extconf.rb`
8
+ puts `make`
9
+ end
8
10
  end
9
11
 
10
12
  require 'jeweler'
11
13
  Jeweler::Tasks.new do |s|
12
- s.version = '0.1'
14
+ s.version = '0.2'
13
15
  s.name = 'blackfoundry-pcap'
14
16
  s.summary = 'extensions to ruby-pcap'
15
17
  s.email = 'david@blackfoundry.com'
@@ -0,0 +1,157 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ exec_prefix = $(prefix)
11
+ prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
12
+ sharedstatedir = $(prefix)/com
13
+ mandir = $(DESTDIR)/usr/share/man
14
+ psdir = $(docdir)
15
+ oldincludedir = $(DESTDIR)/usr/include
16
+ localedir = $(datarootdir)/locale
17
+ bindir = $(exec_prefix)/bin
18
+ libexecdir = $(exec_prefix)/libexec
19
+ sitedir = $(DESTDIR)/Library/Ruby/Site
20
+ htmldir = $(docdir)
21
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
22
+ includedir = $(prefix)/include
23
+ infodir = $(DESTDIR)/usr/share/info
24
+ vendorlibdir = $(vendordir)/$(ruby_version)
25
+ sysconfdir = $(prefix)/etc
26
+ libdir = $(exec_prefix)/lib
27
+ sbindir = $(exec_prefix)/sbin
28
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
29
+ docdir = $(datarootdir)/doc/$(PACKAGE)
30
+ dvidir = $(docdir)
31
+ vendordir = $(libdir)/ruby/vendor_ruby
32
+ datarootdir = $(prefix)/share
33
+ pdfdir = $(docdir)
34
+ archdir = $(rubylibdir)/$(arch)
35
+ sitearchdir = $(sitelibdir)/$(sitearch)
36
+ datadir = $(datarootdir)
37
+ localstatedir = $(prefix)/var
38
+ sitelibdir = $(sitedir)/$(ruby_version)
39
+
40
+ CC = gcc
41
+ LIBRUBY = $(LIBRUBY_SO)
42
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
43
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
44
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
45
+
46
+ RUBY_EXTCONF_H =
47
+ CFLAGS = -fno-common -I/usr/local/include
48
+ INCFLAGS = -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I.
49
+ DEFS =
50
+ CPPFLAGS = -DHAVE_HSTRERROR -DHAVE_PCAP_H -DHAVE_PCAP_COMPILE_NOPCAP -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
51
+ CXXFLAGS = $(CFLAGS)
52
+ ldflags = -L/usr/local/lib
53
+ dldflags =
54
+ archflag =
55
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
56
+ LDSHARED = cc -arch x86_64 -pipe -bundle -undefined dynamic_lookup
57
+ AR = ar
58
+ EXEEXT =
59
+
60
+ RUBY_INSTALL_NAME = ruby
61
+ RUBY_SO_NAME = ruby
62
+ arch = universal-darwin10.0
63
+ sitearch = universal-darwin10.0
64
+ ruby_version = 1.8
65
+ ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
66
+ RUBY = $(ruby)
67
+ RM = rm -f
68
+ MAKEDIRS = mkdir -p
69
+ INSTALL = /usr/bin/install -c
70
+ INSTALL_PROG = $(INSTALL) -m 0755
71
+ INSTALL_DATA = $(INSTALL) -m 644
72
+ COPY = cp
73
+
74
+ #### End of system configuration section. ####
75
+
76
+ preload =
77
+
78
+ libpath = . $(libdir)
79
+ LIBPATH = -L. -L$(libdir)
80
+ DEFFILE =
81
+
82
+ CLEANFILES = mkmf.log
83
+ DISTCLEANFILES =
84
+
85
+ extout =
86
+ extout_prefix =
87
+ target_prefix =
88
+ LOCAL_LIBS =
89
+ LIBS = $(LIBRUBYARG_SHARED) -lpcap -lpthread -ldl
90
+ SRCS = icmp_packet.c ip_packet.c packet.c Pcap.c tcp_packet.c udp_packet.c
91
+ OBJS = icmp_packet.o ip_packet.o packet.o Pcap.o tcp_packet.o udp_packet.o
92
+ TARGET = pcap
93
+ DLLIB = $(TARGET).bundle
94
+ EXTSTATIC =
95
+ STATIC_LIB =
96
+
97
+ BINDIR = $(bindir)
98
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
99
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
100
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
101
+
102
+ TARGET_SO = $(DLLIB)
103
+ CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
104
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
105
+
106
+ all: $(DLLIB)
107
+ static: $(STATIC_LIB)
108
+
109
+ clean:
110
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
111
+
112
+ distclean: clean
113
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
114
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
115
+
116
+ realclean: distclean
117
+ install: install-so install-rb
118
+
119
+ install-so: $(RUBYARCHDIR)
120
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
121
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
122
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
123
+ install-rb: pre-install-rb install-rb-default
124
+ install-rb-default: pre-install-rb-default
125
+ pre-install-rb: Makefile
126
+ pre-install-rb-default: Makefile
127
+ $(RUBYARCHDIR):
128
+ $(MAKEDIRS) $@
129
+
130
+ site-install: site-install-so site-install-rb
131
+ site-install-so: install-so
132
+ site-install-rb: install-rb
133
+
134
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
135
+
136
+ .cc.o:
137
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
138
+
139
+ .cxx.o:
140
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
141
+
142
+ .cpp.o:
143
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
144
+
145
+ .C.o:
146
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
147
+
148
+ .c.o:
149
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
150
+
151
+ $(DLLIB): $(OBJS) Makefile
152
+ @-$(RM) $@
153
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
154
+
155
+
156
+
157
+ $(OBJS): ruby.h defines.h
data/ext/Pcap.c CHANGED
@@ -784,9 +784,9 @@ Init_pcap(void)
784
784
  /* define class PcapStat */
785
785
  cPcapStat = rb_funcall(rb_cStruct, rb_intern("new"), 4,
786
786
  Qnil,
787
- INT2NUM(rb_intern("recv")),
788
- INT2NUM(rb_intern("drop")),
789
- INT2NUM(rb_intern("ifdrop")));
787
+ ID2SYM(rb_intern("recv")),
788
+ ID2SYM(rb_intern("drop")),
789
+ ID2SYM(rb_intern("ifdrop")));
790
790
  rb_define_const(mPcap, "Stat", cPcapStat);
791
791
 
792
792
  /* define exception classes */
Binary file
Binary file
Binary file
@@ -0,0 +1,134 @@
1
+ have_library: checking for socket() in -lsocket... -------------------- no
2
+
3
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lsocket -lpthread -ldl "
4
+ conftest.c: In function ‘t’:
5
+ conftest.c:3: error: ‘socket’ undeclared (first use in this function)
6
+ conftest.c:3: error: (Each undeclared identifier is reported only once
7
+ conftest.c:3: error: for each function it appears in.)
8
+ checked program was:
9
+ /* begin */
10
+ 1: /*top*/
11
+ 2: int main() { return 0; }
12
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))socket; return 0; }
13
+ /* end */
14
+
15
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lsocket -lpthread -ldl "
16
+ ld: library not found for -lsocket
17
+ collect2: ld returned 1 exit status
18
+ checked program was:
19
+ /* begin */
20
+ 1: /*top*/
21
+ 2: int main() { return 0; }
22
+ 3: int t() { socket(); return 0; }
23
+ /* end */
24
+
25
+ --------------------
26
+
27
+ have_library: checking for gethostbyname() in -lxnet... -------------------- no
28
+
29
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lxnet -lpthread -ldl "
30
+ conftest.c: In function ‘t’:
31
+ conftest.c:3: error: ‘gethostbyname’ undeclared (first use in this function)
32
+ conftest.c:3: error: (Each undeclared identifier is reported only once
33
+ conftest.c:3: error: for each function it appears in.)
34
+ checked program was:
35
+ /* begin */
36
+ 1: /*top*/
37
+ 2: int main() { return 0; }
38
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))gethostbyname; return 0; }
39
+ /* end */
40
+
41
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lxnet -lpthread -ldl "
42
+ ld: library not found for -lxnet
43
+ collect2: ld returned 1 exit status
44
+ checked program was:
45
+ /* begin */
46
+ 1: /*top*/
47
+ 2: int main() { return 0; }
48
+ 3: int t() { gethostbyname(); return 0; }
49
+ /* end */
50
+
51
+ --------------------
52
+
53
+ have_func: checking for hstrerror()... -------------------- yes
54
+
55
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lpthread -ldl "
56
+ conftest.c: In function ‘t’:
57
+ conftest.c:3: error: ‘hstrerror’ undeclared (first use in this function)
58
+ conftest.c:3: error: (Each undeclared identifier is reported only once
59
+ conftest.c:3: error: for each function it appears in.)
60
+ checked program was:
61
+ /* begin */
62
+ 1: /*top*/
63
+ 2: int main() { return 0; }
64
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))hstrerror; return 0; }
65
+ /* end */
66
+
67
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lpthread -ldl "
68
+ checked program was:
69
+ /* begin */
70
+ 1: /*top*/
71
+ 2: int main() { return 0; }
72
+ 3: int t() { hstrerror(); return 0; }
73
+ /* end */
74
+
75
+ --------------------
76
+
77
+ have_header: checking for pcap.h... -------------------- yes
78
+
79
+ "gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -o conftest.i"
80
+ checked program was:
81
+ /* begin */
82
+ 1: #include <pcap.h>
83
+ /* end */
84
+
85
+ --------------------
86
+
87
+ have_library: checking for pcap_open_live() in -lpcap... -------------------- yes
88
+
89
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lpcap -lpthread -ldl "
90
+ conftest.c: In function ‘t’:
91
+ conftest.c:3: error: ‘pcap_open_live’ undeclared (first use in this function)
92
+ conftest.c:3: error: (Each undeclared identifier is reported only once
93
+ conftest.c:3: error: for each function it appears in.)
94
+ checked program was:
95
+ /* begin */
96
+ 1: /*top*/
97
+ 2: int main() { return 0; }
98
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))pcap_open_live; return 0; }
99
+ /* end */
100
+
101
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lruby -lpcap -lpthread -ldl "
102
+ checked program was:
103
+ /* begin */
104
+ 1: /*top*/
105
+ 2: int main() { return 0; }
106
+ 3: int t() { pcap_open_live(); return 0; }
107
+ /* end */
108
+
109
+ --------------------
110
+
111
+ have_func: checking for pcap_compile_nopcap()... -------------------- yes
112
+
113
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lpcap -lruby -lpcap -lpthread -ldl "
114
+ conftest.c: In function ‘t’:
115
+ conftest.c:3: error: ‘pcap_compile_nopcap’ undeclared (first use in this function)
116
+ conftest.c:3: error: (Each undeclared identifier is reported only once
117
+ conftest.c:3: error: for each function it appears in.)
118
+ checked program was:
119
+ /* begin */
120
+ 1: /*top*/
121
+ 2: int main() { return 0; }
122
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))pcap_compile_nopcap; return 0; }
123
+ /* end */
124
+
125
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -lpcap -lruby -lpcap -lpthread -ldl "
126
+ checked program was:
127
+ /* begin */
128
+ 1: /*top*/
129
+ 2: int main() { return 0; }
130
+ 3: int t() { pcap_compile_nopcap(); return 0; }
131
+ /* end */
132
+
133
+ --------------------
134
+
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackfoundry-pcap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Turnbull
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-06 00:00:00 Z
17
+ date: 2011-05-20 00:00:00 Z
18
18
  dependencies: []
19
19
 
20
20
  description: " Some extensions to the pcap library.\n"
@@ -29,14 +29,23 @@ extra_rdoc_files:
29
29
  - README.ja
30
30
  files:
31
31
  - Rakefile
32
+ - ext/Makefile
32
33
  - ext/Pcap.c
34
+ - ext/Pcap.o
33
35
  - ext/extconf.rb
34
36
  - ext/icmp_packet.c
37
+ - ext/icmp_packet.o
35
38
  - ext/ip_packet.c
39
+ - ext/ip_packet.o
40
+ - ext/mkmf.log
36
41
  - ext/packet.c
42
+ - ext/packet.o
43
+ - ext/pcap.bundle
37
44
  - ext/ruby_pcap.h
38
45
  - ext/tcp_packet.c
46
+ - ext/tcp_packet.o
39
47
  - ext/udp_packet.c
48
+ - ext/udp_packet.o
40
49
  - lib/pcap_misc.rb
41
50
  - lib/pcaplet.rb
42
51
  - ChangeLog
@@ -71,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
80
  requirements: []
72
81
 
73
82
  rubyforge_project:
74
- rubygems_version: 1.7.2
83
+ rubygems_version: 1.8.2
75
84
  signing_key:
76
85
  specification_version: 3
77
86
  summary: extensions to ruby-pcap