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.
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 */
32 /* the end of the pipe we read for replies */
35 /* the end of the pipe we write for commands */
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
;
47 *probe_reply_func_t
) (
51 struct mplslen
* mpls
,
55 int open_command_pipe(
57 struct packet_command_pipe_t
*cmdpipe
);
59 void close_command_pipe(
60 struct packet_command_pipe_t
*cmdpipe
);
62 void send_probe_command(
64 struct packet_command_pipe_t
*cmdpipe
,
71 void handle_command_replies(
73 struct packet_command_pipe_t
*cmdpipe
,
74 probe_reply_func_t reply_func
);