Moritz Barsnick (barsnick@gmx.net)
Robert Sparks (rjsparks@nostrum.com)
David Stone (stone@AsIf.com)
+ Greg Stark (gsstark@mit.edu)
+ Andrew Brown (codewarrior@daemon.org ?)
+ Marc Bejarano (marc.bejarano@openwave.com)
and anyone who has slipped through the cracks of my mail file.
WHAT'S NEW?
+ v0.45 People are pressuring me to release new versions with their
+ changes. That's fine. Now this version just adds dynamic
+ switching between numeric / dns names, and some minor
+ stuff I forgot. This release serves as a code-sycn-release.
+ new version with even more new stuff in about two weeks!
+ I'm afraid I don't know how to fix the MaxOS-X compilation
+ problems in the source. Help wanted...
+
v0.44 David Stone adds the "last" column to the gtk version.
- v0.43 Compile fixes.
+ v0.43 Compile fixes.
v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack.
Made report mode report the newly added extra resolution.
AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.44)
+AM_INIT_AUTOMAKE(mtr, 0.45)
AC_SUBST(GTK_OBJ)
AC_SUBST(CURSES_OBJ)
#endif
#ifndef getmaxyx
-# define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1)
+# define getmaxyx(win,y,x) ((y) = (win)->_maxy + 1, (x) = (win)->_maxx + 1)
#endif
#include "mtr-curses.h"
return ActionReset;
if (tolower(c) == 'd')
return ActionDisplay;
+ if (tolower(c) == 'n')
+ return ActionDNS;
return 0;
}
printw(">");
}
-void mtr_fill_graph(int at) {
+void mtr_fill_graph(int at, int cols) {
int* saved;
int i;
int val;
saved = net_saved_pings(at);
- for (i = 0; i < SAVED_PINGS; i++) {
+ for (i = SAVED_PINGS-cols; i < SAVED_PINGS; i++) {
if (saved[i] == -2) {
printw(" ");
} else if (saved[i] == -1) {
}
}
-void mtr_curses_graph(int startstat) {
+void mtr_curses_graph(int startstat, int cols) {
int max, at, addr, y, x;
char* name;
- char blocks[50];
max = net_max();
+
for (at = 0; at < max; at++) {
printw("%2d. ", at+1);
move(y, startstat);
printw(" ");
- mtr_fill_graph(at);
+ mtr_fill_graph(at, cols);
printw("\n");
}
}
mtr_curses_hosts(startstat);
} else {
/* David Sward, Jan 1999 */
- startstat = maxx - 52;
-
- mvprintw(rowstat - 1, startstat, " Last 50 pings");
+ char msg[80];
+ int max_cols = maxx<=SAVED_PINGS+30 ? maxx-30 : SAVED_PINGS;
+ startstat = 28;
+ sprintf(msg, " Last %3d pings", max_cols);
+ mvprintw(rowstat - 1, startstat, msg);
+
attroff(A_BOLD);
move(rowstat, 0);
mtr_gen_scale();
- mtr_curses_graph(startstat);
+ mtr_curses_graph(startstat, max_cols);
printw("\n");
attron(A_BOLD);
*/
enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear,
- ActionPause, ActionResume };
+ ActionPause, ActionResume, ActionDNS };
enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit, DisplayRaw };
/* Prototypes for display.c */
void display_clear();
extern int display_mode;
+extern int use_dns;
+extern int dns;
return NULL;
}
+int use_dns = 1;
char *dns_lookup(ip_t ip){
char *t;
if (!dns) return strlongip (ip);
t = dns_lookup2 (ip);
- return t?t:strlongip(ip);
+ return (t&&use_dns)?t:strlongip(ip);
}
int worst;
int transit;
int saved[SAVED_PINGS];
+ int saved_seq_offset;
};
struct sequence {
for (i=0; i<SAVED_PINGS; i++) {
host[at].saved[i] = -2; /* unsent */
}
+ host[at].saved_seq_offset = -SAVED_PINGS+2;
}
for(at = 0; at < MaxSequence; at++) {
return host[at].saved;
}
+void net_save_increment()
+{
+ int at;
+ for (at = 0; at < MaxHost; at++) {
+ memmove(host[at].saved, host[at].saved+1, (SAVED_PINGS-1)*sizeof(int));
+ host[at].saved[SAVED_PINGS-1] = -2;
+ host[at].saved_seq_offset += 1;
+ }
+}
+
void net_save_xmit(int at) {
- int tmp[SAVED_PINGS];
- memcpy(tmp, &host[at].saved[1], (SAVED_PINGS-1)*sizeof(int));
- memcpy(host[at].saved, tmp, (SAVED_PINGS-1)*sizeof(int));
- host[at].saved[SAVED_PINGS-1] = -1;
+ if (host[at].saved[SAVED_PINGS-1] != -2)
+ net_save_increment();
+ host[at].saved[SAVED_PINGS-1] = -1;
}
void net_save_return(int at, int seq, int ms) {
int idx;
- idx = SAVED_PINGS - (host[at].xmit - seq) - 1;
- if (idx < 0) {
- return;
+ idx = seq - host[at].saved_seq_offset;
+ if (idx < 0 || idx > SAVED_PINGS) {
+ return;
}
host[at].saved[idx] = ms;
}
int net_xmit(int at);
int net_transit(int at);
-#define SAVED_PINGS 50
+#define SAVED_PINGS 200
int* net_saved_pings(int at);
void net_save_xmit(int at);
void net_save_return(int at, int seq, int ms);
if (action == ActionResume)
paused=0;
+ if (action == ActionDNS && dns) {
+ use_dns = !use_dns;
+ display_clear();
+ }
+
anyset = 1;
}