Annotation of embedaddon/mtr/raw.c, revision 1.1.1.1

1.1       misho       1: /*
                      2:     mtr  --  a network diagnostic tool
                      3:     Copyright (C) 1998  R.E.Wolff@BitWizard.nl
                      4: 
                      5:     raw.c -- raw output (for logging for later analysis)
                      6: 
                      7:     This program is free software; you can redistribute it and/or modify
                      8:     it under the terms of the GNU General Public License version 2 as 
                      9:     published by the Free Software Foundation.
                     10: 
                     11:     This program is distributed in the hope that it will be useful,
                     12:     but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     14:     GNU General Public License for more details.
                     15: 
                     16:     You should have received a copy of the GNU General Public License
                     17:     along with this program; if not, write to the Free Software
                     18:     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
                     19: */
                     20: 
                     21: #include <config.h>
                     22: #include <ctype.h>
                     23: #include <stdlib.h>
                     24: #include <stdio.h>
                     25: #include <sys/types.h>
                     26: #include <sys/socket.h>
                     27: #include <netinet/in.h>
                     28: #include <arpa/inet.h>
                     29: 
                     30: 
                     31: #include "mtr.h"
                     32: #include "raw.h"
                     33: #include "net.h"
                     34: #include "dns.h"
                     35: 
                     36: static int havename[MaxHost];
                     37: 
                     38: extern int af;
                     39: 
                     40: #if 0
                     41: static char *addr_to_str(ip_t addr)
                     42: {
                     43:   static char buf[20];
                     44: 
                     45:   sprintf (buf, "%s", strlongip( &addr ));
                     46:   return buf;
                     47: }
                     48: #endif
                     49: 
                     50: void raw_rawping (int host, int msec)
                     51: {
                     52:   char *name;
                     53: 
                     54:   if (dns && !havename[host]) {
                     55:     name = dns_lookup2(net_addr(host));
                     56:     if (name) {
                     57:       havename[host]++;
                     58:       printf ("d %d %s\n", host, name);
                     59:     }
                     60:   }
                     61:   printf ("p %d %d\n", host, msec);
                     62:   fflush (stdout); 
                     63: }
                     64: 
                     65: 
                     66: void raw_rawhost (int host, ip_t * ip_addr)
                     67: {
                     68:   printf ("h %d %s\n", host, strlongip( ip_addr ));
                     69:   fflush (stdout); 
                     70: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>