Ethereal-dev: [ethereal-dev] Name resolving patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Laurent Deniel <deniel@xxxxxxxxxxx>
Date: Mon, 07 Sep 1998 18:40:16 +0200
Hi,

 Please find in attachment, the name resolving implementation
 (resolv.[ch]). The IP,TCP and UDP packet files have also been
 modified to use the new functions. Name resolution is activated
 by default but you can disable it by using the process argument 
 -n (like tcpdump).

 The patch contains also the already sent font and help options
 and the DLT_RAW define in packet.c needed to compile with the
 standard <net/bpf.h> on Digital UNIX.

 (patch tested on Linux & Digital UNIX)

 Laurent.

--
Laurent DENIEL            | E-mail: deniel@xxxxxxxxxxx
Paris, FRANCE             |         deniel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
                          | WWW   : http://www.worldnet.fr/~deniel
    All above opinions are personal, unless stated otherwise.
diff -u --recursive --new-file ethereal-0.3.14/AUTHORS ethereal-0.3.14-deniel/AUTHORS
--- ethereal-0.3.14/AUTHORS	Sun Aug 30 17:59:33 1998
+++ ethereal-0.3.14-deniel/AUTHORS	Mon Sep  7 08:53:05 1998
@@ -10,7 +10,7 @@
 Mike Hall            <mlh@xxxxxx>
 Bobo Rajec           <bobo@xxxxxxxxxxxxxxxxx>
 cpg                  <cpg@xxxxxxxxxxxxxx>
-
+Laurent Deniel       <deniel@xxxxxxxxxxx>
 
 Alain Magloire <alainm@xxxxxxxxxxxxxxxxxx> was kind enough to
 give his permission to use his version of snprintf.c.
diff -u --recursive --new-file ethereal-0.3.14/Makefile.am ethereal-0.3.14-deniel/Makefile.am
--- ethereal-0.3.14/Makefile.am	Sat Sep  5 20:25:28 1998
+++ ethereal-0.3.14-deniel/Makefile.am	Mon Sep  7 08:49:40 1998
@@ -29,6 +29,7 @@
 	packet-udp.c   \
 	print.c        \
 	ps.c           \
+	resolv.c       \
 	util.c         \
 	capture.h      \
 	config.h       \
@@ -42,6 +43,7 @@
 	packet-rip.h   \
 	print.h        \
 	ps.h           \
+	resolv.h       \
 	snprintf.h     \
 	util.h
 
diff -u --recursive --new-file ethereal-0.3.14/Makefile.in ethereal-0.3.14-deniel/Makefile.in
--- ethereal-0.3.14/Makefile.in	Sun Sep  6 02:42:22 1998
+++ ethereal-0.3.14-deniel/Makefile.in	Mon Sep  7 08:52:08 1998
@@ -98,6 +98,7 @@
 	packet-udp.c   \
 	print.c        \
 	ps.c           \
+	resolv.c       \
 	util.c         \
 	capture.h      \
 	config.h       \
@@ -111,6 +112,7 @@
 	packet-rip.h   \
 	print.h        \
 	ps.h           \
+        resolv.h       \
 	snprintf.h     \
 	util.h
 
@@ -141,7 +143,7 @@
 menu.o packet.o packet-arp.o packet-bootp.o packet-data.o packet-dns.o \
 packet-eth.o packet-llc.o packet-lpd.o packet-ip.o packet-ipx.o \
 packet-ospf.o packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o \
-packet-tr.o packet-trmac.o packet-udp.o print.o ps.o util.o
+packet-tr.o packet-trmac.o packet-udp.o print.o ps.o resolv.o util.o
 ethereal_LDADD = $(LDADD)
 ethereal_LDFLAGS = 
 CFLAGS = @CFLAGS@
@@ -361,7 +363,7 @@
 capture.o: capture.c config.h packet.h file.h capture.h etypes.h util.h \
 	image/icon-excl.xpm
 ethereal.o: ethereal.c config.h packet.h file.h ethereal.h menu.h \
-	etypes.h print.h
+	etypes.h print.h resolv.h
 ethertype.o: ethertype.c config.h packet.h ethereal.h etypes.h
 file.o: file.c config.h packet.h file.h ethereal.h util.h \
 	image/icon-excl.xpm
@@ -373,7 +375,7 @@
 packet-data.o: packet-data.c config.h ethereal.h packet.h
 packet-dns.o: packet-dns.c config.h packet.h
 packet-eth.o: packet-eth.c config.h packet.h ethereal.h etypes.h
-packet-ip.o: packet-ip.c config.h ethereal.h packet.h etypes.h
+packet-ip.o: packet-ip.c config.h ethereal.h packet.h etypes.h resolv.h
 packet-ipx.o: packet-ipx.c config.h ethereal.h packet.h
 packet-llc.o: packet-llc.c config.h packet.h ethereal.h etypes.h
 packet-lpd.o: packet-lpd.c config.h packet.h ethereal.h etypes.h
@@ -381,13 +383,14 @@
 packet-ppp.o: packet-ppp.c config.h packet.h ethereal.h
 packet-raw.o: packet-raw.c config.h packet.h ethereal.h
 packet-rip.o: packet-rip.c config.h ethereal.h packet.h packet-rip.h
-packet-tcp.o: packet-tcp.c config.h ethereal.h packet.h
+packet-tcp.o: packet-tcp.c config.h ethereal.h packet.h resolv.h
 packet-tr.o: packet-tr.c config.h packet.h ethereal.h etypes.h
 packet-trmac.o: packet-trmac.c config.h packet.h ethereal.h etypes.h
-packet-udp.o: packet-udp.c config.h ethereal.h packet.h
+packet-udp.o: packet-udp.c config.h ethereal.h packet.h resolv.h
 packet.o: packet.c config.h packet.h ethereal.h etypes.h file.h
 print.o: print.c config.h packet.h print.h
 ps.o: ps.c ps.h
+resolv.o: resolv.c config.h packet.h resolv.h
 util.o: util.c config.h util.h image/icon-excl.xpm
 
 info:
diff -u --recursive --new-file ethereal-0.3.14/ethereal.c ethereal-0.3.14-deniel/ethereal.c
--- ethereal-0.3.14/ethereal.c	Sun Aug 30 17:59:55 1998
+++ ethereal-0.3.14-deniel/ethereal.c	Mon Sep  7 08:44:25 1998
@@ -60,6 +60,7 @@
 #include "menu.h"
 #include "etypes.h"
 #include "print.h"
+#include "resolv.h"
 
 capture_file cf;
 GtkWidget   *file_sel, *packet_list, *tree_view, *byte_view, *prog_bar,
@@ -202,6 +203,17 @@
   }
 }
 
+void 
+print_usage(void) {
+
+  fprintf(stderr, "This is GNU %s %s\n", PACKAGE, VERSION);
+  fprintf(stderr, "%s [-v] [-b bold font] [-B byte view height] [-c count] [-h]\n",
+	  PACKAGE);
+  fprintf(stderr, "         [-i interface] [-m medium font] [-n] [-P packet list height]\n");
+  fprintf(stderr, "         [-r infile] [-s snaplen] [-T tree view height]\n");
+  fprintf(stderr, "         [-w savefile] \n");
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -216,6 +228,8 @@
   gchar               *rc_file, *cf_name = NULL;
   gchar               *cl_title[] = {"No.", "Source", "Destination",
                       "Protocol", "Info"};
+  gchar               *medium_font = MONO_MEDIUM_FONT;
+  gchar               *bold_font = MONO_BOLD_FONT;
 
   /* Initialize the capture file struct */
   cf.plist     = NULL;
@@ -231,17 +245,30 @@
   gtk_init (&argc, &argv);
 
   /* Now get our args */
-  while ((opt = getopt(argc, argv, "B:c:i:P:r:s:T:w:v")) != EOF) {
+  while ((opt = getopt(argc, argv, "b:B:c:hi:m:nP:r:s:T:w:v")) != EOF) {
     switch (opt) {
+      case 'b':	       /* Bold font */
+	bold_font = g_strdup(optarg);
+	break;
       case 'B':        /* Byte view pane height */
         bv_size = atoi(optarg);
         break;
       case 'c':        /* Capture xxx packets */
         cf.count = atoi(optarg);
         break;
+      case 'h':        /* Print help and exit */
+	print_usage();
+	exit(0);
+        break;
       case 'i':        /* Use interface xxx */
         cf.iface = g_strdup(optarg);
         break;
+      case 'm':        /* Medium font */
+	medium_font = g_strdup(optarg);
+	break;
+      case 'n':        /* No name resolution */
+	g_resolving_actif = 0;
+	break;
       case 'k':        /* Start capture immediately */
         start_capture = 1;
         break;
@@ -263,7 +290,7 @@
         break;
       case 'w':        /* Write capture file xxx */
         cf.save_file = g_strdup(optarg);
-        break;
+	break;
     }
   }
   
@@ -283,9 +310,16 @@
   printer_opts.file = g_strdup("ethereal.out");
   printer_opts.cmd = g_strdup("lpr");
 
-  m_r_font = gdk_font_load(MONO_MEDIUM_FONT);
-  m_b_font = gdk_font_load(MONO_BOLD_FONT);
-  
+  if ((m_r_font = gdk_font_load(medium_font)) == NULL) {
+    fprintf(stderr, "Error font %s not found (use -m option)\n", medium_font);
+    exit(1);
+  }
+
+  if ((m_b_font = gdk_font_load(bold_font)) == NULL) {
+    fprintf(stderr, "Error font %s not found (use -b option)\n", bold_font);
+    exit(1);
+  }
+
   /* Main window */  
   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_name(window, "main window");
diff -u --recursive --new-file ethereal-0.3.14/packet-ip.c ethereal-0.3.14-deniel/packet-ip.c
--- ethereal-0.3.14/packet-ip.c	Sun Aug 30 18:00:01 1998
+++ ethereal-0.3.14-deniel/packet-ip.c	Sun Sep  6 11:59:49 1998
@@ -41,6 +41,7 @@
 #include "ethereal.h"
 #include "packet.h"
 #include "etypes.h"
+#include "resolv.h"
 
 void
 dissect_ip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
@@ -70,8 +71,8 @@
         sprintf(fd->win_info[4], "Unknown IP protocol (%02x)", iph.ip_p);
     }
 
-    strcpy(fd->win_info[1], ip_to_str((guint8 *) &iph.ip_src));
-    strcpy(fd->win_info[2], ip_to_str((guint8 *) &iph.ip_dst));
+    strcpy(fd->win_info[1], get_hostname(iph.ip_src));
+    strcpy(fd->win_info[2], get_hostname(iph.ip_dst));
   }
   
   iph.ip_tos = IPTOS_TOS(iph.ip_tos);
@@ -118,9 +119,9 @@
     add_item_to_tree(ip_tree, offset + 10, 2, "Header checksum: 0x%04x",
       iph.ip_sum);
     add_item_to_tree(ip_tree, offset + 12, 4, "Source address: %s",
-      ip_to_str((guint8 *) &iph.ip_src));
+		     get_hostname(iph.ip_src));
     add_item_to_tree(ip_tree, offset + 16, 4, "Destination address: %s",
-      ip_to_str((guint8 *) &iph.ip_dst));
+		     get_hostname(iph.ip_dst));
   }
 
   offset += iph.ip_hl * 4;
diff -u --recursive --new-file ethereal-0.3.14/packet-tcp.c ethereal-0.3.14-deniel/packet-tcp.c
--- ethereal-0.3.14/packet-tcp.c	Sun Aug 30 18:00:07 1998
+++ ethereal-0.3.14-deniel/packet-tcp.c	Sun Sep  6 11:58:49 1998
@@ -39,6 +39,7 @@
 
 #include "ethereal.h"
 #include "packet.h"
+#include "resolv.h"
 
 void
 dissect_tcp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
@@ -75,8 +76,8 @@
   
   if (fd->win_info[0]) {
     strcpy(fd->win_info[3], "TCP");
-    sprintf(fd->win_info[4], "Source port: %d  Destination port: %d",
-      th.th_sport, th.th_dport);
+    sprintf(fd->win_info[4], "Source port: %s  Destination port: %s",
+	    get_tcp_port(th.th_sport), get_tcp_port(th.th_dport));
   }
   
   if (tree) {
@@ -84,8 +85,8 @@
       "Transmission Control Protocol");
     tcp_tree = gtk_tree_new();
     add_subtree(ti, tcp_tree, ETT_TCP);
-    add_item_to_tree(tcp_tree, offset,      2, "Source port: %d", th.th_sport);
-    add_item_to_tree(tcp_tree, offset +  2, 2, "Destination port: %d", th.th_dport);
+    add_item_to_tree(tcp_tree, offset,      2, "Source port: %s", get_tcp_port(th.th_sport));    
+    add_item_to_tree(tcp_tree, offset +  2, 2, "Destination port: %s", get_tcp_port(th.th_dport));    
     add_item_to_tree(tcp_tree, offset +  4, 4, "Sequence number: 0x%08x",
       th.th_seq);
     add_item_to_tree(tcp_tree, offset +  8, 4, "Acknowledgement number: 0x%08x",
diff -u --recursive --new-file ethereal-0.3.14/packet-udp.c ethereal-0.3.14-deniel/packet-udp.c
--- ethereal-0.3.14/packet-udp.c	Sat Sep  5 20:23:28 1998
+++ ethereal-0.3.14-deniel/packet-udp.c	Sun Sep  6 11:59:17 1998
@@ -39,6 +39,7 @@
 
 #include "ethereal.h"
 #include "packet.h"
+#include "resolv.h"
 
 void
 dissect_udp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
@@ -55,8 +56,8 @@
   
   if (fd->win_info[0]) {
     strcpy(fd->win_info[3], "UDP");
-    sprintf(fd->win_info[4], "Source port: %d  Destination port: %d",
-      uh_sport, uh_dport);
+    sprintf(fd->win_info[4], "Source port: %s  Destination port: %s",
+	    get_udp_port(uh_sport), get_udp_port(uh_dport));
   }
   
   if (tree) {
@@ -64,8 +65,8 @@
       "User Datagram Protocol");
     udp_tree = gtk_tree_new();
     add_subtree(ti, udp_tree, ETT_UDP);
-    add_item_to_tree(udp_tree, offset,     2, "Source port: %d", uh_sport);
-    add_item_to_tree(udp_tree, offset + 2, 2, "Destination port: %d", uh_dport);
+    add_item_to_tree(udp_tree, offset,     2, "Source port: %s", get_udp_port(uh_sport));
+    add_item_to_tree(udp_tree, offset + 2, 2, "Destination port: %s", get_udp_port(uh_dport));
     add_item_to_tree(udp_tree, offset + 4, 2, "Length: %d", uh_ulen);
     add_item_to_tree(udp_tree, offset + 6, 2, "Checksum: 0x%04x", uh_sum);
   }
diff -u --recursive --new-file ethereal-0.3.14/packet.c ethereal-0.3.14-deniel/packet.c
--- ethereal-0.3.14/packet.c	Sat Sep  5 20:23:47 1998
+++ ethereal-0.3.14-deniel/packet.c	Mon Sep  7 08:20:28 1998
@@ -209,6 +209,9 @@
 		case DLT_IEEE802 :
 			dissect_tr(pd, fd, tree);
 			break;
+#ifndef DLT_RAW
+#define DLT_RAW 12
+#endif
 		case DLT_RAW :
 	        dissect_raw(pd, fd, tree);
 			break;
Binary files ethereal-0.3.14/rdps and ethereal-0.3.14-deniel/rdps differ
diff -u --recursive --new-file ethereal-0.3.14/resolv.c ethereal-0.3.14-deniel/resolv.c
--- ethereal-0.3.14/resolv.c	Thu Jan  1 00:00:00 1970
+++ ethereal-0.3.14-deniel/resolv.c	Mon Sep  7 08:42:40 1998
@@ -0,0 +1,269 @@
+/* resolv.c
+ * Routines for network object lookup
+ *
+ * Laurent Deniel <deniel@xxxxxxxxxxx>
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxx>
+ * Copyright 1998 Gerald Combs
+ *
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ *
+ * To do:
+ *
+ * - Add ethernet address resolution
+ * - In a future live capture and decode mode, 
+ *   add hostname entries in hash table from DNS packet decoding.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef AVOID_DNS_TIMEOUT
+#define AVOID_DNS_TIMEOUT
+#endif
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+#include <netdb.h>
+#include <signal.h>
+#include <sys/socket.h>
+
+#ifdef AVOID_DNS_TIMEOUT
+# include <setjmp.h>
+#endif
+
+#include "packet.h"
+#include "resolv.h"
+
+#define MAXNAMELEN  	64	/* max name length (hostname and port name) */
+#define HASHHOSTSIZE	1024
+#define HASHPORTSIZE	256
+
+/* hash table used for host and port lookup */
+
+typedef struct hashname {
+  u_int			addr;
+  u_char   		name[MAXNAMELEN];
+  struct hashname 	*next;
+} hashname_t;
+
+static hashname_t *host_table[HASHHOSTSIZE];
+static hashname_t *udp_port_table[HASHPORTSIZE];
+static hashname_t *tcp_port_table[HASHPORTSIZE];
+
+/* global variable that indicates if name resolving is actif */
+
+int g_resolving_actif = 1; 	/* routines are active by default */
+
+/* local function definitions */
+
+static u_char *serv_name_lookup(u_int port, u_int proto)
+{
+
+  hashname_t *tp;
+  hashname_t **table;
+  char *serv_proto = NULL;
+  struct servent *servp;
+  int i;
+
+  switch(proto) {
+  case IPPROTO_UDP:
+    table = udp_port_table;
+    serv_proto = "udp";
+    break;
+  case IPPROTO_TCP:
+    table = tcp_port_table;
+    serv_proto = "tcp";
+    break;
+  default:
+    /* not yet implemented */
+    return NULL;
+    /*NOTREACHED*/
+    break;
+  } /* proto */
+  
+  i = port & (HASHPORTSIZE - 1);
+  tp = table[ i & (HASHPORTSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ i & (HASHPORTSIZE - 1)] = 
+      (hashname_t *)g_malloc(sizeof(hashname_t));
+  } else {  
+    while(1) {
+      if( tp->addr == port ) {
+	return tp->name;
+      }
+      if (tp->next == NULL) {
+	tp->next = (hashname_t *)g_malloc(sizeof(hashname_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  /* fill in a new entry */
+  tp->addr = port;
+  tp->next = NULL;
+
+  if ((servp = getservbyport(htons(port), serv_proto)) == NULL) {
+    /* unknown port */
+    sprintf(tp->name, "%d", port);
+  } else {
+    strncpy(tp->name, servp->s_name, MAXNAMELEN);
+  }
+
+  return (tp->name);
+
+} /* serv_name_lookup */
+
+#ifdef AVOID_DNS_TIMEOUT
+
+#define DNS_TIMEOUT 	5 	/* max sec per call */
+
+jmp_buf hostname_env;
+
+static void abort_network_query(int sig)
+{
+  longjmp(hostname_env, 1);
+}
+#endif /* AVOID_DNS_TIMEOUT */
+
+static u_char *host_name_lookup(u_int addr)
+{
+
+  hashname_t *tp;
+  hashname_t **table = host_table;
+  struct hostent *hostp;
+
+  tp = table[ addr & (HASHHOSTSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ addr & (HASHHOSTSIZE - 1)] = 
+      (hashname_t *)g_malloc(sizeof(hashname_t));
+  } else {  
+    while(1) {
+      if( tp->addr == addr ) {
+	return tp->name;
+      }
+      if (tp->next == NULL) {
+	tp->next = (hashname_t *)g_malloc(sizeof(hashname_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  /* fill in a new entry */
+  tp->addr = addr;
+  tp->next = NULL;
+
+#ifdef AVOID_DNS_TIMEOUT
+
+  /* Quick hack to avoid DNS/YP timeout */
+
+  if (!setjmp(hostname_env)) {
+    signal(SIGALRM, abort_network_query);
+    alarm(DNS_TIMEOUT);
+#endif
+    hostp = gethostbyaddr((char *)&addr, 4, AF_INET);
+#ifdef AVOID_DNS_TIMEOUT
+    alarm(0);
+#endif
+    if (hostp != NULL) {
+      strncpy(tp->name, hostp->h_name, MAXNAMELEN);
+      return tp->name;
+    }
+#ifdef AVOID_DNS_TIMEOUT
+  }
+#endif
+
+  /* unknown host or DNS timeout */
+
+  sprintf(tp->name, "%s", ip_to_str((guint8 *)&addr));  
+  return (tp->name);
+
+} /* host_name_lookup */
+
+/* external functions */
+
+extern u_char *get_hostname(u_int addr) 
+{
+  if (!g_resolving_actif)
+    return ip_to_str((guint8 *)&addr);
+
+  return host_name_lookup(addr);
+}
+
+extern u_char *get_udp_port(u_int port) 
+{
+  static gchar  str[3][MAXNAMELEN];
+  static gchar *cur;
+
+  if (!g_resolving_actif) {
+    if (cur == &str[0][0]) {
+      cur = &str[1][0];
+    } else if (cur == &str[1][0]) {  
+      cur = &str[2][0];
+    } else {  
+      cur = &str[0][0];
+    }
+    sprintf(cur, "%d", port);
+    return cur;
+  }
+
+  return serv_name_lookup(port, IPPROTO_UDP);
+
+} /* get_udp_port */
+
+
+extern u_char *get_tcp_port(u_int port) 
+{
+  static gchar  str[3][MAXNAMELEN];
+  static gchar *cur;
+
+  if (!g_resolving_actif) {
+    if (cur == &str[0][0]) {
+      cur = &str[1][0];
+    } else if (cur == &str[1][0]) {  
+      cur = &str[2][0];
+    } else {  
+      cur = &str[0][0];
+    }
+    sprintf(cur, "%d", port);
+    return cur;
+  }
+
+  return serv_name_lookup(port, IPPROTO_TCP);
+
+} /* get_tcp_port */
+
diff -u --recursive --new-file ethereal-0.3.14/resolv.h ethereal-0.3.14-deniel/resolv.h
--- ethereal-0.3.14/resolv.h	Thu Jan  1 00:00:00 1970
+++ ethereal-0.3.14-deniel/resolv.h	Sun Sep  6 12:48:19 1998
@@ -0,0 +1,39 @@
+/* resolv.h
+ * Definitions for network object lookup
+ *
+ * Laurent Deniel <deniel@xxxxxxxxxxx>
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxx>
+ * Copyright 1998 Gerald Combs
+ *
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef __RESOLV_H__
+#define __RESOLV_H__
+
+/* global variable */
+
+extern int g_resolving_actif;
+
+/* Functions in resolv.c */
+
+extern u_char *get_udp_port(u_int port);
+extern u_char *get_tcp_port(u_int port);
+extern u_char *get_hostname(u_int addr);
+
+#endif /* __RESOLV_H__ */