Changed how conflicitng first/max TTL works.
[mtr.git] / ui / cmdpipe.h
blob3d1c58f454e388bbf57feb0869fc63b1ad7955c2
1 /*
2 mtr -- a network diagnostic tool
3 Copyright (C) 2016 Matt Kimball
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.
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.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef CMDPIPE_H
20 #define CMDPIPE_H
22 #include "mtr.h"
24 #define COMMAND_BUFFER_SIZE 4096
25 #define PACKET_REPLY_BUFFER_SIZE 4096
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;
32 /* the end of the pipe we read for replies */
33 int read_fd;
35 /* the end of the pipe we write for commands */
36 int write_fd;
38 /* storage for incoming replies */
39 char reply_buffer[PACKET_REPLY_BUFFER_SIZE];
41 /* the number of bytes currently used in reply_buffer */
42 size_t reply_buffer_used;
45 typedef
46 void (
47 *probe_reply_func_t) (
48 struct mtr_ctl * ctl,
49 int sequence,
50 int err,
51 struct mplslen * mpls,
52 ip_t * addr,
53 int round_trip_time);
55 int open_command_pipe(
56 struct mtr_ctl *ctl,
57 struct packet_command_pipe_t *cmdpipe);
59 void close_command_pipe(
60 struct packet_command_pipe_t *cmdpipe);
62 void send_probe_command(
63 struct mtr_ctl *ctl,
64 struct packet_command_pipe_t *cmdpipe,
65 ip_t * address,
66 ip_t * localaddress,
67 int packet_size,
68 int sequence,
69 int time_to_live);
71 void handle_command_replies(
72 struct mtr_ctl *ctl,
73 struct packet_command_pipe_t *cmdpipe,
74 probe_reply_func_t reply_func);
76 #endif