rb-wartslib 0.9.11 → 0.9.12
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 +6 -0
- data/bin/extract-trace-addrs +3 -3
- data/bin/scdump +7 -7
- data/bin/stat-traces +86 -3
- data/bin/wdump +5 -5
- data/docs/gen-code-html +107 -0
- data/docs/gen-output-html +9 -0
- data/docs/gen-tut-html +4 -0
- data/docs/index.html +221 -0
- data/docs/layout.css +40 -0
- data/docs/reference.html +229 -0
- data/docs/ruby.css +34 -0
- data/docs/samples.html +48 -0
- data/docs/style.css +222 -0
- data/docs/tut-1-count.rb +13 -0
- data/docs/tut-10-list2.rb +22 -0
- data/docs/tut-11-cycle.rb +20 -0
- data/docs/tut-12-cycle2.rb +36 -0
- data/docs/tut-13-write.rb +17 -0
- data/docs/tut-14-write2.rb +22 -0
- data/docs/tut-15-write3.rb +15 -0
- data/docs/tut-16-write4.rb +13 -0
- data/docs/tut-17-modify.rb +28 -0
- data/docs/tut-18-modify2.rb +29 -0
- data/docs/tut-2-count-block.rb +10 -0
- data/docs/tut-3-count-resp.rb +16 -0
- data/docs/tut-4-path-length.rb +44 -0
- data/docs/tut-5-hop-addr.rb +14 -0
- data/docs/tut-6-hop-addr2.rb +14 -0
- data/docs/tut-7-hop-addr3.rb +22 -0
- data/docs/tut-8-hop-addr4.rb +15 -0
- data/docs/tut-9-list.rb +16 -0
- data/docs/tutorial.html +950 -0
- data/ext/scext.c +2 -2
- data/ext/scfile.c +1 -1
- data/ext/sctrace.c +43 -39
- metadata +32 -5
data/ext/scext.c
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
** along with this program; if not, write to the Free Software
|
20
20
|
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21
21
|
**
|
22
|
-
** $Id: scext.c,v 1.
|
22
|
+
** $Id: scext.c,v 1.22 2008/01/16 20:14:50 youngh Exp $
|
23
23
|
**/
|
24
24
|
|
25
25
|
#include "ruby.h"
|
@@ -41,7 +41,7 @@ void Init_wartslibext(void)
|
|
41
41
|
{
|
42
42
|
mWarts = rb_define_module("Warts");
|
43
43
|
|
44
|
-
rb_define_const(mWarts, "WARTS_LIB_VERSION", rb_str_new2("0.9.
|
44
|
+
rb_define_const(mWarts, "WARTS_LIB_VERSION", rb_str_new2("0.9.12"));
|
45
45
|
rb_define_const(mWarts, "SCAMPER_VERSION", rb_str_new2(SCAMPER_VERSION));
|
46
46
|
|
47
47
|
Init_scaddr();
|
data/ext/scfile.c
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
** along with this program; if not, write to the Free Software
|
19
19
|
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
20
|
**
|
21
|
-
** $Id: scfile.c,v 1.
|
21
|
+
** $Id: scfile.c,v 1.32 2008/01/16 20:15:39 youngh Exp $
|
22
22
|
**/
|
23
23
|
|
24
24
|
#include <unistd.h>
|
data/ext/sctrace.c
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
** along with this program; if not, write to the Free Software
|
28
28
|
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
29
29
|
**
|
30
|
-
** $Id: sctrace.c,v 1.
|
30
|
+
** $Id: sctrace.c,v 1.46 2007/12/08 00:33:42 youngh Exp $
|
31
31
|
**/
|
32
32
|
|
33
33
|
#include "ruby.h"
|
@@ -122,17 +122,17 @@ NUM_ATTR_FUN(dport);
|
|
122
122
|
/*-------------------------------------------------------------------------*/
|
123
123
|
|
124
124
|
static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
125
|
-
int hop, int
|
125
|
+
int hop, int response)
|
126
126
|
{
|
127
127
|
scamper_trace_hop_t *trace_hop;
|
128
128
|
|
129
|
-
if (hop < 0 || hop >= trace->hop_count ||
|
129
|
+
if (hop < 0 || hop >= trace->hop_count || response < 0) {
|
130
130
|
return NULL;
|
131
131
|
}
|
132
132
|
|
133
133
|
trace_hop = trace->hops[hop];
|
134
|
-
while (trace_hop &&
|
135
|
-
--
|
134
|
+
while (trace_hop && response > 0) {
|
135
|
+
--response;
|
136
136
|
trace_hop = trace_hop->hop_next;
|
137
137
|
}
|
138
138
|
return trace_hop;
|
@@ -145,9 +145,9 @@ static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
|
145
145
|
/* Because this declares variables, this macro must occur
|
146
146
|
immediately after the variable declarations in a function. */
|
147
147
|
#define PROCESS_HOP_PARAMS \
|
148
|
-
VALUE hop,
|
149
|
-
if (rb_scan_args(argc, argv, "11", &hop, &
|
150
|
-
|
148
|
+
VALUE hop, response; \
|
149
|
+
if (rb_scan_args(argc, argv, "11", &hop, &response) == 1) { \
|
150
|
+
response = INT2FIX(0); \
|
151
151
|
}
|
152
152
|
|
153
153
|
#define NUM_HOP_ATTR_FIELD_FUN(name,field) \
|
@@ -157,7 +157,7 @@ static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
|
157
157
|
scamper_trace_hop_t *trace_hop; \
|
158
158
|
PROCESS_HOP_PARAMS; \
|
159
159
|
Data_Get_Struct(self, scamper_trace_t, trace); \
|
160
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
160
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
161
161
|
if (!trace_hop) { \
|
162
162
|
return Qnil; \
|
163
163
|
} \
|
@@ -174,7 +174,7 @@ static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
|
174
174
|
char *ptr; \
|
175
175
|
PROCESS_HOP_PARAMS; \
|
176
176
|
Data_Get_Struct(self, scamper_trace_t, trace); \
|
177
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
177
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
178
178
|
if (!trace_hop) { \
|
179
179
|
return Qnil; \
|
180
180
|
} \
|
@@ -210,7 +210,7 @@ NUM_HOP_ATTR_FIELD_FUN(rtt_usec, rtt.tv_usec);
|
|
210
210
|
scamper_trace_hop_t *trace_hop; \
|
211
211
|
PROCESS_HOP_PARAMS; \
|
212
212
|
Data_Get_Struct(self, scamper_trace_t, trace); \
|
213
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
213
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
214
214
|
if (!trace_hop) { \
|
215
215
|
return Qnil; \
|
216
216
|
} \
|
@@ -247,7 +247,7 @@ static VALUE sctrace_init(VALUE self)
|
|
247
247
|
** with hop_count = 5 and hops == NULL, which triggers a segfault.
|
248
248
|
*
|
249
249
|
* Program received signal SIGSEGV, Segmentation fault.
|
250
|
-
* 0x283f06cc in find_trace_hop (trace=0x8635e40, hop=4,
|
250
|
+
* 0x283f06cc in find_trace_hop (trace=0x8635e40, hop=4, response=0)
|
251
251
|
* at sctrace.c:109
|
252
252
|
* 109 trace_hop = trace->hops[hop];
|
253
253
|
* (gdb) p trace
|
@@ -256,7 +256,7 @@ static VALUE sctrace_init(VALUE self)
|
|
256
256
|
* $2 = {list = 0x829f2c0, cycle = 0x829f2e0, src = 0x82a7d50, dst = 0x86c39e0,
|
257
257
|
* start = {tv_sec = 1189778005, tv_usec = 809855}, hops = 0x0, hop_count = 5,
|
258
258
|
* stop_reason = 5 '\005', stop_data = 0 '\0', type = 2 '\002', flags = 0 '\0',
|
259
|
-
*
|
259
|
+
* responses = 3 '\003', hoplimit = 0 '\0', gaplimit = 0 '\0',
|
260
260
|
* firsthop = 1 '\001', tos = 0 '\0', wait = 5 '\005', loops = 1 '\001',
|
261
261
|
* probe_size = 44, sport = 46235, dport = 33545, tlvs = 0x0, pmtud = 0x0}
|
262
262
|
*/
|
@@ -411,7 +411,7 @@ static VALUE sctrace_attr_hop_addr(int argc, VALUE *argv, VALUE self)
|
|
411
411
|
|
412
412
|
PROCESS_HOP_PARAMS;
|
413
413
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
414
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
414
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
415
415
|
if (!trace_hop) {
|
416
416
|
return Qnil;
|
417
417
|
}
|
@@ -426,7 +426,7 @@ static VALUE sctrace_attr_hop_rtt(int argc, VALUE *argv, VALUE self)
|
|
426
426
|
|
427
427
|
PROCESS_HOP_PARAMS;
|
428
428
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
429
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
429
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
430
430
|
if (!trace_hop) {
|
431
431
|
return Qnil;
|
432
432
|
}
|
@@ -445,7 +445,7 @@ static VALUE sctrace_attr_hop_rtt_str(int argc, VALUE *argv, VALUE self)
|
|
445
445
|
|
446
446
|
PROCESS_HOP_PARAMS;
|
447
447
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
448
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
448
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
449
449
|
if (!trace_hop) {
|
450
450
|
return Qnil;
|
451
451
|
}
|
@@ -464,7 +464,7 @@ static VALUE sctrace_hop_exists(int argc, VALUE *argv, VALUE self)
|
|
464
464
|
|
465
465
|
PROCESS_HOP_PARAMS;
|
466
466
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
467
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
467
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
468
468
|
return (trace_hop ? Qtrue : Qfalse);
|
469
469
|
}
|
470
470
|
|
@@ -495,7 +495,7 @@ static VALUE sctrace_each_hop(VALUE self)
|
|
495
495
|
}
|
496
496
|
|
497
497
|
|
498
|
-
static VALUE
|
498
|
+
static VALUE sctrace_each_response(VALUE self, VALUE hop)
|
499
499
|
{
|
500
500
|
scamper_trace_t *trace;
|
501
501
|
scamper_trace_hop_t *trace_hop;
|
@@ -504,10 +504,10 @@ static VALUE sctrace_each_attempt(VALUE self, VALUE hop)
|
|
504
504
|
|
505
505
|
trace_hop = find_trace_hop(trace, NUM2INT(hop), 0);
|
506
506
|
if (trace_hop) {
|
507
|
-
int
|
507
|
+
int response = 0;
|
508
508
|
rb_yield(INT2FIX(0));
|
509
509
|
while (trace_hop = trace_hop->hop_next) {
|
510
|
-
rb_yield(INT2FIX(++
|
510
|
+
rb_yield(INT2FIX(++response));
|
511
511
|
}
|
512
512
|
}
|
513
513
|
|
@@ -515,7 +515,7 @@ static VALUE sctrace_each_attempt(VALUE self, VALUE hop)
|
|
515
515
|
}
|
516
516
|
|
517
517
|
|
518
|
-
static VALUE
|
518
|
+
static VALUE sctrace_each_hop_and_response(VALUE self)
|
519
519
|
{
|
520
520
|
scamper_trace_t *trace;
|
521
521
|
scamper_trace_hop_t *trace_hop;
|
@@ -526,7 +526,7 @@ static VALUE sctrace_each_hop_and_attempt(VALUE self)
|
|
526
526
|
|
527
527
|
yield_args = rb_ary_new();
|
528
528
|
for (hop = 0; hop < trace->hop_count; hop++) {
|
529
|
-
int
|
529
|
+
int response = 0;
|
530
530
|
trace_hop = find_trace_hop(trace, hop, 0);
|
531
531
|
|
532
532
|
rb_ary_store(yield_args, 0, INT2FIX(hop));
|
@@ -537,7 +537,7 @@ static VALUE sctrace_each_hop_and_attempt(VALUE self)
|
|
537
537
|
if (trace_hop) {
|
538
538
|
rb_ary_store(yield_args, 2, Qtrue);
|
539
539
|
while (trace_hop = trace_hop->hop_next) {
|
540
|
-
rb_ary_store(yield_args, 1, INT2FIX(++
|
540
|
+
rb_ary_store(yield_args, 1, INT2FIX(++response));
|
541
541
|
rb_yield(yield_args);
|
542
542
|
}
|
543
543
|
}
|
@@ -594,7 +594,7 @@ static VALUE sctrace_hop_dest_response(int argc, VALUE *argv, VALUE self)
|
|
594
594
|
|
595
595
|
PROCESS_HOP_PARAMS;
|
596
596
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
597
|
-
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(
|
597
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
598
598
|
if (!trace_hop) {
|
599
599
|
return Qnil;
|
600
600
|
}
|
@@ -613,7 +613,7 @@ static VALUE sctrace_find_dest_response(VALUE self)
|
|
613
613
|
{
|
614
614
|
scamper_trace_t *trace;
|
615
615
|
scamper_trace_hop_t *trace_hop;
|
616
|
-
int hop,
|
616
|
+
int hop, response;
|
617
617
|
VALUE retval;
|
618
618
|
|
619
619
|
retval = rb_ivar_get(self, iv_dest_response);
|
@@ -633,16 +633,16 @@ static VALUE sctrace_find_dest_response(VALUE self)
|
|
633
633
|
}
|
634
634
|
|
635
635
|
for (hop = trace->hop_count - 1; hop >= 0; hop--) {
|
636
|
-
|
636
|
+
response = 0;
|
637
637
|
trace_hop = find_trace_hop(trace, hop, 0);
|
638
638
|
while (trace_hop) {
|
639
639
|
if (hop_is_dest_response(trace, trace_hop)) {
|
640
640
|
rb_ary_push(retval, INT2FIX(hop));
|
641
|
-
rb_ary_push(retval, INT2FIX(
|
641
|
+
rb_ary_push(retval, INT2FIX(response));
|
642
642
|
return retval;
|
643
643
|
}
|
644
644
|
|
645
|
-
++
|
645
|
+
++response;
|
646
646
|
trace_hop = trace_hop->hop_next;
|
647
647
|
}
|
648
648
|
}
|
@@ -656,7 +656,7 @@ static VALUE sctrace_dest_rtt(VALUE self)
|
|
656
656
|
scamper_trace_t *trace;
|
657
657
|
scamper_trace_hop_t *trace_hop;
|
658
658
|
VALUE dest_response;
|
659
|
-
int hop,
|
659
|
+
int hop, response;
|
660
660
|
|
661
661
|
dest_response = sctrace_find_dest_response(self);
|
662
662
|
if (NIL_P(dest_response)) {
|
@@ -664,10 +664,10 @@ static VALUE sctrace_dest_rtt(VALUE self)
|
|
664
664
|
}
|
665
665
|
|
666
666
|
hop = FIX2INT(rb_ary_entry(dest_response, 0));
|
667
|
-
|
667
|
+
response = FIX2INT(rb_ary_entry(dest_response, 1));
|
668
668
|
|
669
669
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
670
|
-
trace_hop = find_trace_hop(trace, hop,
|
670
|
+
trace_hop = find_trace_hop(trace, hop, response);
|
671
671
|
return rb_float_new(1000.0 * trace_hop->hop_rtt.tv_sec
|
672
672
|
+ trace_hop->hop_rtt.tv_usec / 1000.0);
|
673
673
|
}
|
@@ -680,7 +680,7 @@ static VALUE sctrace_dest_rtt_str(VALUE self)
|
|
680
680
|
scamper_trace_hop_t *trace_hop;
|
681
681
|
VALUE dest_response;
|
682
682
|
char buf[128];
|
683
|
-
int hop,
|
683
|
+
int hop, response;
|
684
684
|
|
685
685
|
dest_response = sctrace_find_dest_response(self);
|
686
686
|
if (NIL_P(dest_response)) {
|
@@ -688,10 +688,10 @@ static VALUE sctrace_dest_rtt_str(VALUE self)
|
|
688
688
|
}
|
689
689
|
|
690
690
|
hop = FIX2INT(rb_ary_entry(dest_response, 0));
|
691
|
-
|
691
|
+
response = FIX2INT(rb_ary_entry(dest_response, 1));
|
692
692
|
|
693
693
|
Data_Get_Struct(self, scamper_trace_t, trace);
|
694
|
-
trace_hop = find_trace_hop(trace, hop,
|
694
|
+
trace_hop = find_trace_hop(trace, hop, response);
|
695
695
|
|
696
696
|
sprintf(buf, "%d.%03d",
|
697
697
|
1000 * trace_hop->hop_rtt.tv_sec + trace_hop->hop_rtt.tv_usec / 1000,
|
@@ -707,7 +707,7 @@ static VALUE sctrace_complete(VALUE self)
|
|
707
707
|
scamper_trace_hop_t *trace_hop;
|
708
708
|
VALUE dest_response;
|
709
709
|
int dest_hop;
|
710
|
-
int hop,
|
710
|
+
int hop, response;
|
711
711
|
|
712
712
|
dest_response = sctrace_find_dest_response(self);
|
713
713
|
if (NIL_P(dest_response)) {
|
@@ -847,12 +847,16 @@ void Init_sctrace(void)
|
|
847
847
|
rb_define_method(cTrace, "dest_rtt", sctrace_dest_rtt, 0);
|
848
848
|
rb_define_method(cTrace, "dest_rtt_str", sctrace_dest_rtt_str, 0);
|
849
849
|
rb_define_method(cTrace, "each_hop", sctrace_each_hop, 0);
|
850
|
-
rb_define_method(cTrace, "
|
851
|
-
rb_define_method(cTrace, "
|
852
|
-
|
850
|
+
rb_define_method(cTrace, "each_response", sctrace_each_response, 1);
|
851
|
+
rb_define_method(cTrace, "each_hop_and_response",
|
852
|
+
sctrace_each_hop_and_response, 0);
|
853
853
|
|
854
854
|
rb_define_alias(cTrace, "dest_responded?", "find_dest_response");
|
855
|
-
rb_define_alias(cTrace, "each", "
|
855
|
+
rb_define_alias(cTrace, "each", "each_hop_and_response");
|
856
|
+
|
857
|
+
/* deprecated methods as of v0.9.12 */
|
858
|
+
rb_define_alias(cTrace, "each_attempt", "each_response");
|
859
|
+
rb_define_alias(cTrace, "each_hop_and_attempt", "each_hop_and_response");
|
856
860
|
|
857
861
|
DEF_HOP_ICMP_QUERY(ttl_exp);
|
858
862
|
DEF_HOP_ICMP_QUERY(ttl_exp_trans);
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: rb-wartslib
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date:
|
6
|
+
version: 0.9.12
|
7
|
+
date: 2008-01-18 00:00:00 -08:00
|
8
8
|
summary: Ruby extension for reading/writing warts files
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -43,10 +43,9 @@ files:
|
|
43
43
|
- bin/w2tr
|
44
44
|
- bin/wcat
|
45
45
|
- bin/wdump
|
46
|
-
- lib/wartslib
|
47
|
-
- lib/wartslib.rb
|
48
46
|
- lib/wartslib/wl-file.rb
|
49
47
|
- lib/wartslib/wl-trace.rb
|
48
|
+
- lib/wartslib.rb
|
50
49
|
- ext/extconf.rb
|
51
50
|
- ext/scaddr.c
|
52
51
|
- ext/scaddr.h
|
@@ -57,6 +56,34 @@ files:
|
|
57
56
|
- ext/sclist.h
|
58
57
|
- ext/sctrace.c
|
59
58
|
- ext/sctrace.h
|
59
|
+
- docs/index.html
|
60
|
+
- docs/reference.html
|
61
|
+
- docs/samples.html
|
62
|
+
- docs/tutorial.html
|
63
|
+
- docs/layout.css
|
64
|
+
- docs/ruby.css
|
65
|
+
- docs/style.css
|
66
|
+
- docs/tut-1-count.rb
|
67
|
+
- docs/tut-10-list2.rb
|
68
|
+
- docs/tut-11-cycle.rb
|
69
|
+
- docs/tut-12-cycle2.rb
|
70
|
+
- docs/tut-13-write.rb
|
71
|
+
- docs/tut-14-write2.rb
|
72
|
+
- docs/tut-15-write3.rb
|
73
|
+
- docs/tut-16-write4.rb
|
74
|
+
- docs/tut-17-modify.rb
|
75
|
+
- docs/tut-18-modify2.rb
|
76
|
+
- docs/tut-2-count-block.rb
|
77
|
+
- docs/tut-3-count-resp.rb
|
78
|
+
- docs/tut-4-path-length.rb
|
79
|
+
- docs/tut-5-hop-addr.rb
|
80
|
+
- docs/tut-6-hop-addr2.rb
|
81
|
+
- docs/tut-7-hop-addr3.rb
|
82
|
+
- docs/tut-8-hop-addr4.rb
|
83
|
+
- docs/tut-9-list.rb
|
84
|
+
- docs/gen-code-html
|
85
|
+
- docs/gen-output-html
|
86
|
+
- docs/gen-tut-html
|
60
87
|
- README
|
61
88
|
- CHANGES
|
62
89
|
- COPYING
|