Annotation of embedaddon/mtr/ui/cmdpipe.h, revision 1.1

1.1     ! misho       1: /*
        !             2:     mtr  --  a network diagnostic tool
        !             3:     Copyright (C) 2016  Matt Kimball
        !             4: 
        !             5:     This program is free software; you can redistribute it and/or modify
        !             6:     it under the terms of the GNU General Public License version 2 as
        !             7:     published by the Free Software Foundation.
        !             8: 
        !             9:     This program is distributed in the hope that it will be useful,
        !            10:     but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            11:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            12:     GNU General Public License for more details.
        !            13: 
        !            14:     You should have received a copy of the GNU General Public License
        !            15:     along with this program; if not, write to the Free Software
        !            16:     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
        !            17: */
        !            18: 
        !            19: #ifndef CMDPIPE_H
        !            20: #define CMDPIPE_H
        !            21: 
        !            22: #include "mtr.h"
        !            23: 
        !            24: #define COMMAND_BUFFER_SIZE 4096
        !            25: #define PACKET_REPLY_BUFFER_SIZE 4096
        !            26: 
        !            27: /*  We use a pipe to the mtr-packet subprocess to generate probes  */
        !            28: struct packet_command_pipe_t {
        !            29:     /*  the process id of mtr-packet  */
        !            30:     pid_t pid;
        !            31: 
        !            32:     /*  the end of the pipe we read for replies  */
        !            33:     int read_fd;
        !            34: 
        !            35:     /*  the end of the pipe we write for commands  */
        !            36:     int write_fd;
        !            37: 
        !            38:     /* storage for incoming replies */
        !            39:     char reply_buffer[PACKET_REPLY_BUFFER_SIZE];
        !            40: 
        !            41:     /*  the number of bytes currently used in reply_buffer  */
        !            42:     size_t reply_buffer_used;
        !            43: };
        !            44: 
        !            45: typedef
        !            46: void (
        !            47:     *probe_reply_func_t) (
        !            48:     struct mtr_ctl * ctl,
        !            49:     int sequence,
        !            50:     struct mplslen * mpls,
        !            51:     ip_t * addr,
        !            52:     int round_trip_time);
        !            53: 
        !            54: int open_command_pipe(
        !            55:     struct mtr_ctl *ctl,
        !            56:     struct packet_command_pipe_t *cmdpipe);
        !            57: 
        !            58: void close_command_pipe(
        !            59:     struct packet_command_pipe_t *cmdpipe);
        !            60: 
        !            61: void send_probe_command(
        !            62:     struct mtr_ctl *ctl,
        !            63:     struct packet_command_pipe_t *cmdpipe,
        !            64:     ip_t * address,
        !            65:     ip_t * localaddress,
        !            66:     int packet_size,
        !            67:     int sequence,
        !            68:     int time_to_live);
        !            69: 
        !            70: void handle_command_replies(
        !            71:     struct mtr_ctl *ctl,
        !            72:     struct packet_command_pipe_t *cmdpipe,
        !            73:     probe_reply_func_t reply_func);
        !            74: 
        !            75: #endif

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