Move HopIdent above hop_cache, which uses it.

This caused an error message when compiled with Clang 3.1:

traceroute.cc:173:41: note: in instantiation of exception specification for 'map' requested here
static std::map<struct HopIdent, Hop *> hop_cache;
                                        ^
traceroute.cc:173:24: note: forward declaration of 'HopIdent'
static std::map<struct HopIdent, Hop *> hop_cache;
                       ^

Found by arrowdodger. http://seclists.org/nmap-dev/2012/q4/58.
This commit is contained in:
david 2012-10-11 05:42:37 +00:00
parent 03d4b03d2c
commit 53b4fdcf0a

View file

@ -166,23 +166,6 @@ struct Hop;
class HostState;
class Probe;
/* A global random token used to distinguish this traceroute's probes from
those of other traceroutes possibly running on the same machine. */
static u16 global_id;
/* A global cache of known hops, indexed by TTL and address. */
static std::map<struct HopIdent, Hop *> hop_cache;
/* A list of timedout hops, which are not kept in hop_cache, so we can delete
all hops on occasion. */
static std::list<Hop *> timedout_hops;
/* The TTL at which we start sending probes if we don't have a distance
estimate. This is updated after each host group on the assumption that hosts
across groups will not differ much in distance. Having this closer to the
true distance makes the trace faster but is not needed for accuracy. */
static u8 initial_ttl = 10;
static struct timeval get_now(struct timeval *now = NULL);
static const char *ss_to_string(const struct sockaddr_storage *ss);
/* An object of this class is a (TTL, address) pair that uniquely identifies a
hop. Hops in the hop_cache are indexed by this type. */
struct HopIdent {
@ -204,6 +187,23 @@ struct HopIdent {
}
};
/* A global random token used to distinguish this traceroute's probes from
those of other traceroutes possibly running on the same machine. */
static u16 global_id;
/* A global cache of known hops, indexed by TTL and address. */
static std::map<struct HopIdent, Hop *> hop_cache;
/* A list of timedout hops, which are not kept in hop_cache, so we can delete
all hops on occasion. */
static std::list<Hop *> timedout_hops;
/* The TTL at which we start sending probes if we don't have a distance
estimate. This is updated after each host group on the assumption that hosts
across groups will not differ much in distance. Having this closer to the
true distance makes the trace faster but is not needed for accuracy. */
static u8 initial_ttl = 10;
static struct timeval get_now(struct timeval *now = NULL);
static const char *ss_to_string(const struct sockaddr_storage *ss);
struct Hop {
Hop *parent;
struct sockaddr_storage tag;