Annotation of embedaddon/mtr/ui/raw.c, revision 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: 
        !            23: #include <ctype.h>
        !            24: #include <stdlib.h>
        !            25: #include <stdio.h>
        !            26: #include <sys/types.h>
        !            27: #include <sys/socket.h>
        !            28: #include <netinet/in.h>
        !            29: #include <arpa/inet.h>
        !            30: 
        !            31: #include "mtr.h"
        !            32: #include "raw.h"
        !            33: #include "net.h"
        !            34: #include "dns.h"
        !            35: 
        !            36: 
        !            37: /* Log an echo request, or a "ping" */
        !            38: void raw_rawxmit(
        !            39:     int host,
        !            40:     int seq)
        !            41: {
        !            42:     printf("x %d %d\n", host, seq);
        !            43:     fflush(stdout);
        !            44: }
        !            45: 
        !            46: /* Log an echo reply, or a "pong" */
        !            47: void raw_rawping(
        !            48:     struct mtr_ctl *ctl,
        !            49:     int host,
        !            50:     int msec,
        !            51:     int seq)
        !            52: {
        !            53:     static int havename[MaxHost];
        !            54:     char *name;
        !            55: 
        !            56:     if (ctl->dns && !havename[host]) {
        !            57:         name = dns_lookup2(ctl, net_addr(host));
        !            58:         if (name) {
        !            59:             havename[host]++;
        !            60:             printf("d %d %s\n", host, name);
        !            61:         }
        !            62:     }
        !            63:     printf("p %d %d %d\n", host, msec, seq);
        !            64:     fflush(stdout);
        !            65: }
        !            66: 
        !            67: 
        !            68: void raw_rawhost(
        !            69:     struct mtr_ctl *ctl,
        !            70:     int host,
        !            71:     ip_t * ip_addr)
        !            72: {
        !            73:     printf("h %d %s\n", host, strlongip(ctl, ip_addr));
        !            74:     fflush(stdout);
        !            75: }

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