rb-wartslib 0.9.12 → 0.9.13
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 +37 -0
- data/README +9 -6
- data/bin/count-traces +4 -4
- data/bin/create-aspath +3 -3
- data/bin/extract-trace-addrs +3 -3
- data/bin/modify-traces +7 -7
- data/bin/scdump +3 -3
- data/bin/select-traces +9 -9
- data/bin/show-cycles +5 -6
- data/bin/split-traces-by-type +2 -2
- data/bin/stat-traces +29 -30
- data/bin/trace-gap-size-hist +3 -3
- data/bin/trace-timestamps-hist +2 -2
- data/bin/w2tr +2 -2
- data/bin/wdump +16 -4
- data/docs/index.html +9 -1
- data/docs/reference.html +330 -7
- data/docs/style.css +1 -1
- data/docs/tut-1-count.rb +1 -1
- data/docs/tut-10-list2.rb +3 -3
- data/docs/tut-11-cycle.rb +1 -1
- data/docs/tut-12-cycle2.rb +7 -8
- data/docs/tut-13-write.rb +1 -1
- data/docs/tut-14-write2.rb +2 -3
- data/docs/tut-15-write3.rb +1 -1
- data/docs/tut-16-write4.rb +1 -1
- data/docs/tut-17-modify.rb +3 -4
- data/docs/tut-18-modify2.rb +3 -4
- data/docs/tut-2-count-block.rb +1 -1
- data/docs/tut-3-count-resp.rb +1 -1
- data/docs/tut-4-path-length.rb +5 -17
- data/docs/tut-5-hop-addr.rb +1 -1
- data/docs/tut-6-hop-addr2.rb +1 -1
- data/docs/tut-7-hop-addr3.rb +1 -1
- data/docs/tut-8-hop-addr4.rb +1 -1
- data/docs/tut-9-list.rb +1 -1
- data/docs/tutorial.html +38 -54
- data/ext/scaddr.h +3 -2
- data/ext/scext.c +11 -2
- data/ext/scfile.c +2 -1
- data/ext/scfile.h +3 -2
- data/ext/sclist.h +2 -2
- data/ext/sctrace.c +205 -18
- data/ext/sctrace.h +3 -2
- data/lib/wartslib/wl-file.rb +3 -2
- data/lib/wartslib/wl-trace.rb +70 -2
- metadata +2 -2
data/ext/scaddr.h
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: scaddr.h,v 1.
|
21
|
+
** $Id: scaddr.h,v 1.3 2008/01/22 23:47:43 youngh Exp $
|
22
22
|
**/
|
23
23
|
|
24
24
|
#ifndef __SCADDR_H
|
@@ -29,4 +29,5 @@
|
|
29
29
|
VALUE scaddr_create(scamper_addr_t *addr);
|
30
30
|
void Init_scaddr(void);
|
31
31
|
|
32
|
-
#endif
|
32
|
+
#endif /* __SCADDR_H */
|
33
|
+
|
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.24 2008/01/25 01:15:46 youngh Exp $
|
23
23
|
**/
|
24
24
|
|
25
25
|
#include "ruby.h"
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#endif
|
30
30
|
|
31
31
|
#include "scamper.h"
|
32
|
+
#include "scamper_file.h"
|
32
33
|
|
33
34
|
#include "scaddr.h"
|
34
35
|
#include "sclist.h"
|
@@ -41,9 +42,17 @@ void Init_wartslibext(void)
|
|
41
42
|
{
|
42
43
|
mWarts = rb_define_module("Warts");
|
43
44
|
|
44
|
-
rb_define_const(mWarts, "WARTS_LIB_VERSION", rb_str_new2("0.9.
|
45
|
+
rb_define_const(mWarts, "WARTS_LIB_VERSION", rb_str_new2("0.9.13"));
|
45
46
|
rb_define_const(mWarts, "SCAMPER_VERSION", rb_str_new2(SCAMPER_VERSION));
|
46
47
|
|
48
|
+
rb_define_const(mWarts, "LIST", INT2FIX(SCAMPER_FILE_OBJ_LIST));
|
49
|
+
rb_define_const(mWarts, "CYCLE_START", INT2FIX(SCAMPER_FILE_OBJ_CYCLE_START));
|
50
|
+
rb_define_const(mWarts, "CYCLE_DEF", INT2FIX(SCAMPER_FILE_OBJ_CYCLE_DEF));
|
51
|
+
rb_define_const(mWarts, "CYCLE_STOP", INT2FIX(SCAMPER_FILE_OBJ_CYCLE_STOP));
|
52
|
+
rb_define_const(mWarts, "ADDR", INT2FIX(SCAMPER_FILE_OBJ_ADDR));
|
53
|
+
rb_define_const(mWarts, "TRACE", INT2FIX(SCAMPER_FILE_OBJ_TRACE));
|
54
|
+
rb_define_const(mWarts, "PING", INT2FIX(SCAMPER_FILE_OBJ_PING));
|
55
|
+
|
47
56
|
Init_scaddr();
|
48
57
|
Init_sclist();
|
49
58
|
Init_sccycle();
|
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.33 2008/01/25 01:15:20 youngh Exp $
|
22
22
|
**/
|
23
23
|
|
24
24
|
#include <unistd.h>
|
@@ -647,6 +647,7 @@ void Init_scfile(void)
|
|
647
647
|
|
648
648
|
cFile = rb_define_class_under(mWarts, "File", rb_cObject);
|
649
649
|
|
650
|
+
/* deprecated since 0.9.13 -- use the same constants in the Warts module */
|
650
651
|
for (i = 0; i < num_sctypes; i++) {
|
651
652
|
rb_define_const(cFile, all_sctypes[i].name,
|
652
653
|
INT2FIX(all_sctypes[i].value));
|
data/ext/scfile.h
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.h,v 1.
|
21
|
+
** $Id: scfile.h,v 1.3 2008/01/22 23:48:23 youngh Exp $
|
22
22
|
**/
|
23
23
|
|
24
24
|
#ifndef __SCFILE_H
|
@@ -26,4 +26,5 @@
|
|
26
26
|
|
27
27
|
void Init_scfile(void);
|
28
28
|
|
29
|
-
#endif
|
29
|
+
#endif /* __SCFILE_H */
|
30
|
+
|
data/ext/sclist.h
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: sclist.h,v 1.
|
21
|
+
** $Id: sclist.h,v 1.3 2008/01/22 23:48:39 youngh Exp $
|
22
22
|
**/
|
23
23
|
|
24
24
|
#ifndef __SCLIST_H
|
@@ -31,4 +31,4 @@ VALUE sccycle_create(scamper_cycle_t *cycle, int type);
|
|
31
31
|
void Init_sclist(void);
|
32
32
|
void Init_sccycle(void);
|
33
33
|
|
34
|
-
#endif
|
34
|
+
#endif /* __SCLIST_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.59 2008/01/25 00:17:32 youngh Exp $
|
31
31
|
**/
|
32
32
|
|
33
33
|
#include "ruby.h"
|
@@ -36,7 +36,11 @@
|
|
36
36
|
#include <stdint.h>
|
37
37
|
#endif
|
38
38
|
|
39
|
+
#include "scamper_addr.h"
|
40
|
+
#include "scamper_list.h"
|
41
|
+
#include "scamper_trace.h"
|
39
42
|
#include "scamper_file.h"
|
43
|
+
#include "scamper_tlv.h"
|
40
44
|
#include "sctrace.h"
|
41
45
|
#include "sclist.h"
|
42
46
|
|
@@ -50,9 +54,10 @@ static ID meth_write_trace;
|
|
50
54
|
|
51
55
|
/*-------------------------------------------------------------------------*/
|
52
56
|
|
53
|
-
#define
|
54
|
-
rb_define_const(cTrace, #
|
57
|
+
#define DEF_CONST2(field_name, macro_name) \
|
58
|
+
rb_define_const(cTrace, #field_name, INT2FIX(SCAMPER_TRACE_##macro_name));
|
55
59
|
|
60
|
+
#define DEF_CONST(name) DEF_CONST2(name, name)
|
56
61
|
|
57
62
|
/*-------------------------------------------------------------------------*/
|
58
63
|
|
@@ -142,6 +147,7 @@ static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
|
142
147
|
#define DEF_HOP_ATTR(name) \
|
143
148
|
rb_define_method(cTrace, #name, sctrace_attr_##name, -1);
|
144
149
|
|
150
|
+
|
145
151
|
/* Because this declares variables, this macro must occur
|
146
152
|
immediately after the variable declarations in a function. */
|
147
153
|
#define PROCESS_HOP_PARAMS \
|
@@ -150,14 +156,18 @@ static scamper_trace_hop_t *find_trace_hop(scamper_trace_t *trace,
|
|
150
156
|
response = INT2FIX(0); \
|
151
157
|
}
|
152
158
|
|
153
|
-
#define
|
154
|
-
static VALUE sctrace_attr_hop_##name(int argc, VALUE *argv, VALUE self) \
|
155
|
-
{ \
|
159
|
+
#define HOP_METHOD_BODY_BEGINNING \
|
156
160
|
scamper_trace_t *trace; \
|
157
161
|
scamper_trace_hop_t *trace_hop; \
|
158
162
|
PROCESS_HOP_PARAMS; \
|
159
163
|
Data_Get_Struct(self, scamper_trace_t, trace); \
|
160
164
|
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
165
|
+
|
166
|
+
|
167
|
+
#define NUM_HOP_ATTR_FIELD_FUN(name,field) \
|
168
|
+
static VALUE sctrace_attr_hop_##name(int argc, VALUE *argv, VALUE self) \
|
169
|
+
{ \
|
170
|
+
HOP_METHOD_BODY_BEGINNING; \
|
161
171
|
if (!trace_hop) { \
|
162
172
|
return Qnil; \
|
163
173
|
} \
|
@@ -191,29 +201,151 @@ NUM_HOP_ATTR_FUN(probe_ttl);
|
|
191
201
|
NUM_HOP_ATTR_FUN(reply_ttl);
|
192
202
|
NUM_HOP_ATTR_FUN(probe_size);
|
193
203
|
NUM_HOP_ATTR_FUN(reply_size);
|
194
|
-
NUM_HOP_ATTR_FUN(icmp_type);
|
195
|
-
NUM_HOP_ATTR_FUN(icmp_code);
|
196
|
-
NUM_HOP_ATTR_FUN(tcp_flags);
|
197
204
|
NUM_HOP_ATTR_FIELD_FUN(rtt_sec, rtt.tv_sec);
|
198
205
|
NUM_HOP_ATTR_FIELD_FUN(rtt_usec, rtt.tv_usec);
|
199
206
|
|
207
|
+
/*-------------------------------------------------------------------------*/
|
208
|
+
|
209
|
+
#define HOP_FLAG_FUN(name,flag) \
|
210
|
+
static VALUE sctrace_hop_##name(int argc, VALUE *argv, VALUE self) \
|
211
|
+
{ \
|
212
|
+
HOP_METHOD_BODY_BEGINNING; \
|
213
|
+
if (!trace_hop) { \
|
214
|
+
return Qnil; \
|
215
|
+
} \
|
216
|
+
return ((trace_hop->hop_flags & SCAMPER_TRACE_HOP_FLAG_##flag) \
|
217
|
+
? Qtrue : Qfalse);\
|
218
|
+
}
|
219
|
+
|
220
|
+
#define HOP_NOT_FLAG_FUN(name,flag) \
|
221
|
+
static VALUE sctrace_hop_##name(int argc, VALUE *argv, VALUE self) \
|
222
|
+
{ \
|
223
|
+
HOP_METHOD_BODY_BEGINNING; \
|
224
|
+
if (!trace_hop) { \
|
225
|
+
return Qnil; \
|
226
|
+
} \
|
227
|
+
return ((trace_hop->hop_flags & SCAMPER_TRACE_HOP_FLAG_##flag) \
|
228
|
+
? Qfalse : Qtrue);\
|
229
|
+
}
|
230
|
+
|
231
|
+
/*
|
232
|
+
** If a trace doesn't have a reply TTL, then the hop_reply_ttl accessor
|
233
|
+
** returns 0. The user should call hop_has_reply_ttl? to distinguish
|
234
|
+
** a true 0 reply TTL from a missing reply TTL.
|
235
|
+
*/
|
236
|
+
HOP_FLAG_FUN(has_reply_ttl, REPLY_TTL);
|
237
|
+
|
238
|
+
/*
|
239
|
+
** The scamper_trace_hop.hop_un.hop_tcp_flags field is only valid if the TCP
|
240
|
+
** flag is set. Similarly, scamper_trace_hop.hop_un.hop_icmp_{type,code}
|
241
|
+
** fields are only valid if the TCP flag is NOT set.
|
242
|
+
*/
|
243
|
+
HOP_FLAG_FUN(has_tcp_reply, TCP);
|
244
|
+
HOP_NOT_FLAG_FUN(has_icmp_reply, TCP);
|
200
245
|
|
201
246
|
/*-------------------------------------------------------------------------*/
|
202
247
|
|
203
|
-
#define
|
204
|
-
|
248
|
+
#define NUM_HOP_ATTR_FLAG_FUN(name,flag) \
|
249
|
+
static VALUE sctrace_attr_hop_##name(int argc, VALUE *argv, VALUE self) \
|
250
|
+
{ \
|
251
|
+
HOP_METHOD_BODY_BEGINNING; \
|
252
|
+
if (!trace_hop \
|
253
|
+
|| (trace_hop->hop_flags & SCAMPER_TRACE_HOP_FLAG_##flag) == 0) { \
|
254
|
+
return Qnil; \
|
255
|
+
} \
|
256
|
+
return UINT2NUM(trace_hop->hop_##name); \
|
257
|
+
}
|
205
258
|
|
206
|
-
#define
|
207
|
-
static VALUE
|
259
|
+
#define NUM_HOP_ATTR_NOT_FLAG_FUN(name,flag) \
|
260
|
+
static VALUE sctrace_attr_hop_##name(int argc, VALUE *argv, VALUE self) \
|
261
|
+
{ \
|
262
|
+
HOP_METHOD_BODY_BEGINNING; \
|
263
|
+
if (!trace_hop \
|
264
|
+
|| (trace_hop->hop_flags & SCAMPER_TRACE_HOP_FLAG_##flag)) { \
|
265
|
+
return Qnil; \
|
266
|
+
} \
|
267
|
+
return UINT2NUM(trace_hop->hop_##name); \
|
268
|
+
}
|
269
|
+
|
270
|
+
NUM_HOP_ATTR_NOT_FLAG_FUN(icmp_type, TCP);
|
271
|
+
NUM_HOP_ATTR_NOT_FLAG_FUN(icmp_code, TCP);
|
272
|
+
NUM_HOP_ATTR_FLAG_FUN(tcp_flags, TCP);
|
273
|
+
|
274
|
+
/*-------------------------------------------------------------------------*/
|
275
|
+
|
276
|
+
#define DEF_HOP_TLV(name) \
|
277
|
+
rb_define_method(cTrace, #name, sctrace_tlv_##name, -1);
|
278
|
+
|
279
|
+
#define NUM_HOP_TLV_FUN(name,type,size) \
|
280
|
+
static VALUE sctrace_tlv_hop_##name(int argc, VALUE *argv, VALUE self) \
|
281
|
+
{ \
|
282
|
+
scamper_trace_t *trace; \
|
283
|
+
scamper_trace_hop_t *trace_hop; \
|
284
|
+
const scamper_tlv_t *tlv; \
|
285
|
+
PROCESS_HOP_PARAMS; \
|
286
|
+
Data_Get_Struct(self, scamper_trace_t, trace); \
|
287
|
+
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
288
|
+
if (!trace_hop) { \
|
289
|
+
return Qnil; \
|
290
|
+
} \
|
291
|
+
tlv = scamper_tlv_get(trace_hop->hop_tlvs, SCAMPER_TRACE_HOP_TLV_##type); \
|
292
|
+
return (tlv ? UINT2NUM(tlv->tlv_u.val_##size) : Qnil); \
|
293
|
+
}
|
294
|
+
|
295
|
+
#define NUM_HOP_TLV_WITH_DEFAULT_FUN(name,type,size,default_value) \
|
296
|
+
static VALUE sctrace_tlv_hop_##name(int argc, VALUE *argv, VALUE self) \
|
208
297
|
{ \
|
209
298
|
scamper_trace_t *trace; \
|
210
299
|
scamper_trace_hop_t *trace_hop; \
|
300
|
+
const scamper_tlv_t *tlv; \
|
211
301
|
PROCESS_HOP_PARAMS; \
|
212
302
|
Data_Get_Struct(self, scamper_trace_t, trace); \
|
213
303
|
trace_hop = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response)); \
|
214
304
|
if (!trace_hop) { \
|
215
305
|
return Qnil; \
|
216
306
|
} \
|
307
|
+
tlv = scamper_tlv_get(trace_hop->hop_tlvs, SCAMPER_TRACE_HOP_TLV_##type); \
|
308
|
+
return UINT2NUM(tlv ? tlv->tlv_u.val_##size : default_value); \
|
309
|
+
}
|
310
|
+
|
311
|
+
NUM_HOP_TLV_FUN(reply_ipid, REPLY_IPID, 16);
|
312
|
+
NUM_HOP_TLV_FUN(reply_iptos, REPLY_IPTOS, 8);
|
313
|
+
NUM_HOP_TLV_FUN(next_hop_mtu, NHMTU, 16);
|
314
|
+
NUM_HOP_TLV_WITH_DEFAULT_FUN(inner_iplen, INNER_IPLEN, 16,
|
315
|
+
trace_hop->hop_probe_size);
|
316
|
+
NUM_HOP_TLV_WITH_DEFAULT_FUN(inner_ipttl, INNER_IPTTL, 8, 1);
|
317
|
+
|
318
|
+
/*
|
319
|
+
* INNER_IPTOS was introduced in scamper-cvs-20070523j.new (Jan 20,
|
320
|
+
* 2008). Some care is needed, however, because a missing inner iptos
|
321
|
+
* tlv can mean two completely different things: (A) the inner iptos
|
322
|
+
* is the same as the probe iptos (scamper j.new or later), or (B) the
|
323
|
+
* inner iptos may or may not be the same as the probe iptos (scamper
|
324
|
+
* prior to j.new).
|
325
|
+
*
|
326
|
+
* It would be nice to have the inner_iptos accessor method return the
|
327
|
+
* probe tos if no tlv is found, but that would be misleading for older
|
328
|
+
* trace files. Hence, this returns nil when no tlv is found, and leaves
|
329
|
+
* it to the user to disambiguate this result based on external knowledge.
|
330
|
+
*/
|
331
|
+
#ifndef SCAMPER_TRACE_HOP_TLV_INNER_IPTOS
|
332
|
+
#define SCAMPER_TRACE_HOP_TLV_INNER_IPTOS 0x06 /* 1 byte */
|
333
|
+
#endif
|
334
|
+
|
335
|
+
NUM_HOP_TLV_FUN(inner_iptos, INNER_IPTOS, 8);
|
336
|
+
|
337
|
+
/*-------------------------------------------------------------------------*/
|
338
|
+
|
339
|
+
#define DEF_HOP_ICMP_QUERY(name) \
|
340
|
+
rb_define_method(cTrace, "hop_icmp_" #name "?", sctrace_hop_icmp_##name, -1);
|
341
|
+
|
342
|
+
#define HOP_ICMP_QUERY_FUN(name,macro) \
|
343
|
+
static VALUE sctrace_hop_icmp_##name(int argc, VALUE *argv, VALUE self) \
|
344
|
+
{ \
|
345
|
+
HOP_METHOD_BODY_BEGINNING; \
|
346
|
+
if (!trace_hop) { \
|
347
|
+
return Qnil; \
|
348
|
+
} \
|
217
349
|
return SCAMPER_TRACE_HOP_IS_ICMP_##macro(trace_hop) ? Qtrue : Qfalse; \
|
218
350
|
}
|
219
351
|
|
@@ -284,7 +416,7 @@ static VALUE sctrace_src(VALUE self)
|
|
284
416
|
}
|
285
417
|
|
286
418
|
|
287
|
-
static VALUE
|
419
|
+
static VALUE sctrace_dest(VALUE self)
|
288
420
|
{
|
289
421
|
scamper_trace_t *trace;
|
290
422
|
char buf[128];
|
@@ -314,7 +446,7 @@ static VALUE sctrace_src_cmp(VALUE self, VALUE other)
|
|
314
446
|
}
|
315
447
|
|
316
448
|
|
317
|
-
static VALUE
|
449
|
+
static VALUE sctrace_dest_cmp(VALUE self, VALUE other)
|
318
450
|
{
|
319
451
|
scamper_trace_t *self_trace;
|
320
452
|
scamper_trace_t *other_trace;
|
@@ -403,6 +535,33 @@ static VALUE sctrace_set_cycle(VALUE self, VALUE cycle_v)
|
|
403
535
|
|
404
536
|
/*-------------------------------------------------------------------------*/
|
405
537
|
|
538
|
+
static VALUE sctrace_hop_tcp_flags_breakdown(int argc, VALUE *argv, VALUE self)
|
539
|
+
{
|
540
|
+
scamper_trace_t *trace;
|
541
|
+
scamper_trace_hop_t *th;
|
542
|
+
VALUE retval;
|
543
|
+
|
544
|
+
PROCESS_HOP_PARAMS;
|
545
|
+
Data_Get_Struct(self, scamper_trace_t, trace);
|
546
|
+
th = find_trace_hop(trace, NUM2INT(hop), NUM2INT(response));
|
547
|
+
if (!th || (th->hop_flags & SCAMPER_TRACE_HOP_FLAG_TCP) == 0) {
|
548
|
+
return Qnil;
|
549
|
+
}
|
550
|
+
|
551
|
+
retval = rb_ary_new();
|
552
|
+
if (th->hop_tcp_flags & 0x01) { rb_ary_push(retval, rb_str_new2("fin")); }
|
553
|
+
if (th->hop_tcp_flags & 0x02) { rb_ary_push(retval, rb_str_new2("syn")); }
|
554
|
+
if (th->hop_tcp_flags & 0x04) { rb_ary_push(retval, rb_str_new2("rst")); }
|
555
|
+
if (th->hop_tcp_flags & 0x08) { rb_ary_push(retval, rb_str_new2("psh")); }
|
556
|
+
if (th->hop_tcp_flags & 0x10) { rb_ary_push(retval, rb_str_new2("ack")); }
|
557
|
+
if (th->hop_tcp_flags & 0x20) { rb_ary_push(retval, rb_str_new2("urg")); }
|
558
|
+
if (th->hop_tcp_flags & 0x40) { rb_ary_push(retval, rb_str_new2("ece")); }
|
559
|
+
if (th->hop_tcp_flags & 0x80) { rb_ary_push(retval, rb_str_new2("cwr")); }
|
560
|
+
/* there are only 8 flag bits, so no more possible */
|
561
|
+
return retval;
|
562
|
+
}
|
563
|
+
|
564
|
+
|
406
565
|
static VALUE sctrace_attr_hop_addr(int argc, VALUE *argv, VALUE self)
|
407
566
|
{
|
408
567
|
scamper_trace_t *trace;
|
@@ -761,10 +920,21 @@ void Init_sctrace(void)
|
|
761
920
|
DEF_CONST(STOP_UNREACH);
|
762
921
|
DEF_CONST(STOP_ICMP);
|
763
922
|
DEF_CONST(STOP_LOOP);
|
764
|
-
|
923
|
+
|
924
|
+
#ifdef SCAMPER_TRACE_STOP_GAPLIMIT /* scamper-cvs-20070523j.new (20080120) */
|
925
|
+
DEF_CONST2(STOP_DEAD, STOP_GAPLIMIT); /* deprecated */
|
926
|
+
DEF_CONST(STOP_GAPLIMIT);
|
927
|
+
#else
|
928
|
+
DEF_CONST(STOP_DEAD); /* deprecated */
|
929
|
+
DEF_CONST2(STOP_GAPLIMIT, STOP_DEAD);
|
930
|
+
#endif
|
931
|
+
|
765
932
|
DEF_CONST(STOP_ERROR);
|
933
|
+
|
766
934
|
#ifdef SCAMPER_TRACE_STOP_HOPLIMIT /* scamper-cvs-20070523 */
|
767
935
|
DEF_CONST(STOP_HOPLIMIT);
|
936
|
+
#else
|
937
|
+
DEF_CONST2(STOP_HOPLIMIT, 0x07);
|
768
938
|
#endif
|
769
939
|
|
770
940
|
DEF_CONST(FLAG_ALLATTEMPTS);
|
@@ -782,6 +952,7 @@ void Init_sctrace(void)
|
|
782
952
|
DEF_CONST(HOP_FLAG_TS_DL_RX);
|
783
953
|
DEF_CONST(HOP_FLAG_TS_TSC);
|
784
954
|
DEF_CONST(HOP_FLAG_REPLY_TTL);
|
955
|
+
DEF_CONST(HOP_FLAG_TCP);
|
785
956
|
|
786
957
|
DEF_ATTR(list_id);
|
787
958
|
DEF_ATTR(list_name);
|
@@ -827,20 +998,32 @@ void Init_sctrace(void)
|
|
827
998
|
DEF_HOP_ATTR(hop_rtt_sec);
|
828
999
|
DEF_HOP_ATTR(hop_rtt_usec);
|
829
1000
|
|
1001
|
+
DEF_HOP_TLV(hop_reply_ipid);
|
1002
|
+
DEF_HOP_TLV(hop_reply_iptos);
|
1003
|
+
DEF_HOP_TLV(hop_next_hop_mtu);
|
1004
|
+
DEF_HOP_TLV(hop_inner_iplen);
|
1005
|
+
DEF_HOP_TLV(hop_inner_ipttl);
|
1006
|
+
DEF_HOP_TLV(hop_inner_iptos);
|
1007
|
+
|
830
1008
|
rb_define_alloc_func(cTrace, sctrace_alloc);
|
831
1009
|
|
832
1010
|
rb_define_attr(cTrace, "element_type", 1, 0);
|
833
1011
|
|
834
1012
|
rb_define_method(cTrace, "initialize", sctrace_init, 0);
|
835
1013
|
rb_define_method(cTrace, "src", sctrace_src, 0);
|
836
|
-
rb_define_method(cTrace, "
|
1014
|
+
rb_define_method(cTrace, "dest", sctrace_dest, 0);
|
837
1015
|
rb_define_method(cTrace, "src_cmp", sctrace_src_cmp, 1);
|
838
|
-
rb_define_method(cTrace, "
|
1016
|
+
rb_define_method(cTrace, "dest_cmp", sctrace_dest_cmp, 1);
|
839
1017
|
rb_define_method(cTrace, "write_to", sctrace_write_to, 1);
|
840
1018
|
rb_define_method(cTrace, "list", sctrace_list, 0);
|
841
1019
|
rb_define_method(cTrace, "cycle", sctrace_cycle, 0);
|
842
1020
|
rb_define_method(cTrace, "cycle=", sctrace_set_cycle, 1);
|
843
1021
|
rb_define_method(cTrace, "hop_exists?", sctrace_hop_exists, -1);
|
1022
|
+
rb_define_method(cTrace, "hop_has_reply_ttl?", sctrace_hop_has_reply_ttl, -1);
|
1023
|
+
rb_define_method(cTrace, "hop_has_tcp_reply?", sctrace_hop_has_tcp_reply, -1);
|
1024
|
+
rb_define_method(cTrace, "hop_has_icmp_reply?",sctrace_hop_has_icmp_reply,-1);
|
1025
|
+
rb_define_method(cTrace, "hop_tcp_flags_breakdown",
|
1026
|
+
sctrace_hop_tcp_flags_breakdown, -1);
|
844
1027
|
rb_define_method(cTrace, "hop_dest_response?", sctrace_hop_dest_response,-1);
|
845
1028
|
rb_define_method(cTrace, "find_dest_response", sctrace_find_dest_response,0);
|
846
1029
|
rb_define_method(cTrace, "complete?", sctrace_complete, 0);
|
@@ -858,6 +1041,10 @@ void Init_sctrace(void)
|
|
858
1041
|
rb_define_alias(cTrace, "each_attempt", "each_response");
|
859
1042
|
rb_define_alias(cTrace, "each_hop_and_attempt", "each_hop_and_response");
|
860
1043
|
|
1044
|
+
/* deprecated methods as of v0.9.13 */
|
1045
|
+
rb_define_alias(cTrace, "dst", "dest");
|
1046
|
+
rb_define_alias(cTrace, "dst_cmp", "dest_cmp");
|
1047
|
+
|
861
1048
|
DEF_HOP_ICMP_QUERY(ttl_exp);
|
862
1049
|
DEF_HOP_ICMP_QUERY(ttl_exp_trans);
|
863
1050
|
DEF_HOP_ICMP_QUERY(packet_too_big);
|
data/ext/sctrace.h
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: sctrace.h,v 1.
|
22
|
+
** $Id: sctrace.h,v 1.4 2008/01/22 23:49:09 youngh Exp $
|
23
23
|
**/
|
24
24
|
|
25
25
|
#ifndef __SCFILE_H
|
@@ -32,4 +32,5 @@
|
|
32
32
|
VALUE sctrace_create(scamper_trace_t *trace);
|
33
33
|
void Init_sctrace(void);
|
34
34
|
|
35
|
-
#endif
|
35
|
+
#endif /* __SCFILE_H */
|
36
|
+
|