solutious-stella 0.5.5
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/CHANGES.txt +36 -0
- data/README.textile +162 -0
- data/Rakefile +88 -0
- data/bin/stella +12 -0
- data/bin/stella.bat +12 -0
- data/lib/daemonize.rb +56 -0
- data/lib/pcaplet.rb +180 -0
- data/lib/stella.rb +101 -0
- data/lib/stella/adapter/ab.rb +337 -0
- data/lib/stella/adapter/base.rb +106 -0
- data/lib/stella/adapter/httperf.rb +305 -0
- data/lib/stella/adapter/pcap_watcher.rb +221 -0
- data/lib/stella/adapter/proxy_watcher.rb +76 -0
- data/lib/stella/adapter/siege.rb +341 -0
- data/lib/stella/cli.rb +258 -0
- data/lib/stella/cli/agents.rb +73 -0
- data/lib/stella/cli/base.rb +55 -0
- data/lib/stella/cli/language.rb +18 -0
- data/lib/stella/cli/localtest.rb +78 -0
- data/lib/stella/cli/sysinfo.rb +16 -0
- data/lib/stella/cli/watch.rb +278 -0
- data/lib/stella/command/base.rb +40 -0
- data/lib/stella/command/localtest.rb +358 -0
- data/lib/stella/data/domain.rb +82 -0
- data/lib/stella/data/http.rb +131 -0
- data/lib/stella/logger.rb +84 -0
- data/lib/stella/response.rb +85 -0
- data/lib/stella/storable.rb +201 -0
- data/lib/stella/support.rb +276 -0
- data/lib/stella/sysinfo.rb +257 -0
- data/lib/stella/test/definition.rb +79 -0
- data/lib/stella/test/run/summary.rb +70 -0
- data/lib/stella/test/stats.rb +114 -0
- data/lib/stella/text.rb +64 -0
- data/lib/stella/text/resource.rb +38 -0
- data/lib/utils/crypto-key.rb +84 -0
- data/lib/utils/domainutil.rb +47 -0
- data/lib/utils/escape.rb +302 -0
- data/lib/utils/fileutil.rb +78 -0
- data/lib/utils/httputil.rb +266 -0
- data/lib/utils/mathutil.rb +15 -0
- data/lib/utils/stats.rb +88 -0
- data/lib/utils/textgraph.rb +267 -0
- data/lib/utils/timerutil.rb +58 -0
- data/lib/win32/Console.rb +970 -0
- data/lib/win32/Console/ANSI.rb +305 -0
- data/support/kvm.h +91 -0
- data/support/ruby-pcap-takuma-notes.txt +19 -0
- data/support/ruby-pcap-takuma-patch.txt +30 -0
- data/support/text/en.yaml +80 -0
- data/support/text/nl.yaml +7 -0
- data/support/useragents.txt +75 -0
- data/tests/01-util_test.rb +0 -0
- data/tests/02-stella-util_test.rb +42 -0
- data/tests/10-stella_test.rb +104 -0
- data/tests/11-stella-storable_test.rb +68 -0
- data/tests/60-stella-command_test.rb +248 -0
- data/tests/80-stella-cli_test.rb +45 -0
- data/tests/spec-helper.rb +31 -0
- metadata +165 -0
@@ -0,0 +1,305 @@
|
|
1
|
+
#
|
2
|
+
# Win32::Console::ANSI
|
3
|
+
#
|
4
|
+
# Copyright 2004 - Gonzalo Garramuno
|
5
|
+
# Licensed under GNU General Public License or Perl's Artistic License
|
6
|
+
#
|
7
|
+
# Based on Perl's Win32::Console::ANSI
|
8
|
+
# Copyright (c) 2003 Jean-Louis Morel <jl_morel@bribes.org>
|
9
|
+
# Licensed under GNU General Public License or Perl's Artistic License
|
10
|
+
#
|
11
|
+
require "win32/Console"
|
12
|
+
|
13
|
+
module Win32
|
14
|
+
class Console
|
15
|
+
module ANSI
|
16
|
+
|
17
|
+
class IO < IO
|
18
|
+
|
19
|
+
VERSION = '0.05'
|
20
|
+
DEBUG = nil
|
21
|
+
|
22
|
+
require "win32/registry"
|
23
|
+
|
24
|
+
include Win32::Console::Constants
|
25
|
+
|
26
|
+
# @todo: encode is another perl module
|
27
|
+
EncodeOk = false
|
28
|
+
|
29
|
+
# Retrieving the codepages
|
30
|
+
cpANSI = nil
|
31
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\CurrentControlSet\Control\Nls\CodePage' ) { |reg|
|
32
|
+
cpANSI = reg['ACP']
|
33
|
+
}
|
34
|
+
|
35
|
+
STDERR.puts "Unable to read Win codepage #{cpANSI}" if DEBUG && !cpANSI
|
36
|
+
|
37
|
+
|
38
|
+
cpANSI = 'cp'+(cpANSI ? cpANSI : '1252') # Windows codepage
|
39
|
+
OEM = Win32::Console::OutputCP()
|
40
|
+
cpOEM = 'cp' + OEM.to_s # DOS codepage
|
41
|
+
@@cp = cpANSI + cpOEM
|
42
|
+
|
43
|
+
STDERR.puts "EncodeOk=#{EncodeOk} cpANSI=#{cpANSI} "+
|
44
|
+
"cpOEM=#{cpOEM}" if DEBUG
|
45
|
+
|
46
|
+
@@color = { 30 => 0, # black foreground
|
47
|
+
31 => FOREGROUND_RED, # red foreground
|
48
|
+
32 => FOREGROUND_GREEN, # green foreground
|
49
|
+
33 => FOREGROUND_RED|FOREGROUND_GREEN, # yellow foreground
|
50
|
+
34 => FOREGROUND_BLUE, # blue foreground
|
51
|
+
35 => FOREGROUND_BLUE|FOREGROUND_RED, # magenta foreground
|
52
|
+
36 => FOREGROUND_BLUE|FOREGROUND_GREEN, # cyan foreground
|
53
|
+
37 => FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE, # white foreground
|
54
|
+
40 => 0, # black background
|
55
|
+
41 => BACKGROUND_RED, # red background
|
56
|
+
42 => BACKGROUND_GREEN, # green background
|
57
|
+
43 => BACKGROUND_RED|BACKGROUND_GREEN, # yellow background
|
58
|
+
44 => BACKGROUND_BLUE, # blue background
|
59
|
+
45 => BACKGROUND_BLUE|BACKGROUND_RED, # magenta background
|
60
|
+
46 => BACKGROUND_BLUE|BACKGROUND_GREEN, # cyan background
|
61
|
+
47 => BACKGROUND_RED|BACKGROUND_GREEN|BACKGROUND_BLUE, # white background
|
62
|
+
}
|
63
|
+
|
64
|
+
def initialize
|
65
|
+
super(1,'w')
|
66
|
+
@Out = Win32::Console.new(STD_OUTPUT_HANDLE)
|
67
|
+
@x = @y = 0 # to save cursor position
|
68
|
+
@foreground = 7
|
69
|
+
@background = 0
|
70
|
+
@bold =
|
71
|
+
@underline =
|
72
|
+
@revideo =
|
73
|
+
@concealed = nil
|
74
|
+
@conv = 1 # char conversion by default
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def write(*s)
|
79
|
+
s.each { |x|
|
80
|
+
_PrintString(x)
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def _PrintString(t)
|
88
|
+
s = t.dup
|
89
|
+
while s != ''
|
90
|
+
if s.sub!( /([^\e]*)?\e([\[\(])([0-9\;\=]*)([a-zA-Z@])(.*)/s,'\5')
|
91
|
+
@Out.Write((_conv("#$1")))
|
92
|
+
if $2 == '['
|
93
|
+
case $4
|
94
|
+
when 'm' # ESC[#;#;....;#m Set display attributes
|
95
|
+
attributs = $3.split(';')
|
96
|
+
attributs.push(nil) unless attributs # ESC[m == ESC[;m ==...==ESC[0m
|
97
|
+
for attr in attributs
|
98
|
+
atv = attr.to_i
|
99
|
+
if atv > 0
|
100
|
+
if atv == 1
|
101
|
+
@bold = 1
|
102
|
+
elsif atv == 21
|
103
|
+
@bold = nil
|
104
|
+
elsif atv == 4
|
105
|
+
@underline = 1
|
106
|
+
elsif atv == 24
|
107
|
+
@underline = nil
|
108
|
+
elsif atv == 7
|
109
|
+
@revideo = 1
|
110
|
+
elsif atv == 27
|
111
|
+
@revideo = nil
|
112
|
+
elsif atv == 8
|
113
|
+
@concealed = 1
|
114
|
+
elsif atv == 28
|
115
|
+
@concealed = nil
|
116
|
+
elsif atv >= 30 and atv <= 37
|
117
|
+
@foreground = atv - 30
|
118
|
+
elsif atv >=40 and atv <=47
|
119
|
+
@background = atv - 40
|
120
|
+
end
|
121
|
+
else # ESC[0m reset
|
122
|
+
@foreground = 7
|
123
|
+
@background = 0
|
124
|
+
@bold =
|
125
|
+
@underline =
|
126
|
+
@revideo =
|
127
|
+
@concealed = nil
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if @revideo
|
132
|
+
attribut = @@color[40+@foreground] |
|
133
|
+
@@color[30+@background]
|
134
|
+
else
|
135
|
+
attribut = @@color[30+@foreground] |
|
136
|
+
@@color[40+@background]
|
137
|
+
end
|
138
|
+
attribut |= FOREGROUND_INTENSITY if @bold
|
139
|
+
attribut |= BACKGROUND_INTENSITY if @underline
|
140
|
+
@Out.Attr(attribut)
|
141
|
+
when 'J'
|
142
|
+
if !$3 or $3 == '' # ESC[0J from cursor to end of display
|
143
|
+
info = @Out.Info()
|
144
|
+
s = ' ' * ((info[1]-info[3]-1)*info[0]+info[0]-info[2]-1)
|
145
|
+
@Out.WriteChar(s, info[2], info[3])
|
146
|
+
@Out.Cursor(info[2], info[3])
|
147
|
+
elsif $3 == '1' # ESC[1J erase from start to cursor.
|
148
|
+
info = @Out.Info()
|
149
|
+
s = ' ' * (info[3]*info[0]+info[2]+1)
|
150
|
+
@Out.WriteChar(s, 0, 0)
|
151
|
+
@Out.Cursor(info[2], info[3])
|
152
|
+
elsif $3 == '2' # ESC[2J Clear screen and home cursor
|
153
|
+
@Out.Cls()
|
154
|
+
@Out.Cursor(0, 0)
|
155
|
+
else
|
156
|
+
STDERR.print "\e#$2#$3#$4" if DEBUG # if ESC-code not implemented
|
157
|
+
end
|
158
|
+
when 'K'
|
159
|
+
info = @Out.Info()
|
160
|
+
if !$3 or $3 == '' # ESC[0K Clear to end of line
|
161
|
+
s = ' ' * (info[7]-info[2]+1)
|
162
|
+
@Out.Write(s)
|
163
|
+
@Out.Cursor(info[2], info[3])
|
164
|
+
elsif $3=='1' # ESC[1K Clear from start of line to cursor
|
165
|
+
s = ' '*(info[2]+1)
|
166
|
+
@Out.WriteChar(s, 0, info[3])
|
167
|
+
@Out.Cursor(info[2], info[3])
|
168
|
+
elsif $3=='2' # ESC[2K Clear whole line.
|
169
|
+
s = ' '* info[0]
|
170
|
+
@Out.WriteChar(s, 0, info[3])
|
171
|
+
@Out.Cursor(info[2], info[3])
|
172
|
+
end
|
173
|
+
when 'L' # ESC[#L Insert # blank lines.
|
174
|
+
n = $3 == ''? 1 : $3.to_i # ESC[L == ESC[1L
|
175
|
+
info = @Out.Info()
|
176
|
+
@Out.Scroll(0, info[3], info[0]-1, info[1]-1,
|
177
|
+
0, info[3] + n.to_i,
|
178
|
+
' '[0], @Out.Attr(),
|
179
|
+
0, 0, 10000, 10000)
|
180
|
+
@Out.Cursor(info[2], info[3])
|
181
|
+
when 'M' # ESC[#M Delete # line.
|
182
|
+
n = $3 == ''? 1 : $3.to_i # ESC[M == ESC[1M
|
183
|
+
info = @Out.Info();
|
184
|
+
@Out.Scroll(0, info[3]+n, info[0]-1, info[1]-1,
|
185
|
+
0, info[3],
|
186
|
+
' '[0], @Out.Attr(),
|
187
|
+
0, 0, 10000, 10000)
|
188
|
+
@Out.Cursor(info[2], info[3])
|
189
|
+
when 'P' # ESC[#P Delete # characters.
|
190
|
+
n = $3 == ''? 1 : $3.to_i # ESC[P == ESC[1P
|
191
|
+
info = @Out.Info()
|
192
|
+
n = info[0]-info[2] if info[2]+n > info[0]-1
|
193
|
+
@Out.Scroll(info[2]+n, info[3] , info[0]-1, info[3],
|
194
|
+
info[2], info[3],
|
195
|
+
' '[0], @Out.Attr(),
|
196
|
+
0, 0, 10000, 10000)
|
197
|
+
s = ' ' * n
|
198
|
+
@Out.Cursor(info[0]-n, info[3])
|
199
|
+
@Out.Write(s)
|
200
|
+
@Out.Cursor(info[2], info[3])
|
201
|
+
when '@' # ESC[#@ Insert # blank Characters
|
202
|
+
s = ' ' * $3.to_i
|
203
|
+
info = @Out.Info()
|
204
|
+
s << @Out.ReadChar(info[7]-info[2]+1, info[2], info[3])
|
205
|
+
s = s[0..-($3.to_i)]
|
206
|
+
@Out.Write(s);
|
207
|
+
@Out.Cursor(info[2], info[3])
|
208
|
+
when 'A' # ESC[#A Moves cursor up # lines
|
209
|
+
(x, y) = @Out.Cursor()
|
210
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[A == ESC[1A
|
211
|
+
@Out.Cursor(x, y-n)
|
212
|
+
when 'B' # ESC[#B Moves cursor down # lines
|
213
|
+
(x, y) = @Out.Cursor()
|
214
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[B == ESC[1B
|
215
|
+
@Out.Cursor(x, y+n)
|
216
|
+
when 'C' # ESC[#C Moves cursor forward # spaces
|
217
|
+
(x, y) = @Out.Cursor()
|
218
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[C == ESC[1C
|
219
|
+
@Out.Cursor(x+n, y)
|
220
|
+
when 'D' # ESC[#D Moves cursor back # spaces
|
221
|
+
(x, y) = @Out.Cursor()
|
222
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[D == ESC[1D
|
223
|
+
@Out.Cursor(x-n, y)
|
224
|
+
when 'E' # ESC[#E Moves cursor down # lines, column 1.
|
225
|
+
x, y = @Out.Cursor()
|
226
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[E == ESC[1E
|
227
|
+
@Out.Cursor(0, y+n)
|
228
|
+
when 'F' # ESC[#F Moves cursor up # lines, column 1.
|
229
|
+
x, y = @Out.Cursor()
|
230
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[F == ESC[1F
|
231
|
+
@Out.Cursor(0, y-n)
|
232
|
+
when 'G' # ESC[#G Moves cursor column # in current row.
|
233
|
+
x, y = @Out.Cursor()
|
234
|
+
n = $3 == ''? 1 : $3.to_i; # ESC[G == ESC[1G
|
235
|
+
@Out.Cursor(n-1, y)
|
236
|
+
when 'f' # ESC[#;#f Moves cursor to line #, column #
|
237
|
+
y, x = $3.split(';')
|
238
|
+
x = 1 unless x # ESC[;5H == ESC[1;5H ...etc
|
239
|
+
y = 1 unless y
|
240
|
+
@Out.Cursor(x.to_i-1, y.to_i-1) # origin (0,0) in DOS console
|
241
|
+
when 'H' # ESC[#;#H Moves cursor to line #, column #
|
242
|
+
y, x = $3.split(';')
|
243
|
+
x = 1 unless x # ESC[;5H == ESC[1;5H ...etc
|
244
|
+
y = 1 unless y
|
245
|
+
@Out.Cursor(x.to_i-1, y.to_i-1) # origin (0,0) in DOS console
|
246
|
+
when 's' # ESC[s Saves cursor position for recall later
|
247
|
+
(@x, @y) = @Out.Cursor()
|
248
|
+
when 'u' # ESC[u Return to saved cursor position
|
249
|
+
@Out.Cursor(@x, @y)
|
250
|
+
else
|
251
|
+
STDERR.puts "\e#$2#$3#$4 not implemented" if DEBUG # ESC-code not implemented
|
252
|
+
end
|
253
|
+
else
|
254
|
+
case $4
|
255
|
+
when 'U' # ESC(U no mapping
|
256
|
+
@conv = nil
|
257
|
+
when 'K' # ESC(K mapping if it exist
|
258
|
+
@Out.OutputCP(OEM) # restore original codepage
|
259
|
+
@conv = 1
|
260
|
+
when 'X' # ESC(#X codepage **EXPERIMENTAL**
|
261
|
+
@conv = nil
|
262
|
+
@Out.OutputCP($3)
|
263
|
+
else
|
264
|
+
STDERR.puts "\e#$2#$3#$4 not implemented" if DEBUG # ESC-code not implemented
|
265
|
+
end
|
266
|
+
end
|
267
|
+
else
|
268
|
+
@Out.Write(_conv(s))
|
269
|
+
s=''
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def _conv(s)
|
275
|
+
if @concealed
|
276
|
+
s.gsub!( /\S/,' ')
|
277
|
+
elsif @conv
|
278
|
+
if EncodeOk
|
279
|
+
from_to(s, cpANSI, cpOEM)
|
280
|
+
elsif @@cp == 'cp1252cp850' # WinLatin1 --> DOSLatin1
|
281
|
+
s.tr!("���������������������������������������������������������������������������������������������������ÁāŁƁǁȁɁʁˁ́́ρЁсҁӁԁՁցׁفځہ܁݁ށ߁��������������������������������������������","???�??????????????????????????��������ρ��݁�����������������������������������������������ǎ����Ԑ�ҁӁށցׁс������噞����ꚁ��ᅁ���Ƅ�������������Ё������䔁����������")
|
282
|
+
elsif @@cp == 'cp1252cp437' # WinLatin1 --> DOSLatinUS
|
283
|
+
s.tr!("���������������������������������������������������������������������������������������������������ÁāŁƁǁȁɁʁˁ́́ρЁсҁӁԁՁցׁفځہ܁݁ށ߁��������������������������������������������", "??????????????????????????????������?�????������???�����??��?��??��������?��????����?�???????��????�?????�??�ᅁ��?�������������?������?���?�����??�")
|
284
|
+
elsif @@cp == 'cp1250cp852' # WinLatin2 --> DOSLatin2
|
285
|
+
s.tr!("���������������������������������������������������������������������������������������������������ÁāŁƁǁȁɁʁˁ́́ρЁсҁӁԁՁցׁفځہ܁݁ށ߁��������������������������������������������",
|
286
|
+
"??????????��?��??????????��?������������ρ�?����?��������?����?���???�����������聵���Ǝ���������Ӂ��ցׁҁс�Ձ��⊙����ށ�뚁�݁�ꁠ��DŽ������������ԁЁ�偢�����������������" )
|
287
|
+
elsif @@cp == 'cp1251cp855' # WinCyrillic --> DOSCyrillic
|
288
|
+
s.tr!("���������������������������������������������������������������������������������������������������ÁāŁƁǁȁɁʁˁ́́ρЁсҁӁԁՁցׁفځہ܁݁ށ߁��������������������������������������������",
|
289
|
+
"��?�??????�?����?????????�?����������??���?���?��?�??��????������������쁭��������ǁсӁՁׁ݁���聫�����������������������끬��������ƁЁҁԁց���灪������������������")
|
290
|
+
end
|
291
|
+
end
|
292
|
+
return s
|
293
|
+
end
|
294
|
+
|
295
|
+
end
|
296
|
+
|
297
|
+
# end print overloading
|
298
|
+
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
|
304
|
+
$stdout = Win32::Console::ANSI::IO.new()
|
305
|
+
|
data/support/kvm.h
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
3
|
+
*
|
4
|
+
* @APPLE_LICENSE_HEADER_START@
|
5
|
+
*
|
6
|
+
* This file contains Original Code and/or Modifications of Original Code
|
7
|
+
* as defined in and that are subject to the Apple Public Source License
|
8
|
+
* Version 2.0 (the 'License'). You may not use this file except in
|
9
|
+
* compliance with the License. Please obtain a copy of the License at
|
10
|
+
* http://www.opensource.apple.com/apsl/ and read it before using this
|
11
|
+
* file.
|
12
|
+
*
|
13
|
+
* The Original Code and all software distributed under the License are
|
14
|
+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
15
|
+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
16
|
+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
18
|
+
* Please see the License for the specific language governing rights and
|
19
|
+
* limitations under the License.
|
20
|
+
*
|
21
|
+
* @APPLE_LICENSE_HEADER_END@
|
22
|
+
*/
|
23
|
+
/*-
|
24
|
+
* Copyright (c) 1989, 1993
|
25
|
+
* The Regents of the University of California. All rights reserved.
|
26
|
+
*
|
27
|
+
* Redistribution and use in source and binary forms, with or without
|
28
|
+
* modification, are permitted provided that the following conditions
|
29
|
+
* are met:
|
30
|
+
* 1. Redistributions of source code must retain the above copyright
|
31
|
+
* notice, this list of conditions and the following disclaimer.
|
32
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
33
|
+
* notice, this list of conditions and the following disclaimer in the
|
34
|
+
* documentation and/or other materials provided with the distribution.
|
35
|
+
* 3. All advertising materials mentioning features or use of this software
|
36
|
+
* must display the following acknowledgement:
|
37
|
+
* This product includes software developed by the University of
|
38
|
+
* California, Berkeley and its contributors.
|
39
|
+
* 4. Neither the name of the University nor the names of its contributors
|
40
|
+
* may be used to endorse or promote products derived from this software
|
41
|
+
* without specific prior written permission.
|
42
|
+
*
|
43
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
44
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
45
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
46
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
47
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
48
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
49
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
51
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
52
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
53
|
+
* SUCH DAMAGE.
|
54
|
+
*
|
55
|
+
* @(#)kvm.h 8.1 (Berkeley) 6/2/93
|
56
|
+
*/
|
57
|
+
|
58
|
+
#ifndef _KVM_H_
|
59
|
+
#define _KVM_H_
|
60
|
+
|
61
|
+
/* Default version symbol. */
|
62
|
+
#define VRS_SYM "_version"
|
63
|
+
#define VRS_KEY "VERSION"
|
64
|
+
|
65
|
+
#include <nlist.h>
|
66
|
+
#include <sys/cdefs.h>
|
67
|
+
|
68
|
+
__BEGIN_DECLS
|
69
|
+
|
70
|
+
typedef struct __kvm kvm_t;
|
71
|
+
|
72
|
+
struct kinfo_proc;
|
73
|
+
int kvm_close(kvm_t *);
|
74
|
+
char **kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
|
75
|
+
char **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
|
76
|
+
char *kvm_geterr(kvm_t *);
|
77
|
+
int kvm_getloadavg(kvm_t *, double [], int);
|
78
|
+
char *kvm_getfiles(kvm_t *, int, int, int *);
|
79
|
+
struct kinfo_proc *
|
80
|
+
kvm_getprocs(kvm_t *, int, int, int *);
|
81
|
+
int kvm_nlist(kvm_t *, struct nlist *);
|
82
|
+
kvm_t *kvm_open
|
83
|
+
(const char *, const char *, const char *, int, const char *);
|
84
|
+
kvm_t *kvm_openfiles
|
85
|
+
(const char *, const char *, const char *, int, char *);
|
86
|
+
int kvm_read(kvm_t *, unsigned long, void *, unsigned int);
|
87
|
+
int kvm_write(kvm_t *, unsigned long, const void *, unsigned int);
|
88
|
+
|
89
|
+
__END_DECLS
|
90
|
+
|
91
|
+
#endif /* !_KVM_H_ */
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Ruby-Pcap Patch (2008-02-10)
|
2
|
+
-------------------------------------------------------
|
3
|
+
|
4
|
+
"pcap.bundle: warning: do not use Fixnums as Symbols"
|
5
|
+
|
6
|
+
Ruby-Pcap is a libpcap binding for Ruby. On Ruby 1.8.6,
|
7
|
+
the latest release (0.6) produces the warning above on
|
8
|
+
OS X. ruby-pcap-takuma-patch.txt is a patch from here:
|
9
|
+
http://d.hatena.ne.jp/takuma104/20080210/1202638583
|
10
|
+
|
11
|
+
You can get Ruby-Pcap from here:
|
12
|
+
http://www.goto.info.waseda.ac.jp/~fukusima/ruby/pcap-e.html
|
13
|
+
|
14
|
+
$ tar -zxf ruby-pcap-0.6.tar.gz
|
15
|
+
$ cd pcap
|
16
|
+
$ patch -p1 < ruby-pcap-takuma-patch.txt
|
17
|
+
$ make
|
18
|
+
$ make install
|
19
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
diff -ur pcap/Pcap.c pcap-modified/Pcap.c
|
2
|
+
--- pcap/Pcap.c 2000-08-13 01:56:31.000000000 -0400
|
3
|
+
+++ pcap-modified/Pcap.c 2009-01-02 10:55:49.000000000 -0500
|
4
|
+
@@ -782,9 +782,9 @@
|
5
|
+
/* define class PcapStat */
|
6
|
+
cPcapStat = rb_funcall(rb_cStruct, rb_intern("new"), 4,
|
7
|
+
Qnil,
|
8
|
+
- INT2NUM(rb_intern("recv")),
|
9
|
+
- INT2NUM(rb_intern("drop")),
|
10
|
+
- INT2NUM(rb_intern("ifdrop")));
|
11
|
+
+ ID2SYM(rb_intern("recv")),
|
12
|
+
+ ID2SYM(rb_intern("drop")),
|
13
|
+
+ ID2SYM(rb_intern("ifdrop")));
|
14
|
+
rb_define_const(mPcap, "Stat", cPcapStat);
|
15
|
+
|
16
|
+
/* define exception classes */
|
17
|
+
diff -ur pcap/packet.c pcap-modified/packet.c
|
18
|
+
--- pcap/packet.c 2000-08-13 02:56:15.000000000 -0400
|
19
|
+
+++ pcap-modified/packet.c 2009-01-02 10:56:07.000000000 -0500
|
20
|
+
@@ -17,8 +17,8 @@
|
21
|
+
|
22
|
+
VALUE cPacket;
|
23
|
+
static VALUE mMarshal;
|
24
|
+
-int id_load;
|
25
|
+
-int id_dump;
|
26
|
+
+ID id_load;
|
27
|
+
+ID id_dump;
|
28
|
+
|
29
|
+
/* called from GC */
|
30
|
+
static void
|