diff --git a/traceroute.cc b/traceroute.cc index 91f4501af..7230a19a6 100644 --- a/traceroute.cc +++ b/traceroute.cc @@ -1207,6 +1207,34 @@ void TraceGroup::consolidateHops() { TraceProbes.erase(++ttl_count); } +/* This is the function that gives the traceroute its "up and down" nature. + gotReply is true if we've gotten a reply from the target (finished counting + up). */ +void TraceGroup::nextTTL() { + if (gotReply) { + ttl--; + } else { + ttl++; + hopDistance++; + } +} + +void TraceGroup::incRemaining() { + if (remaining < 255) + ++remaining; +} + +void TraceGroup::decRemaining() { + if (remaining > 0) + --remaining; +} + +char *TraceGroup::IPStr() { + struct in_addr s; + s.s_addr = ipdst; + return inet_ntoa (s); +} + u8 TraceGroup::setState(u8 state) { if (state <= G_FINISH && state >= G_OK) diff --git a/traceroute.h b/traceroute.h index cc44324dd..52e6d9ed7 100644 --- a/traceroute.h +++ b/traceroute.h @@ -251,11 +251,11 @@ class TraceGroup { void consolidateHops (); /* the next ttl to send, if the destination has replied * the ttl is decremented, if it hasn't it is incremented */ - void nextTTL () { if (gotReply) ttl--; else { ttl++; hopDistance++;}} + void nextTTL(); /* number of probes currently waiting for replies */ - void incRemaining () { if (remaining < 255) ++remaining; } - void decRemaining () { if (remaining > 0) --remaining; } - char *IPStr () { struct in_addr s; s.s_addr = ipdst; return inet_ntoa (s);} + void incRemaining(); + void decRemaining(); + char *IPStr(); u8 getRemaining () { return remaining;} u8 getState () { return state; } u8 setState (u8 state);