items_t* items = &items_a;
-char *ipinfo_lookup(const char *domain) {
+static char *ipinfo_lookup(const char *domain) {
unsigned char answer[PACKETSZ], *pt;
char host[128];
char *txt;
return txt;
}
-char* trimsep(char *s) {
+static char* trimsep(char *s) {
int l;
char *p = s;
while (*p == ' ' || *p == ITEMSEP)
}
// originX.asn.cymru.com txtrec: ASN | Route | Country | Registry | Allocated
-char* split_txtrec(char *txt_rec) {
+static char* split_txtrec(char *txt_rec) {
if (!txt_rec)
return NULL;
if (iihash) {
#ifdef ENABLE_IPV6
// from dns.c:addr2ip6arpa()
-void reverse_host6(struct in6_addr *addr, char *buff) {
+static void reverse_host6(struct in6_addr *addr, char *buff) {
int i;
char *b = buff;
for (i=(sizeof(*addr)/2-1); i>=0; i--, b+=4) // 64b portion
}
#endif
-char *get_ipinfo(ip_t *addr) {
+static char *get_ipinfo(ip_t *addr) {
if (!addr)
return NULL;
return val;
}
-int get_iiwidth(void) {
+extern int get_iiwidth(void) {
return (ipinfo_no < iiwidth_len) ? iiwidth[ipinfo_no] : iiwidth[ipinfo_no % iiwidth_len];
}
-char *fmt_ipinfo(ip_t *addr) {
+extern char *fmt_ipinfo(ip_t *addr) {
char *ipinfo = get_ipinfo(addr);
char fmt[8];
snprintf(fmt, sizeof(fmt), "%s%%-%ds", ipinfo_no?"":"AS", get_iiwidth());
return fmtinfo;
}
-int is_printii(void) {
+extern int is_printii(void) {
return ((ipinfo_no >= 0) && (ipinfo_no != ipinfo_max));
}
-void asn_open(void) {
+extern void asn_open(void) {
if (ipinfo_no >= 0) {
DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI);
if (!(iihash = hcreate(IIHASH_HI)))
}
}
-void asn_close(void) {
+extern void asn_close(void) {
if ((ipinfo_no >= 0) && iihash) {
DEB_syslog(LOG_INFO, "hdestroy()");
hdestroy();
extern int ipinfo_max;
extern int iiwidth_len;
extern int iihash;
-void asn_open();
-void asn_close();
-char *fmt_ipinfo(ip_t *addr);
-int get_iiwidth(void);
-int is_printii(void);
+extern void asn_open();
+extern void asn_close();
+extern char *fmt_ipinfo(ip_t *addr);
+extern int get_iiwidth(void);
+extern int is_printii(void);
static int __unused_int;
-void pwcenter(char *str)
+static void pwcenter(char *str)
{
int maxx;
int cx;
}
-char *format_number (int n, int w, char *buf)
+static char *format_number (int n, int w, char *buf)
{
// XXX todo: implement w != 5..
if (w != 5) return ("unimpl");
}
-
-int mtr_curses_keyaction(void)
+extern int mtr_curses_keyaction(void)
{
int c = getch();
int i=0;
}
-void format_field (char *dst, const char *format, int n)
+static void format_field (char *dst, const char *format, int n)
{
if (index (format, 'N' ) ) {
*dst++ = ' ';
}
}
-void mtr_curses_hosts(int startstat)
+static void mtr_curses_hosts(int startstat)
{
int max;
int at;
static int scale[NUM_FACTORS];
static int low_ms, high_ms;
-void mtr_gen_scale(void)
+static void mtr_gen_scale(void)
{
int *saved, i, max, at;
int range;
static char block_map[NUM_FACTORS];
-void mtr_curses_init(void) {
+static void mtr_curses_init(void) {
int i;
int block_split;
COLOR_PAIR(2)|A_BOLD
};
-void mtr_print_scaled(int ms)
+static void mtr_print_scaled(int ms)
{
int i;
}
-void mtr_fill_graph(int at, int cols)
+static void mtr_fill_graph(int at, int cols)
{
int* saved;
int i;
}
-void mtr_curses_graph(int startstat, int cols)
+static void mtr_curses_graph(int startstat, int cols)
{
int max, at, y;
ip_t * addr;
}
-void mtr_curses_redraw(void)
+extern void mtr_curses_redraw(void)
{
int maxx;
int startstat;
}
-void mtr_curses_open(void)
+extern void mtr_curses_open(void)
{
initscr();
raw();
}
-void mtr_curses_close(void)
+extern void mtr_curses_close(void)
{
printw("\n");
endwin();
}
-void mtr_curses_clear(void)
+extern void mtr_curses_clear(void)
{
mtr_curses_close();
mtr_curses_open();
#define UNUSED_IF_NO_GTK UNUSED
#endif
-void display_detect(int *argc UNUSED_IF_NO_GTK, char ***argv UNUSED_IF_NO_GTK)
+extern void display_detect(int *argc UNUSED_IF_NO_GTK, char ***argv UNUSED_IF_NO_GTK)
{
DisplayMode = DEFAULT_DISPLAY;
}
-void display_open(void)
+extern void display_open(void)
{
switch(DisplayMode) {
}
-void display_close(time_t now)
+extern void display_close(time_t now)
{
switch(DisplayMode) {
case DisplayReport:
}
-void display_redraw(void)
+extern void display_redraw(void)
{
switch(DisplayMode) {
}
-int display_keyaction(void)
+extern int display_keyaction(void)
{
switch(DisplayMode) {
#ifdef HAVE_NCURSES
}
-void display_rawxmit(int host, int seq)
+extern void display_rawxmit(int host, int seq)
{
switch(DisplayMode) {
case DisplayRaw:
}
-void display_rawping(int host, int msec, int seq)
+extern void display_rawping(int host, int msec, int seq)
{
switch(DisplayMode) {
case DisplayReport:
}
-void display_rawhost(int host, ip_t *ip_addr)
+extern void display_rawhost(int host, ip_t *ip_addr)
{
switch(DisplayMode) {
case DisplayReport:
}
-void display_loop(void)
+extern void display_loop(void)
{
switch(DisplayMode) {
case DisplayReport:
}
-void display_clear(void)
+extern void display_clear(void)
{
switch(DisplayMode) {
#ifdef HAVE_NCURSES
};
/* Prototypes for display.c */
-void display_detect(int *argc, char ***argv);
-void display_open(void);
-void display_close(time_t now);
-void display_redraw(void);
-void display_rawxmit(int hostnum, int seq);
-void display_rawping(int hostnum, int msec, int seq);
-void display_rawhost(int hostnum, ip_t *ip_addr);
-int display_keyaction(void);
-void display_loop(void);
-void display_clear(void);
+extern void display_detect(int *argc, char ***argv);
+extern void display_open(void);
+extern void display_close(time_t now);
+extern void display_redraw(void);
+extern void display_rawxmit(int hostnum, int seq);
+extern void display_rawping(int hostnum, int msec, int seq);
+extern void display_rawhost(int hostnum, ip_t *ip_addr);
+extern int display_keyaction(void);
+extern void display_loop(void);
+extern void display_clear(void);
extern int display_mode;
extern int display_offset; /* only used in text mode */
struct dns_results *results;
-char *strlongip(ip_t * ip)
+extern char *strlongip(ip_t * ip)
{
#ifdef ENABLE_IPV6
static char addrstr[INET6_ADDRSTRLEN];
#define UNUSED_IF_NO_IPV6 UNUSED
#endif
-int longipstr( char *s, ip_t *dst, int family UNUSED_IF_NO_IPV6)
+static int longipstr( char *s, ip_t *dst, int family UNUSED_IF_NO_IPV6)
{
#ifdef ENABLE_IPV6
return inet_pton( family, s, dst );
}
-struct hostent * dns_forward(const char *name)
+extern struct hostent * dns_forward(const char *name)
{
struct hostent *host;
}
-struct dns_results *findip (ip_t *ip)
+static struct dns_results *findip (ip_t *ip)
{
struct dns_results *t;
return NULL;
}
-void set_sockaddr_ip (struct sockaddr_storage *sa, ip_t *ip)
+static void set_sockaddr_ip (struct sockaddr_storage *sa, ip_t *ip)
{
struct sockaddr_in *sa_in;
struct sockaddr_in6 *sa_in6;
FILE *fromdnsfp;
#if 0
-void handle_sigchld(int sig) {
+static void handle_sigchld(int sig) {
while (waitpid((pid_t)(-1), 0, WNOHANG) > 0) {}
}
#endif
-void dns_open(void)
+extern void dns_open(void)
{
int pid;
}
}
-int dns_waitfd (void)
+extern int dns_waitfd (void)
{
return fromdns[0];
}
-
-void dns_ack(void)
+extern void dns_ack(void)
{
char buf[2048], host[NI_MAXHOST], name[NI_MAXHOST];
ip_t hostip;
#ifdef ENABLE_IPV6
-int dns_waitfd6 (void)
+extern int dns_waitfd6 (void)
{
return -1;
}
-void dns_ack6(void)
+extern void dns_ack6(void)
{
return;
}
#endif
-char *dns_lookup2(ip_t * ip)
+extern char *dns_lookup2(ip_t * ip)
{
struct dns_results *r;
char buf[INET6_ADDRSTRLEN + 1];
}
-char *dns_lookup(ip_t * ip)
+extern char *dns_lookup(ip_t * ip)
{
char *t;
#if 0
-char *strlongip(ip_t * ip)
+extern char *strlongip(ip_t * ip)
{
#ifdef ENABLE_IPV6
static char addrstr[INET6_ADDRSTRLEN];
// XXX check if necessary/exported.
/* Resolve an IP address to a hostname. */
-struct hostent *addr2host( const char *addr, int family ) {
+extern struct hostent *addr2host( const char *addr, int family ) {
int len = 0;
switch ( family ) {
case AF_INET:
/* Prototypes for dns.c */
-void dns_open(void);
-int dns_waitfd(void);
-void dns_ack(void);
+extern void dns_open(void);
+extern int dns_waitfd(void);
+extern void dns_ack(void);
#ifdef ENABLE_IPV6
-int dns_waitfd6(void);
-void dns_ack6(void);
+extern int dns_waitfd6(void);
+extern void dns_ack6(void);
#ifdef NEED_RES_STATE_EXT
/* __res_state_ext is missing on many (most?) BSD systems */
struct __res_state_ext {
#endif
#endif
-char *dns_lookup(ip_t * address);
-char *dns_lookup2(ip_t * address);
-struct hostent * dns_forward(const char *name);
-char *strlongip(ip_t * ip);
+extern char *dns_lookup(ip_t * address);
+extern char *dns_lookup2(ip_t * address);
+extern struct hostent * dns_forward(const char *name);
+extern char *strlongip(ip_t * ip);
-void addr2ip6arpa( ip_t * ip, char * buf );
-struct hostent *addr2host( const char *addr, int type );
+extern void addr2ip6arpa( ip_t * ip, char * buf );
+extern struct hostent *addr2host( const char *addr, int type );
#include "img/mtr_icon.xpm"
#endif
-gint gtk_ping(gpointer data);
-gint Copy_activate(GtkWidget *widget, gpointer data);
-gint NewDestination_activate(GtkWidget *widget, gpointer data);
-gboolean ReportTreeView_clicked(GtkWidget *Tree, GdkEventButton *event);
-gchar* getSelectedHost(GtkTreePath *path);
+static gint gtk_ping(gpointer data);
+static gint Copy_activate(GtkWidget *widget, gpointer data);
+static gint NewDestination_activate(GtkWidget *widget, gpointer data);
+static gboolean ReportTreeView_clicked(GtkWidget *Tree, GdkEventButton *event);
+static gchar* getSelectedHost(GtkTreePath *path);
static GtkWidget *Entry;
static GtkWidget *main_window;
-void gtk_add_ping_timeout (void)
+static void gtk_add_ping_timeout (void)
{
if(gtk_toggle_button_get_active((GtkToggleButton *)Pause_Button)){
return;
}
-void gtk_do_init(int *argc, char ***argv)
+static void gtk_do_init(int *argc, char ***argv)
{
static int done = 0;
}
-int gtk_detect(UNUSED int *argc, UNUSED char ***argv)
+extern int gtk_detect(UNUSED int *argc, UNUSED char ***argv)
{
if(getenv("DISPLAY") != NULL) {
/* If we do this here, gtk_init exits on an error. This happens
}
-gint Window_destroy(UNUSED GtkWidget *Window, UNUSED gpointer data)
+static gint Window_destroy(UNUSED GtkWidget *Window, UNUSED gpointer data)
{
gtk_main_quit();
}
-gint Restart_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
+static gint Restart_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
{
net_reset();
gtk_redraw();
}
-gint Pause_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
+static gint Pause_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
{
static int paused = 0;
return FALSE;
}
-gint About_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
+static gint About_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data)
{
gchar *authors[] = {
"Matt Kimball <mkimball@xmission.com>",
* What's the problem with this? (-> "I don't think so)
*/
-gint WaitTime_changed(UNUSED GtkAdjustment *Adj, UNUSED GtkWidget *Button)
+static gint WaitTime_changed(UNUSED GtkAdjustment *Adj, UNUSED GtkWidget *Button)
{
WaitTime = gtk_spin_button_get_value(GTK_SPIN_BUTTON(Button));
g_source_remove (ping_timeout_timer);
}
-gint Host_activate(GtkWidget *entry, UNUSED gpointer data)
+static gint Host_activate(GtkWidget *entry, UNUSED gpointer data)
{
struct hostent * addr;
-void Toolbar_fill(GtkWidget *Toolbar)
+static void Toolbar_fill(GtkWidget *Toolbar)
{
GtkWidget *Button;
GtkWidget *Label;
// earlier, so it is ok. Nothing to worry about....
#define POINTER_TO_INT(p) ((int)(long)(p))
-void float_formatter(GtkTreeViewColumn *tree_column UNUSED,
+static void float_formatter(GtkTreeViewColumn *tree_column UNUSED,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
g_object_set(cell, "text", text, NULL);
}
-void percent_formatter(GtkTreeViewColumn *tree_column UNUSED,
+static void percent_formatter(GtkTreeViewColumn *tree_column UNUSED,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
g_object_set(cell, "text", text, NULL);
}
-void TreeViewCreate(void)
+static void TreeViewCreate(void)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
}
-void update_tree_row(int row, GtkTreeIter *iter)
+static void update_tree_row(int row, GtkTreeIter *iter)
{
ip_t *addr;
char str[256]="???", *name=str;
#endif
}
-void gtk_redraw(void)
+extern void gtk_redraw(void)
{
int max = net_max();
}
-void Window_fill(GtkWidget *Window)
+static void Window_fill(GtkWidget *Window)
{
GtkWidget *VBox;
GtkWidget *Toolbar;
}
-void gtk_open(void)
+extern void gtk_open(void)
{
GdkPixbuf *icon;
}
-void gtk_close(void)
+extern void gtk_close(void)
{
}
-int gtk_keyaction(void)
+extern int gtk_keyaction(void)
{
return 0;
}
-gint gtk_ping(UNUSED gpointer data)
+static gint gtk_ping(UNUSED gpointer data)
{
gtk_redraw();
net_send_batch();
}
-gboolean gtk_net_data(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
+static gboolean gtk_net_data(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
{
net_process_return();
return TRUE;
}
-gboolean gtk_dns_data(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
+static gboolean gtk_dns_data(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
{
dns_ack();
gtk_redraw();
return TRUE;
}
#ifdef ENABLE_IPV6
-gboolean gtk_dns_data6(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
+static gboolean gtk_dns_data6(UNUSED GIOChannel *channel, UNUSED GIOCondition cond, UNUSED gpointer data)
{
dns_ack6();
gtk_redraw();
#endif
-void gtk_loop(void)
+extern void gtk_loop(void)
{
GIOChannel *net_iochannel, *dns_iochannel;
gtk_main();
}
-gboolean NewDestination_activate(GtkWidget *widget UNUSED, gpointer data)
+static gboolean NewDestination_activate(GtkWidget *widget UNUSED, gpointer data)
{
gchar *hostname;
GtkTreePath *path = (GtkTreePath*)data;
}
-gboolean Copy_activate(GtkWidget *widget UNUSED, gpointer data)
+static gboolean Copy_activate(GtkWidget *widget UNUSED, gpointer data)
{
gchar *hostname;
GtkTreePath *path = (GtkTreePath*)data;
return TRUE;
}
-gchar *getSelectedHost(GtkTreePath *path)
+static gchar *getSelectedHost(GtkTreePath *path)
{
GtkTreeIter iter;
gchar *name = NULL;
}
-gboolean ReportTreeView_clicked(GtkWidget *Tree UNUSED, GdkEventButton *event)
+static gboolean ReportTreeView_clicked(GtkWidget *Tree UNUSED, GdkEventButton *event)
{
GtkWidget* popup_menu;
GtkWidget* copy_item;
*/
/* Prototypes for curses.c */
-void mtr_curses_open(void);
-void mtr_curses_close(void);
-void mtr_curses_redraw(void);
-int mtr_curses_keyaction(void);
-void mtr_curses_clear(void);
+extern void mtr_curses_open(void);
+extern void mtr_curses_close(void);
+extern void mtr_curses_redraw(void);
+extern int mtr_curses_keyaction(void);
+extern void mtr_curses_clear(void);
*/
/* Prototypes for gtk.c */
-int gtk_detect(int *argc, char ***argv);
-void gtk_open(void);
-void gtk_close(void);
-void gtk_redraw(void);
-int gtk_keyaction(void);
-void gtk_loop(void);
+extern int gtk_detect(int *argc, char ***argv);
+extern void gtk_open(void);
+extern void gtk_close(void);
+extern void gtk_redraw(void);
+extern int gtk_keyaction(void);
+extern void gtk_loop(void);
}
-char *
+extern char *
trim(char * s) {
char * p = s;
}
-void init_fld_options (void)
+static void init_fld_options (void)
{
int i;
}
-void parse_arg (int argc, char **argv)
+static void parse_arg (int argc, char **argv)
{
int opt;
int i;
}
-void parse_mtr_options (char *string)
+static void parse_mtr_options (char *string)
{
int argc;
char *argv[128], *p;
}
-int main(int argc, char **argv)
+extern int main(int argc, char **argv)
{
struct hostent * host = NULL;
int net_preopen_result;
typedef int socklen_t;
#endif
-char *
+extern char *
trim(char * s);
#include "display.h"
#include "dns.h"
+static void sockaddrtop( struct sockaddr * saddr, char * strptr, size_t len );
+static void decodempls(int, char *, struct mplslen *, int);
+
/* We can't rely on header files to provide this information, because
the fields have different names between, for instance, Linux and
Solaris */
}
-int checksum(void *data, int sz)
+static int checksum(void *data, int sz)
{
uint16 *ch;
uint32 sum;
/* Prepend pseudoheader to the udp datagram and calculate checksum */
-int udp_checksum(void *pheader, void *udata, int psize, int dsize, int alt_checksum)
+static int udp_checksum(void *pheader, void *udata, int psize, int dsize, int alt_checksum)
{
unsigned int tsize = psize + dsize;
char csumpacket[tsize];
}
-void save_sequence(int index, int seq)
+static void save_sequence(int index, int seq)
{
display_rawxmit(index, seq);
net_save_xmit(index);
}
-int new_sequence(int index)
+static int new_sequence(int index)
{
static int next_sequence = MinSequence;
int seq;
}
/* Attempt to connect to a TCP port with a TTL */
-void net_send_tcp(int index)
+static void net_send_tcp(int index)
{
int ttl, s;
int port;
#ifdef HAS_SCTP
/* Attempt to connect to a SCTP port with a TTL */
-void net_send_sctp(int index)
+static void net_send_sctp(int index)
{
int ttl, s;
int opt = 1;
#endif
/* Attempt to find the host at a particular number of hops away */
-void net_send_query(int index)
+static void net_send_query(int index)
{
if (mtrtype == IPPROTO_TCP) {
net_send_tcp(index);
/* We got a return on something we sent out. Record the address and
time. */
-void net_process_ping(int seq, struct mplslen mpls, void * addr, struct timeval now)
+static void net_process_ping(int seq, struct mplslen mpls, void * addr, struct timeval now)
{
int index;
int totusec;
/* We know a packet has come in, because the main select loop has called us,
now we just need to read it, see if it is for us, and if it is a reply
to something we sent, then call net_process_ping() */
-void net_process_return(void)
+extern void net_process_return(void)
{
char packet[MAXPACKET];
#ifdef ENABLE_IPV6
}
-ip_t *net_addr(int at)
+extern ip_t *net_addr(int at)
{
return (ip_t *)&(host[at].addr);
}
-ip_t *net_addrs(int at, int i)
+extern ip_t *net_addrs(int at, int i)
{
return (ip_t *)&(host[at].addrs[i]);
}
-void *net_mpls(int at)
+extern void *net_mpls(int at)
{
return (struct mplslen *)&(host[at].mplss);
}
-void *net_mplss(int at, int i)
+extern void *net_mplss(int at, int i)
{
return (struct mplslen *)&(host[at].mplss[i]);
}
-int net_loss(int at)
+extern int net_loss(int at)
{
if ((host[at].xmit - host[at].transit) == 0)
return 0;
}
-int net_drop(int at)
+extern int net_drop(int at)
{
return (host[at].xmit - host[at].transit) - host[at].returned;
}
-int net_last(int at)
+extern int net_last(int at)
{
return (host[at].last);
}
-int net_best(int at)
+extern int net_best(int at)
{
return (host[at].best);
}
-int net_worst(int at)
+extern int net_worst(int at)
{
return (host[at].worst);
}
-int net_avg(int at)
+extern int net_avg(int at)
{
return (host[at].avg);
}
-int net_gmean(int at)
+extern int net_gmean(int at)
{
return (host[at].gmean);
}
-int net_stdev(int at)
+extern int net_stdev(int at)
{
if( host[at].returned > 1 ) {
return ( sqrt( host[at].ssd/(host[at].returned -1.0) ) );
}
-int net_jitter(int at)
+extern int net_jitter(int at)
{
return (host[at].jitter);
}
-int net_jworst(int at)
+extern int net_jworst(int at)
{
return (host[at].jworst);
}
-int net_javg(int at)
+extern int net_javg(int at)
{
return (host[at].javg);
}
-int net_jinta(int at)
+extern int net_jinta(int at)
{
return (host[at].jinta);
}
-int net_max(void)
+extern int net_max(void)
{
int at;
int max;
}
-int net_min (void)
+extern int net_min (void)
{
return ( fstTTL - 1 );
}
-int net_returned(int at)
+extern int net_returned(int at)
{
return host[at].returned;
}
-int net_xmit(int at)
+extern int net_xmit(int at)
{
return host[at].xmit;
}
-int net_up(int at)
+extern int net_up(int at)
{
return host[at].up;
}
-char * net_localaddr (void)
+extern char * net_localaddr (void)
{
return localaddr;
}
-void net_end_transit(void)
+extern void net_end_transit(void)
{
int at;
}
}
-int net_send_batch(void)
+extern int net_send_batch(void)
{
int n_unknown=0, i;
#endif
}
-int net_preopen(void)
+extern int net_preopen(void)
{
int trueopt = 1;
}
-int net_selectsocket(void)
+extern int net_selectsocket(void)
{
#if !defined(IP_HDRINCL) && defined(IP_TOS) && defined(IP_TTL)
switch ( mtrtype ) {
}
-int net_open(struct hostent * hostent)
+extern int net_open(struct hostent * hostent)
{
#ifdef ENABLE_IPV6
struct sockaddr_storage name_struct;
}
-void net_reopen(struct hostent * addr)
+extern void net_reopen(struct hostent * addr)
{
int at;
}
-void net_reset(void)
+extern void net_reset(void)
{
int at;
int i;
gettimeofday(&reset, NULL);
}
-int net_set_interfaceaddress_udp(void)
+static int net_set_interfaceaddress_udp(void)
{
struct sockaddr_in * sa4;
struct sockaddr_storage remote;
}
-int net_set_interfaceaddress (char *InterfaceAddress)
+extern int net_set_interfaceaddress (char *InterfaceAddress)
{
#ifdef ENABLE_IPV6
struct sockaddr_storage name_struct;
-void net_close(void)
+extern void net_close(void)
{
if (sendsock4 >= 0) {
close(sendsock4_icmp);
}
-int net_waitfd(void)
+extern int net_waitfd(void)
{
return recvsock;
}
-int* net_saved_pings(int at)
+extern int* net_saved_pings(int at)
{
return host[at].saved;
}
-void net_save_increment(void)
+static void net_save_increment(void)
{
int at;
for (at = 0; at < MaxHost; at++) {
}
-void net_save_xmit(int at)
+extern void net_save_xmit(int at)
{
if (host[at].saved[SAVED_PINGS-1] != -2)
net_save_increment();
}
-void net_save_return(int at, int seq, int ms)
+extern void net_save_return(int at, int seq, int ms)
{
int idx;
idx = seq - host[at].saved_seq_offset;
}
/* Similar to inet_ntop but uses a sockaddr as it's argument. */
-void sockaddrtop( struct sockaddr * saddr, char * strptr, size_t len ) {
+static void sockaddrtop( struct sockaddr * saddr, char * strptr, size_t len ) {
struct sockaddr_in * sa4;
#ifdef ENABLE_IPV6
struct sockaddr_in6 * sa6;
}
/* Address comparison. */
-int addrcmp( char * a, char * b, int family ) {
+extern int addrcmp( char * a, char * b, int family ) {
int rc = -1;
switch ( family ) {
}
/* Address copy. */
-void addrcpy( char * a, char * b, int family ) {
+extern void addrcpy( char * a, char * b, int family ) {
switch ( family ) {
case AF_INET:
}
/* Decode MPLS */
-void decodempls(int num, char *packet, struct mplslen *mpls, int offset) {
+static void decodempls(int num, char *packet, struct mplslen *mpls, int offset) {
int i;
unsigned int ext_ver, ext_res, ext_chk, obj_hdr_len;
}
/* Add open sockets to select() */
-void net_add_fds(fd_set *writefd, int *maxfd)
+extern void net_add_fds(fd_set *writefd, int *maxfd)
{
int at, fd;
for (at = 0; at < MaxSequence; at++) {
}
/* check if we got connection or error on any fds */
-void net_process_fds(fd_set *writefd)
+extern void net_process_fds(fd_set *writefd)
{
int at, fd, r;
struct timeval now;
}
/* for GTK frontend */
-void net_harvest_fds(void)
+extern void net_harvest_fds(void)
{
fd_set writefd;
int maxfd = 0;
#include <netinet/icmp6.h>
#endif
-int net_preopen(void);
-int net_selectsocket(void);
-int net_open(struct hostent *host);
-void net_reopen(struct hostent *address);
-int net_set_interfaceaddress (char *InterfaceAddress);
-void net_reset(void);
-void net_close(void);
-int net_waitfd(void);
-void net_process_return(void);
-void net_harvest_fds(void);
-
-int net_max(void);
-int net_min(void);
-int net_last(int at);
-ip_t * net_addr(int at);
-void * net_mpls(int at);
-void * net_mplss(int, int);
-int net_loss(int at);
-int net_drop(int at);
-int net_last(int at);
-int net_best(int at);
-int net_worst(int at);
-int net_avg(int at);
-int net_gmean(int at);
-int net_stdev(int at);
-int net_jitter(int at);
-int net_jworst(int at);
-int net_javg(int at);
-int net_jinta(int at);
-ip_t * net_addrs(int at, int i);
-char *net_localaddr(void);
-
-int net_send_batch(void);
-void net_end_transit(void);
-
-int calc_deltatime (float WaitTime);
-
-int net_returned(int at);
-int net_xmit(int at);
-
-int net_up(int at);
+extern int net_preopen(void);
+extern int net_selectsocket(void);
+extern int net_open(struct hostent *host);
+extern void net_reopen(struct hostent *address);
+extern int net_set_interfaceaddress (char *InterfaceAddress);
+extern void net_reset(void);
+extern void net_close(void);
+extern int net_waitfd(void);
+extern void net_process_return(void);
+extern void net_harvest_fds(void);
+
+extern int net_max(void);
+extern int net_min(void);
+extern int net_last(int at);
+extern ip_t * net_addr(int at);
+extern void * net_mpls(int at);
+extern void * net_mplss(int, int);
+extern int net_loss(int at);
+extern int net_drop(int at);
+extern int net_last(int at);
+extern int net_best(int at);
+extern int net_worst(int at);
+extern int net_avg(int at);
+extern int net_gmean(int at);
+extern int net_stdev(int at);
+extern int net_jitter(int at);
+extern int net_jworst(int at);
+extern int net_javg(int at);
+extern int net_jinta(int at);
+extern ip_t * net_addrs(int at, int i);
+extern char *net_localaddr(void);
+
+extern int net_send_batch(void);
+extern void net_end_transit(void);
+
+extern int calc_deltatime (float WaitTime);
+
+extern int net_returned(int at);
+extern int net_xmit(int at);
+
+extern int net_up(int at);
#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);
-int net_duplicate(int at, int seq);
+extern int* net_saved_pings(int at);
+extern void net_save_xmit(int at);
+extern void net_save_return(int at, int seq, int ms);
-void sockaddrtop( struct sockaddr * saddr, char * strptr, size_t len );
-int addrcmp( char * a, char * b, int af );
-void addrcpy( char * a, char * b, int af );
+extern int addrcmp( char * a, char * b, int af );
+extern void addrcpy( char * a, char * b, int af );
-void net_add_fds(fd_set *writefd, int *maxfd);
-void net_process_fds(fd_set *writefd);
+extern void net_add_fds(fd_set *writefd, int *maxfd);
+extern void net_process_fds(fd_set *writefd);
#define MAXPATH 8
#define MaxHost 256
char labels; /* how many labels did we get? */
};
-void decodempls(int, char *, struct mplslen *, int);
-
#ifdef IPPROTO_SCTP
#define HAS_SCTP
#endif
#endif
// Log an echo request, or a "ping"
-void raw_rawxmit (int host, int seq)
+extern void raw_rawxmit (int host, int seq)
{
printf ("x %d %d\n", host, seq);
fflush (stdout);
}
// Log an echo reply, or a "pong"
-void raw_rawping (int host, int msec, int seq)
+extern void raw_rawping (int host, int msec, int seq)
{
char *name;
}
-void raw_rawhost (int host, ip_t * ip_addr)
+extern void raw_rawhost (int host, ip_t * ip_addr)
{
printf ("h %d %s\n", host, strlongip( ip_addr ));
fflush (stdout);
*/
/* Prototypes for raw.c */
-void raw_rawxmit(int host, int seq);
-void raw_rawping(int host, int msec, int seq);
-void raw_rawhost(int host, ip_t * addr);
+extern void raw_rawxmit(int host, int seq);
+extern void raw_rawping(int host, int msec, int seq);
+extern void raw_rawhost(int host, ip_t * addr);
extern int reportwide;
-void report_open(void)
+extern void report_open(void)
{
const time_t now = time(NULL);
char *t = ctime (&now);
#ifdef HAVE_IPINFO
-void print_mpls(struct mplslen *mpls) {
+static void print_mpls(struct mplslen *mpls) {
int k;
for (k=0; k < mpls->labels; k++)
printf(" [MPLS: Lbl %lu Exp %u S %cu TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]);
}
#endif
-void report_close(void)
+extern void report_close(void)
{
int i, j, at, max, z, w;
struct mplslen *mpls, *mplss;
}
-void txt_open(void)
+extern void txt_open(void)
{
}
-void txt_close(void)
+extern void txt_close(void)
{
report_close();
}
-void json_open(void)
+extern void json_open(void)
{
}
-void json_close(void)
+extern void json_close(void)
{
int i, j, at, first, max;
ip_t *addr;
-void xml_open(void)
+extern void xml_open(void)
{
}
-void xml_close(void)
+extern void xml_close(void)
{
int i, j, at, max;
ip_t *addr;
}
-void csv_open(void)
+extern void csv_open(void)
{
}
-void csv_close(time_t now)
+extern void csv_close(time_t now)
{
int i, j, at, max;
ip_t *addr;
/* Prototypes for report.h */
-void report_open(void);
-void report_close(void);
-void txt_open(void);
-void txt_close(void);
-void json_open(void);
-void json_close(void);
-void xml_open(void);
-void xml_close(void);
-void csv_open(void);
-void csv_close(time_t now);
+extern void report_open(void);
+extern void report_close(void);
+extern void txt_open(void);
+extern void txt_close(void);
+extern void json_open(void);
+extern void json_close(void);
+extern void xml_open(void);
+extern void xml_close(void);
+extern void csv_open(void);
+extern void csv_close(time_t now);
#define GRACETIME (GraceTime * 1000*1000)
-void select_loop(void) {
+extern void select_loop(void) {
fd_set readfd;
fd_set writefd;
int anyset = 0;
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-void select_loop(void);
+extern void select_loop(void);
#define DEBUG 0
-void split_redraw(void)
+extern void split_redraw(void)
{
int max;
int at;
}
-void split_open(void)
+extern void split_open(void)
{
int i;
#if DEBUG
}
-void split_close(void)
+extern void split_close(void)
{
#if DEBUG
printf("split_close()\n");
}
-int split_keyaction(void)
+extern int split_keyaction(void)
{
#ifdef HAVE_NCURSES
char c = getch();
*/
/* Prototypes for split.c */
-void split_open(void);
-void split_close(void);
-void split_redraw(void);
-int split_keyaction(void);
+extern void split_open(void);
+extern void split_close(void);
+extern void split_redraw(void);
+extern int split_keyaction(void);