img/mtr_icon.xpm \
mtr-gtk.h
-if IPINFO
+if WITH_IPINFO
mtr_SOURCES += asn.c asn.h
endif
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-// The autoconf system provides us with the NO_IPINFO define.
-// Littering the code with #ifndef NO_IPINFO (double negative)
-// does not benefit readability. So here we invert the sense of the
-// define.
-//
-// Similarly, this include file should be included unconditionally.
-// It will evaluate to nothing if we don't need it.
-
-#ifndef NO_IPINFO
-
-#ifndef IPINFO
-#define IPINFO
-
extern int ipinfo_no;
extern int ipinfo_max;
extern int iiwidth_len;
char *fmt_ipinfo(ip_t *addr);
int get_iiwidth(void);
int is_printii(void);
-
-#endif /* IPINFO */
-#endif /* NO_IPINFO */
AC_ARG_WITH([ipinfo],
[AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])],
[], [with_ipinfo=yes])
-AM_CONDITIONAL([IPINFO], [test "x$with_ipinfo" = "xyes"])
-AS_IF([test "x$with_ipinfo" = "xno"], [
- AC_DEFINE([NO_IPINFO], [1], [Define to disable ipinfo lookup])
+AM_CONDITIONAL([WITH_IPINFO], [test "x$with_ipinfo" = "xyes"])
+AS_IF([test "x$with_ipinfo" = "xyes"], [
+ AC_DEFINE([HAVE_IPINFO], [1], [Define when ipinfo lookups are in use])
])
AC_ARG_ENABLE([ipv6],
return ActionMPLS;
if (tolower(c) == 'n')
return ActionDNS;
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (tolower(c) == 'y')
return ActionII;
if (tolower(c) == 'z')
printw(" b <c> set ping bit pattern to c(0..255) or random(c<0)\n" );
printw(" Q <t> set ping packet's TOS to t\n" );
printw(" u switch between ICMP ECHO and UDP datagrams\n" );
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
printw(" y switching IP info\n");
printw(" z toggle ASN info on/off\n");
pressanykey_row += 2;
name = dns_lookup(addr);
if (! net_up(at))
attron(A_BOLD);
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii())
printw(fmt_ipinfo(addr));
#endif
name = dns_lookup(addrs);
if (! net_up(at)) attron(A_BOLD);
printw("\n ");
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii())
printw(fmt_ipinfo(addrs));
#endif
if (! net_up(at))
attron(A_BOLD);
if (addrcmp((void *) addr, (void *) &unspec_addr, af)) {
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii())
printw(fmt_ipinfo(addr));
#endif
} else {
char msg[80];
int padding = 30;
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii())
padding += get_iiwidth();
#endif
#include "split.h"
#endif
-#ifndef IPINFO
+#ifndef HAVE_IPINFO
// No support for IPINFO allow the calls to remain in the main code.
#define asn_open()
#define asn_close()
(notably the one on Irix 5.2) do not like that. */
enum { ActionNone, ActionQuit, ActionReset, ActionDisplay,
ActionClear, ActionPause, ActionResume, ActionMPLS, ActionDNS,
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
ActionII, ActionAS,
#endif
ActionScrollDown, ActionScrollUp };
static GtkListStore *ReportStore;
enum {
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
COL_ASN,
#endif
COL_HOSTNAME,
GtkTreeViewColumn *column;
ReportStore = gtk_list_store_new(N_COLS,
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
G_TYPE_STRING,
#endif
G_TYPE_STRING,
g_signal_connect(GTK_OBJECT(ReportTreeView), "button_press_event",
G_CALLBACK(ReportTreeView_clicked),NULL);
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii()) {
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("ASN",
COL_COLOR, net_up(row) ? "black" : "red",
-1);
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii())
gtk_list_store_set(ReportStore, iter, COL_ASN, fmt_ipinfo(addr), -1);
#endif
{ "no-dns", 0, NULL, 'n' },
{ "show-ips", 0, NULL, 'b' },
{ "order", 1, NULL, 'o' }, /* fields to display & their order */
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
{ "ipinfo", 1, NULL, 'y' }, /* IP info lookup */
{ "aslookup", 0, NULL, 'z' }, /* Do AS lookup (--ipinfo 0) */
#endif
fprintf( stderr, "IPv6 not enabled.\n" );
break;
#endif
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
case 'y':
ipinfo_no = atoi (optarg);
if (ipinfo_no < 0)
}
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
void print_mpls(struct mplslen *mpls) {
int k;
for (k=0; k < mpls->labels; k++)
}
}
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
int len_tmp = len_hosts;
if (ipinfo_no >= 0) {
ipinfo_no %= iiwidth_len;
mpls = net_mpls(at);
snprint_addr(name, sizeof(name), addr);
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii()) {
snprintf(fmt, sizeof(fmt), " %%2d. %%s%%-%zus", len_hosts);
snprintf(buf, sizeof(buf), fmt, at+1, fmt_ipinfo(addr), name);
#endif
snprintf( fmt, sizeof(fmt), " %%2d.|-- %%-%zus", len_hosts);
snprintf(buf, sizeof(buf), fmt, at+1, name);
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
}
#endif
len = reportwide ? strlen(buf) : len_hosts;
if (!found) {
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii()) {
if (mpls->labels && z == 1 && enablempls)
print_mpls(mpls);
}
}
#endif
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
}
#endif
}
}
/* No multipath */
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if (is_printii()) {
if (mpls->labels && z == 1 && enablempls)
print_mpls(mpls);
}
}
#endif
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
}
#endif
}
if (at == net_min()) {
printf("Mtr_Version,Start_Time,Status,Host,Hop,Ip,");
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if(!ipinfo_no) {
printf("Asn,");
}
printf("\n");
}
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
if(!ipinfo_no) {
char* fmtinfo = fmt_ipinfo(addr);
fmtinfo = trim(fmtinfo);
display_clear();
}
break;
-#ifdef IPINFO
+#ifdef HAVE_IPINFO
case ActionII:
ipinfo_no++;
if (ipinfo_no > ipinfo_max)